-
Notifications
You must be signed in to change notification settings - Fork 9
docs: replicating the system database with a constrained topology (5.2) #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,9 @@ Adds a new Harper instance to the cluster. If `subscriptions` are provided, it c | |
| - `table` — table name | ||
| - `subscribe` — if `true`, transactions on the remote table are replicated locally | ||
| - `publish` — if `true`, transactions on the local table are replicated to the remote node | ||
| - `sendsTo` / `receivesFrom` _(optional)_ — database-scoped controlled-flow entries for this node, mirroring the config-route `replicates.sendsTo` / `replicates.receivesFrom` syntax (see [Controlling Replication Flow](./overview.md#controlling-replication-flow)). Each entry is a database name or an object: `{ database, excludeTables? }`. When provided, replication with this node is restricted to the listed databases; to replicate all databases except specific tables, use a wildcard entry (`excludeTables` with no `database`). Mutually exclusive with `subscriptions`. | ||
|
|
||
| > **Note**: `sendsTo` / `receivesFrom` here scope only the connection to _this_ node — they don't change how the local node advertises itself to the rest of the cluster. A node's own directional (non-mesh) `hdb_nodes` self-record is derived solely from its `harper-config.yaml` routes, so replicating `system` without collapsing to a full mesh requires directional routes in config, not just `add_node`/`set_node` scoping (see [Replicating the `system` database with controlled flow](./overview.md#replicating-the-system-database-with-controlled-flow)). | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Scope only the connection to this node" overstates the containment, and it breaks in exactly the scenario this PR documents (replicated The note's main point — that it doesn't make your node directional — is correct; it's the "restricted to this connection only" guarantee that doesn't hold once the record propagates. (Same phrase appears in the 5.2 release notes.) Arguably the real fix is upstream: should |
||
|
|
||
| **Request**: | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Each entry is a database name or an object" is wrong, and it fails silently. In the implementation a bare-string entry is matched as a peer/node name, never a database — see
routeEntriesIncludePeer(if (entry === peerName) return true) and the gate fallback inshouldReplicateFromNode(sendsTo === getThisNodeName()). So a user writing"sendsTo": ["cardata"]authorizes nothing at all and gets no error — replication simply doesn't happen.Fix:
"Each entry is an object{ database, excludeTables? }"— or document strings as node names, matchingcomputeSelfReplicates's{ target: e }normalization.Separately, the
sendsTodirection is ambiguous — and the implementation's perspective is the opposite of config routes. In config routes,replicates.sendsTomeans "the local node sends these to the route's peer" (computeSelfReplicatesputs them in the self record). Inadd_node,req.sendsTois written verbatim into the added peer's record (setNode.ts:201), where the receive gate reads a record'ssendsToas "this peer sends to me" — i.e.add_node'ssendsTomeans "databases the added node sends to the local node"."Mirroring the config-route syntax" invites the local-perspective reading, which is inverted. Symmetric configs (same list in both keys) mask it; one-way flows silently go the wrong direction. Is the added-node perspective intended, or should
setNodematch the config-route perspective? No test pins it today.Minor: "mutually exclusive with
subscriptions" is guidance, not enforcement — the Joi schema accepts both andsetNodesilently preferssubscriptions(if (req.subscriptions) … else if (req.sendsTo || req.receivesFrom)). Either say "if both are provided,subscriptionstakes precedence", or file a harper-pro validation follow-up.