Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-06-05 Thread Masahiko Sawada
case RT_NODE_KIND_32: RT_ADD_CHILD_16(tree, ref, node, chunk, child); break; case RT_NODE_KIND_125: RT_ADD_CHILD_48(tree, ref, node, chunk, child); break; case RT_NODE_KIND_256: RT_ADD_CHILD_256(tree, ref, node, chunk, child); break; Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: PG 16 draft release notes ready

2023-05-30 Thread Masahiko Sawada
"origin" option. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: PG 16 draft release notes ready

2023-05-29 Thread Masahiko Sawada
ioned two times in this item and commit 0fdab27ad is listed two times. Is it intentional? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: make_ctags: use -I option to ignore pg_node_attr macro

2023-05-29 Thread Masahiko Sawada
searching on of the tags file. I've fixed the comment accordingly too. Regards, [1] https://en.wikipedia.org/wiki/Ctags#Etags_2 -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com fix_make_ctags.patch Description: Binary data

Re: running logical replication as the subscription owner

2023-05-26 Thread Masahiko Sawada
On Thu, May 25, 2023 at 5:41 PM Amit Kapila wrote: > > On Thu, May 25, 2023 at 12:33 PM Masahiko Sawada > wrote: > > > > On Tue, May 23, 2023 at 8:21 PM Amit Kapila wrote: > > > > > > On Mon, May 22, 2023 at 6:06 PM Masahiko Sawada > > > w

Re: running logical replication as the subscription owner

2023-05-25 Thread Masahiko Sawada
On Tue, May 23, 2023 at 8:21 PM Amit Kapila wrote: > > On Mon, May 22, 2023 at 6:06 PM Masahiko Sawada wrote: > > > > Thank you for updating the patch! Here are review comments: > > > > + /* > > +* Make sure that the copy command runs as the ta

Re: running logical replication as the subscription owner

2023-05-22 Thread Masahiko Sawada
On Wed, May 17, 2023 at 10:10 AM Ajin Cherian wrote: > > On Mon, May 15, 2023 at 10:47 PM Masahiko Sawada > wrote: > > > > On Mon, May 15, 2023 at 5:44 PM Ajin Cherian wrote: > > > > > > On Fri, May 12, 2023 at 9:55 PM Ajin Cherian wrote: > > >

Re: Initial Schema Sync for Logical Replication

2023-05-21 Thread Masahiko Sawada
On Fri, Apr 28, 2023 at 4:16 PM Masahiko Sawada wrote: > Yes, in this approach, we need to dump/restore objects while > specifying with fine granularity. Ideally, the table sync worker dumps > and restores the table schema, does copy the initial data, and then > creates indexes, and

Re: Subscription statistics are not dropped at DROP SUBSCRIPTION in some cases

2023-05-16 Thread Masahiko Sawada
On Thu, May 11, 2023 at 5:12 PM Masahiko Sawada wrote: > > On Wed, May 10, 2023 at 8:58 PM Melih Mutlu wrote: > > > > Hi, > > > > Masahiko Sawada , 8 May 2023 Pzt, 10:24 tarihinde > > şunu yazdı: > >> > >> I've attached the patch. Feedb

Re: running logical replication as the subscription owner

2023-05-15 Thread Masahiko Sawada
e patch! I think we might want to have tests for it. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: walsender performance regression due to logical decoding on standby changes

2023-05-15 Thread Masahiko Sawada
ake a > separate latch-wait-list thing. +1 Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Time delayed LR (WAS Re: logical replication restrictions)

2023-05-11 Thread Masahiko Sawada
t to delay cases (i.e. adding non-streamed transaction support and the delay mechanism). It might be helpful if this patch becomes large and this approach can enable us to reduce the complexity or divide the patch. That being said, I've not considered this approach enough yet and it's just

Re: running logical replication as the subscription owner

2023-05-11 Thread Masahiko Sawada
t seems that the initial sync worker respects 'run_as_owner' during catching up but not during COPYing. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Time delayed LR (WAS Re: logical replication restrictions)

2023-05-11 Thread Masahiko Sawada
a (and perhaps could be a building block of this feature) that we write streamed changes to a permanent file so that the apply worker can retry to apply them without retrieving the same changes again from the publisher. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Subscription statistics are not dropped at DROP SUBSCRIPTION in some cases

2023-05-11 Thread Masahiko Sawada
On Wed, May 10, 2023 at 8:58 PM Melih Mutlu wrote: > > Hi, > > Masahiko Sawada , 8 May 2023 Pzt, 10:24 tarihinde şunu > yazdı: >> >> I've attached the patch. Feedback is very welcome. > > > Thanks for the patch, nice catch. > I can confirm that the is

Re: walsender performance regression due to logical decoding on standby changes

2023-05-10 Thread Masahiko Sawada
we need this condition variable > logic for physical walsenders? It sounds like a good idea. We can have two condition variables for logical and physical walsenders, and selectively wake up walsenders sleeping on the condition variables. It should work, it seems like much of a hack, though. Regards, [1] https://www.postgresql.org/message-id/2d314c22b9e03415aa1c7d8fd1f698dae60effa7.camel%40j-davis.com -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: [DOC] Update ALTER SUBSCRIPTION documentation

2023-05-09 Thread Masahiko Sawada
On Tue, May 9, 2023 at 3:40 PM Amit Kapila wrote: > > On Mon, May 8, 2023 at 1:51 PM Masahiko Sawada wrote: > > > > Apart from the documentation change, given that setting slot_name = > > NONE always requires for the subscription to be disabled beforehand, > > does

Re: Perform streaming logical transactions by background workers and parallel apply

2023-05-08 Thread Masahiko Sawada
. +*/ + shm_mq_detach(winfo->error_mq_handle); + winfo->error_mq_handle = NULL; In pa_detach_all_error_mq(), we try to detach error queues of all workers in the pool. I think we should check if the queue is already detached (i.e. is NULL) there. Otherwise, we will end

