You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HA offline bootstrap: leadership-transfer path never commits baseline (post-transfer leader sees commitIndex != 0) #5099
RaftBootstrapLeadershipTransferIT.leadershipTransfersToTheFresherPeerBeforeBootstrapCommit fails: after the offline-bootstrap protocol transfers Raft leadership to the elected source peer, that new leader never commits the BOOTSTRAP_FINGERPRINT_ENTRY, so getBootstrapBaseline(db) stays null on every peer and the test times out.
Confirmed failing on pristine main (not a regression). Distinct from the transient--1 first-formation bug fixed in #5098 - that fix is a prerequisite for even reaching this path.
Root cause
BootstrapElection's class Javadoc assumes:
the protocol never commits a baseline before transferring leadership, so the single transfer-then-commit-all sequence keeps the commitIndex == 0 first-formation gate valid
This assumption is empirically false. Instrumented run:
Leader elected: ArcadeDB_0 (term=1)
Bootstrap: transferring leadership to elected source localhost_2436 (freshest copy)
Leader changed: ArcadeDB_0 -> ArcadeDB_2 (term=2) ← new leader
DIAG bootstrap outcome=SKIPPED_NOT_FIRST_FORMATION commitIndex=2 isLeader=true
The leadership transfer and the term-2 leader election cause Ratis to append and commit internal no-op / configuration entries, so the new leader (the elected source) reads commitIndex = 2, not 0. The isConfirmedFirstFormation(commitIndex) gate (commitIndex == 0, tightened in #4800) therefore rejects the post-transfer leader, and the baseline is never committed anywhere.
Why it is hard
The gate can't simply be loosened to <= 2 or similar: #4800 deliberately keys first-formation on an exact 0 to prevent re-triggering bootstrap on an already-running cluster (which would risk overwriting live data). A correct fix needs a first-formation signal that survives an internal term bump but still cannot fire on a cluster that has committed application data - e.g. "no BOOTSTRAP_FINGERPRINT_ENTRY has been committed for any database yet" tracked independently of the raw Ratis commit index.
Reproduce
mvn test -pl ha-raft -Dtest=RaftBootstrapLeadershipTransferIT -DskipITs=false -DfailIfNoTests=false
(requires a fresh arcadedb-engine in ~/.m2, e.g. -am)
Activity
fix(#5099): HA bootstrap first-formation survives leadership transfer (…
fix(#5099): HA bootstrap first-formation survives leadership transfer (…
address review: document which reads advance a sequence, tie the runn…