Compare commits

...

6 Commits

Author SHA1 Message Date
Konstantin Knizhnik
4fed569517 Add description of test_logical_replication_ondemand_download test 2025-07-07 18:26:04 +03:00
Konstantin Knizhnik
aa0986de85 Reduce table size in on-demand WAL download test 2025-07-04 22:45:55 +03:00
Konstantin Knizhnik
a2b4ca23a0 Make ruff happy 2025-07-04 22:42:44 +03:00
Konstantin Knizhnik
b40d367f4b Reduce table size in on-demand WAL download test 2025-07-04 22:18:53 +03:00
Konstantin Knizhnik
1e34b8e16a Add test for pg_wal size 2025-07-04 14:15:57 +03:00
Konstantin Knizhnik
c8cab8803b Do not invalidate obsolete slot if on demand wal download is supported 2025-07-03 15:25:31 +03:00
6 changed files with 57 additions and 8 deletions

View File

@@ -624,3 +624,52 @@ def test_subscriber_synchronous_commit(neon_simple_env: NeonEnv, vanilla_pg: Van
log.info("waiting for sync after restart")
logical_replication_wait_flush_lsn_sync(vanilla_pg)
assert sub.safe_psql_scalar("SELECT count(*) FROM t") == 1000
# Test that we can use max_slot_wal_keep_size to restrict WAL size on the local disk but
# do not invalidate obsolete (unacked) slot relying on on-demand WAL download feature.
def test_logical_replication_ondemand_download(neon_simple_env: NeonEnv, vanilla_pg):
env = neon_simple_env
env.create_branch("publisher")
endpoint = env.endpoints.create(
"publisher", config_lines=["max_slot_wal_keep_size=1MB", "max_wal_size=32MB"]
)
endpoint.start()
pg_conn = endpoint.connect()
cur = pg_conn.cursor()
cur.execute(
"create table t(x integer primary key, fillter text default repeat(' ', 1000)) with (fillfactor=10)"
)
cur.execute("create publication pub1 for table t")
# now start subscriber
vanilla_pg.configure(["wal_level=logical"])
vanilla_pg.start()
vanilla_pg.safe_psql(
"create table t(x integer primary key, fillter text default repeat(' ', 1000)) with (fillfactor=10)"
)
connstr = endpoint.connstr().replace("'", "''")
log.info(f"ep connstr is {endpoint.connstr()}, subscriber connstr {vanilla_pg.connstr()}")
vanilla_pg.safe_psql(f"create subscription sub1 connection '{connstr}' publication pub1")
# Stop subscriber...
vanilla_pg.stop()
# ... and insert 800Mb data which should be delivered to subscriber after restart
cur.execute("insert into t values (generate_series(1,100000))")
# Check that WAL is truncated
assert endpoint.get_pg_wal_size() < 800
# Start subscriber...
vanilla_pg.start()
# Check that subscribers receives all data
def check_that_changes_propagated():
assert vanilla_pg.safe_psql("select count(*) from t")[0][0] == 100000
wait_until(check_that_changes_propagated, timeout=200.0, interval=10.0)

View File

@@ -1,18 +1,18 @@
{
"v17": [
"17.5",
"db424d42d748f8ad91ac00e28db2c7f2efa42f7f"
"611710b6ed40269e7c09c8095c5e916c5fd19417"
],
"v16": [
"16.9",
"7a4c0eacaeb9b97416542fa19103061c166460b1"
"35f6d1ba51577b03ba2affc238ba190541434f6d"
],
"v15": [
"15.13",
"8c3249f36c7df6ac0efb8ee9f1baf4aa1b83e5c9"
"d1627bff1c5f8172845406a3b85b7aa84a7760e2"
],
"v14": [
"14.18",
"9085654ee8022d5cc4ca719380a1dc53e5e3246f"
"ced5045624096851658c6de00c5b8930cfea8755"
]
}