Skip to content

HA offline bootstrap: leadership-transfer path never commits baseline (post-transfer leader sees commitIndex != 0) #5099

Closed

Description

@robfrank

Summary

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)

Related

Activity

  1. added this to the 26.7.2 milestone on Jul 8, 2026
  2. added a commit that references this issue on Jul 8, 2026
  3. added a commit that references this issue on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions