Skip to content

test: add physical and logical replication tests#263

Merged
tjgreen42 merged 3 commits intomainfrom
test/replication-tests
Mar 6, 2026
Merged

test: add physical and logical replication tests#263
tjgreen42 merged 3 commits intomainfrom
test/replication-tests

Conversation

@tjgreen42
Copy link
Copy Markdown
Collaborator

Summary

  • Adds physical (streaming) replication test covering standby queries, ongoing replication, segment replication, and standby promotion
  • Adds logical replication test covering initial sync, INSERT/DELETE/UPDATE replication with search verification
  • Adds test-replication and test-logical-replication Makefile targets

Both replication modes work correctly with the existing codebase. The lazy rebuild path in tp_get_local_index_statetp_rebuild_index_from_disk handles standby/subscriber startup by reconstructing memtable state from replicated on-disk pages (metapage, segments, docid pages).

Testing

All 8 replication tests pass locally:

  • Physical: standby queries, ongoing replication, segment replication, standby promotion
  • Logical: initial sync + index build, INSERT replication, DELETE replication, UPDATE replication

Add two new shell test scripts that verify pg_textsearch works
correctly with Postgres replication:

- replication.sh: Physical (streaming) replication tests
  1. Standby starts up with replicated bm25 index
  2. BM25 queries work on hot standby
  3. Inserts on primary replicate to standby
  4. Standby promotion preserves index functionality

- logical_replication.sh: Logical replication tests
  1. Initial table sync + index build on subscriber
  2. INSERT replication with search verification
  3. DELETE replication removes entries from search
  4. UPDATE replication reflects new content in search

Both physical and logical replication work correctly with the
existing codebase. The lazy rebuild path in tp_get_local_index_state
handles standby/subscriber startup by rebuilding memtable state from
replicated on-disk pages.
- Add test-replication and test-logical-replication to .PHONY
- Add comment explaining why replication tests are not in test-shell
- Change warn to error for DELETE replication assertion
- Change warn to error for post-promotion insert assertion
- Add exit $exit_code at end of cleanup functions
@tjgreen42 tjgreen42 marked this pull request as ready for review March 5, 2026 16:03
@tjgreen42 tjgreen42 merged commit 740749b into main Mar 6, 2026
14 checks passed
@tjgreen42 tjgreen42 deleted the test/replication-tests branch March 6, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant