agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH v7 10/10] Say "re-sent" not "resent".. 5+ messages / 2 participants [nested] [flat]
* [PATCH v3 14/20] Say "re-sent" not "resent".. @ 2020-04-11 02:14 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: Justin Pryzby @ 2020-04-11 02:14 UTC (permalink / raw) ..which means "feel bitter or indignant about" --- doc/src/sgml/logicaldecoding.sgml | 2 +- doc/src/sgml/ref/create_subscription.sgml | 2 +- src/backend/storage/lmgr/proc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index bad3bfe620..e08ae9e2af 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -223,7 +223,7 @@ $ pg_recvlogical -d postgres --slot=test --drop-slot A logical slot will emit each change just once in normal operation. The current position of each slot is persisted only at checkpoint, so in the case of a crash the slot may return to an earlier LSN, which will - then cause recent changes to be resent when the server restarts. + then cause recent changes to be re-sent when the server restarts. Logical decoding clients are responsible for avoiding ill effects from handling the same message more than once. Clients may wish to record the last LSN they saw when decoding and skip over any repeated data or diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml index 1a90c244fb..c18618d5c8 100644 --- a/doc/src/sgml/ref/create_subscription.sgml +++ b/doc/src/sgml/ref/create_subscription.sgml @@ -159,7 +159,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl <para> It is safe to use <literal>off</literal> for logical replication: If the subscriber loses transactions because of missing - synchronization, the data will be resent from the publisher. + synchronization, the data will be re-sent from the publisher. </para> <para> diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 5aa19d3f78..22fe566f48 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -1373,7 +1373,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) else LWLockRelease(ProcArrayLock); - /* prevent signal from being resent more than once */ + /* prevent signal from being re-sent more than once */ allow_autovacuum_cancel = false; } -- 2.17.0 --doUn1Hmx68n+7ij2 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v3-0015-doc-2014-pg_basebackup-Add-support-for-relocating.patch" ^ permalink raw reply [nested|flat] 5+ messages in thread
* [PATCH v6 10/10] Say "re-sent" not "resent".. @ 2020-04-11 02:14 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: Justin Pryzby @ 2020-04-11 02:14 UTC (permalink / raw) ..which means "feel bitter or indignant about" --- doc/src/sgml/logicaldecoding.sgml | 2 +- doc/src/sgml/ref/create_subscription.sgml | 2 +- src/backend/storage/lmgr/proc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index 1571d71a5b..145c36f567 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -223,7 +223,7 @@ $ pg_recvlogical -d postgres --slot=test --drop-slot A logical slot will emit each change just once in normal operation. The current position of each slot is persisted only at checkpoint, so in the case of a crash the slot may return to an earlier LSN, which will - then cause recent changes to be resent when the server restarts. + then cause recent changes to be re-sent when the server restarts. Logical decoding clients are responsible for avoiding ill effects from handling the same message more than once. Clients may wish to record the last LSN they saw when decoding and skip over any repeated data or diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml index cdb22c54fe..d1d3647f31 100644 --- a/doc/src/sgml/ref/create_subscription.sgml +++ b/doc/src/sgml/ref/create_subscription.sgml @@ -160,7 +160,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl <para> It is safe to use <literal>off</literal> for logical replication: If the subscriber loses transactions because of missing - synchronization, the data will be resent from the publisher. + synchronization, the data will be re-sent from the publisher. </para> <para> diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index aa9fbd8054..fa2cac5e11 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -1369,7 +1369,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) else LWLockRelease(ProcArrayLock); - /* prevent signal from being resent more than once */ + /* prevent signal from being re-sent more than once */ allow_autovacuum_cancel = false; } -- 2.17.0 --C+ts3FVlLX8+P6JN-- ^ permalink raw reply [nested|flat] 5+ messages in thread
* [PATCH v7 10/10] Say "re-sent" not "resent".. @ 2020-04-11 02:14 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: Justin Pryzby @ 2020-04-11 02:14 UTC (permalink / raw) ..which means "feel bitter or indignant about" --- doc/src/sgml/logicaldecoding.sgml | 2 +- doc/src/sgml/ref/create_subscription.sgml | 2 +- src/backend/storage/lmgr/proc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index 1571d71a5b..145c36f567 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -223,7 +223,7 @@ $ pg_recvlogical -d postgres --slot=test --drop-slot A logical slot will emit each change just once in normal operation. The current position of each slot is persisted only at checkpoint, so in the case of a crash the slot may return to an earlier LSN, which will - then cause recent changes to be resent when the server restarts. + then cause recent changes to be re-sent when the server restarts. Logical decoding clients are responsible for avoiding ill effects from handling the same message more than once. Clients may wish to record the last LSN they saw when decoding and skip over any repeated data or diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml index cdb22c54fe..d1d3647f31 100644 --- a/doc/src/sgml/ref/create_subscription.sgml +++ b/doc/src/sgml/ref/create_subscription.sgml @@ -160,7 +160,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl <para> It is safe to use <literal>off</literal> for logical replication: If the subscriber loses transactions because of missing - synchronization, the data will be resent from the publisher. + synchronization, the data will be re-sent from the publisher. </para> <para> diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index aa9fbd8054..fa2cac5e11 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -1369,7 +1369,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) else LWLockRelease(ProcArrayLock); - /* prevent signal from being resent more than once */ + /* prevent signal from being re-sent more than once */ allow_autovacuum_cancel = false; } -- 2.17.0 --AsxXAMtlQ5JHofzM-- ^ permalink raw reply [nested|flat] 5+ messages in thread
* [PATCH v8 14/14] Say "re-sent" not "resent".. @ 2020-04-11 02:14 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: Justin Pryzby @ 2020-04-11 02:14 UTC (permalink / raw) ..which means "feel bitter or indignant about" --- doc/src/sgml/logicaldecoding.sgml | 2 +- doc/src/sgml/ref/create_subscription.sgml | 2 +- src/backend/storage/lmgr/proc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index 1571d71a5b..145c36f567 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -223,7 +223,7 @@ $ pg_recvlogical -d postgres --slot=test --drop-slot A logical slot will emit each change just once in normal operation. The current position of each slot is persisted only at checkpoint, so in the case of a crash the slot may return to an earlier LSN, which will - then cause recent changes to be resent when the server restarts. + then cause recent changes to be re-sent when the server restarts. Logical decoding clients are responsible for avoiding ill effects from handling the same message more than once. Clients may wish to record the last LSN they saw when decoding and skip over any repeated data or diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml index cdb22c54fe..d1d3647f31 100644 --- a/doc/src/sgml/ref/create_subscription.sgml +++ b/doc/src/sgml/ref/create_subscription.sgml @@ -160,7 +160,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl <para> It is safe to use <literal>off</literal> for logical replication: If the subscriber loses transactions because of missing - synchronization, the data will be resent from the publisher. + synchronization, the data will be re-sent from the publisher. </para> <para> diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index aa9fbd8054..fa2cac5e11 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -1369,7 +1369,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) else LWLockRelease(ProcArrayLock); - /* prevent signal from being resent more than once */ + /* prevent signal from being re-sent more than once */ allow_autovacuum_cancel = false; } -- 2.17.0 --0eh6TmSyL6TZE2Uz-- ^ permalink raw reply [nested|flat] 5+ messages in thread
* [PATCH 3/6] Move conversion of a "historic" to MVCC snapshot to a separate function. @ 2026-01-08 16:47 Antonin Houska <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: Antonin Houska @ 2026-01-08 16:47 UTC (permalink / raw) The conversion is now handled by SnapBuildMVCCFromHistoric(). REPACK CONCURRENTLY will also need it. --- src/backend/replication/logical/snapbuild.c | 57 +++++++++++++++++---- src/backend/utils/time/snapmgr.c | 3 +- src/include/replication/snapbuild.h | 1 + src/include/utils/snapmgr.h | 1 + 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index 7f79621b57e..95f230f8e9b 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -440,10 +440,7 @@ Snapshot SnapBuildInitialSnapshot(SnapBuild *builder) { Snapshot snap; - TransactionId xid; TransactionId safeXid; - TransactionId *newxip; - int newxcnt = 0; Assert(XactIsoLevel == XACT_REPEATABLE_READ); Assert(builder->building_full_snapshot); @@ -485,7 +482,33 @@ SnapBuildInitialSnapshot(SnapBuild *builder) MyProc->xmin = snap->xmin; - /* allocate in transaction context */ + /* Convert the historic snapshot to MVCC snapshot. */ + return SnapBuildMVCCFromHistoric(snap, true); +} + +/* + * Turn a historic MVCC snapshot into an ordinary MVCC snapshot. + * + * Unlike a regular (non-historic) MVCC snapshot, the 'xip' array of this + * snapshot contains not only running main transactions, but also their + * subtransactions. On the other hand, 'subxip' will usually be empty. This + * difference does not affect the result of XidInMVCCSnapshot() because it + * searches both in 'xip' and 'subxip'. + * + * Pass true for 'in_place' if you don't care about modifying the source + * snapshot. If you need a new instance, and one that was allocated as a + * single chunk of memory, pass false. + */ +Snapshot +SnapBuildMVCCFromHistoric(Snapshot snapshot, bool in_place) +{ + TransactionId xid; + TransactionId *oldxip = snapshot->xip; + uint32 oldxcnt = snapshot->xcnt; + TransactionId *newxip; + int newxcnt = 0; + Snapshot result; + newxip = palloc_array(TransactionId, GetMaxSnapshotXidCount()); /* @@ -494,7 +517,7 @@ SnapBuildInitialSnapshot(SnapBuild *builder) * classical snapshot by marking all non-committed transactions as * in-progress. This can be expensive. */ - for (xid = snap->xmin; NormalTransactionIdPrecedes(xid, snap->xmax);) + for (xid = snapshot->xmin; NormalTransactionIdPrecedes(xid, snapshot->xmax);) { void *test; @@ -502,7 +525,7 @@ SnapBuildInitialSnapshot(SnapBuild *builder) * Check whether transaction committed using the decoding snapshot * meaning of ->xip. */ - test = bsearch(&xid, snap->xip, snap->xcnt, + test = bsearch(&xid, snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); if (test == NULL) @@ -519,11 +542,25 @@ SnapBuildInitialSnapshot(SnapBuild *builder) } /* adjust remaining snapshot fields as needed */ - snap->snapshot_type = SNAPSHOT_MVCC; - snap->xcnt = newxcnt; - snap->xip = newxip; + snapshot->xcnt = newxcnt; + snapshot->xip = newxip; + + if (in_place) + result = snapshot; + else + { + result = CopySnapshot(snapshot); + + /* Restore the original values so the source is intact. */ + snapshot->xip = oldxip; + snapshot->xcnt = oldxcnt; + + /* newxip has been copied */ + pfree(newxip); + } + result->snapshot_type = SNAPSHOT_MVCC; - return snap; + return result; } /* diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c index 2e6197f5f35..3af1b366adf 100644 --- a/src/backend/utils/time/snapmgr.c +++ b/src/backend/utils/time/snapmgr.c @@ -213,7 +213,6 @@ typedef struct ExportedSnapshot static List *exportedSnapshots = NIL; /* Prototypes for local functions */ -static Snapshot CopySnapshot(Snapshot snapshot); static void UnregisterSnapshotNoOwner(Snapshot snapshot); static void FreeSnapshot(Snapshot snapshot); static void SnapshotResetXmin(void); @@ -604,7 +603,7 @@ SetTransactionSnapshot(Snapshot sourcesnap, VirtualTransactionId *sourcevxid, * The copy is palloc'd in TopTransactionContext and has initial refcounts set * to 0. The returned snapshot has the copied flag set. */ -static Snapshot +Snapshot CopySnapshot(Snapshot snapshot) { Snapshot newsnap; diff --git a/src/include/replication/snapbuild.h b/src/include/replication/snapbuild.h index ccded021433..34383dea776 100644 --- a/src/include/replication/snapbuild.h +++ b/src/include/replication/snapbuild.h @@ -73,6 +73,7 @@ extern void FreeSnapshotBuilder(SnapBuild *builder); extern void SnapBuildSnapDecRefcount(Snapshot snap); extern Snapshot SnapBuildInitialSnapshot(SnapBuild *builder); +extern Snapshot SnapBuildMVCCFromHistoric(Snapshot snapshot, bool in_place); extern const char *SnapBuildExportSnapshot(SnapBuild *builder); extern void SnapBuildClearExportedSnapshot(void); extern void SnapBuildResetExportedSnapshotState(void); diff --git a/src/include/utils/snapmgr.h b/src/include/utils/snapmgr.h index b8c01a291a1..de824945f0b 100644 --- a/src/include/utils/snapmgr.h +++ b/src/include/utils/snapmgr.h @@ -63,6 +63,7 @@ extern Snapshot GetTransactionSnapshot(void); extern Snapshot GetLatestSnapshot(void); extern void SnapshotSetCommandId(CommandId curcid); +extern Snapshot CopySnapshot(Snapshot snapshot); extern Snapshot GetCatalogSnapshot(Oid relid); extern Snapshot GetNonHistoricCatalogSnapshot(Oid relid); extern void InvalidateCatalogSnapshot(void); -- 2.47.3 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=v29-0004-Add-CONCURRENTLY-option-to-REPACK-command.patch ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-01-08 16:47 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-04-11 02:14 [PATCH v3 14/20] Say "re-sent" not "resent".. Justin Pryzby <[email protected]> 2020-04-11 02:14 [PATCH v6 10/10] Say "re-sent" not "resent".. Justin Pryzby <[email protected]> 2020-04-11 02:14 [PATCH v7 10/10] Say "re-sent" not "resent".. Justin Pryzby <[email protected]> 2020-04-11 02:14 [PATCH v8 14/14] Say "re-sent" not "resent".. Justin Pryzby <[email protected]> 2026-01-08 16:47 [PATCH 3/6] Move conversion of a "historic" to MVCC snapshot to a separate function. Antonin Houska <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox