Skip to content

Moving work into new branch for PR against v5_STABLE#406

Open
susan-pgedge wants to merge 13 commits intov5_STABLEfrom
doc_updates_4_2026
Open

Moving work into new branch for PR against v5_STABLE#406
susan-pgedge wants to merge 13 commits intov5_STABLEfrom
doc_updates_4_2026

Conversation

@susan-pgedge
Copy link
Copy Markdown
Member

@susan-pgedge susan-pgedge commented Apr 3, 2026

There is a draft version for review at: TEMP contains the draft version

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 88180070-fe22-416b-b611-c4fb99a96e33

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch doc_updates_4_2026

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 3, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

# Using Batch Inserts

Using batch inserts improves replication performance for transactions that perform multiple inserts into a single table. To enable batch mode, modify the `postgresql.conf` file, setting:
Using batch inserts improves replication performance for transactions that
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see zero test coverage on this feature in the code. Maybe skip it or name it as an experimental feature?

the `postgresql.conf` file, setting:

* the `spock.batch_inserts` parameter to `true`.
* the `spock.conflict_resolution` parameter to `error`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If I read the code correctly, there is no such option as 'error':

static const struct config_enum_entry SpockConflictResolvers[] = {
	/*
	 * Disabled until we can clearly define their desired behavior. Jan Wieck
	 * 2024-08-12
	 *
	 * {"error", SPOCK_RESOLVE_ERROR, false}, {"apply_remote",
	 * SPOCK_RESOLVE_APPLY_REMOTE, false}, {"keep_local",
	 * SPOCK_RESOLVE_KEEP_LOCAL, false}, {"first_update_wins",
	 * SPOCK_RESOLVE_FIRST_UPDATE_WINS, false},
	 */
	{"last_update_wins", SPOCK_RESOLVE_LAST_UPDATE_WINS, false},
	{NULL, 0, false}
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Done. Seems good.


* `spock.enable_ddl_replication` enables replication of ddl statements
through the default replication set. Some DDL statements are intentionally
not replicated (like `CREATE DATABASE`). Other DDL statements are
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just note. With an AI helper, we might maintain exact lists of replicated/restricted DDL and utility commands and reference them here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@danolivo If you want to share that/those lists, I'll be glad to add them!

```
Note that the value of `sub_enabled` is `t` if the subscription is currently replicating.
Note that the value of `sub_enabled` is `t` if the subscription is currently
replicating.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you sure? I think a more accurate wording is 'active', because the actual subscription status we extract from the spock.sub_show_status() call.

provider and a subscriber node in a Spock logical replication setup. You can
use `spock.sync_event` to ensure that all changes up to a specific point
(indicated by the PostgreSQL Log Sequence Number or LSN) on the provider have
been received and applied on the subscriber.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since commit fdd9587, I'm not totally sure. Their comment about bypassing the reorder buffer leaves me a little nervous about that. So it should be @mason-sharp , who would approve this statement.

### SYNOPSIS

`spock.spock_gen_slot_name (dbname name, provider_node name, subscription name)`
spock.spock_gen_slot_name(dbname name, provider_node name,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like this function has a non-conventional name: the 'spock' used twice here, isn't it?


`spock.spock_gen_slot_name (dbname name, provider_node name, subscription name)`
spock.spock_gen_slot_name(dbname name, provider_node name,
subscription name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mason-sharp , shouldn't we do more in this function? I mean, check and reserve this name till the end of the transaction to avoid potential conflicts. Also, following ReplicationSlotNameForTablesync, we could use more compact and stable OIDs and GetSystemIdentifier() as Postgres core does.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@mason-sharp Comments?

## NAME

`spock.spock_max_proto_version()`
spock.spock_max_proto_version()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The same issue with naming.
Also, we might simplify the UI by consolidating these four functions into a single VIEW spock.info, which would be extensible and clearer. @mason-sharp , what do you think?

The additional connection string to the node. The user in this string should equal the OS user. This connection string should be reachable from outside and match the one used later in the sub-create command. Example: host=10.1.2.5 port= 5432 user=rocky
node_add_interface
--------------------
1239112588
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems we should switch here from unstable hashes to stable OIDs, like we already do with node_id and like Postgres does. @mason-sharp ?

Optional country code or name associated with the node. The default is
NULL.

info
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This field might contain internal fields that affect the conflict-resolution logic. I'm not sure if it was documented somehow, maybe reference here?

inventory=# SELECT spock.node_create('n3','host=10.0.0.12 port=5432 dbname=inventory');
node_create
-------------
9057
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mason-sharp , the same question as for the interface OID generation.

only removes Spock's logical representation of the interface.

Other nodes that were using this interface to connect will no longer be able
to use it. Ensure no active subscriptions are relying on this interface
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Vague term 'ensure'. What may happen if I forget to clean all dependencies? Crash, error, something else?

### SYNOPSIS

`spock.node_info ()`
spock.node_info()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This place looks like a good place to add all the 'spock_version' stuff described earlier.

No functional changes. Pure formatting: every C function CREATE statement
in spock--5.0.0.sql, spock--5.0.0--5.0.1.sql, and spock--5.0.1--5.0.2.sql
is reformatted:

- One parameter per line, indented two spaces
- IN parameter names column-aligned within each function
- RETURNS clause on its own line
- AS 'MODULE_PATHNAME', 'symbol' on its own line
- LANGUAGE C [attributes] as the final line before the semicolon

This matches the convention used by PostgreSQL core contrib extensions
(pageinspect, amcheck, postgres_fdw, etc.) and makes signatures easier
to read and diff.
Copy link
Copy Markdown
Contributor

@danolivo danolivo left a comment

Choose a reason for hiding this comment

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

Almost all is good. Minor changes needed - see comments here and in Slack.

Susan Douglas and others added 4 commits April 9, 2026 08:34
- Rename spock_sub_sync.md → spock_sub_alter_sync.md (sub_sync → sub_alter_sync)
- Delete spock_seq_sync.md (content already in spock_sync_seq.md)
- Rename spock_xact_timestamp_origin.md → spock_xact_commit_timestamp_origin.md
- Remove redundant spock. prefix from spock_version, spock_version_num, spock_max_proto_version, spock_min_proto_version docs
- Update forward_origins default from {all} to {} with explanation in sub_mgmt.md and spock_sub_create.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants