Files
neon/test_runner/regress/test_ondemand_wal_download.py
Konstantin Knizhnik 770ac34ae6 Register custom xlog reader callbacks for on-demand WAL download in StartupDecodingContext (#9007)
## Problem

See https://github.com/neondatabase/neon/issues/8931
On-demand WAL download are not set in all cases where WAL is accessed by
logical replication

## Summary of changes

Set customer xlog reader handles in StartupDecodingContext

Related changes in Postgres modules:

https://github.com/neondatabase/postgres/pull/495
https://github.com/neondatabase/postgres/pull/496
https://github.com/neondatabase/postgres/pull/497
https://github.com/neondatabase/postgres/pull/498

## Checklist before requesting a review

- [ ] I have performed a self-review of my code.
- [ ] If it is a core feature, I have added thorough tests.
- [ ] Do we need to implement analytics? if so did you add the relevant
metrics to the dashboard?
- [ ] If this PR requires public announcement, mark it with
/release-notes label and add several sentences in this section.

## Checklist before merging

- [ ] Do not forget to reformat commit message to not include the above
checklist

---------

Co-authored-by: Konstantin Knizhnik <knizhnik@neon.tech>
2024-11-19 22:29:57 +02:00

28 lines
941 B
Python

from fixtures.neon_fixtures import NeonEnv
def test_on_demand_wal_download(neon_simple_env: NeonEnv):
env = neon_simple_env
ep = env.endpoints.create_start(
branch_name="main",
endpoint_id="primary",
config_lines=[
"max_wal_size=32MB",
"min_wal_size=32MB",
"neon.logical_replication_max_snap_files=10000",
],
)
con = ep.connect()
cur = con.cursor()
cur.execute("CREATE TABLE t(pk bigint primary key, payload text)")
cur.execute("ALTER TABLE t ALTER payload SET STORAGE external")
cur.execute("select pg_create_logical_replication_slot('myslot', 'test_decoding', false, true)")
cur.execute("insert into t values (generate_series(1,100000),repeat('?',10000))")
ep.stop("fast")
ep.start()
con = ep.connect()
cur = con.cursor()
cur.execute("select pg_replication_slot_advance('myslot', pg_current_wal_insert_lsn())")