-
Notifications
You must be signed in to change notification settings - Fork 0
Clone sync verification now detects an in-progress base copy on RocksDB instead of marking the node Available mid-copy #657
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b0ca70d
Clone sync check: verify no-target databases by the copy-completion w…
kriszyp 95429f8
Scope the missing-socket hold to subscribed databases so a v4 leader …
kriszyp 0d8cfa3
Ratchet seen sockets into the required set so a dropped system socket…
kriszyp 3cf4cf1
Merge remote-tracking branch 'origin/main' into kris/copy-watermark-gate
kriszyp 4e380b3
Filter sync targets by replication.databases and require the system s…
kriszyp 6ad25da
Fail the leader-version probe closed and exclude sharded entries from…
kriszyp 7e91689
Evaluate the real shard predicate for sync targets instead of excludi…
kriszyp 752ebc1
Tolerate prefixed leader version strings in the probe
kriszyp 511bdcb
Persist clone copy completion across worker restarts
kriszyp 687d11d
Harden clone completion restoration
kriszyp 65ef227
Preserve selective clone targeting
kriszyp d1851e6
Merge remote-tracking branch 'origin/main' into kris/copy-watermark-gate
kriszyp 9cd94e0
fix(clone): don't require a system socket the node never subscribes to
kriszyp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /** | ||
| * Whether `dbName` is replicated under a `replication.databases` config value, mirroring the | ||
| * name/shard gating of `shouldReplicateFromNode` (`replication/knownNodes.ts`): `undefined` or | ||
| * `'*'` accept everything; an array accepts the names it lists, and a sharded entry only when | ||
| * `shardedReplicates` accepts it (same-shard leader). Callers that cannot evaluate the shard | ||
| * predicate must pass a fail-closed (always-true) predicate: a wrong inclusion stalls the clone | ||
| * visibly, while a wrong exclusion would skip verification of a database that is being copied. | ||
| */ | ||
| export function isReplicatedDatabase( | ||
| databaseReplications: unknown, | ||
| dbName: string, | ||
| shardedReplicates: (entry: any) => boolean = () => true | ||
| ): boolean { | ||
| if (!databaseReplications || databaseReplications === '*') return true; | ||
| if (!Array.isArray(databaseReplications)) return true; | ||
| return databaseReplications.some((entry: any) => | ||
| typeof entry === 'string' | ||
| ? entry === dbName | ||
| : entry?.name === dbName && (!entry.sharded || shardedReplicates(entry)) | ||
|
kriszyp marked this conversation as resolved.
Outdated
|
||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import assert from 'node:assert/strict'; | ||
| import { isReplicatedDatabase } from '#src/cloneNode/replicatedDatabases'; | ||
|
|
||
| describe('isReplicatedDatabase', () => { | ||
| it('accepts everything when replication.databases is unset or a wildcard', () => { | ||
| assert.equal(isReplicatedDatabase(undefined, 'data'), true); | ||
| assert.equal(isReplicatedDatabase('*', 'data'), true); | ||
| }); | ||
|
|
||
| it('matches string entries by name', () => { | ||
| assert.equal(isReplicatedDatabase(['data'], 'data'), true); | ||
| assert.equal(isReplicatedDatabase(['data'], 'other'), false); | ||
| }); | ||
|
|
||
| it('matches unsharded object entries by name regardless of the shard predicate', () => { | ||
| assert.equal( | ||
| isReplicatedDatabase([{ name: 'data' }], 'data', () => false), | ||
| true | ||
| ); | ||
| }); | ||
|
|
||
| it('accepts a sharded entry only when the shard predicate does (same-shard leader)', () => { | ||
| const entries = [{ name: 'data', sharded: true }]; | ||
| assert.equal( | ||
| isReplicatedDatabase(entries, 'data', () => true), | ||
| true | ||
| ); | ||
| assert.equal( | ||
| isReplicatedDatabase(entries, 'data', () => false), | ||
| false | ||
| ); | ||
| }); | ||
|
|
||
| it('fails closed for a sharded entry when no shard predicate is supplied', () => { | ||
| // Callers that cannot evaluate the leader's shard must keep the database as a sync target: | ||
| // a wrong inclusion stalls the clone visibly, a wrong exclusion skips verifying a copy. | ||
| assert.equal(isReplicatedDatabase([{ name: 'data', sharded: true }], 'data'), true); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.