Re: Perform streaming logical transactions by background workers and parallel apply

2023-05-08 Thread Masahiko Sawada
On Mon, May 8, 2023 at 3:34 PM Amit Kapila wrote: > > On Mon, May 8, 2023 at 11:08 AM Masahiko Sawada wrote: > > > > On Mon, May 8, 2023 at 12:52 PM Zhijie Hou (Fujitsu) > > wrote: > > > > > > On Monday, May 8, 2023 11:08 AM Masahiko Sawada > >

Re: [DOC] Update ALTER SUBSCRIPTION documentation

2023-05-08 Thread Masahiko Sawada
beforehand, does it make sense to change ALTER SUBSCRIPTION SET so that we disable the subscription when setting slot_name = NONE? Setting slot_name to a valid slot name doesn't enable the subscription, though. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Subscription statistics are not dropped at DROP SUBSCRIPTION in some cases

2023-05-08 Thread Masahiko Sawada
removing the catalog tuple. There is a chance the transaction dropping the subscription fails due to network error etc but we don't need to worry about it as reporting the subscription drop is transactional. I've attached the patch. Feedback is very welcome. Regards, -- Masahiko Sawada

Re: Perform streaming logical transactions by background workers and parallel apply

2023-05-07 Thread Masahiko Sawada
On Mon, May 8, 2023 at 12:52 PM Zhijie Hou (Fujitsu) wrote: > > On Monday, May 8, 2023 11:08 AM Masahiko Sawada > > Hi, > > > > > On Tue, May 2, 2023 at 12:22 PM Amit Kapila > > wrote: > > > > > > On Fri, Apr 28, 2023 at 11:48 AM Masahiko Saw

Re: Perform streaming logical transactions by background workers and parallel apply

2023-05-07 Thread Masahiko Sawada
On Tue, May 2, 2023 at 12:22 PM Amit Kapila wrote: > > On Fri, Apr 28, 2023 at 11:48 AM Masahiko Sawada > wrote: > > > > While investigating this issue, I've reviewed the code around > > callbacks and worker termination etc and I found a problem. > >

Re: Perform streaming logical transactions by background workers and parallel apply

2023-04-30 Thread Masahiko Sawada
On Fri, Apr 28, 2023 at 6:01 PM Amit Kapila wrote: > > On Fri, Apr 28, 2023 at 11:48 AM Masahiko Sawada > wrote: > > > > On Fri, Apr 28, 2023 at 11:51 AM Amit Kapila > > wrote: > > > > > > On Wed, Apr 26, 2023 at 4:11 PM Zhijie Hou (Fujitsu) >

Re: Initial Schema Sync for Logical Replication

2023-04-28 Thread Masahiko Sawada
On Thu, Apr 27, 2023 at 12:02 PM Wei Wang (Fujitsu) wrote: > > On Fri, Apr 21, 2023 at 16:48 PM Masahiko Sawada > wrote: > > On Thu, Apr 20, 2023 at 8:16 PM Amit Kapila wrote: > > > > > > On Mon, Apr 17, 2023 at 9:12 AM Masahiko Sawada > > wrote: > &g

Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode

2023-04-27 Thread Masahiko Sawada
On Wed, Apr 26, 2023 at 9:59 PM Melanie Plageman wrote: > > > On Wed, Apr 26, 2023 at 8:31 AM Daniel Gustafsson wrote: >> >> > On 26 Apr 2023, at 13:26, David Rowley wrote: >> > On Wed, 26 Apr 2023, 8:48 pm Masahiko Sawada, > > <mailto:sawada.m...@gmail

Re: Perform streaming logical transactions by background workers and parallel apply

2023-04-27 Thread Masahiko Sawada
pq_mq_parallel_leader_backend_id); else { Assert(IsParallelWorker()); It normally would be a should-no-happen case, though. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Testing autovacuum wraparound (including failsafe)

2023-04-27 Thread Masahiko Sawada
he patch needs to be updated since commit 664d757531e1 changed background psql TAP functions. I've attached the updated patch. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com v3-0001-Add-tests-for-XID-wraparound.patch Description: Binary data

Re: Should vacuum process config file reload more often

2023-04-27 Thread Masahiko Sawada
8850, skip_privs=skip_privs@entry=false, > bstrategy=bstrategy@entry=0x14ddca8) > at ../src/backend/commands/vacuum.c:2236 Good catch. I think the problem is that vacuum_rel() is called recursively and we don't reset VacuumFailsafeActive before vacuuming the toast table. I think we should reset it in heap_vacuum_rel() instead of Assert(). It's possible that we trigger the failsafe mode only for either one.Please find the attached patch. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com reset_VacuumFailsafeActive.patch Description: Binary data

Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode

2023-04-26 Thread Masahiko Sawada
# range 128kB to 16GB It works but I think we might want to add the unit kB for understandability and consistency with other GUC_UNIT_KB parameters. I've attached a small patch that adds the unit and aligns the indent of the comments to the perimeter parameters. Regards, --

Re: Support logical replication of DDLs

2023-04-25 Thread Masahiko Sawada
ed functions, and we will end up having lists of all types of objects. > > > > One more alternative could be like: > > One more alternative could be like: > CREATE PUBLICATION xx FOR pub_create_alter_table WITH (ddl = > 'table:create,alter'); -- it will publish create table and alter table > operations. > CREATE PUBLICATION xx FOR pub_all_table WITH (ddl = 'table:all'); -- This > means all table operations create/alter/drop > CREATE PUBLICATION xx FOR pub_all_table WITH (ddl = 'table'); -- same as above > > This can be extended later to: > CREATE PUBLICATION xx FOR pub_all_func WITH (ddl = 'function:all'); > CREATE PUBLICATION xx FOR pub_create_trigger (ddl = 'trigger:create'); > > In this approach, we don't need to add more stuff in gram.y and > will give fine-grained control as well. What did you mean by pub_create_alter_table, pub_all_table, pg_all_func, and pub_create_trigger? Are they table names or some special keywords indicating groups of objects? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Support logical replication of DDLs

2023-04-25 Thread Masahiko Sawada
On Wed, Apr 26, 2023 at 2:56 PM Amit Kapila wrote: > > On Wed, Apr 26, 2023 at 10:01 AM Masahiko Sawada > wrote: > > > > On Tue, Apr 25, 2023 at 12:58 PM Zhijie Hou (Fujitsu) > > wrote: > > > > > > Aport from above comments, I splitted the code rela

Re: Support logical replication of DDLs

2023-04-25 Thread Masahiko Sawada
won't be replicated. The same is true when we unset the ddl option instead of dropping the publication. IIUC it seems not to be a good idea to tie the event triggers with publications. I don't have any good alternative ideas for now, though. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Should vacuum process config file reload more often

2023-04-25 Thread Masahiko Sawada
On Tue, Apr 25, 2023 at 10:35 PM Daniel Gustafsson wrote: > > > On 25 Apr 2023, at 15:31, Masahiko Sawada wrote: > > > > On Tue, Apr 25, 2023 at 9:39 PM Daniel Gustafsson wrote: > >> > >>> On 17 Apr 2023, at 04:04, Masahiko Sawada wrote: > >&

Re: Should vacuum process config file reload more often

2023-04-25 Thread Masahiko Sawada
On Tue, Apr 25, 2023 at 9:39 PM Daniel Gustafsson wrote: > > > On 17 Apr 2023, at 04:04, Masahiko Sawada wrote: > > > I've attached an updated patch for fixing at_dobalance condition. > > I revisited this and pushed it to all supported branches after another roun

Re: Perform streaming logical transactions by background workers and parallel apply

2023-04-23 Thread Masahiko Sawada
On Mon, Apr 24, 2023 at 2:24 PM Amit Kapila wrote: > > On Mon, Apr 24, 2023 at 7:26 AM Masahiko Sawada wrote: > > > > While looking at the worker.c, I realized that we have the following > > code in handle_streamed_transaction(): > > > > d

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-04-23 Thread Masahiko Sawada
On Wed, Apr 19, 2023 at 4:02 PM John Naylor wrote: > > On Mon, Apr 17, 2023 at 8:49 PM Masahiko Sawada wrote: > > > > - With lazy expansion and single-value leaves, the root of a radix tree > > > can point to a single leaf. That might get rid of the need to track >

Re: Perform streaming logical transactions by background workers and parallel apply

2023-04-23 Thread Masahiko Sawada
default: Assert(false); return false; / silence compiler warning / I think it's better to do elog(ERROR) instead of Assert() as it ends up returning false in non-assertion builds, which might cause a problem. And it's more consistent with other codes in worker

Re: New committers: Nathan Bossart, Amit Langote, Masahiko Sawada

2023-04-21 Thread Masahiko Sawada
On Fri, Apr 21, 2023 at 2:40 AM Tom Lane wrote: > > The Core Team would like to extend our congratulations to > Nathan Bossart, Amit Langote, and Masahiko Sawada, who have > accepted invitations to become our newest Postgres committers. > > Please join me in wishing them mu

Re: Initial Schema Sync for Logical Replication

2023-04-21 Thread Masahiko Sawada
On Thu, Apr 20, 2023 at 8:16 PM Amit Kapila wrote: > > On Mon, Apr 17, 2023 at 9:12 AM Masahiko Sawada wrote: > > > > On Fri, Apr 7, 2023 at 6:37 PM Amit Kapila wrote: > > > > > > On Thu, Apr 6, 2023 at 6:57 PM Masahiko Sawada > > > wrote: > &g

