mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 05:22:56 +00:00
Fix usage of pg_waldump --ignore option (#7578)
Previously, the --ignore option was only used when reading from a single file. With this PR pg_waldump -i is enough to open any neon WAL segments
This commit is contained in:
committed by
GitHub
parent
25af32e834
commit
69bf1bae7d
46
test_runner/regress/test_pg_waldump.py
Normal file
46
test_runner/regress/test_pg_waldump.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import os
|
||||
|
||||
from fixtures.neon_fixtures import NeonEnv, PgBin
|
||||
from fixtures.utils import subprocess_capture
|
||||
|
||||
|
||||
# Simple test to check that pg_waldump works with neon WAL files
|
||||
def test_pg_waldump(neon_simple_env: NeonEnv, test_output_dir, pg_bin: PgBin):
|
||||
env = neon_simple_env
|
||||
env.neon_cli.create_branch("test_pg_waldump", "empty")
|
||||
endpoint = env.endpoints.create_start("test_pg_waldump")
|
||||
|
||||
cur = endpoint.connect().cursor()
|
||||
cur.execute(
|
||||
"""
|
||||
BEGIN;
|
||||
CREATE TABLE t1(i int primary key, n_updated int);
|
||||
INSERT INTO t1 select g, 0 from generate_series(1, 50) g;
|
||||
ROLLBACK;
|
||||
"""
|
||||
)
|
||||
|
||||
cur.execute(
|
||||
"""
|
||||
BEGIN;
|
||||
CREATE TABLE t1(i int primary key, n_updated int);
|
||||
INSERT INTO t1 select g, 0 from generate_series(1, 50) g;
|
||||
COMMIT;
|
||||
"""
|
||||
)
|
||||
|
||||
# stop the endpoint to make sure that WAL files are flushed and won't change
|
||||
endpoint.stop()
|
||||
|
||||
assert endpoint.pgdata_dir
|
||||
wal_path = os.path.join(endpoint.pgdata_dir, "pg_wal/000000010000000000000001")
|
||||
pg_waldump_path = os.path.join(pg_bin.pg_bin_path, "pg_waldump")
|
||||
|
||||
# use special --ignore option to ignore the validation checks in pg_waldump
|
||||
# this is necessary, because neon WAL files contain gap at the beginning
|
||||
output_path, _, _ = subprocess_capture(test_output_dir, [pg_waldump_path, "--ignore", wal_path])
|
||||
|
||||
with open(f"{output_path}.stdout", "r") as f:
|
||||
stdout = f.read()
|
||||
assert "ABORT" in stdout
|
||||
assert "COMMIT" in stdout
|
||||
2
vendor/postgres-v14
vendored
2
vendor/postgres-v14
vendored
Submodule vendor/postgres-v14 updated: d9149dc59a...d6f7e2c604
2
vendor/postgres-v15
vendored
2
vendor/postgres-v15
vendored
Submodule vendor/postgres-v15 updated: 85d809c124...f0d6b0ef75
2
vendor/postgres-v16
vendored
2
vendor/postgres-v16
vendored
Submodule vendor/postgres-v16 updated: 261497dd63...8ef3c33aa0
6
vendor/revisions.json
vendored
6
vendor/revisions.json
vendored
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"postgres-v16": "261497dd63ace434045058b1453bcbaaa83f23e5",
|
||||
"postgres-v15": "85d809c124a898847a97d66a211f7d5ef4f8e0cb",
|
||||
"postgres-v14": "d9149dc59abcbeeb26293707509aef51752db28f"
|
||||
"postgres-v16": "8ef3c33aa01631e17cb24a122776349fcc777b46",
|
||||
"postgres-v15": "f0d6b0ef7581bd78011832e23d8420a7d2c8a83a",
|
||||
"postgres-v14": "d6f7e2c604bfc7cbc4c46bcea0a8e800f4bc778a"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user