Re: Support logical replication of DDLs

2023-04-26 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
ed. 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 round &g

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

2023-04-24 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.c. Please

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
e 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 > > >

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
password_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-07 Thread Masahiko Sawada
>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, we include the autovacuum wor

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 > > > >

Re: Should vacuum process config file reload more often

2023-04-06 Thread Masahiko Sawada
Consider 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': /* Parallel

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
N_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

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
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 beca

Re: logical decoding and replication of sequences, take 2

2023-03-29 Thread Masahiko Sawada
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
acuumCostInactive, 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
e. 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 to postpon

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-28 Thread Masahiko Sawada
ing 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
> 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
cludes 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

Re: Commitfest 2023-03 starting tomorrow!

2023-03-23 Thread Masahiko Sawada
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
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-23 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
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
sage-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_BACKEND * MaxBack

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

2023-03-21 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 be

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
n 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
r 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
em != 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? */ +#define rbtxn_is_toptx

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: > > > > On Fri, Ma

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

2023-03-14 Thread Masahiko Sawada
y 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-14 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 > > > dete

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 to >

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 those closel

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
rrent 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
st 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
nk 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, effectivel

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 stud

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 me > &g

Re: add PROCESS_MAIN to VACUUM

2023-03-01 Thread Masahiko Sawada
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
t; 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 to set min_send_delay

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

2023-03-01 Thread Masahiko Sawada
On Wed, Mar 1, 2023 at 3:37 PM John Naylor wrote: > > On Tue, Feb 28, 2023 at 10:09 PM Masahiko Sawada > wrote: > > > > On Tue, Feb 28, 2023 at 10:20 PM Masahiko Sawada > > wrote: > > > > > > On Tue, Feb 28, 2023 at 3:42 PM John Naylor > &g

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

