Compare commits

...

3 Commits

Author SHA1 Message Date
Anastasia Lubennikova
5ccf32b756 fix vendor/revisions.json 2024-05-01 19:50:14 +01:00
Anastasia Lubennikova
120bd1972f Bump vendor/postrges 2024-05-01 19:50:14 +01:00
Anastasia Lubennikova
434eea7d11 Add test_pg_waldump.py
Simple test to ensure that pg_waldump works with neon WAL files
2024-05-01 19:50:14 +01:00
5 changed files with 52 additions and 6 deletions

View 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

View File

@@ -1,5 +1,5 @@
{
"postgres-v16": "261497dd63ace434045058b1453bcbaaa83f23e5",
"postgres-v15": "85d809c124a898847a97d66a211f7d5ef4f8e0cb",
"postgres-v14": "d9149dc59abcbeeb26293707509aef51752db28f"
"postgres-v16": "10fb158d0ec04f17e4076e5e1ce0bae6ba9acb3b",
"postgres-v15": "d6c949db38c932d9f29413a185f4dcf0d0b116b9",
"postgres-v14": "574f0e509e98a171d11b2a252cf4763b18fc80d6"
}