Re: Initial Schema Sync for Logical Replication

2023-04-21 Thread Masahiko Sawada
On Thu, Apr 20, 2023 at 9:41 PM Kumar, Sachin wrote: > > I am working on a prototype with above discussed idea, I think I will send it > for initial review by Monday. > Okay, but which idea are you referring to? pg_subscription_remote_rel + worker_pid idea Amit proposed? Regards,

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-04-17 Thread Masahiko Sawada
r. > > Note: I've moved the CF entry to the next CF, and set to waiting on author > for now. Since no action is currently required from Masahiko, I've added > myself as author as well. If tackling bitmap heap scan shows promise, we > could RWF and resurrect at a later time. Thanks. I'm going to continue researching the memory limitation and try lazy path expansion until PG17 development begins. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Initial Schema Sync for Logical Replication

2023-04-16 Thread Masahiko Sawada
On Fri, Apr 7, 2023 at 6:37 PM Amit Kapila wrote: > > On Thu, Apr 6, 2023 at 6:57 PM Masahiko Sawada wrote: > > > > On Thu, Mar 30, 2023 at 10:11 PM Masahiko Sawada > > wrote: > > > > > > On Thu, Mar 30, 2023 at 12:18 AM Masahiko Sawada >

Re: Should vacuum process config file reload more often

2023-04-16 Thread Masahiko Sawada
On Wed, Apr 12, 2023 at 12:05 AM Masahiko Sawada wrote: > > On Fri, Apr 7, 2023 at 10:23 PM Daniel Gustafsson wrote: > > > > > On 7 Apr 2023, at 15:07, Melanie Plageman > > > wrote: > > > On Fri, Apr 7, 2023 at 2:53 AM Masahiko Sawada > > > wro

Re: Should vacuum process config file reload more often

2023-04-11 Thread Masahiko Sawada
On Fri, Apr 7, 2023 at 10:23 PM Daniel Gustafsson wrote: > > > On 7 Apr 2023, at 15:07, Melanie Plageman wrote: > > On Fri, Apr 7, 2023 at 2:53 AM Masahiko Sawada > > wrote: > > >> + /* Only log updates to cost-related variables */ &

Re: CREATE SUBSCRIPTION -- add missing tab-completes

2023-04-07 Thread Masahiko Sawada
On Fri, Apr 7, 2023 at 6:10 PM Amit Kapila wrote: > > On Fri, Apr 7, 2023 at 1:12 PM Masahiko Sawada wrote: > > > > On Fri, Apr 7, 2023 at 2:28 PM Amit Kapila wrote: > > > > > > On Wed, Apr 5, 2023 at 5:58 AM Peter Smith wrote: > > > > > >

Re: CREATE SUBSCRIPTION -- add missing tab-completes

2023-04-07 Thread Masahiko Sawada
word_required, run_as_owner, and origin. Only a superuser can set password_required = false. ISTM that both password_required and run_as_owner are parameters to control the subscription's behavior, like disable_on_error and streaming. So it looks good to me that password_required belongs to the second section. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Should vacuum process config file reload more often

2023-04-06 Thread Masahiko Sawada
!(avopts && (avopts->vacuum_cost_limit > 0 || avopts->vacuum_cost_delay > 0)); The initial values of both avopts->vacuum_cost_limit and avopts->vacuum_cost_delay are -1. I think we should use ">= 0" instead of "> 0". Otherwise,

Re: Initial Schema Sync for Logical Replication

2023-04-06 Thread Masahiko Sawada
On Thu, Mar 30, 2023 at 10:11 PM Masahiko Sawada wrote: > > On Thu, Mar 30, 2023 at 12:18 AM Masahiko Sawada > wrote: > > > > On Wed, Mar 29, 2023 at 7:57 PM Kumar, Sachin wrote: > > > > > > > > > > From: Amit Kapila > > > > &g

Re: Should vacuum process config file reload more often

2023-04-05 Thread Masahiko Sawada
nsider whether or not the initial two commits should just be > squashed with the third commit > > - Anything else reviewers are still unhappy with > > > On Wed, Apr 5, 2023 at 1:56 AM Masahiko Sawada wrote: > > > > On Wed, Apr 5, 2023 at 5:05 AM Melanie Pla

Re: Add index scan progress to pg_stat_progress_vacuum

2023-04-05 Thread Masahiko Sawada
On Wed, Apr 5, 2023 at 4:47 PM Michael Paquier wrote: > > On Fri, Feb 24, 2023 at 03:16:10PM +0900, Masahiko Sawada wrote: > > Thanks! It looks good to me so I've marked it as Ready for Committer. > > + case 'P':

Re: Should vacuum process config file reload more often

