diff --git a/test_runner/regress/test_twophase.py b/test_runner/regress/test_twophase.py index ebe65e7c29dc..75fab78d6e6c 100644 --- a/test_runner/regress/test_twophase.py +++ b/test_runner/regress/test_twophase.py @@ -8,6 +8,7 @@ PgBin, fork_at_current_lsn, import_timeline_from_vanilla_postgres, + wait_for_wal_insert_lsn, ) @@ -22,11 +23,6 @@ def twophase_test_on_timeline(env: NeonEnv): conn = endpoint.connect() cur = conn.cursor() - # FIXME: Switch to the next WAL segment, to work around the bug fixed in - # https://github.com/neondatabase/neon/pull/8914. When that is merged, this can be - # removed. - cur.execute("select pg_switch_wal()") - cur.execute("CREATE TABLE foo (t text)") # Prepare a transaction that will insert a row @@ -140,3 +136,28 @@ def test_twophase_nonzero_epoch( vanilla_pg.stop() # don't need the original server anymore twophase_test_on_timeline(env) + + +def test_twophase_at_wal_segment_start(neon_simple_env: NeonEnv): + """ + Same as 'test_twophase' test, but the server is started at an LSN at the beginning + of a WAL segment. We had a bug where we didn't initialize the "long XLOG page header" + at the beginning of the segment correctly, which was detected when the checkpointer + tried to read the XLOG_XACT_PREPARE record from the WAL, if that record was on the + very first page of a WAL segment and the server was started up at that first page. + """ + env = neon_simple_env + timeline_id = env.neon_cli.create_branch("test_twophase", "main") + + endpoint = env.endpoints.create_start( + "test_twophase", config_lines=["max_prepared_transactions=5"] + ) + endpoint.safe_psql("SELECT pg_switch_wal()") + + # to avoid hitting https://github.com/neondatabase/neon/issues/9079, wait for the + # WAL to reach the pageserver. + wait_for_wal_insert_lsn(env, endpoint, env.initial_tenant, timeline_id) + + endpoint.stop_and_destroy() + + twophase_test_on_timeline(env) diff --git a/vendor/postgres-v14 b/vendor/postgres-v14 index f9c51c12438b..a38d15f3233a 160000 --- a/vendor/postgres-v14 +++ b/vendor/postgres-v14 @@ -1 +1 @@ -Subproject commit f9c51c12438b20049b6905eb4e43d321defd6ff2 +Subproject commit a38d15f3233a4c07f2bf3335fcbd874dd1f4e386 diff --git a/vendor/postgres-v15 b/vendor/postgres-v15 index 1dbd6f316416..16c3c6b64f14 160000 --- a/vendor/postgres-v15 +++ b/vendor/postgres-v15 @@ -1 +1 @@ -Subproject commit 1dbd6f316416c8360bbd4f3d6db956cf70937cf0 +Subproject commit 16c3c6b64f1420a367a2a9b2510f20d94f791af8 diff --git a/vendor/postgres-v16 b/vendor/postgres-v16 index d009084a745c..1d7081a3b076 160000 --- a/vendor/postgres-v16 +++ b/vendor/postgres-v16 @@ -1 +1 @@ -Subproject commit d009084a745cb4d5e6de222c778b2a562c8b2767 +Subproject commit 1d7081a3b076ddf5086e0b118d4329820e6a7427 diff --git a/vendor/postgres-v17 b/vendor/postgres-v17 index dadd6fe208bb..2cf120e7393c 160000 --- a/vendor/postgres-v17 +++ b/vendor/postgres-v17 @@ -1 +1 @@ -Subproject commit dadd6fe208bb906cc0a48980f2ab4e13c47ba3ad +Subproject commit 2cf120e7393ca5f537c6a38b457585576dc035fc diff --git a/vendor/revisions.json b/vendor/revisions.json index c93393970ffa..9f6512d03e85 100644 --- a/vendor/revisions.json +++ b/vendor/revisions.json @@ -1,18 +1,18 @@ { "v17": [ "17rc1", - "dadd6fe208bb906cc0a48980f2ab4e13c47ba3ad" + "2cf120e7393ca5f537c6a38b457585576dc035fc" ], "v16": [ "16.4", - "d009084a745cb4d5e6de222c778b2a562c8b2767" + "1d7081a3b076ddf5086e0b118d4329820e6a7427" ], "v15": [ "15.8", - "1dbd6f316416c8360bbd4f3d6db956cf70937cf0" + "16c3c6b64f1420a367a2a9b2510f20d94f791af8" ], "v14": [ "14.13", - "f9c51c12438b20049b6905eb4e43d321defd6ff2" + "a38d15f3233a4c07f2bf3335fcbd874dd1f4e386" ] }