pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Rearrange logrep worker's snapshot handling some more. 4+ messages / 1 participants [nested] [flat]
* pgsql: Rearrange logrep worker's snapshot handling some more. @ 2021-06-10 16:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2021-06-10 16:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Rearrange logrep worker's snapshot handling some more. It turns out that worker.c's code path for TRUNCATE was also careless about establishing a snapshot while executing user-defined code, allowing the checks added by commit 84f5c2908 to fail when a trigger is fired in that context. We could just wrap Push/PopActiveSnapshot around the truncate call, but it seems better to establish a policy of holding a snapshot throughout execution of a replication step. To help with that and possible future requirements, replace the previous ensure_transaction calls with pairs of begin/end_replication_step calls. Per report from Mark Dilger. Back-patch to v11, like the previous changes. Discussion: https://postgr.es/m/B4A3AF82-79ED-4F4C-A4E5-CD2622098972@enterprisedb.com Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6e43f1c2df3da18b9d7087edddaf72dec84cfaf4 Modified Files -------------- src/backend/replication/logical/worker.c | 71 +++++++++++++++++--------------- 1 file changed, 38 insertions(+), 33 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Rearrange logrep worker's snapshot handling some more. @ 2021-06-10 16:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2021-06-10 16:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Rearrange logrep worker's snapshot handling some more. It turns out that worker.c's code path for TRUNCATE was also careless about establishing a snapshot while executing user-defined code, allowing the checks added by commit 84f5c2908 to fail when a trigger is fired in that context. We could just wrap Push/PopActiveSnapshot around the truncate call, but it seems better to establish a policy of holding a snapshot throughout execution of a replication step. To help with that and possible future requirements, replace the previous ensure_transaction calls with pairs of begin/end_replication_step calls. Per report from Mark Dilger. Back-patch to v11, like the previous changes. Discussion: https://postgr.es/m/B4A3AF82-79ED-4F4C-A4E5-CD2622098972@enterprisedb.com Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/26383da7d47a140c33271bfd9215fe50959c80e3 Modified Files -------------- src/backend/replication/logical/worker.c | 70 +++++++++++++++++--------------- 1 file changed, 38 insertions(+), 32 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Rearrange logrep worker's snapshot handling some more. @ 2021-06-10 16:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2021-06-10 16:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Rearrange logrep worker's snapshot handling some more. It turns out that worker.c's code path for TRUNCATE was also careless about establishing a snapshot while executing user-defined code, allowing the checks added by commit 84f5c2908 to fail when a trigger is fired in that context. We could just wrap Push/PopActiveSnapshot around the truncate call, but it seems better to establish a policy of holding a snapshot throughout execution of a replication step. To help with that and possible future requirements, replace the previous ensure_transaction calls with pairs of begin/end_replication_step calls. Per report from Mark Dilger. Back-patch to v11, like the previous changes. Discussion: https://postgr.es/m/B4A3AF82-79ED-4F4C-A4E5-CD2622098972@enterprisedb.com Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/eea081ad013d657a2a7857bd591cfcb559c9a94d Modified Files -------------- src/backend/replication/logical/worker.c | 70 +++++++++++++++++--------------- 1 file changed, 38 insertions(+), 32 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Rearrange logrep worker's snapshot handling some more. @ 2021-06-10 16:27 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2021-06-10 16:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Rearrange logrep worker's snapshot handling some more. It turns out that worker.c's code path for TRUNCATE was also careless about establishing a snapshot while executing user-defined code, allowing the checks added by commit 84f5c2908 to fail when a trigger is fired in that context. We could just wrap Push/PopActiveSnapshot around the truncate call, but it seems better to establish a policy of holding a snapshot throughout execution of a replication step. To help with that and possible future requirements, replace the previous ensure_transaction calls with pairs of begin/end_replication_step calls. Per report from Mark Dilger. Back-patch to v11, like the previous changes. Discussion: https://postgr.es/m/B4A3AF82-79ED-4F4C-A4E5-CD2622098972@enterprisedb.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/3a09d75b4f6cabc8331e228b6988dbfcd9afdfbe Modified Files -------------- src/backend/replication/logical/worker.c | 85 ++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 37 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2021-06-10 16:27 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-06-10 16:27 pgsql: Rearrange logrep worker's snapshot handling some more. Tom Lane <tgl@sss.pgh.pa.us> 2021-06-10 16:27 pgsql: Rearrange logrep worker's snapshot handling some more. Tom Lane <tgl@sss.pgh.pa.us> 2021-06-10 16:27 pgsql: Rearrange logrep worker's snapshot handling some more. Tom Lane <tgl@sss.pgh.pa.us> 2021-06-10 16:27 pgsql: Rearrange logrep worker's snapshot handling some more. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox