Do not invalidate obsolete slot if on demand wal download is supported

This commit is contained in:
Konstantin Knizhnik
2025-07-03 15:25:31 +03:00
parent 8b4fbefc29
commit c8cab8803b
6 changed files with 50 additions and 8 deletions
@@ -624,3 +624,45 @@ 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
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"])
endpoint.start()
pg_conn = endpoint.connect()
cur = pg_conn.cursor()
# create table...
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.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 some data which should be delivered to subscriber after restart
cur.execute("insert into t values (generate_series(1,1000000))") # 8Gb
# Stop 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] == 1000000
wait_until(check_that_changes_propagated, timeout=200.0, interval=10.0)
+4 -4
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"
]
}