2023-04-04 Thread Masahiko Sawada
On Wed, Apr 5, 2023 at 5:05 AM Melanie Plageman wrote: > > On Tue, Apr 4, 2023 at 4:27 AM Masahiko Sawada wrote: > > --- > > -if (worker->wi_proc != NULL) > > -elog(DEBUG2, "autovac_balance_cost(pid=%d > > db=

Re: Should vacuum process config file reload more often

2023-04-04 Thread Masahiko Sawada
On Tue, Apr 4, 2023 at 1:41 AM Melanie Plageman wrote: > > On Sun, Apr 2, 2023 at 10:28 PM Masahiko Sawada wrote: > > Thank you for updating the patches. Here are comments for 0001, 0002, > > and 0003 patches: > > Thanks for the review! > > v13 attached with

Re: Minimal logical decoding on standbys

2023-04-04 Thread Masahiko Sawada
On Tue, Apr 4, 2023 at 10:55 AM Masahiko Sawada wrote: > > On Tue, Apr 4, 2023 at 3:17 AM Drouvot, Bertrand > wrote: > > > > Hi, > > > > On 4/3/23 8:10 AM, Drouvot, Bertrand wrote: > > > Hi, > > > > > > On 4/3/23 7:35 AM, Amit Kapila wr

Re: Minimal logical decoding on standbys

2023-04-03 Thread Masahiko Sawada
ind = REPLICATION_KIND_LOGICAL; + I think we might want to set the replication kind when processing the START_REPLICATION command. The walsender using a logical replication slot is not necessarily streaming (e.g. when COPYing table data). Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Initial Schema Sync for Logical Replication

2023-04-03 Thread Masahiko Sawada
On Mon, Apr 3, 2023 at 3:54 PM Kumar, Sachin wrote: > > > > > -Original Message- > > From: Masahiko Sawada > > > > I was thinking each TableSync process will call pg_dump --table, > > > > This way if we have N tableSync process, we can hav

Re: Should vacuum process config file reload more often

2023-04-02 Thread Masahiko Sawada
On Sat, Apr 1, 2023 at 4:09 AM Melanie Plageman wrote: > > On Fri, Mar 31, 2023 at 10:31 AM Melanie Plageman > wrote: > > > > On Thu, Mar 30, 2023 at 3:26 PM Daniel Gustafsson wrote: > > > > > > > On 30 Mar 2023, at 04:57, Masahiko Sawada wrote: >

Re: Minimal logical decoding on standbys

2023-03-30 Thread Masahiko Sawada
the other hand, in not-in-recovery case, the events are: * socket readable * socket writable (if pq_is_send_pending() is true) * latch * timeout I think that we don't need to change for the latter case as WalSndWait() perfectly works. As for the former cases, since we need to wait for CV, timeout, or socket writable we can use ConditionVariableEventSleep(). Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Initial Schema Sync for Logical Replication

2023-03-30 Thread Masahiko Sawada
On Thu, Mar 30, 2023 at 12:18 AM Masahiko Sawada wrote: > > On Wed, Mar 29, 2023 at 7:57 PM Kumar, Sachin wrote: > > > > > > > > From: Amit Kapila > > > > > > > I think we won't be able to use same snapshot because the >

Re: logical decoding and replication of sequences, take 2

2023-03-29 Thread Masahiko Sawada
> the subscriber understands. So we could increment the protocol version, > > check it in pgoutput_startup and then error-out in the sequence callback > > if the subscriber version is too old. > > > > That'd be nicer in the sense that we'd generate nicer error message on > > the publisher, not an "unknown message type" on the subscriber. > > > > Agreed. So, we can probably formalize this rule such that whenever in > a newer version publisher we want to send additional information which > the old version subscriber won't be able to handle, the error should > be raised at the publisher by using protocol version number. +1 Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Should vacuum process config file reload more often

2023-03-29 Thread Masahiko Sawada
h the ternary VacuumCostInactive, only vacuum code has to know about > the distinction between inactive+failsafe active and inactive+failsafe > inactive. As another idea, why don't we use macros for that? For example, suppose VacuumCostStatus is like: typedef enum VacuumCostStatus { VACUUM_COST_INACTIVE_LOCKED = 0, VACUUM_COST_INACTIVE, VACUUM_COST_ACTIVE, } VacuumCostStatus; VacuumCostStatus VacuumCost; non-vacuum code can use the following macros: #define VacuumCostActive() (VacuumCost == VACUUM_COST_ACTIVE) #define VacuumCostInactive() (VacuumCost <= VACUUM_COST_INACTIVE) // or we can use !VacuumCostActive() instead. Or is there any reason why we need to keep VacuumCostActive and treat it as a boolean? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Initial Schema Sync for Logical Replication

2023-03-29 Thread Masahiko Sawada
COPY table. How can we postpone creating the pg_subscription_rel entries until the tablesync worker starts and does the schema sync? I think that since pg_subscription_rel entry needs the table OID, we need either to do the schema sync before creating the entry (i.e, during CREATE SUBSCRIPTION) or

Re: logical decoding and replication of sequences, take 2

2023-03-28 Thread Masahiko Sawada
On Wed, Mar 29, 2023 at 3:34 AM Tomas Vondra wrote: > > On 3/28/23 18:34, Masahiko Sawada wrote: > > On Mon, Mar 27, 2023 at 11:46 PM Tomas Vondra > > wrote: > >> > >> > >> > >> On 3/27/23 03:32, Masahiko Sawada wrote: > >>

Re: logical decoding and replication of sequences, take 2

2023-03-28 Thread Masahiko Sawada
On Mon, Mar 27, 2023 at 11:46 PM Tomas Vondra wrote: > > > > On 3/27/23 03:32, Masahiko Sawada wrote: > > Hi, > > > > On Fri, Mar 24, 2023 at 7:26 AM Tomas Vondra > > wrote: > >> > >> I merged the earlier "fixup" patches in

Re: Initial Schema Sync for Logical Replication

2023-03-28 Thread Masahiko Sawada
On Tue, Mar 28, 2023 at 6:47 PM Amit Kapila wrote: > > On Mon, Mar 27, 2023 at 8:17 AM Masahiko Sawada wrote: > > > > On Fri, Mar 24, 2023 at 11:51 PM Kumar, Sachin wrote: > > > > > > > From: Amit Kapila > > > > > I think we won&

Re: Support logical replication of global object commands

2023-03-27 Thread Masahiko Sawada
ng another database such as template1), simply replicating the CREATE DATABASE statement would not produce the same results as the publisher. Also, since event triggers are not fired on DDLs for global objects, always WAL-logging such DDL statements like the proposed patch does is not a good idea. Given that there seems to be some tricky problems and there is a discussion for cutting the scope to make the initial patch small[1], I think it's better to do this work after the first version. Regards, [1] https://www.postgresql.org/message-id/CAA4eK1K3VXfTWXbLADcH81J%3D%3D7ussvNdqLFHN68sEokDPueu7w%40mail.gmail.com -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Initial Schema Sync for Logical Replication

2023-03-26 Thread Masahiko Sawada
sh a > > new snapshot using a technique proposed in email [1]. > > > > Thanks, I think option (b) will be perfect, since we don’t have to create a > new slot. Regarding (b), does it mean that apply worker stops streaming, requests to create a snapshot, and then resumes the streaming? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: logical decoding and replication of sequences, take 2

2023-03-26 Thread Masahiko Sawada
he publication includes that, or (2) not send sequence changes to such subscribers. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Should vacuum process config file reload more often

2023-03-23 Thread Masahiko Sawada
On Fri, Mar 24, 2023 at 9:27 AM Melanie Plageman wrote: > > On Thu, Mar 23, 2023 at 2:09 AM Masahiko Sawada wrote: > > On Sun, Mar 19, 2023 at 7:47 AM Melanie Plageman > > wrote: > > Do we need to calculate the number of workers running with > > nworkers_for

Re: Commitfest 2023-03 starting tomorrow!

2023-03-23 Thread Masahiko Sawada
bug was reported late in the discussion but it was the same issue as CF item "Assertion failure in SnapBuildInitialSnapshot()". Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: pg_upgrade and logical replication

2023-03-23 Thread Masahiko Sawada
would have validated that your application is compatible with that new > version before this point) I might be missing something but is there any reason why you created a subscription before pg_upgrade? Steps like doing pg_upgrade, then creating missing tables, and then creating a subscription (with copy_data = false) could be an alternative way to support upgrading the server from the physical standby? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Should vacuum process config file reload more often

2023-03-22 Thread Masahiko Sawada
On Sun, Mar 19, 2023 at 7:47 AM Melanie Plageman wrote: > > On Wed, Mar 15, 2023 at 1:14 AM Masahiko Sawada wrote: > > On Sat, Mar 11, 2023 at 8:11 AM Melanie Plageman > > wrote: > > > I've implemented the atomic cost limit in the attached patch. Though, >

Re: Initial Schema Sync for Logical Replication

2023-03-22 Thread Masahiko Sawada
On Wed, Mar 22, 2023 at 2:16 PM Amit Kapila wrote: > > On Wed, Mar 22, 2023 at 8:29 AM Masahiko Sawada wrote: > > > > On Tue, Mar 21, 2023 at 8:18 PM Amit Kapila wrote: > > > > > > On Tue, Mar 21, 2023 at 7:32 AM Euler Taveira wrote: > > > > >

Re: Initial Schema Sync for Logical Replication

2023-03-21 Thread Masahiko Sawada
inconsistent dump. The subscriber will easily be not in > sync due to that. > > Now, how do we avoid these problems even if we have our own version of > functionality similar to pg_dump for selected objects? I guess we will > face similar problems. Right. I think that such functionality needs to return DDL commands that can be executed on the requested version. > If so, we may need to deny schema sync in any such case. Yes. Do we have any concrete use case where the subscriber is an older version, in the first place? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Making the initial and maximum DSA segment sizes configurable

