Repository navigation
A node never says in sync with a main that isn't the one it synced with - #331
Merged
Merged
Conversation
Spec sail-main-rebuilt. M1: every database is minted a random catalog id (one migration, kept by upgrades and copies); main's welcome names it and a node records the first one at session open. M2/M3: NodeRound.admit refuses any other catalog, or none once one is recorded, before anything is pushed, adopted or recorded, with exit 1 and the restore sentence, so "Already in sync" follows only a round with the recorded main. M4: every join prints the pinned fingerprint and how to check it on main; rebuiltRecovery names a rebuild from a copy. M5: the re-join probe prints nothing of its own. M6: README and ARCHITECTURE.md say main's database is the org, how to back it up and restore it; invariant I5 names its tests. NativeFleetIT rebuilds main empty and from a copy over real ssh.
…nd a box leaving the node role forgets main's catalog The delta review found two gaps. A main restored in place keeps its box id, so its log sat below the node's checkpoint: the node paged nothing and said it was in sync while main held rows written after the restore. A log below the checkpoint now forgets the checkpoints and walks every head again. A box promoted to main, or migrated as main or standalone, kept the catalog it recorded as a node and would refuse any other main forever with the wrong remedy; it forgets it with its scope. A blank catalog is refused at the record, the catalog-less refusal names the upgrade command as the protocol refusal does, main's database path comes from SailPaths, and the docs no longer promise that a restore recovers work main took and lost.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Spec
sail-main-rebuilt.DatabaseCatalog: one migration (CREATE TABLE catalog AS SELECT lower(hex(randomblob(16))) AS id, NULL AS main) gives every database a random id at creation (or at upgrade, for an existing one). Upgrades and copies keep it. Main's welcome names it (catalog; an older main sends none), and a node records the first one it sees.NodeRound.admitruns at session open inSyncOperations, before the demo unseed andNodeRound.begin. It refuses a different catalog, or none once one is recorded, with exit 1: "Main at is not the database this box synced with (catalog , now ). Restore main's database (/var/lib/sail/sail.db) from a copy, then sync again." The check uses the catalog, not the box id, so a fresh database under the oldhost.yamlis refused too.rebuiltRecoverynow covers a rebuild from a copy.welcomedAs) prints nothing of its own.Tests:
DatabaseCatalogTest,SchemaManagerTest(a database from before catalogs),SyncWireTest,NodeRoundAdmitTest,MainRebuiltRoundTest(scenarios 1–5 through a real_syncserver; a refusal that survives main hanging up),JoinCommandTest(scenarios 6–7), andNativeFleetIT(scenarios 1 and 3 over real ssh). Scenario 1 failed in both the unit and native lanes whenadmitwas disabled.mvn -o -Pintegration -Dsail.it.requireIncus=false clean verifypasses locally.Takeover (third commit, bf37dff): the independent delta review found one HIGH and three MEDIUMs, fixed red-then-green.
LocalReplica.forgetCheckpoints) and walks every head again (MainRebuiltRoundTest).HandleChangeand the migrate-time repair forget it with the scope (HandleChangeTest,SyncCliTest).sudo sail upgradeas the protocol refusal does; main's path comes fromSailPaths; the docs say a node records the first welcome that names a catalog.