Re: New committer: Jacob Champion

2025-04-11 Thread Bharath Rupireddy
Congratulations Jacob! Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com On Fri, Apr 11, 2025 at 1:26 PM Jonathan S. Katz wrote: > The Core Team would like to extend our congratulations to Jacob > Champion, who has accep

Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM

2024-10-30 Thread Bharath Rupireddy
Replication Apply will have a lot more conditions (e.g. RETURNING clause, triggers etc.) and they will need to be handled differently. So, I left TableModifyIsMultiInsertsSupported as-is in a common place in matview.c. Please find the attached v25 patch set. -- Bharath Rupireddy PostgreSQL Contri

Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM

2024-10-26 Thread Bharath Rupireddy
s, the idea is to take the basic stuff forward. I reworked structure names, members and function names, reworded comments, addressed review comments in the v24 patches. Please have a look. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aw

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-16 Thread Bharath Rupireddy
invalidation of a slot implies that it is not guaranteed to hold any resources like WAL and XMINs. Does it also imply that the slot must be unusable? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-16 Thread Bharath Rupireddy
_since = *now; > + > + if (acquire_lock) > + SpinLockRelease(&s->mutex); > +} > > Is the logic correct? What if the slot was already invalid due to some > reason other than RS_INVAL_INACTIVE_TIMEOUT? Is an Assert needed? Hm. Since invalidated slots can't be acq

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-16 Thread Bharath Rupireddy
an avoid calling it again based on > whether 'now' is NULL or not. Getting a current timestamp can get costlier on platforms that use various clock sources, so assigning 'now' unconditionally isn't the way IMO. Using the inline function in two places improves the readability. Can optimize it if there's any performance impact of calling the inline function in two places. Will post the new patch version soon. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Disallow altering invalidated replication slots

2024-09-10 Thread Bharath Rupireddy
e not removed when > the active slot is invalidated, and check that an error occurs when > attempting to alter the invalid slot. Added. But, keeping it closer to the test case doesn't hurt. Please find the attached v2 patch also having Shveta's review comments addressed. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com v2-0001-Disallow-altering-invalidated-replication-slots.patch Description: Binary data

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-09 Thread Bharath Rupireddy
e to me as well. But let's go ahead and get that sorted out > first. Moved the discussion to new thread - https://www.postgresql.org/message-id/CALj2ACW4fSOMiKjQ3%3D2NVBMTZRTG8Ujg6jsK9z3EvOtvA4vzKQ%40mail.gmail.com. Please have a look. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Disallow altering invalidated replication slots

2024-09-09 Thread Bharath Rupireddy
%2Bszcosq0nS109mMSxPWyNT1Q%3DUNYCJgXKYuCceaPS%2BhA%40mail.gmail.com -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com v1-0001-Disallow-altering-invalidated-replication-slots.patch Description: Binary data

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-08 Thread Bharath Rupireddy
ation causes which still allow alter-slot. +1. Perhaps, track it in a separate thread? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-08 Thread Bharath Rupireddy
ot has been inactive for longer than the duration specified > by replication_slot_inactive_timeout parameter. > > Better to have: > ..the slot has been inactive for a time longer than the duration > specified by the replication_slot_inactive_timeout parameter. Changed it to the

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-08 Thread Bharath Rupireddy
CKPOINT then b) inspecting the server log for the slot > invalidation, and c) waiting for a bit. Repeat 10 times. > > A comment describing the logic for this subroutine would be helpful. > > The most important side-effect of this function is the CHECKPOINT > because without that nothing will ever get invalida

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-08-31 Thread Bharath Rupireddy
> 14. CheckPointReplicationSlots > > /* > - * Flush all replication slots to disk. > + * Flush all replication slots to disk. Also, invalidate slots during > + * non-shutdown checkpoint. > * > * It is convenient to flush dirty replication slots at the time of >

Re: Switching XLog source from archive to streaming when primary available

2024-08-29 Thread Bharath Rupireddy
This is a problem. One idea is to disable streaming_replication_retry_interval feature for slot-less streaming replication - either when primary_slot_name isn't specified disallow the GUC to be set in assign_hook or when deciding to switch the wal source. Thoughts? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Add contrib/pg_logicalsnapinspect

2024-08-29 Thread Bharath Rupireddy
lot data to help when the server is down - https://www.postgresql.org/message-id/flat/CALj2ACW0rV5gWK8A3m6_X62qH%2BVfaq5hznC%3Di0R5Wojt5%2Byhyw%40mail.gmail.com. When the server is running, pg_get_replication_slots() pretty much gives the on-disk contents. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM

2024-08-29 Thread Bharath Rupireddy
v21 is to assign the default AMs in GetTableAmRoutine() itself to avoid if .. else if .. else in the table_modify_XXX(). -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-08-28 Thread Bharath Rupireddy
imes for each invalidated + * slot. Please see the attached v43 patches addressing the above review comments. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com v43-0002-Add-XID-age-based-replication-slot-invalidation.patch Des

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-08-25 Thread Bharath Rupireddy
lidation checks" as we > might not actually invalidate any slot here. Changed. > 3. > > + ReplicationSlotsComputeRequiredXmin(false); > + ReplicationSlotsComputeRequiredLSN(); > + } > > Is this calculation of resource limits really required here when the same is > already done inside InvalidateObs

Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM

2024-08-25 Thread Bharath Rupireddy
On Wed, Jun 5, 2024 at 12:42 PM Bharath Rupireddy wrote: > > Please find the v22 patches with the above changes. Please find the v23 patches after rebasing 0005 and adapting 0004 for 9758174e2e. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Se

Re: Surround CheckRelation[Oid]LockedByMe() with USE_ASSERT_CHECKING

2024-07-01 Thread Bharath Rupireddy
are debug-only and being used in asserts? While it might reduce the compiled binary size a bit for release builds, we may have to be cautious about external or out of core modules using them. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-06-23 Thread Bharath Rupireddy
Hi, On Mon, Jun 17, 2024 at 5:55 PM Bharath Rupireddy wrote: > > Here are my thoughts on when to do the XID age invalidation. In all > the patches sent so far, the XID age invalidation happens in two > places - one during the slot acquisition, and another during the > che

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-06-17 Thread Bharath Rupireddy
Hi, On Sat, Apr 13, 2024 at 9:36 AM Bharath Rupireddy wrote: > > There was a point raised by Amit > https://www.postgresql.org/message-id/CAA4eK1K8wqLsMw6j0hE_SFoWAeo3Kw8UNnMfhsWaYDF1GWYQ%2Bg%40mail.gmail.com > on when to do the XID age based invalidation - whether in checkpoint

Is creating logical replication slots in template databases useful at all?

2024-06-17 Thread Bharath Rupireddy
m the fundamental principle of template databases in the sense that everything in the template database must be copied over to the new database created using it. Is it okay to do this? Am I missing something here? Thoughts? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Data

Re: Use WALReadFromBuffers in more places

2024-06-12 Thread Bharath Rupireddy
ched v2 patches for further review. No changes in 0002 patch. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com From 6902b207cf7497396493aef369a9e275900a86e7 Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy Date: Wed,

Re: Logical Replication of sequences

2024-06-05 Thread Bharath Rupireddy
... Replicate Sequences) so that users can replicate sequences before > shutdown and then disable the subscriptions so that there won't be a > corresponding walsender. As stated above, I like this idea to start with. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM

2024-06-05 Thread Bharath Rupireddy
fering for the new table. Also, the tuples are written to the table from the buffer when there arrives a non-INSERT operation, for example, UPDATE/DELETE/TRUNCATE/COMMIT etc. FWIW, pglogical has the similar multi inserts logic - https://github.com/2ndQuadrant/pglogical/blob/R

Re: Logical Replication of sequences

2024-06-04 Thread Bharath Rupireddy
housands of sequences in a production server, and surely decoding and sending them just during the shutdown can take a lot of time hampering the overall server uptime. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM

2024-05-15 Thread Bharath Rupireddy
orries one like another acronym is being added. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM

2024-05-15 Thread Bharath Rupireddy
On Mon, Apr 29, 2024 at 11:36 AM Bharath Rupireddy wrote: > > Please see the attached v20 patch set. It looks like with the use of the new multi insert table access method (TAM) for COPY (v20-0005), pgbench regressed about 35% [1]. The reason is that the memory-based flushing decision t

Re: Show WAL write and fsync stats in pg_stat_io

2024-05-13 Thread Bharath Rupireddy
; view breaks this aim. -1 as it defeats the very purpose of one-stop view pg_stat_io for all kinds of I/O. PS: see my response above about adding both WAL write I/O and read I/O stats to pg_stat_wal. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: First draft of PG 17 release notes

2024-05-13 Thread Bharath Rupireddy
on that Direct IO for WAL isn't something used in production and debug_io_direct is a developer option. > I could reword and merge it into this item, if > you think I should: > > Improve performance of heavily-contended WAL writes (Bharath > Rupireddy) I think both the

Re: Use WALReadFromBuffers in more places

2024-05-12 Thread Bharath Rupireddy
it hasn't yet implemented the idea of collecting WAL read stats for both walsenders and the backends reading WAL. If that's done, we can extend it for WAL read from WAL buffers. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: First draft of PG 17 release notes

2024-05-10 Thread Bharath Rupireddy
gt; I welcome feedback. For some reason it was an easier job than usual. Thanks a lot for this work Bruce! It looks like commit https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=91f2cae7a4e664e9c0472b364c7db29d755ab151 is missing from daft release notes. Just curious to know

Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM

2024-04-28 Thread Bharath Rupireddy
On Thu, Apr 25, 2024 at 10:11 PM Jeff Davis wrote: > > On Wed, 2024-04-24 at 18:19 +0530, Bharath Rupireddy wrote: > > I added a flush callback named TableModifyBufferFlushCallback; when > > provided by callers invoked after tuples are flushed to disk from the > > buffers

Re: New committers: Melanie Plageman, Richard Guo

2024-04-26 Thread Bharath Rupireddy
ss and few reverts! Congratulations to both of you! -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Add missing ConditionVariableCancelSleep() in slot.c

2024-04-24 Thread Bharath Rupireddy
it will have any other issues. BTW, I like the emoji "¯\_(ツ)_/¯" in the code comments :). > Alternatively, maybe we need to not prepare-to-sleep in > InvalidatePossiblyObsoleteSlot() if we have already prepared to sleep in > a previous iteration through the loop (and of c

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-24 Thread Bharath Rupireddy
not being used (released). > As for the timeout-based slot invalidation feature, we could end up > invalidating the temporary slots even if they are shown as active, > which could confuse users. Do we want to somehow deal with it? Yes. As long as the temporary slot is lying unused hol

Re: Improve WALRead() to suck data directly from WAL buffers when possible

2024-04-24 Thread Bharath Rupireddy
hat should be v18 work, particularly v27-0002: > https://www.postgresql.org/message-id/CALj2ACWCibnX2jcnRreBHFesFeQ6vbKiFstML=w-jvtvukd...@mail.gmail.com Thanks. I started a new thread https://www.postgresql.org/message-id/CALj2ACVfF2Uj9NoFy-5m98HNtjHpuD17EDE9twVeJng-jTAe7A%40mail.gmail.com. -- Bh

Use WALReadFromBuffers in more places

2024-04-24 Thread Bharath Rupireddy
atches. I will register this for the next commit fest. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com v1-0001-Use-WALReadFromBuffers-in-more-places.patch Description: Binary data v1-0002-Add-test-module-to-demonstrate-re

Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM

2024-04-24 Thread Bharath Rupireddy
Core(s) per socket: 8 Socket(s): 1 Stepping:7 BogoMIPS:5999.99 Caches (sum of all): L1d: 256 KiB (8 instances) L1i: 256 KiB (8 instances) L2:8 MiB (8 instances) L3:

Remove unnecessary segment number calculation after wal_removed invalidation of replication slots

2024-04-13 Thread Bharath Rupireddy
SegNo_saved == _logSegNo); + Assert(RedoRecPtr_saved == RedoRecPtr); -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com v1-0001-Remove-unnecessary-seg-no-calculation-after-check.patch Description: Binary data

Add missing ConditionVariableCancelSleep() in slot.c

2024-04-13 Thread Bharath Rupireddy
ed = '' AND a.attrelid = 16391 ORDER BY a.attnum [2] for i in {1..100}; do make check PROVE_TESTS="t/001_rep_changes.pl"; if [ $? -ne 0 ]; then echo "The command failed on iteration $i"; break; fi; done -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Dat

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-12 Thread Bharath Rupireddy
On Sat, Apr 6, 2024 at 5:10 PM Bharath Rupireddy wrote: > > Please see the attached v38 patch. Hi, thanks everyone for reviewing the design and patches so far. Here I'm with the v39 patches implementing inactive timeout based (0001) and XID age based (0002) invalidation mechanisms.

Re: Improve WALRead() to suck data directly from WAL buffers when possible

2024-04-07 Thread Bharath Rupireddy
On Thu, Mar 21, 2024 at 11:33 PM Bharath Rupireddy wrote: > > Please find the v26 patches after rebasing. Commit f3ff7bf83b added a check in WALReadFromBuffers to ensure the requested WAL is not past the WAL that's copied to WAL buffers. So, I've dropped v26-0001 patch. I

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-06 Thread Bharath Rupireddy
d introducing the new functions like > SaveGivenReplicationSlot() and MarkGivenReplicationSlotDirty(), if we > do the required work in the caller? Hm. Removed them now. Please see the attached v38 patch. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon

Re: promotion related handling in pg_sync_replication_slots()

2024-04-05 Thread Bharath Rupireddy
are not while we are shutting down the slot sync worker as part of the standby promotion which might leave the slots in an inconsistent state. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: LogwrtResult contended spinlock

2024-04-05 Thread Bharath Rupireddy
ng if it is somehow related to what's discussed in "Why is parula failing?" https://www.postgresql.org/message-id/4009739.1710878318%40sss.pgh.pa.us. It seems like parula is behaving unexpectedly because of the compiler and other stuff. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-05 Thread Bharath Rupireddy
gt; # log. > ok( !$standby1->log_contains( > "invalidating obsolete replication slot \"lsub1_sync_slot\"", > $standby1_logstart), > 'check that syned slot has not been invalidated on the standby'); > > Would that make sense to trigger a checkpoint on the standby before this test? > I mean I think that without a checkpoint on the standby we should not see the > invalidation in the log anyway. Done. Please find the attached v37 patch for further review. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com v37-0001-Add-inactive_timeout-based-replication-slot-inva.patch Description: Binary data

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-04 Thread Bharath Rupireddy
based on inactive timeout because 1) we do the inactive timeout invalidation at slot level as opposed to InvalidateObsoleteReplicationSlots which does loop over all the slots, 2) InvalidatePossiblyObsoleteSlot does release the lock in some cases, has a lot of unneeded code for inactive timeout invalidat

Re: LogwrtResult contended spinlock

2024-04-04 Thread Bharath Rupireddy
esult first and then logFlushResult, similar to the comment atop RefreshXLogWriteResult? > For 0002, did you consider having pg_atomic_monotonic_advance_u64() > return the currval? +1 for returning currval here. Except for the above comments, the patches look good to me. I've also run the tes

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-04 Thread Bharath Rupireddy
_inactive_since is called even for normal server startups/crash recovery. I've added a check to exit if the StandbyMode isn't set. Please find the attached v35 patch. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com Fro

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-03 Thread Bharath Rupireddy
he attached? Thanks for the changes. v34-0001 LGTM. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-03 Thread Bharath Rupireddy
nactive_since to current time in this case in ShutDownSlotSync, the inactive timeout invalidation mechanism can kick in immediately. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: LogwrtResult contended spinlock

2024-04-03 Thread Bharath Rupireddy
}; do make check PROVE_TESTS="t/027_stream_regress.pl"; if [ $? -ne 0 ]; then echo "The command failed on iteration $i"; break; fi; done ./configure --prefix=$PWD/pg17/ --enable-debug --enable-tap-tests --enable-cassert CC=/usr/bin/clang-14 > install.log && make -j 8 install > install.log 2>&1 & -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-03 Thread Bharath Rupireddy
t, so please give it a > thought): > https://www.postgresql.org/message-id/202403260739.udlp7lxixktx%40alvherre.pgsql Yeah. It's synonymous with inactive_since. If others have an opinion to have replication_slot_inactivity_timeout, I'm fine with it. > 2) Commit msg: > a) > "

Re: New Table Access Methods for Multi and Single Inserts

2024-04-03 Thread Bharath Rupireddy
On Wed, Apr 3, 2024 at 2:32 PM Bharath Rupireddy wrote: > > I too prefer the latter so that the caller doesn't have to have two > paths. The new API can just transparently fallback to single inserts. > I've implemented that in the attached v17 patch. I also tested the > d

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-03 Thread Bharath Rupireddy
ime as an optional parameter. Per an offlist chat with Amit, I've added the following note in synchronize_one_slot: @@ -584,6 +585,11 @@ synchronize_one_slot(RemoteSlot *remote_slot, Oid remote_dbid) * overwriting 'invalidated' flag to remote_slot's value. See * InvalidatePossiblyObsoleteSlot() where it invalidates slot directly * if the slot is not acquired by other processes. + * + * XXX: If it ever turns out that slot acquire/release is costly for + * cases when none of the slot property is changed then we can do a + * pre-check to ensure that at least one of the slot property is + * changed before acquiring the slot. */ ReplicationSlotAcquire(remote_slot->name, true); Please find the attached v32-0001 patch with the above review comments addressed. I'm working on review comments for 0002. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com v32-0001-Allow-synced-slots-to-have-their-own-inactive_si.patch Description: Binary data

Re: New Table Access Methods for Multi and Single Inserts

2024-04-03 Thread Bharath Rupireddy
On Wed, Apr 3, 2024 at 1:10 AM Jeff Davis wrote: > > On Sun, 2024-03-31 at 21:18 +0530, Bharath Rupireddy wrote: > > if (table_modify_buffer_insert() is defined) > >table_modify_buffer_insert(...); > > else > > { > > myState->bistate = GetBulk

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-02 Thread Bharath Rupireddy
changes for them to be called as *active* slots) - synced slots inactive_since is set to current timestamp after the standby gets promoted to help inactive_since interpret correctly just like any other slot. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source D

Re: Synchronizing slots from primary to standby

2024-04-02 Thread Bharath Rupireddy
d have a nit, rest all looks good. +if (DecodingContextReady(ctx) && found_consistent_snapshot) +*found_consistent_snapshot = true; Can the found_consistent_snapshot be checked first to help avoid the function call DecodingContextReady() for pg_replication_slot_advance callers? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Synchronizing slots from primary to standby

2024-04-02 Thread Bharath Rupireddy
are in fast_forward mode where no changes are + * generated. + */ +if (slot->data.database != MyDatabaseId && !fast_forward) ereport(ERROR, It's not clear from the comment that we need it for a slotsync worker to advance the slots from different databases.

Re: Synchronizing slots from primary to standby

2024-04-02 Thread Bharath Rupireddy
to build the + * logical changes unless we are in fast-forward mode where no changes are + * generated. + */ +if (slot->data.database != MyDatabaseId && !fast_forward) May I know if we need this change for this fix? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: [HACKERS] make async slave to wait for lsn to be replayed

2024-04-02 Thread Bharath Rupireddy
achieving read-after-write-consistency on streaming standbys in their application right now without a function like this? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-04-02 Thread Bharath Rupireddy
now on the standby for synced slots. This leads us to define actually what a slot being active means. Is syncing the data from the remote slot considered as the slot being active? On the other hand, it may not sound great if we don't invalidate synced slots due to inactive timeout even though t

Re: Synchronizing slots from primary to standby

2024-04-01 Thread Bharath Rupireddy
cture and use it for each sync worker cycle? Is there any problem with it? What do you think? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Synchronizing slots from primary to standby

2024-04-01 Thread Bharath Rupireddy
t() for having this problem reproduced consistently in a TAP test. Perhaps, we can think of adding this later after the fix is shipped. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Synchronizing slots from primary to standby

2024-03-31 Thread Bharath Rupireddy
"INSERT INTO dummy1 VALUES(999);" ./psql -d postgres -p 5433 -c "SELECT pg_promote();" ./psql -d postgres -p 5433 -c "SELECT pg_is_in_recovery();" ./psql -d postgres -p 5433 -c "select * from pg_logical_slot_get_changes('lrep_sync_slot', NULL, NULL);" -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-31 Thread Bharath Rupireddy
-- 2024-03-30 19:08:26.978016+00 (1 row) Time: 21.144 ms postgres=# SELECT pg_get_current_timestamp(10); pg_get_current_timestamp --- 2024-03-30 19:08:29.142248+00 (1 row) Time: 2.269 ms postgres=# SELECT pg_get_current_timestamp(1); pg_get_current_timestamp -

Re: [HACKERS] make async slave to wait for lsn to be replayed

2024-03-31 Thread Bharath Rupireddy
modifications to reach this LSN. Right, but why pg_wal_replay_wait blocks without a timeout? It must return an error saying it can't reach the target LSN, no? Did you forget to attach the new patch? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: New Table Access Methods for Multi and Single Inserts

2024-03-31 Thread Bharath Rupireddy
On Wed, Mar 27, 2024 at 1:42 PM Jeff Davis wrote: > > On Wed, 2024-03-27 at 01:19 +0530, Bharath Rupireddy wrote: > > > > Similarly, with this new AM, the onus lies on the table AM > > implementers to provide an implementation for these new AMs even if > > they just

Re: [HACKERS] make async slave to wait for lsn to be replayed

2024-03-30 Thread Bharath Rupireddy
ate_backend's timeout logic in pg_wait_until_termination, perhaps reducing waittime to 1msec or so? 12. Why should we let every user run pg_wal_replay_wait procedure? Can't we revoke execute from the public in system_functions.sql so that one can decide who to run this function? Per comment #

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-30 Thread Bharath Rupireddy
break; > > InvalidatePossiblyObsoleteSlot() is not called with such a reason, better to > use > an Assert here and in the caller too? Done. > CR11 === > > +++ b/src/test/recovery/t/050_invalidate_slots.pl > > why not using 019_replslot_limit.p

Re: Add new error_action COPY ON_ERROR "log"

2024-03-30 Thread Bharath Rupireddy
a parameter". I don't mind adding one for LOG_VERBOSITY though. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com v14-0001-Add-new-COPY-option-LOG_VERBOSITY.patch Description: Binary data

Re: Add new error_action COPY ON_ERROR "log"

2024-03-28 Thread Bharath Rupireddy
# COPY t1 FROM stdin WITH ( QUOTE ); ERROR: relation "t1" does not exist postgres=# COPY t1 FROM stdin WITH ( DEFAULT ); ERROR: relation "t1" does not exist postgres=# COPY t1 FROM stdin WITH ( ENCODING ); ERROR: relation "t1" does not exist -- Bharath Rupiredd

Re: Add new error_action COPY ON_ERROR "log"

2024-03-27 Thread Bharath Rupireddy
; [2] commit b9424d014e195386a83b0f1fe9f5a8e5727e46ea Author: Tom Lane Date: Thu Nov 10 18:20:49 2022 -0500 Support writing "CREATE/ALTER TABLE ... SET STORAGE DEFAULT". -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-27 Thread Bharath Rupireddy
On Wed, Mar 27, 2024 at 6:54 PM Bertrand Drouvot wrote: > > Hi, > > On Wed, Mar 27, 2024 at 05:55:05PM +0530, Bharath Rupireddy wrote: > > On Wed, Mar 27, 2024 at 3:42 PM Bertrand Drouvot > > Please see the attached v28 patch. > > Thanks! > > 1 === sorr

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-27 Thread Bharath Rupireddy
nce we are referring to the sync cycle here, I feel it will be > good to give a link to that page. > +zero until the next slot sync cycle (see > + > for > +slot synchronization details). WFM. Please see the attached v28 patch. -- Bharath Rupireddy Postgr

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-27 Thread Bharath Rupireddy
ttached v27 patch which also has Bertrand's comment on deduplicating the TAP function. I've now moved it to Cluster.pm. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com From b4f113ef1d3467383913d0f04cc672372133420d Mo

Re: pgsql: Track last_inactive_time in pg_replication_slots.

2024-03-26 Thread Bharath Rupireddy
problem > of the tool but I think there is no harm in giving a way to avoid > problems at the server end due to such slots. Right. I can personally connect to this problem of leftover slots where manual intervention was needed to drop all such slots which is time-consuming and painful sometimes. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-26 Thread Bharath Rupireddy
On Wed, Mar 27, 2024 at 10:08 AM Bharath Rupireddy wrote: > > Please find the attached v25-0001 (made this 0001 patch now as > inactive_since patch is committed) patch with the above changes. Fixed an issue in synchronize_slots where DatumGetLSN is being used in place of DatumGetTi

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-26 Thread Bharath Rupireddy
On Wed, Mar 27, 2024 at 10:24 AM shveta malik wrote: > > On Wed, Mar 27, 2024 at 10:22 AM Amit Kapila wrote: > > > > On Wed, Mar 27, 2024 at 10:08 AM Bharath Rupireddy > > wrote: > > > > > > On Tue, Mar 26, 2024 at 11:22 PM Bert

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-26 Thread Bharath Rupireddy
nSlotSync phase right? Maybe we should prevent that otherwise some of the slots are synced and the standby gets promoted while others are yet-to-be-synced. > 4) > 040_standby_failover_slots_sync.pl: > > +# Capture the inactive_since of the slot from the standby the logical > failo

Re: New Table Access Methods for Multi and Single Inserts

2024-03-26 Thread Bharath Rupireddy
On Tue, Mar 26, 2024 at 9:07 PM Jeff Davis wrote: > > On Tue, 2024-03-26 at 01:28 +0530, Bharath Rupireddy wrote: > > I'm thinking > > of dropping the COPY FROM patch using the new multi insert API for > > the > > following reasons: ... > > I agree w

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-26 Thread Bharath Rupireddy
On Tue, Mar 26, 2024 at 4:35 PM Bharath Rupireddy wrote: > > If we just sync inactive_since value for synced slots while in > recovery from the primary, so be it. Why do we need to update it to > the current time when the slot is being created? We don't expose slot > creation

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-26 Thread Bharath Rupireddy
can reset it to the current time so that it gets its own time. Do you see any issues with it? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com

Re: Add new error_action COPY ON_ERROR "log"

2024-03-26 Thread Bharath Rupireddy
On Tue, Mar 26, 2024 at 1:46 PM Masahiko Sawada wrote: > > Thank you for updating the patch! Looks good to me. > > Please find the attached patch. I've made some changes for the > documentation and the commit message. I'll push it, barring any > objections. Thanks.

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-26 Thread Bharath Rupireddy
interpret the time if the standby gets > promoted without a restart. > > shutdown --> shutdown of slot sync worker (as it was not clear if it > is instance shutdown or something else) Changed it to "shutdown of slot sync machinery" to be consistent with the comments. >