2023-03-21 Thread Masahiko Sawada
tgresql.org/message-id/CAD21AoDKr%3D4YHphy6cRojE5eyT6E2ao8xb44E309eTrUEOC6xw%40mail.gmail.com [3] from dsm.c, the total number of DSM segments available on the system is calculated by: #define PG_DYNSHMEM_FIXED_SLOTS 64 #define PG_DYNSHMEM_SLOTS_PER_BACKEND 5 maxitems = PG_DYNSHMEM_FIXED_SLOTS + PG_DYNSHMEM_SLOTS_PER_BA

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-20 Thread Masahiko Sawada
On Tue, Mar 21, 2023 at 2:41 PM John Naylor wrote: > > > On Mon, Mar 20, 2023 at 9:34 PM Masahiko Sawada wrote: > > > > On Mon, Mar 20, 2023 at 9:34 PM John Naylor > > wrote: > > > That's an interesting idea, and the analogous behavior to aset could b

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-20 Thread Masahiko Sawada
On Mon, Mar 20, 2023 at 9:34 PM John Naylor wrote: > > > On Mon, Mar 20, 2023 at 12:25 PM Masahiko Sawada > wrote: > > > > On Fri, Mar 17, 2023 at 4:49 PM Masahiko Sawada > > wrote: > > > > > > On Fri, Mar 17, 2023 at 4:03 PM John Naylor > &g

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-19 Thread Masahiko Sawada
On Fri, Mar 17, 2023 at 4:49 PM Masahiko Sawada wrote: > > On Fri, Mar 17, 2023 at 4:03 PM John Naylor > wrote: > > > > On Wed, Mar 15, 2023 at 9:32 AM Masahiko Sawada > > wrote: > > > > > > On Tue, Mar 14, 2023 at 8:27 PM John

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-17 Thread Masahiko Sawada
On Fri, Mar 17, 2023 at 4:03 PM John Naylor wrote: > > On Wed, Mar 15, 2023 at 9:32 AM Masahiko Sawada wrote: > > > > On Tue, Mar 14, 2023 at 8:27 PM John Naylor > > wrote: > > > > > > I wrote: > > > > > > > > > Since the bloc

Re: logical decoding and replication of sequences, take 2

2023-03-16 Thread Masahiko Sawada
a for replication origin "pg_16390" during message type "BEGIN" in transaction 734, finished at 0/1751698 If I create the sequence s2 in advance on the subscriber, the sequence change is applied on the subscriber. If the subscriber doesn't need to apply transactional sequence changes in the first place, this problem will disappear. --- There are two typos in 0001 patch: In the commit message: ensure the sequence record has a valid XID - until now the the increment s/the the/ the/ And, + /* Only ever called from ReorderBufferApplySequence, so transational. */ s/transational/transactional/ Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode

2023-03-15 Thread Masahiko Sawada
unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: 2023-03-15 17:10:59.404 JST [471159] LOG: server process (PID 471180) was terminated by signal 11: Segmentation fault Finally, when I used a more lower value, 16777100, I got a memory allocation error: postgres(1:471361)=# vacuum (buffer_usage_limit 16777100) ; 2023-03-15 17:12:17.853 JST [471361] ERROR: invalid memory alloc request size 18446744073709551572 Probably vacuum_buffer_usage_limit also has the same issue. Also, should we support a table option for vacuum_buffer_usage_limit as well? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Add macros for ReorderBufferTXN toptxn

2023-03-14 Thread Masahiko Sawada
(txn->nentries_mem != 0))) txn->txn_flags |= RBTXN_IS_STREAMED; Probably the following comment of the above lines also needs to be updated? * The toplevel transaction, identified by (toptxn==NULL), is marked as * streamed always, --- +/* Is this a top-level transaction? */ +#d

Re: Should vacuum process config file reload more often

2023-03-14 Thread Masahiko Sawada
On Sat, Mar 11, 2023 at 8:11 AM Melanie Plageman wrote: > > Quotes below are combined from two of Sawada-san's emails. > > I've also attached a patch with my suggested current version. > > On Thu, Mar 9, 2023 at 10:27 PM Masahiko Sawada wrote: > > > >

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-14 Thread Masahiko Sawada
what invokes a page fault. --- IIUC you suggested measuring memory usage by tracking how much memory chunks are allocated within a block. If your idea at the top of the page follows this method, it still doesn't deal with the point Andres mentioned. > I'll put this item and a couple other things together in a separate email > tomorrow. Thanks! Regards, [1] https://www.postgresql.org/message-id/CAFBsxsEnzivaJ13iCGdDoUMsXJVGOaahuBe_y%3Dq6ow%3DLTzyDvA%40mail.gmail.com -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Testing autovacuum wraparound (including failsafe)

2023-03-13 Thread Masahiko Sawada
On Wed, Mar 8, 2023 at 1:52 PM Masahiko Sawada wrote: > > On Fri, Mar 3, 2023 at 8:34 PM Heikki Linnakangas wrote: > > > > On 16/11/2022 06:38, Ian Lawrence Barwick wrote: > > > Thanks for the patch. While reviewing the patch backlog, we have > > > determi

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-13 Thread Masahiko Sawada
On Mon, Mar 13, 2023 at 10:28 PM John Naylor wrote: > > On Mon, Mar 13, 2023 at 8:41 AM Masahiko Sawada wrote: > > > > On Sun, Mar 12, 2023 at 12:54 AM John Naylor > > wrote: > > > > > > On Fri, Mar 10, 2023 at 9:30 PM Masahiko Sawada > > &g

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-12 Thread Masahiko Sawada
On Sun, Mar 12, 2023 at 12:54 AM John Naylor wrote: > > On Fri, Mar 10, 2023 at 9:30 PM Masahiko Sawada wrote: > > > > On Fri, Mar 10, 2023 at 3:42 PM John Naylor > > wrote: > > > > I'd suggest sharing your todo list in the meanwhile, it'd be good

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-10 Thread Masahiko Sawada
On Fri, Mar 10, 2023 at 3:42 PM John Naylor wrote: > > On Thu, Mar 9, 2023 at 1:51 PM Masahiko Sawada wrote: > > > I've attached the new version patches. I merged improvements and fixes > > I did in the v29 patch. > > I haven't yet had a chance to look at th

Re: Should vacuum process config file reload more often

2023-03-09 Thread Masahiko Sawada
On Fri, Mar 10, 2023 at 11:23 AM Melanie Plageman wrote: > > On Tue, Mar 7, 2023 at 12:10 AM Masahiko Sawada wrote: > > > > On Mon, Mar 6, 2023 at 5:26 AM Melanie Plageman > > wrote: > > > > > > On Thu, Mar 2, 2023 at 6:37 PM Melanie Plageman > &

Re: Should vacuum process config file reload more often

2023-03-09 Thread Masahiko Sawada
than > the current state of affairs. And I think that the tidstore makes it easy to react to maintenance_work_mem changes. We don't need to enlarge it and just update its memory limit at an appropriate time. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Testing autovacuum wraparound (including failsafe)

2023-03-07 Thread Masahiko Sawada
vacuum_min_duration reloption for the test tables instead of globally enabling it The 001 test uses the 2PC transaction that holds locks on tables but since we can consume xids while the server running, we don't need that. Instead I think we can keep a transaction open in the background like 002 test does. I'll try these ideas. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Time delayed LR (WAS Re: logical replication restrictions)

2023-03-07 Thread Masahiko Sawada
r perspective. I also think it would be worth exploring it if we've not yet. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Should vacuum process config file reload more often

2023-03-06 Thread Masahiko Sawada
On Mon, Mar 6, 2023 at 5:26 AM Melanie Plageman wrote: > > On Thu, Mar 2, 2023 at 6:37 PM Melanie Plageman > wrote: > > > > On Thu, Mar 2, 2023 at 2:36 AM Masahiko Sawada > > wrote: > > > > > > On Thu, Mar 2, 2023 at 10:41 AM Melanie Plageman >

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-06 Thread Masahiko Sawada
On Tue, Mar 7, 2023 at 1:01 AM John Naylor wrote: > > On Mon, Mar 6, 2023 at 1:28 PM Masahiko Sawada wrote: > > > > Since the block-level measurement is likely overestimating quite a bit, I > > > propose to simply reverse the order of the actions here, effectively &

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-05 Thread Masahiko Sawada
On Fri, Mar 3, 2023 at 8:04 PM John Naylor wrote: > > On Wed, Mar 1, 2023 at 6:59 PM Masahiko Sawada wrote: > > > > On Wed, Mar 1, 2023 at 3:37 PM John Naylor > > wrote: > > > > > > I think we're trying to solve the wrong problem here. I need to

Re: Time delayed LR (WAS Re: logical replication restrictions)

2023-03-03 Thread Masahiko Sawada
On Thu, Mar 2, 2023 at 1:07 PM Amit Kapila wrote: > > On Thu, Mar 2, 2023 at 7:38 AM Masahiko Sawada wrote: > > > > On Wed, Mar 1, 2023 at 6:21 PM Hayato Kuroda (Fujitsu) > > wrote: > > > > > > > > > > > Apart from a bad-use case example

Re: Should vacuum process config file reload more often

2023-03-01 Thread Masahiko Sawada
On Thu, Mar 2, 2023 at 10:41 AM Melanie Plageman wrote: > > On Mon, Feb 27, 2023 at 9:12 AM Masahiko Sawada wrote: > > On Fri, Feb 24, 2023 at 7:08 AM Melanie Plageman > > wrote: > > > Users may wish to speed up long-running vacuum of a larg

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Masahiko Sawada
On Thu, Mar 2, 2023 at 2:26 PM Nathan Bossart wrote: > > On Thu, Mar 02, 2023 at 02:21:08PM +0900, Michael Paquier wrote: > > On Thu, Mar 02, 2023 at 12:58:32PM +0900, Masahiko Sawada wrote: > >> Cutting the toast relation name to 'pg_toast' is a bit confusing to

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Masahiko Sawada
, s.vacuum_count FROM pg_stat_all_tables s LEFT JOIN pg_class c ON s.relid = c.reltoastrelid WHERE c.relname = 'vactst' OR s.relname = 'vactst' We will get like: SELECT * FROM vactst_vacuum_counts; relname | vacuum_count --+-- toast for vactst |0 vactst |1 (2 rows) The rest looks good to me. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Time delayed LR (WAS Re: logical replication restrictions)

2023-03-01 Thread Masahiko Sawada
compare > min_send_delay and max_slot_wal_keep_size when publisher receives the > parameter. Since max_slot_wal_keep_size can be changed by reloading the config file, each walsender warns it also at that time? Not sure it's helpful. I think it's a legitimate use case t

<    1   2   3   4   5   6   7   8   9   10   >