2023-02-28 Thread Masahiko Sawada
On Wed, Mar 1, 2023 at 1:55 PM Amit Kapila wrote: > > On Wed, Mar 1, 2023 at 8:18 AM Masahiko Sawada wrote: > > > > On Wed, Mar 1, 2023 at 12:51 AM Hayato Kuroda (Fujitsu) > > wrote: > > > > Thinking of side effects of this feature (no matter whe

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

2023-02-28 Thread Masahiko Sawada
ver crash appear on the publisher, which sounds dangerous to me. Imagine a service or system like where there is a publication server and it's somewhat exposed so that a user (or a subsystem) arbitrarily can create a subscriber to replicate a subset of the data. A malicious user can have the publisher crash by creating a subscription with, say, min_send_delay = 20d. max_slot_wal_keep_size helps this situation but it's -1 by default. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

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

2023-02-28 Thread Masahiko Sawada
On Tue, Feb 28, 2023 at 10:20 PM Masahiko Sawada wrote: > > On Tue, Feb 28, 2023 at 3:42 PM John Naylor > wrote: > > > > > > On Fri, Feb 24, 2023 at 12:50 PM Masahiko Sawada > > wrote: > > > > > > On Wed, Feb 22, 2023 at 6:55 PM John Nay

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

2023-02-28 Thread Masahiko Sawada
On Tue, Feb 28, 2023 at 3:42 PM John Naylor wrote: > > > On Fri, Feb 24, 2023 at 12:50 PM Masahiko Sawada > wrote: > > > > On Wed, Feb 22, 2023 at 6:55 PM John Naylor > > wrote: > > > > > > That doesn't seem useful to me. If we've done enough

Re: Should vacuum process config file reload more often

2023-02-27 Thread Masahiko Sawada
On Tue, Feb 28, 2023 at 10:21 AM Andres Freund wrote: > > Hi, > > On 2023-02-27 23:11:53 +0900, Masahiko Sawada wrote: > > As far as I know there are not such GUC parameters in the core but > > there might be in third-party table AM and index AM extensions. > > We al

Re: Should vacuum process config file reload more often

2023-02-27 Thread Masahiko Sawada
vacuum/analyze processes. Both processes can update them accordingly in vacuum_delay_point(). Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

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

2023-02-27 Thread Masahiko Sawada
On Mon, Feb 27, 2023 at 3:34 PM Amit Kapila wrote: > > On Mon, Feb 27, 2023 at 11:11 AM Masahiko Sawada > wrote: > > > > On Thu, Feb 23, 2023 at 9:10 PM Hayato Kuroda (Fujitsu) > > wrote: > > > > > > Thank you for reviewing! PSA new version. > &g

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

2023-02-26 Thread Masahiko Sawada
d. +ok( time() - $publisher_insert_time >= $delay, +"subscriber applies WAL only after replication delay for non-streaming transaction" +); The subscriber doesn't actually apply WAL records, but logically replicated changes. How about "subscriber applies changes only after..."? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Support logical replication of DDLs

2023-02-24 Thread Masahiko Sawada
On Tue, Feb 21, 2023 at 11:09 AM Zheng Li wrote: > > On Mon, Feb 20, 2023 at 3:23 AM Masahiko Sawada wrote: > > > > On Fri, Feb 17, 2023 at 1:13 PM Zheng Li wrote: > > > > > > > > I've implemented a prototype to allow replicated objects to have t

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

2023-02-24 Thread Masahiko Sawada
> > Here, the old array pessimistically needs 1GB allocated (as for any table > > ~5GB), but only fills 228MB for tid lookup. The patch reports 8.7MB. Tables > that only fit, say, 30-50 tuples per page will have less extreme differences > in memory use. Same for the case where only a couple dead items occur per > page, with many uninteresting pages in between. Even so, the allocation will > be much more accurately sized in the patch, especially in non-parallel vacuum. Agreed. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Add index scan progress to pg_stat_progress_vacuum

2023-02-23 Thread Masahiko Sawada
t looks good to me so I've marked it as Ready for Committer. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

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

2023-02-23 Thread Masahiko Sawada
On Wed, Feb 22, 2023 at 6:55 PM John Naylor wrote: > > > On Wed, Feb 22, 2023 at 3:29 PM Masahiko Sawada wrote: > > > > On Wed, Feb 22, 2023 at 4:35 PM John Naylor > > wrote: > > > > > > I don't think any vacuum calls in regression tests would stre

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

2023-02-22 Thread Masahiko Sawada
On Wed, Feb 22, 2023 at 4:35 PM John Naylor wrote: > > > On Wed, Feb 22, 2023 at 1:16 PM Masahiko Sawada wrote: > > > > On Mon, Feb 20, 2023 at 2:56 PM Masahiko Sawada > > wrote: > > > > > > Yeah, I did a similar thing in an earlier version o

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

2023-02-21 Thread Masahiko Sawada
On Mon, Feb 20, 2023 at 2:56 PM Masahiko Sawada wrote: > > On Thu, Feb 16, 2023 at 6:23 PM John Naylor > wrote: > > > > On Thu, Feb 16, 2023 at 10:24 AM Masahiko Sawada > > wrote: > > > > > > On Tue, Feb 14, 2023 at 8:24 PM John Naylor > >

Re: Support logical replication of DDLs

2023-02-20 Thread Masahiko Sawada
nd. > > Right, we can do some optimization here: only send the owner for > commands that create objects (CREATE TABLE/FUNCTION/INDEX etc.) Note > that ALTER TABLE/OBJECT OWNER TO is replicated so we don't need to > worry about owner change. What role will be used for executing ALTER and DROP commands on the subscriber? the subscription owner? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

Re: Add index scan progress to pg_stat_progress_vacuum

2023-02-19 Thread Masahiko Sawada
#define PROGRESS_VACUUM_NUM_INDEX_VACUUMS 4 #define PROGRESS_VACUUM_MAX_DEAD_TUPLES5 #define PROGRESS_VACUUM_NUM_DEAD_TUPLES6 +#define PROGRESS_VACUUM_INDEX_TOTAL 7 +#define PROGRESS_VACUUM_INDEX_PROCESSED 8 -

Re: Add index scan progress to pg_stat_progress_vacuum

2023-02-16 Thread Masahiko Sawada
pe. How about parallel_progress_callback_type? I've attached a patch that incorporates the above comments and has some suggestions of updating comments etc. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com fix_v23_masahiko.patch Description: Binary data

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

2023-02-15 Thread Masahiko Sawada
On Tue, Feb 14, 2023 at 8:24 PM John Naylor wrote: > > On Mon, Feb 13, 2023 at 2:51 PM Masahiko Sawada wrote: > > > > On Sat, Feb 11, 2023 at 2:33 PM John Naylor > > wrote: > > > > > > I didn't get any closer to radix-tree regression, > > > &

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

2023-02-14 Thread Masahiko Sawada
ARALLEL_APPLY_SEND_DATA name seemed misleading > > > because that makes it sound like the parallel apply worker is doing > > > the sending, but IIUC it's really the opposite. > > > > > > > So, how about WAIT_EVENT_LOGICAL_APPLY_SEND_DATA? > > > > Yes, IIUC all the LR events are

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

2023-02-12 Thread Masahiko Sawada
rsion for tidstore_lookup_tid(). > > v2699-0003: Get rid of all the remaining special cases for encoding/or not. I > am unaware of the need to optimize that case or treat it in any way > differently. I haven't tested this on an installation with non-default > blocksize and did

Re: Support logical replication of DDLs

2023-02-10 Thread Masahiko Sawada
ean, since EventTriggerCollectCreatePublication() collects the information from the parse tree, I wonder if we could use SCT_Simple for them. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

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

2023-02-09 Thread Masahiko Sawada
On Fri, Feb 10, 2023 at 3:51 PM John Naylor wrote: > > > On Thu, Feb 9, 2023 at 2:08 PM Masahiko Sawada wrote: > > > > query: select * from bench_tidstore_load(0, 10 * 1000 * 1000) > > > > v15: > > load_ms > > - > > 816 > >

Re: Exit walsender before confirming remote flush in logical replication

2023-02-09 Thread Masahiko Sawada
message consistent with other enum parameters. How about the message like: ERROR: invalid value shutdown mode: "%s" Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

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

2023-02-08 Thread Masahiko Sawada
Hi, On Tue, Feb 7, 2023 at 6:25 PM John Naylor wrote: > > > On Tue, Jan 31, 2023 at 9:43 PM Masahiko Sawada wrote: > > > I've attached v24 patches. The locking support patch is separated > > (0005 patch). Also I kept the updates for TidStore and the vacuum > >

Re: Assertion failure in SnapBuildInitialSnapshot()

2023-02-08 Thread Masahiko Sawada
On Wed, Feb 8, 2023 at 1:13 PM Amit Kapila wrote: > > On Wed, Feb 8, 2023 at 1:19 AM Andres Freund wrote: > > > > On 2023-02-01 11:23:57 +0530, Amit Kapila wrote: > > > On Tue, Jan 31, 2023 at 6:08 PM Masahiko Sawada > > > wrote: >

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

2023-02-06 Thread Masahiko Sawada
On Fri, Feb 3, 2023 at 6:44 PM Amit Kapila wrote: > > On Fri, Feb 3, 2023 at 1:28 PM Masahiko Sawada wrote: > > > > On Fri, Feb 3, 2023 at 12:29 PM houzj.f...@fujitsu.com > > wrote: > > > > > > On Friday, February 3, 2023 11:04 AM Amit Kapila > &g

Re: Add progress reporting to pg_verifybackup

2023-02-05 Thread Masahiko Sawada
On Mon, Feb 6, 2023 at 2:45 PM Michael Paquier wrote: > > On Mon, Feb 06, 2023 at 12:27:51PM +0900, Masahiko Sawada wrote: > > I thought that too, but I thought it's better to ignore it, instead of > > erroring out. For example, we can specify both --disable and >

Re: Add progress reporting to pg_verifybackup

2023-02-05 Thread Masahiko Sawada
o pg_checksum commands, but we don't write any progress information in this case. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com

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

2023-02-02 Thread Masahiko Sawada
and revert the change back to normal after the job. If it's unlikely to stream the changes in the regular workload as logical_decoding_work_mem is big enough to handle the regular transaction data, the excess parallel workers won't exit. Another subscription might want to use parallel workers but there might not be free wor

Re: Add progress reporting to pg_verifybackup

2023-02-02 Thread Masahiko Sawada
On Thu, Feb 2, 2023 at 3:12 PM Michael Paquier wrote: > > On Thu, Feb 02, 2023 at 02:57:44PM +0900, Masahiko Sawada wrote: > > It seems that the --progress option doesn't work with command_like() > > since the progress information is written in stderr but command_like(

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