Re: Add new error_action COPY ON_ERROR "log"

2024-03-25 Thread Bharath Rupireddy
nse to me. But the current message seems not > to be clear to me and consistent with other NOTICE messages. Also, the > last summary line would not be written if the user cancelled, and > someone other than person who used ON_ERROR 'ignore' might check the >

Re: pgsql: Track last_inactive_time in pg_replication_slots.

2024-03-25 Thread Bharath Rupireddy
a1Jz7%2B2gAiA%40mail.gmail.com I posted the v21 patch implementing the above idea in the other thread - https://www.postgresql.org/message-id/CALj2ACXRFx9g7A9RFJZF7eBe%3Dzxk7%3DapMRFuCgJJKYB7O%3Dvgwg%40mail.gmail.com. For ease, I'm also attaching the patch in here. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com v21-0001-Fix-review-comments-for-slot-s-last_inactive_tim.patch Description: Binary data

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-25 Thread Bharath Rupireddy
during promotion). > The plus point of maintaining last_inactive_time for synced slots > could be, this can provide data to the user on when last time the sync > was attempted on that particular slot by background slot sync worker > or SQl function. Thoughts? Please find the attached

Re: Add new error_action COPY ON_ERROR "log"

2024-03-25 Thread Bharath Rupireddy
sagree with exposing the limit_printout_length() function > but I think it's better to rename it for consistency with other > exposed COPY command functions. Only this function is snake-case. How > about CopyLimitPrintoutLength() or similar? WFM. Although its implementation is not re

