Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
86ef5e7
Add spock_create_subscriber — bootstrap a subscriber from a physical …
rasifr Jun 22, 2026
bc9ae7b
spock_create_subscriber: drop legacy paths and extension usage
rasifr Jun 22, 2026
20a14ef
Added usage document for spock_create_subscriber
rasifr Jun 22, 2026
0517945
spock_create_subscriber address review feedback
rasifr Jul 22, 2026
361ee4d
spock_create_subscriber: add bidirectional join plumbing
rasifr Jul 9, 2026
3c0c6b5
spock_create_subscriber: add TAP test for --bidirectional plumbing
rasifr Jul 13, 2026
ee93acf
spock_create_subscriber: physical backup, catalog strip, repset restore
rasifr Jul 28, 2026
35dabb6
spock_create_subscriber: add --postgresql-auto-conf override
rasifr Aug 5, 2026
813330a
spock_create_subscriber: trace every query and step at -v -v
rasifr Aug 6, 2026
4f32cee
spock_create_subscriber: catchup subscription phase
rasifr Aug 6, 2026
7536c18
spock_create_subscriber: bring n3 live with bidirectional replication
rasifr Aug 20, 2026
cb8923a
spock_create_subscriber: unify peer/source loops in the reverse-sub p…
rasifr Aug 24, 2026
c43949f
spock_create_subscriber: simplify and strengthen option parsing
rasifr Aug 27, 2026
51c047d
spock_create_subscriber: break main() into lifecycle phases
rasifr Aug 27, 2026
b65f9b2
spock_create_subscriber: liveness-aware stall watchdog for big transa…
rasifr Sep 7, 2026
a79f4ee
spock_create_subscriber: WAL-retention test; expand bidirectional TAP…
rasifr Sep 7, 2026
0f79ab4
pgindent run
rasifr Sep 7, 2026
55f9992
spock_create_subscriber: fix manifest JSON parsing on PG15/16
rasifr Sep 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
results
regression_output
tmp_check
spock_create_subscriber
/utils/spock_create_subscriber/spock_create_subscriber
/utils/spock_create_subscriber/.deps/
.vimrc
*.o
*.so
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ EXTENSION = spock
PGFILEDESC = "spock - multi-master replication"

MODULES = spock_output
SUBDIRS = utils/spock_create_subscriber

# Lookup source directory
vpath % src src/compat/$(PGVER)
Expand Down
38 changes: 38 additions & 0 deletions docs/creating_subscriber_nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Creating a Subscriber Node with pg_basebackup

