Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-01-08 Thread japin
* NB: We count on this to protect us against problems with refreshing the -* data using TABLE_INSERT_FROZEN. -*/ - CheckTableNotInUse(matviewRel, "REFRESH MATERIALIZED VIEW"); + relowner = matviewRel->rd_rel->relowner; After apply the patch, there i

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-01-08 Thread japin
On Fri, 08 Jan 2021 at 17:24, Bharath Rupireddy wrote: > On Fri, Jan 8, 2021 at 1:50 PM japin wrote: >> Thanks for updating the patch! >> >> + /* Get the data generating query. */ >> + dataQuery = get_matview_query(stm

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-01-08 Thread japin
On Sat, 09 Jan 2021 at 09:38, Bharath Rupireddy wrote: > On Fri, Jan 8, 2021 at 9:50 PM japin wrote: >> > Attaching v3 patches, please consider these for further review. >> > >> >> I find that both the declaration and definition of >> match_matview_wit

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-02-12 Thread japin
Thanks for your review again. On Wed, 10 Feb 2021 at 21:49, Bharath Rupireddy wrote: > On Fri, Feb 5, 2021 at 6:51 PM japin wrote: >> On Fri, 05 Feb 2021 at 17:50, Bharath Rupireddy >> wrote: >> We will get cell == NULL when we iterate all items in publist. I use it &g

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-02-17 Thread japin
On Tue, 16 Feb 2021 at 09:58, Bharath Rupireddy wrote: > On Mon, Feb 15, 2021 at 8:13 AM Bharath Rupireddy > wrote: >> >> On Sat, Feb 13, 2021 at 11:41 AM japin wrote: >> > > IIUC, with the current patch, the new ALTER SUBSCRIPTION ... ADD/DROP >> > >

Re: Fix typo about WalSndPrepareWrite

2021-02-17 Thread japin
n the comment. > After review the code. It says "just as it's done in XLogSendPhysical", not fill out the sendtime with XLogSendPhysical. My bad. Sorry for the noise. I will close this cf entry. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: NOT VALID for Unique Indexes

2021-02-27 Thread japin
On Fri, 26 Feb 2021 at 17:36, Simon Riggs wrote: > On Mon, Jan 18, 2021 at 11:19 PM japin wrote: >> >> >> On Fri, 15 Jan 2021 at 00:22, Simon Riggs >> wrote: >> > As you may be aware the NOT VALID qualifier currently only applies to >> > CH

Use macros for calculating LWLock offset

2020-11-18 Thread japin
    LWLockInitialize(&lock->lock, LWTRANCHE_PREDICATE_LOCK_MANAGER); -- Best regards Japin Li diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index 2fa90cc095..108e652179 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/b

Re: Terminate the idle sessions

2020-11-19 Thread japin
/* * (5) turn off the idle-in-transaction timeout */ ``` Please mention about idle-session timeout and check another comment. Thanks! Add the comment for idle-session timeout. -- Best regards Japin Li >From ca226701bd04d7c7f766776094610ef6a3e96279 Mon Sep 17 00:00

Re: Added schema level support for publication.

2021-01-11 Thread japin
her, see \d+ > t1, there will not be any associated publication in the output > 6) execute alter subscription refresh publication on the subscriber, > with the expectation that it should not receive the data from the > publisher for the table t1 since it's dropped from the publication in > (5) > 7) insert into table t1 on the publisher > 8) still the newly inserted data in (7) from the publisher, will be > received into the table t1 in the subscriber > > IIUC, the behaviour of ALTER PUBLICATION DROP TABLE from the docs and > the above use case, it looks like a bug to me. If I'm wrong, can > someone correct me? > Yes, if we modify the publication, we should refresh the subscription on each subscriber. It looks strange for me, especially for partitioned tables [1]. > Thoughts? > Can we trace the different between publication and subscription, and auto-refresh subscription on subscriber? [1] https://www.postgresql.org/message-id/flat/1D6DCFD2-0F44-4A18-BF67-17C2697B1631%40hotmail.com -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-11 Thread japin
replicate the records. As I said in [1], if we don't insert a new data in step-5, it will not replicate the records. In both cases, the AlterSubscription_refresh() call RemoveSubscriptionRel() and logicalrep_worker_stop_at_commit(). However, if we insert a data in step-5, it doesn't work a

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-11 Thread japin
On Tue, 12 Jan 2021 at 13:39, Amit Kapila wrote: > On Tue, Jan 12, 2021 at 9:58 AM japin wrote: >> >> >> On Tue, 12 Jan 2021 at 11:37, Amit Kapila wrote: >> > On Mon, Jan 11, 2021 at 6:51 PM Bharath Rupireddy >> > wrote: >> >> >> >&g

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-12 Thread japin
gt;> true in pgoutput_change(). Maybe the walsender should look at the >> catalogue pg_publication_rel in is_publishable_relation()? >> > > We must be somewhere checking pg_publication_rel before sending the > decoded change because otherwise, we would have sent the c

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-12 Thread japin
On Tue, 12 Jan 2021 at 19:32, Bharath Rupireddy wrote: > On Tue, Jan 12, 2021 at 4:47 PM Li Japin wrote: >> IIUC the logical replication only replicate the tables in publication, I >> think >> when the tables that aren't in publication should not be replicated. >

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-12 Thread japin
id 0 is valid because it >> will be applicable only during the table sync phase, the comment in the >> LogicalRepWorker structure says that. >> >> And also, I think, expecting the apply worker to be closed this way doesn't >> make sense because the apply worke

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-13 Thread japin
e: >> > > >> > > On Tue, Jan 12, 2021 at 5:23 PM japin wrote: >> > > > >> > > > On Tue, 12 Jan 2021 at 19:32, Bharath Rupireddy wrote: >> > > > > On Tue, Jan 12, 2021 at 4:47 PM Li Japin wrote: >> > > > &g

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-13 Thread japin
On Wed, 13 Jan 2021 at 17:23, Dilip Kumar wrote: > On Tue, Jan 12, 2021 at 4:47 PM Li Japin wrote: >> >> >> On Jan 12, 2021, at 5:47 PM, japin wrote: >> >> >> On Tue, 12 Jan 2021 at 14:38, Amit Kapila wrote: >> >> On Tue, Jan 12, 2021 at 11

Fix typo about WalSndPrepareWrite

2021-01-13 Thread japin
Hi, While reading the code about logical replication, I found that WalSndPrepareWrite function says it use XLogSendPhysical to fill out the sendtime, however, it actually done by WalSndWriteData. It looks like a typo, attaching a very small patch to correct it. -- Regrads, Japin Li. ChengDu

Re: Fix typo about WalSndPrepareWrite

2021-01-14 Thread japin
On Thu, 14 Jan 2021 at 15:32, Kyotaro Horiguchi wrote: > At Thu, 14 Jan 2021 06:46:35 +, Li Japin wrote in >> >> On Jan 14, 2021, at 12:56 PM, Ashutosh Bapat >> mailto:ashutosh.bapat@gmail.com>> wrote: >> >> Hi Japin, >> Thanks for the r

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-14 Thread japin
On Thu, 14 Jan 2021 at 20:19, Bharath Rupireddy wrote: > On Thu, Jan 14, 2021 at 5:36 PM Li Japin wrote >> Do we really need to access PUBLICATIONRELMAP in this patch? What if >> we just set it to false in the else condition of (if (publish && >> (relkind != REL

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-14 Thread japin
On Fri, 15 Jan 2021 at 14:50, Bharath Rupireddy wrote: > On Fri, Jan 15, 2021 at 11:33 AM Hou, Zhijie > wrote: >> >> > On Thu, Jan 14, 2021 at 5:36 PM Li Japin wrote >> > > Do we really need to access PUBLICATIONRELMAP in this patch? What if >>

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-15 Thread japin
On Fri, 15 Jan 2021 at 15:49, japin wrote: > On Fri, 15 Jan 2021 at 14:50, Bharath Rupireddy > wrote: >> On Fri, Jan 15, 2021 at 11:33 AM Hou, Zhijie >> wrote: >>> >>> > On Thu, Jan 14, 2021 at 5:36 PM Li Japin wrote >>> > > Do we reall

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-15 Thread japin
the meantime, can you add the test case in the patch as >> requested earlier as well. > > @Li Japin Please let me know if you have already started to work on > the test case, otherwise I can make a 0002 patch for the test case and > post. > Yeah, I'm working on the

Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION

2021-01-15 Thread japin
944/ > Thanks for the updated patch. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Narrow the scope of the variable outputstr in logicalrep_write_tuple

2021-01-17 Thread japin
utFunctionCall(typclass->typoutput, values[i]); pq_sendcountedtext(out, outputstr, strlen(outputstr), false); pfree(outputstr); } Attached is a samll patch to fix it. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. diff --git a/src/ba

Re: Narrow the scope of the variable outputstr in logicalrep_write_tuple

2021-01-18 Thread japin
On Mon, 18 Jan 2021 at 15:59, Bharath Rupireddy wrote: > On Mon, Jan 18, 2021 at 1:16 PM japin wrote: >> >> >> Hi, >> >> I find that the outputstr variable in logicalrep_write_tuple() only use in >> `else` branch, I think we can narrow the scope, just

Re: NOT VALID for Unique Indexes

2021-01-18 Thread japin
ALTER TABLE .. ADD table_constraint [ NOT VALID ] ALTER TABLE .. VALIDATE CONSTRAINT constraint_name Should we implement unique index valid/not valid same as foreign key and CHECK constraints? 3. If we use the syntax to valid/not valid the unique, should we support other constraints, such as foreign key and CHECK constraints? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: simplifying foreign key/RI checks

2021-01-18 Thread japin
t partition key values from the unique key. >> >> At the end of the nested loop, should there be an assertion that >> partkey->partnatts partition key values have been found ? >> This can be done by using a counter (initialized to 0) which is incremented >> when a m

Use boolean array for nulls parameters

2021-01-19 Thread japin
ether this chagnges cause other problems or not. Any thought? [1] - https://www.postgresql.org/message-id/flat/ca+hiwqgkfjfydeq5vhph6eqpkjsbfpddy+j-kxyfepqedts...@mail.gmail.com -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. >From 7496f20ccfda7687333db9e5c43227ee30e4eda9 Mon

Re: Use boolean array for nulls parameters

2021-01-19 Thread japin
On Tue, 19 Jan 2021 at 23:45, Tom Lane wrote: > japin writes: >> When I review the [1], I find that the tuple's nulls array use char type. >> However there are many places use boolean array to repsent the nulls array, >> so I think we can replace the char type n

Re: Change default of checkpoint_completion_target

2021-01-19 Thread japin
ALTER SYSTEM in that list either. > If this was C code, maybe we could get away with just changing such > references as we find them, but I don't think we'd want the > documentation to be in an inconsistent state regarding that. > I have already mentioned this in [1], however it seems unattractive. [1] - https://www.postgresql.org/message-id/flat/199703E4-A795-4FB8-911C-D0DE9F51519C%40hotmail.com -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Identify missing publications from publisher while create/alter subscription.

2021-01-21 Thread japin
make another connection. > 3) If multiple publications are specified in the CREATE SUBSCRIPTION > query, IIUC, with your patch, the query fails even if at least one of > the publications doesn't exist. Should we throw a warning in this case > and allow the subscription be created for other existing > publications? > +1. If all the publications do not exist, we should throw an error. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: About to add WAL write/fsync statistics to pg_stat_wal view

2021-01-22 Thread japin
the reader >> because it's called even before the fsync method is called. As I >> commented above, calling to fsyncMethodCalled() can be eliminated. >> That way, this function is called at only once. So do we really need >> this function? > > Thanks to your comments, I removed them. > > >> * As far as I read the code, issue_xlog_fsync() seems to do fsync even >> if enableFsync is false. Why does the function return false in that >> case? I might be missing something. > > IIUC, the reason is that I thought that each fsync functions like > pg_fsync_no_writethrough() check enableFsync. > > If this code doesn't check, m_wal_sync_time may be incremented > even though some sync methods like SYNC_METHOD_OPEN don't call to sync > some data to the disk at the time. > >> * void is missing as argument? >> >> * s/mothod/method/ > > I removed them. > > > Regards, -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: About to add WAL write/fsync statistics to pg_stat_wal view

2021-01-24 Thread japin
ly need to increment m_wal_sync > after doing fsync we can write the code without an additional variable > as follows: > > if (enableFsync) > { > switch (sync_method) > { > case SYNC_METHOD_FSYNC: > #ifdef HAVE_FSYNC_WRITETHROUGH > case SYNC_METHOD_FSYNC_WRITETHROUGH: > #endif > #ifdef HAVE_FDATASYNC > case SYNC_METHOD_FDATASYNC: > #endif > WalStats.m_wal_sync++; > if (track_wal_io_timing) > INSTR_TIME_SET_CURRENT(start); > break; > default: > break; > } > } > > (do fsync and error handling here) > >/* increment the i/o timing and the number of times to fsync WAL data */ >if (track_wal_io_timing) >{ >INSTR_TIME_SET_CURRENT(duration); >INSTR_TIME_SUBTRACT(duration, start); >WalStats.m_wal_sync_time = INSTR_TIME_GET_MICROSEC(duration); >} > > I think we can change the first switch-case to an if statement. > +1. We can also narrow the scope of "duration" into "if (track_wal_io_timing)" branch. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Identify missing publications from publisher while create/alter subscription.

2021-01-25 Thread japin
non_existent_publication;? > > Or > > Do you mean when we drop publications from a subscription? If yes, do > we have a way to drop a publication from the subscription? See below > one of my earlier questions on this. > "I wonder, why isn't dropping a publication from a list of > publications that are with subscription is not allowed?" > At least, I see no ALTER SUBSCRIPTION ... DROP PUBLICATION mypub1 or > something similar? > Why we do not support ALTER SUBSCRIPTION...ADD/DROP PUBLICATION? When we have multiple publications in subscription, but I want to add/drop a single publication, it is conveient. The ALTER SUBSCRIPTION...SET PUBLICATION... should supply the completely publications. Sorry, this question is unrelated with this subject. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-01-25 Thread japin
7, mypub8; I think it's more convenient. Any thoughts? [1] - https://www.postgresql.org/message-id/MEYP282MB16690CD5EC5319FC35B2F78AB6BD0%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-01-25 Thread japin
On Tue, 26 Jan 2021 at 11:47, japin wrote: > Hi, hackers > > When I read the discussion in [1], I found that update subscription's > publications > is complicated. > > For example, I have 5 publications in subscription. > > CREATE SUBSCRIPTION mysub1 CONN

Re: Identify missing publications from publisher while create/alter subscription.

2021-01-25 Thread japin
On Mon, 25 Jan 2021 at 21:55, Bharath Rupireddy wrote: > On Mon, Jan 25, 2021 at 5:18 PM japin wrote: >> > Do you mean when we drop publications from a subscription? If yes, do >> > we have a way to drop a publication from the subscription? See below >> > one o

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-01-25 Thread japin
Hi, Bharath Thanks for your reviewing. On Tue, 26 Jan 2021 at 12:55, Bharath Rupireddy wrote: > On Tue, Jan 26, 2021 at 9:25 AM japin wrote: >> > I think it's more convenient. Any thoughts? >> >> Sorry, I forgot to attach the patch. > > As I mentioned ear

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-01-26 Thread japin
On Tue, 26 Jan 2021 at 13:46, japin wrote: > Hi, Bharath > > Thanks for your reviewing. > > On Tue, 26 Jan 2021 at 12:55, Bharath Rupireddy > wrote: >> On Tue, Jan 26, 2021 at 9:25 AM japin wrote: >>> > I think it's more convenient. Any thoughts? &g

Fix ALTER SUBSCRIPTION ... SET PUBLICATION documentation

2021-01-26 Thread japin
rSubscription_refresh(sub, copy_data); } break; } Should we fix the documentation or the code? I'd be inclined fix the documentation. [1] - https://www.postgresql.org/docs/devel/sql-altersubscription.html -- Regrads, Japin Li. ChengDu WenWu In

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-01-27 Thread japin
DD > PUBLICATION, then it refreshes all the returned publications [3]. I > believe this is also true with ALTER SUBSCRIPTION ... DROP > PUBLICATION. > > So, I think the new syntax, ALTER SUBSCRIPTION .. ADD/DROP PUBLICATION > will refresh the new and existing publications. > Yes! It will refresh the new and existing publications. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-01-27 Thread japin
On Wed, 27 Jan 2021 at 16:59, Amit Kapila wrote: > On Tue, Jan 26, 2021 at 9:18 AM japin wrote: >> >> >> When I read the discussion in [1], I found that update subscription's >> publications >> is complicated. >> >> For example, I hav

Re: Fix ALTER SUBSCRIPTION ... SET PUBLICATION documentation

2021-01-27 Thread japin
On Wed, 27 Jan 2021 at 19:47, Bharath Rupireddy wrote: > On Wed, Jan 27, 2021 at 4:57 PM Amit Kapila wrote: >> >> On Tue, Jan 26, 2021 at 4:56 PM japin wrote: >> > >> > >> > Hi, >> > >> > When I read the documentation of ALTER SU

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-01-27 Thread japin
On Thu, 28 Jan 2021 at 12:22, Bharath Rupireddy wrote: > On Wed, Jan 27, 2021 at 7:35 PM Li Japin wrote: >> > I don't see any problem if ALTER SUBSCRIPTION ... ADD PUBLICATION with >> > refresh true refreshes only the newly added publications,

Re: row filtering for logical replication

2021-02-01 Thread japin
n publisher postgres=# \dRp+ Publication mypub1 Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root ---++-+-+-+---+-- japin | f |

Re: row filtering for logical replication

2021-02-01 Thread japin
On Tue, 02 Feb 2021 at 03:11, Euler Taveira wrote: > On Mon, Feb 1, 2021, at 6:11 AM, japin wrote: >> Thanks for updating the patch. Here are some comments: > Thanks for your review. I updated the documentation accordingly. > >> The documentation says: >> >

Re: memory leak in auto_explain

2021-02-02 Thread japin
lease ExplainState memory, however, it does not make sence, I do not know why this does not work? So I try to create it in queryDesc->estate->es_query_cxt memory context like queryDesc->totaltime, and it works. Attached fix the memory leakage in auto_explain.

Re: row filtering for logical replication

2021-02-02 Thread japin
ve bumped into this thread, and applied 0001. My guess is that > one of the patches developped originally for logical replication > defined atttypmod in LogicalRepRelation, but has finished by not using > it. Nice catch. Since the 0001 patch already be commited (4ad31bb2ef), we can remove

Re: row filtering for logical replication

2021-02-02 Thread japin
On Tue, 02 Feb 2021 at 19:16, japin wrote: > On Tue, 02 Feb 2021 at 13:02, Michael Paquier wrote: >> On Mon, Feb 01, 2021 at 04:11:50PM -0300, Euler Taveira wrote: >>> After the commit 3696a600e2, the last patch does not apply cleanly. I'm >>> attachin

Re: memory leak in auto_explain

2021-02-02 Thread japin
On Wed, 03 Feb 2021 at 02:13, Tom Lane wrote: > japin writes: >> Here's my analysis: >> 1) In the explain_ExecutorEnd(), it will create a ExplainState on SQL >> function >> memory context, which is a long-lived, cause the memory grow up. > > Yeah, agreed

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-02-03 Thread japin
On Wed, 03 Feb 2021 at 13:15, Bharath Rupireddy wrote: > On Thu, Jan 28, 2021 at 10:07 AM japin wrote: >> Attaching v3 patches, please consider these for further review. > > I think we can add a commitfest entry for this feature, so that the > patches will be tested on cfb

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-02-05 Thread japin
On Fri, 05 Feb 2021 at 17:50, Bharath Rupireddy wrote: > On Wed, Feb 3, 2021 at 2:02 PM japin wrote: >> On Wed, 03 Feb 2021 at 13:15, Bharath Rupireddy >> wrote: >> > On Thu, Jan 28, 2021 at 10:07 AM japin wrote: >> >> Attaching v3 patches, plea

Re: [PATCH] add relation and block-level filtering to pg_waldump

2022-02-24 Thread Japin Li
useful. > Cool. I think we can report an error instead of reading wal files, if the tablespace, database, or relation is invalid. Does there any WAL record that has invalid tablespace, database, or relation OID? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: [PATCH] add relation and block-level filtering to pg_waldump

2022-02-25 Thread Japin Li
s, we do not need to read the WAL files, since it always invalid. > non-existence of objects is a no-go, since that depends purely on the WAL > range you are > looking at and you’d have to, you know, scan it to see if it existed before > marking as invalid. :) > Agreed. -- Regrads

Re: Size functions inconsistent results

2022-02-25 Thread Japin Li
'init') + pg_relation_size(relid, 'fsm') + pg_relation_size(relid, 'vm') AS heap_bytes, pg_indexes_size(relid) AS index_bytes, pg_table_size(reltoastrelid) + pg_indexes_size(reltoastrelid) AS toast_bytes from relations r join pg_class on pg_class.oid = r.relid ) select total_bytes, heap_bytes, index_bytes, toast_bytes, (total_bytes = (heap_bytes+index_bytes+toast_bytes)) as "Equal?", (total_bytes - (heap_bytes+index_bytes+toast_bytes)) as "Diff" from sizes; -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

CREATE DATABASE IF NOT EXISTS in PostgreSQL

2022-02-27 Thread Japin Li
_database WHERE datname = 'mydb')\gexec Why don't support CREATE DATABASE IF NOT EXISTS syntax in PostgreSQL? I create a patch for this, any suggestions? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. >From 7971893868e6eedc7229d28442f07890f251c42b Mon Sep 17 0

Re: CREATE DATABASE IF NOT EXISTS in PostgreSQL

2022-02-27 Thread Japin Li
On Mon, 28 Feb 2022 at 01:53, Tom Lane wrote: > Japin Li writes: >> Why don't support CREATE DATABASE IF NOT EXISTS syntax in PostgreSQL? > > FWIW, I'm generally hostile to CREATE IF NOT EXISTS semantics across > the board, because of its exceedingly squishy sem

Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-02 Thread Japin Li
bout wal_level [1] doesn't mentation this. How about adding a sentence to describe how to set max_wal_senders when setting wal_level to minimal? [1] https://www.postgresql.org/docs/devel/runtime-config-wal.html -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. diff --git a/doc

Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-02 Thread Japin Li
of the default setting for > archive_mode. > Add the default value for archive_mode. > In addition, max_wal_senders could also be changed, adding a sentence like: > > "If setting max_wal_senders to 0 consider also reducing the amount of WAL > produced by changing wal_level to min

Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-03 Thread Japin Li
On Thu, 03 Mar 2022 at 12:10, Japin Li wrote: > On Thu, 03 Mar 2022 at 11:25, David G. Johnston > wrote: >> I would suggest a wording more like: >> >> "A precondition for using minimal WAL is to disable WAL archiving and >> streaming replication b

Re: Doc about how to set max_wal_senders when setting minimal wal_level

2022-03-04 Thread Japin Li
On Fri, 04 Mar 2022 at 14:05, Kyotaro Horiguchi wrote: > At Fri, 04 Mar 2022 12:18:29 +0800, Japin Li wrote in >> >> On Thu, 03 Mar 2022 at 12:10, Japin Li wrote: >> >> Attach v3 patch to fix missing close varname tag. > > +A precondition for us

Re: support for MERGE

2022-03-14 Thread Japin Li
estore; Should we add "for" for transition INSERT comment? +MERGE is a multiple-table, multiple-action command: it specifies a target +table and a source relation, and can contain multiple WHEN MATCHED and +WHEN NOT MATCHED clauses, each of which specifies one UPDATE, INSERT, +UPDATE,

Re: Support logical replication of DDLs

2022-03-16 Thread Japin Li
t the patch into several pieces (at least implementation and test cases) for easier review. + * Simiarl to the generic logical messages, These DDL messages can be either + * transactional or non-transactional. Note by default DDLs in PostgreSQL are + * transactional. There is a typo, s/Simiarl/Similar/. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: support for MERGE

2022-03-16 Thread Japin Li
On Thu, 17 Mar 2022 at 03:18, Alvaro Herrera wrote: > v16. > On 2022-Mar-14, Japin Li wrote: > >> + ar_delete_trig_tcs = mtstate->mt_transition_capture; >> + if (mtstate->operation == CMD_UPDATE && >> mtstate->mt_tran

Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)

2022-03-17 Thread Japin Li
not think it is a good way. snprintf(buf1, sizeof(buf1), INT64_FORMAT, (int64) len); snprintf(buf2, sizeof(buf2), INT64_FORMAT, (int64) th->fileLen); fatal("actual file length (%s) does not match expected (%s)", buf1, buf2); -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Support logical replication of DDLs

2022-03-17 Thread Japin Li
s, test returned 29 (wstat 7424, 0x1d00) No subtests run The new patch change the behavior of publication, when we drop a table on publisher, the table also be dropped on subscriber, and this made the regression testa failed, since the regression test will try to drop the table on subscriber.

Re: Support logical replication of DDLs

2022-03-17 Thread Japin Li
On Fri, 18 Mar 2022 at 00:22, Zheng Li wrote: > Hello Japin, >>The new patch change the behavior of publication, when we drop a table >>on publisher, the table also be dropped on subscriber, and this made the >>regression testa failed, since the regression test will try t

Re: Support logical replication of DDLs

2022-03-17 Thread Japin Li
On Fri, 18 Mar 2022 at 08:18, Zheng Li wrote: > Hello, > > Attached please find the broken down patch set. Also fixed the failing > TAP tests Japin reported. > Thanks for updating the patchset, I will try it later. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Support logical replication of DDLs

2022-03-17 Thread Japin Li
On Fri, 18 Mar 2022 at 08:22, Japin Li wrote: > On Fri, 18 Mar 2022 at 00:22, Zheng Li wrote: >> Hello Japin, >>>The new patch change the behavior of publication, when we drop a table >>>on publisher, the table also be dropped on subscriber, and this made the >&g

Re: Support logical replication of DDLs

2022-03-18 Thread Japin Li
On Fri, 18 Mar 2022 at 08:18, Zheng Li wrote: > Hello, > > Attached please find the broken down patch set. Also fixed the failing > TAP tests Japin reported. > Here are some comments for the new patches: Seems like you forget initializing the *ddl_level_given aft

Remove INT64_FORMAT in translatable strings

2022-03-18 Thread Japin Li
ons? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. >From 29bfcdf96324433cd8f4beada7023a27fc2bf0b8 Mon Sep 17 00:00:00 2001 From: Japin Li Date: Fri, 18 Mar 2022 23:09:22 +0800 Subject: [PATCH v1] Remove use of [U]INT64_FORMAT in some translatable strings This is similar to

Re: Support logical replication of DDLs

2022-03-18 Thread Japin Li
Review binary_upgrade results in >> /home/px/Codes/postgresql/Debug/src/bin/pg_dump/tmp_check/tmp_test_jgRI > .. >> Failed 84/7709 subtests >> t/003_pg_dump_with_server.pl .. ok >> t/010_dump_connstr.pl . ok >> >> Test Summary Report >> --- >> t/002_pg_dump.pl(Wstat: 21504 Tests: 7709 Failed: 84) > > This is fixed in the latest version. I need to remind myself to run > make check-world in the future. > Thanks for updating the patch. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Remove INT64_FORMAT in translatable strings

2022-03-18 Thread Japin Li
On Sat, 19 Mar 2022 at 01:12, Tom Lane wrote: > Japin Li writes: >> we can rely on %lld/%llu and we decided to use them in translatable strings. > > Seems like good cleanup, so pushed. I think though that project style > is to use "long long" or "unsigned lo

Re: [PATCH] Remove workarounds to format [u]int64's

2022-03-21 Thread Japin Li
); snprintf(current_size_str, sizeof(current_size_str), INT64_FORMAT, current_size / (1024 * 1024)); fprintf(stderr, _("%*s/%s MB (%d%%) computed"), (int) strlen(current_size_str), current_size_str, total_size_str, percent); -- Regrads, Japin L

Re: [PATCH] Add reloption for views to enable RLS

2022-03-21 Thread Japin Li
On Mon, 21 Mar 2022 at 20:40, Laurenz Albe wrote: > On Mon, 2022-03-21 at 18:09 +0800, Japin Li wrote: >> After apply the patch, I found pg_checksums.c also has the similar code. >> >> In progress_report(), I'm not sure we can do this replace for this code. >>

Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)

2022-03-22 Thread Japin Li
(unsigned long long) xid, tuple->t_infomask))); -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: About to add WAL write/fsync statistics to pg_stat_wal view

2020-12-07 Thread Li Japin
case SYNC_METHOD_FDATASYNC: + return 1; + default: + /* others don't have a specific fsync method */ + return 0; + } +} + -- Best regards ChengDu WenWu Information Technology Co.,Ltd. Japin Li

Re: Feature improvement for pg_stat_statements

2020-12-09 Thread Li Japin
) is for SRFs according to the comments, I think, we can remove it here. Correct? + if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE) + elog(ERROR, "return type must be a row type"); + + tupdesc = BlessTupleDesc(tupdesc); -- Best regards ChengDu WenWu Information Technology Co.,Ltd. Japin Li

Confused about stream replication protocol documentation

2020-12-22 Thread Li Japin
hy we document here? However, if it makes sense, should we explain it? Can someone help me out? Anyway, thanks in advance! [1] https://www.postgresql.org/docs/devel/protocol-replication.html -- Best regards Japin Li

Re: Confused about stream replication protocol documentation

2020-12-22 Thread Li Japin
rotocol”. -- Best regards Japin Li

Re: Confused about stream replication protocol documentation

2020-12-23 Thread Li Japin
On Dec 23, 2020, at 8:11 PM, Fujii Masao mailto:masao.fu...@oss.nttdata.com>> wrote: On 2020/12/23 11:08, Li Japin wrote: On Dec 22, 2020, at 11:13 PM, Fujii Masao mailto:masao.fu...@oss.nttdata.com> <mailto:masao.fu...@oss.nttdata.com>> wrote: ‘B’ means a backend and ‘F

Cannot ship records to subscriber for partition tables using logical replication (publish_via_partition_root=false)

2020-12-23 Thread Li Japin
dd the new partitions in publication, should we add them on the subscriber automatically? [1] https://www.postgresql.org/docs/devel/sql-createpublication.html -- Best regards Japin Li ChengDu WenWu Information Technology Co.Ltd.

Re: Terminate the idle sessions

2021-01-06 Thread Li Japin
-- Best regards Japin Li On Jan 7, 2021, at 10:03 AM, Thomas Munro mailto:thomas.mu...@gmail.com>> wrote: * I'm not entirely comfortable with the name "idle_session_timeout", because it sounds like it applies to all idle states, but actually it only applies when we'r

Re: WIP: System Versioned Temporal Table

2021-02-25 Thread Li Japin
conflict correctly. Same as above. Since the get_row_start_time_col_name() and get_row_end_time_col_name() are similar, IMO we can pass a flag to get StartTime/EndTime column name, thought? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-03 Thread Japin Li
On Wed, 03 Mar 2021 at 20:56, David Steele wrote: > Do you know if you will have time to review this patch during the > current commitfest? > Sorry for the late reply! I think I have time to review this patch and I will do it later. -- Regrads, Japin Li. ChengDu WenWu Information T

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-04 Thread Japin Li
urrent in get_new_heap_oid(). The others looks good to me. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: Inquiries about PostgreSQL's system catalog development——from a student developer of Nanjing University

2021-03-06 Thread Japin Li
the system backend, how > can I reach it? Is there any code or interface demonstration to show me? >     I am looking forward to your prompt reply. Heartfelt thanks. Here is a document on how to create a new system catalog for PostgreSQL 11. https://blog.japinli.top/2019/08/postgresql-new-cata

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-06 Thread Japin Li
On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy wrote: > Attaching v5 patch set for further review. > The v5 patch looks good to me, if there is no objection, I'll change the cf status to "Ready for Committer" in few days. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-06 Thread Japin Li
On Sun, 07 Mar 2021 at 14:25, Bharath Rupireddy wrote: > On Sun, Mar 7, 2021 at 11:49 AM Japin Li wrote: >> >> On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy >> wrote: >> > Attaching v5 patch set for further review. >> > >> >> The v5 pat

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-07 Thread Japin Li
On Sun, 07 Mar 2021 at 17:33, Bharath Rupireddy wrote: > On Sun, Mar 7, 2021 at 12:13 PM Japin Li wrote: >> >> On Sun, 07 Mar 2021 at 14:25, Bharath Rupireddy >> wrote: >> > On Sun, Mar 7, 2021 at 11:49 AM Japin Li wrote: >> >> >> &g

Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax

2021-03-07 Thread Japin Li
ub->publications. Do you see any problems in doing so? If done > that, we can discard the 0001 patch and comments (1) and (3) becomes > irrelevant. Thank you point out this. Fixed it in v7 patch set. Please consider the v7 patch for futher review. -- Regrads, Japin Li. ChengDu WenWu Info

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-12 Thread Japin Li
to put the 'if (explainInfo)' as the first check. That >> way, the check for skipData can be simplified. > > Changed. > > Thanks for review comments. Attaching v7 patch set with changes only > in 0002 patch. Please have a look. > The v7 patch looks good to me, and

Re: Terminate the idle sessions

2020-11-15 Thread Li Japin
ons in the doc file? I made an example: ``` Note that this values should be set to zero if you use postgres_fdw or some Connection-pooling software, because connections might be closed unexpectedly. ``` Thanks for your advice! Attached v4. -- Best regards Japin Li v4-0001-Allow-terminating-th

Re: Terminate the idle sessions

2020-11-16 Thread Li Japin
ION_TIMEOUT, IDLE_IN_TRANSACTION_SESSION_TIMEOUT, + IDLE_SESSION_TIMEOUT, /* First user-definable timeout reason */ USER_TIMEOUT, /* Maximum number of timeout reasons */ Thanks for your review! Attached. -- Best regards Japin Li v5-0001-Allow-terminating-the-idle-sessions.patch Descripti

Re: Terminate the idle sessions

2020-11-16 Thread Li Japin
-- Best regards Japin Li On Nov 17, 2020, at 7:59 AM, David G. Johnston mailto:david.g.johns...@gmail.com>> wrote: On Mon, Nov 16, 2020 at 5:41 AM Li Japin mailto:japi...@hotmail.com>> wrote: Thanks for your review! Attached. Reading the doc changes: I'd rather not

Re: Terminate the idle sessions

2020-11-16 Thread Li Japin
On Nov 17, 2020, at 10:53 AM, David G. Johnston mailto:david.g.johns...@gmail.com>> wrote: On Monday, November 16, 2020, Li Japin mailto:japi...@hotmail.com>> wrote: Consider setting this for specific users instead of as a server default. Client connections managed by connec

Re: Terminate the idle sessions

2020-11-17 Thread Li Japin
ions might be needed. Not sure! I find that Win32 do not support setitimer(), PostgreSQL emulate setitimer() by creating a persistent thread to handle the timer setting and notification upon timeout. So if we want to replace it, I think we should open a new thread to achieve this. -- Best regards Japin Li

Re: Terminate the idle sessions

2020-11-17 Thread Li Japin
mments comes from miscadmin.h. Right, but how about before HOLD_INTERRUPTS()? If so, only calling handle_sig_alarm() is occurred, and Setitimer will not be set, I think. Yeah, it might be occurred. Any suggestions to fix it? -- Best regards Japin Li

Re: Terminate the idle sessions

2020-11-17 Thread Li Japin
cause any intrreputions might be occured. +*/ + sigalrm_delivered = true; schedule_alarm(GetCurrentTimestamp()); + } } ``` Thanks for your suggestion. Attached! -- Best regards Japin Li v7-0001-Allow-terminating-the-idle-sessions.patch Description

  1   2   3   4   5   6   >