Re: pgsql: Track last_inactive_time in pg_replication_slots.

2024-03-25 Thread Bharath Rupireddy
of the related discussions, I'm inclined to agree > that inactive_since provides the clearest description for the column. I think we all have some agreement on inactive_since. So, I'm attaching the patch for that change. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source

Re: New Table Access Methods for Multi and Single Inserts

2024-03-25 Thread Bharath Rupireddy
indexes etc. aren't taken care of as I'm now only focusing on CTAS, CMV, RMV optimizations. Please see the attached v14 patches. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com From 2de89705c6b2d03020988db0cc8857a0bf1

Re: speed up a logical replica setup

2024-03-25 Thread Bharath Rupireddy
On Mon, Mar 25, 2024 at 5:25 PM Peter Eisentraut wrote: > > I have committed your version v33. Looks like BF animals aren't happy, please check - https://buildfarm.postgresql.org/cgi-bin/show_failures.pl. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases

Re: Add new error_action COPY ON_ERROR "log"

2024-03-25 Thread Bharath Rupireddy
on "check_ign_err3" violates not-null constraint DETAIL: Failing row contains (2, {2}, 2, null). CONTEXT: COPY check_ign_err3, line 2: "2 {2} 2 \N" -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://a

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-25 Thread Bharath Rupireddy
ntil the standby gets > promoted). > > So, I think that last_inactive_time does not make sense if the slot never had > the chance to be active. Right. Done that way i.e. not setting the last_inactive_time for slots both while releasing the slot and restoring from the disk. Als

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-24 Thread Bharath Rupireddy
parate query than clubbing it up with pg_create_physical_replication_slot. SELECT current_timestamp FROM pg_create_physical_replication_slot('foo'); > Apart from this, I have made minor changes in the comments. See and > let me know what you think of attached. LGTM. I've merged the

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-24 Thread Bharath Rupireddy
7;ve attached the v18 patch set here. I've also addressed earlier review comments from Amit, Ajin Cherian. Note that I've added new invalidation mechanism tests in a separate TAP test file just because I don't want to clutter or bloat any of the existing files and spread tests for physical

Re: [HACKERS] make async slave to wait for lsn to be replayed

2024-03-23 Thread Bharath Rupireddy
tee (considered to be achieving) the read-after-write consistency on standbys unless there's a way for the application to tell the wait LSN. Thoughts? [1] https://www.postgresql.org/message-id/CALj2ACUfS7LH1PaWmSZ5KwH4BpQxO9izeMw4qC3a1DAwi6nfbQ%40mail.gmail.com -- Bharath Rupireddy Postgre

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-23 Thread Bharath Rupireddy
019_replslot_limit would be a better > place, because I see the timeout as another kind of limit. Hm. Done that way. Please see the attached v17 patch. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com From a1210ae2dd86afdfd

  1   2   3   4   5   6   7   8   9   10   >