Spock supports creating a subscriber node by cloning the provider with [`pg_basebackup`](https://www.postgresql.org/docs/current/app-pgbasebackup.html) and starting it as a Spock subscriber. Use the `spock_create_subscriber` utility (located in the `bin` directory of your pgEdge platform installation) to register the node.

### Synopsis:

`spock_create_subscriber [OPTION]...`

**Options**

Specify the following options as needed.

| Option | Description
|----------|-------------
| `-D`, `--pgdata=DIRECTORY` | The `data` directory to be used for new node. This can be either an empty/non-existing directory, or a directory populated using the `pg_basebackup -X stream` command.
| `--databases` | An optional list of databases to replicate.
| `-n`, `--subscriber-name=NAME` | The name of the newly created subscriber.
| `--subscriber-dsn=CONNSTR` | A connection string to the newly created subscriber.
| `--provider-dsn=CONNSTR` | A connection string to the provider.
| `--replication-sets=SETS` | A comma-separated list of replication set names.
| `--apply-delay=DELAY` | The apply delay in seconds (by default 0).
| `--drop-slot-if-exists` | Drop replication slot of conflicting name.
| `-s`, `--stop` | Stop the server once the initialization is done.
| `-v` | Increase logging verbosity.
| `--extra-basebackup-args` | Additional arguments to pass to `pg_basebackup`. Safe options are: `-T`, `-c`, `--xlogdir`/`--waldir`
Comment on lines +9 to +25

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Document the --text-types option.

The --text-types CLI option (line 211 in spock_create_subscriber.c, which sets force_text_transfer) is neither listed in this options table nor in the usage() output (lines 578–603). Users have no way to discover it.

Add a row to the options table and a corresponding printf in usage().

📝 Proposed additions
 | `--extra-basebackup-args` | Additional arguments to pass to `pg_basebackup`. Safe options are: `-T`, `-c`, `--xlogdir`/`--waldir`
+| `--text-types` | Force text transfer for all columns.
 printf(_("  --extra-basebackup-args     additional arguments to pass to pg_basebackup.\n"));
 printf(_("                              Safe options: -T, -c, --xlogdir/--waldir\n"));
+printf(_("  --text-types                 force text transfer for all columns\n"));
🧰 Tools
🪛 LanguageTool

[grammar] ~20-~20: Use a hyphen to join words.
Context: ...r. | --replication-sets=SETS | A comma separated list of replication set names....

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/creating_subscriber_nodes.md` around lines 9 - 25, The `--text-types`
CLI option is missing from both the subscriber creation documentation and the
CLI help output, so users cannot discover it. Add a new row for `--text-types`
in the options table in the subscriber docs, and add a matching `printf` entry
in `usage()` in `spock_create_subscriber.c` alongside the existing option
descriptions, referencing the `force_text_transfer` behavior.

| `--text-types` | Transfer all column values as text rather than binary during initial sync. Use this when provider and subscriber differ in endianness or type representation.

**Configuration files overrides**

You can use the following options to override the location of the configuration files.

| Option | Description
|----------|-------------
|`--hba-conf` | path to the new `pg_hba.conf`
| `--postgresql-conf` | path to the new `postgresql.conf`
| `--recovery-conf` | path to the template recovery configuration

Unlike `spock.sub_create`'s other data sync options, this method of cloning ignores replication sets and copies all tables on all databases. However, it's often much faster, especially over high-bandwidth connections.
9 changes: 6 additions & 3 deletions src/spock_fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@ appendPQExpBufferConnstrValue(PQExpBuffer buf, const char *str)
bool needquotes;

/*
* If the string consists entirely of plain ASCII characters, no need to
* quote it. This is quite conservative, but better safe than sorry.
* If the string is one or more plain ASCII characters, no need to quote
* it. An empty string must default to needing quotes -- an unquoted
* empty value doesn't parse as empty, it swallows the entire next
* "keyword=value" token.
*/
needquotes = false;
needquotes = true;
for (s = str; *s; s++)
{
if (!((*s >= 'a' && *s <= 'z') || (*s >= 'A' && *s <= 'Z') ||
Expand All @@ -238,6 +240,7 @@ appendPQExpBufferConnstrValue(PQExpBuffer buf, const char *str)
needquotes = true;
break;
}
needquotes = false;
}

if (needquotes)
Expand Down
10 changes: 10 additions & 0 deletions tests/tap/schedule
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,20 @@ test: 037_wire_format_datestyle
test: 038_reserved_schema_ddl_guard
test: 044_apply_change_logging
test: 045_lsn_from_commit_ts
test: 048_bidir_join
test: 050_bidir_join_crash_midcatchup
test: 051_bidir_join_multipeer_lag
test: 052_bidir_join_big_txn_liveness
test: 053_bidir_join_unbounded_peer_slot_wal
test: 054_bidir_join_precondition_negatives
test: 055_bidir_join_lww_conflict
test: 056_bidir_join_concurrent_load
test: 057_bidir_join_stall_abort
# Upgrade schema match test (builds from source, slow):
#test: 018_upgrade_schema_match
#

# Regression tests
test: 103_manager_worker_dboid_race
test: 105_sub_disable_retransmit_after_disconnect

7 changes: 7 additions & 0 deletions tests/tap/schedule-nightly
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ test: 017_zodan_3n_timeout
# deadlock.
test: 035_deadlock_retry
test: 036_real_deadlock_retry

# --bidirectional join under sustained OLTP write load (pgedge-loadgen).
# Not yet enabled here: needs its real-world runtime at
# SPOCK_BIDIR_LOAD_LEVEL=medium/heavy characterized on CI hardware first,
# and CI needs a pgedge-loadgen checkout (PGEDGE_LOADGEN_BIN) available --
# it skip_alls cleanly without one. ~161s locally at the light default.
#test: 049_bidir_join_under_load
Loading
Loading