pgsql: Include replication origins in SQL functions for commit timestam
Include replication origins in SQL functions for commit timestamp This includes two changes: - Addition of a new function pg_xact_commit_timestamp_origin() able, for a given transaction ID, to return the commit timestamp and replication origin of this transaction. An equivalent function existed in pglogical. - Addition of the replication origin to pg_last_committed_xact(). The commit timestamp manager includes already APIs able to return the replication origin of a transaction on top of its commit timestamp, but the code paths for replication origins were never stressed as those functions have never looked for a replication origin, and the SQL functions available have never included this information since their introduction in 73c986a. While on it, refactor a test of modules/commit_ts/ to use tstzrange() to check that a transaction timestamp is within the wanted range, making the test a bit easier to read. Bump catalog version. Author: Movead Li Reviewed-by: Madan Kumar, Michael Paquier Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b1e48bbe64a411666bb1928b9741e112e267836d Modified Files -- doc/src/sgml/func.sgml | 22 - src/backend/access/transam/commit_ts.c | 71 +++-- src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.dat| 15 +++- .../commit_ts/expected/commit_timestamp.out| 93 +- .../commit_ts/expected/commit_timestamp_1.out | 75 - .../modules/commit_ts/sql/commit_timestamp.sql | 35 +++- 7 files changed, 295 insertions(+), 18 deletions(-)
Re: pgsql: Include replication origins in SQL functions for commit timestam
On Sun, Jul 12, 2020 at 11:47:38AM +, Michael Paquier wrote: > Include replication origins in SQL functions for commit timestamp > > While on it, refactor a test of modules/commit_ts/ to use tstzrange() to > check that a transaction timestamp is within the wanted range, making > the test a bit easier to read. longfin has been failing here: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=longfin&dt=2020-07-12%2011%3A49%3A08 The buildfarm logs include no output, but the problem comes from -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS, where replication origins should be prefixed by "regress_". I did not know that this rule was applied here. -- Michael signature.asc Description: PGP signature
pgsql: Fix test failure with -DENFORCE_REGRESSION_TEST_NAME_RESTRICTION
Fix test failure with -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS Replication origins created by regression tests should have names starting with "regress_", and the test introduced in b1e48bb for commit timestamps did not do that. Per buildfarm member longfin. Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ea3e15d1691ec4cadc67f160cc91c7f237a705ae Modified Files -- .../modules/commit_ts/expected/commit_timestamp.out| 18 +- .../modules/commit_ts/expected/commit_timestamp_1.out | 6 +++--- src/test/modules/commit_ts/sql/commit_timestamp.sql| 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-)
Re: pgsql: Include replication origins in SQL functions for commit timestam
On Sun, Jul 12, 2020 at 09:25:07PM +0900, Michael Paquier wrote: > longfin has been failing here: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=longfin&dt=2020-07-12%2011%3A49%3A08 > > The buildfarm logs include no output, but the problem comes from > -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS, where replication origins > should be prefixed by "regress_". I did not know that this rule was > applied here. Sorry for the delay. jacana has been complaining here: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jacana&dt=2020-07-12%2018%3A02%3A48 Visily switching to tstzrange() is not a brilliant idea, as I suspect here that the problem is caused by the timestamp comparison in the upper bound: using the internal range checks, the upper bound is excluded, so if the follow-up query's now() matches the commit timestamp of the previous transaction, the comparison fails. -- Michael signature.asc Description: PGP signature
pgsql: Fix timestamp range handling in regression tests of modules/comm
Fix timestamp range handling in regression tests of modules/commit_ts/ Switching the regression tests to use tstzrange() has proved to not be a good idea for environments where the timestamp precision is low, as internal range checks exclude the upper bound. So, if the commit timestamp of a transaction matched with now() from the next query, the test would fail. This changes to use two bound checks instead of the range function, where the upper bound is inclusive. Per buildfarm member jacana. Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5bfe6a3c485d3259f59fa2d2e1d34dea1a3baeba Modified Files -- .../commit_ts/expected/commit_timestamp.out| 49 -- .../commit_ts/expected/commit_timestamp_1.out | 19 ++--- .../modules/commit_ts/sql/commit_timestamp.sql | 19 ++--- 3 files changed, 54 insertions(+), 33 deletions(-)
pgsql: HashAgg: before spilling tuples, set unneeded columns to NULL.
HashAgg: before spilling tuples, set unneeded columns to NULL. This is a replacement for 4cad2534. Instead of projecting all tuples going into a HashAgg, only remove unnecessary attributes when actually spilling. This avoids the regression for the in-memory case. Discussion: https://postgr.es/m/a2fb7dfeb4f50aa0a123e42151ee3013933cb802.camel%40j-davis.com Backpatch-through: 13 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2302302236a0c7aeba3377d78dd9d80ba53247df Modified Files -- src/backend/executor/nodeAgg.c | 123 ++--- src/include/nodes/execnodes.h | 8 ++- 2 files changed, 96 insertions(+), 35 deletions(-)
pgsql: Revert "Use CP_SMALL_TLIST for hash aggregate"
Revert "Use CP_SMALL_TLIST for hash aggregate" This reverts commit 4cad2534da6d17067d98cf04be2dfc1bda8f2cd0 due to a performance regression. It will be replaced by a new approach in an upcoming commit. Reported-by: Andres Freund Discussion: https://postgr.es/m/[email protected] Backpatch-through: 13 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0babd109801e5ecd90df29589c23c6daf3ae69f7 Modified Files -- contrib/postgres_fdw/expected/postgres_fdw.out | 4 ++-- src/backend/optimizer/plan/createplan.c| 28 -- 2 files changed, 6 insertions(+), 26 deletions(-)
pgsql: Revert "Use CP_SMALL_TLIST for hash aggregate"
Revert "Use CP_SMALL_TLIST for hash aggregate" This reverts commit 4cad2534da6d17067d98cf04be2dfc1bda8f2cd0 due to a performance regression. It will be replaced by a new approach in an upcoming commit. Reported-by: Andres Freund Discussion: https://postgr.es/m/[email protected] Backpatch-through: 13 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/926ecf83c0bab7e985eaf5727bb69cdf8ce6b067 Modified Files -- contrib/postgres_fdw/expected/postgres_fdw.out | 4 ++-- src/backend/optimizer/plan/createplan.c| 28 -- 2 files changed, 6 insertions(+), 26 deletions(-)
pgsql: HashAgg: before spilling tuples, set unneeded columns to NULL.
HashAgg: before spilling tuples, set unneeded columns to NULL. This is a replacement for 4cad2534. Instead of projecting all tuples going into a HashAgg, only remove unnecessary attributes when actually spilling. This avoids the regression for the in-memory case. Discussion: https://postgr.es/m/a2fb7dfeb4f50aa0a123e42151ee3013933cb802.camel%40j-davis.com Backpatch-through: 13 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/d8a7ce245095e3a70a2ad738c17be95593f68996 Modified Files -- src/backend/executor/nodeAgg.c | 123 ++--- src/include/nodes/execnodes.h | 8 ++- 2 files changed, 96 insertions(+), 35 deletions(-)
pgsql: Revert "Track statistics for spilling of changes from ReorderBuf
Revert "Track statistics for spilling of changes from ReorderBuffer". The stats with this commit was available only for WALSenders, however, users might want to see for backends doing logical decoding via SQL API. Then, users might want to reset and access these stats across server restart which was not possible with the current patch. List of commits reverted: caa3c4242c Don't call elog() while holding spinlock. e641b2a995 Doc: Update the documentation for spilled transaction statistics. 5883f5fe27 Fix unportable printf format introduced in commit 9290ad198. 9290ad198b Track statistics for spilling of changes from ReorderBuffer. Additionaly, remove the release notes entry for this feature. Backpatch-through: 13, where it was introduced Discussion: https://postgr.es/m/ca+fd4k5_ppayrtdro2pbttoe0ehqpbvuqmcr8ic39utnmr4...@mail.gmail.com Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/b074813d48bcd2a7e224b56a3aff6db9df745237 Modified Files -- doc/src/sgml/monitoring.sgml| 38 -- doc/src/sgml/release-13.sgml| 14 src/backend/catalog/system_views.sql| 5 +-- src/backend/replication/logical/reorderbuffer.c | 12 --- src/backend/replication/walsender.c | 43 ++--- src/include/catalog/catversion.h| 2 +- src/include/catalog/pg_proc.dat | 6 ++-- src/include/replication/reorderbuffer.h | 11 --- src/include/replication/walsender_private.h | 5 --- src/test/regress/expected/rules.out | 7 ++-- 10 files changed, 9 insertions(+), 134 deletions(-)
pgsql: Revert "Track statistics for spilling of changes from ReorderBuf
Revert "Track statistics for spilling of changes from ReorderBuffer". The stats with this commit was available only for WALSenders, however, users might want to see for backends doing logical decoding via SQL API. Then, users might want to reset and access these stats across server restart which was not possible with the current patch. List of commits reverted: caa3c4242c Don't call elog() while holding spinlock. e641b2a995 Doc: Update the documentation for spilled transaction statistics. 5883f5fe27 Fix unportable printf format introduced in commit 9290ad198. 9290ad198b Track statistics for spilling of changes from ReorderBuffer. Additionaly, remove the release notes entry for this feature. Backpatch-through: 13, where it was introduced Discussion: https://postgr.es/m/ca+fd4k5_ppayrtdro2pbttoe0ehqpbvuqmcr8ic39utnmr4...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d973747281caece520236e93d255c654cc613ec9 Modified Files -- doc/src/sgml/monitoring.sgml| 38 -- src/backend/catalog/system_views.sql| 5 +-- src/backend/replication/logical/reorderbuffer.c | 12 --- src/backend/replication/walsender.c | 43 ++--- src/include/catalog/catversion.h| 2 +- src/include/catalog/pg_proc.dat | 6 ++-- src/include/replication/reorderbuffer.h | 11 --- src/include/replication/walsender_private.h | 5 --- src/test/regress/expected/rules.out | 7 ++-- 9 files changed, 9 insertions(+), 120 deletions(-)
