Skip to content

The per-database stale read floor (#6760) is in-memory only, so a restart unclamps LINEARIZABLE reads of a database a snapshot install gave up on #8137

Closed

Description

@robfrank

Summary

#7735 makes the per-database quarantine (ArcadeStateMachine.divergedDatabases) durable: it is mirrored into
the quarantine object of .raft/applied-index and read back by ensureAppliedIndexLoaded(), so a restart no
longer brings a node back RUNNING with alerts: [] on a database that is missing a committed entry.

Its sibling, the per-database stale read floor staleDatabaseAppliedFloors (issue #6760), is still
in-memory only and is not reconstructed on restart.

Where (HEAD of the #7735 branch)

  • ha-raft/src/main/java/com/arcadedb/server/ha/raft/ArcadeStateMachine.java
    • staleDatabaseAppliedFloors - ConcurrentHashMap, written only by markDatabasesNotAtSnapshotIndex(...)
      during a snapshot install, cleared by clearDivergedDatabase / clearDivergedState.
    • reinitialize() reconstructs staleSnapshotAppliedFloor (the node-wide one, from the marker vs the persisted
      applied index) and nothing reconstructs the per-database map.
    • getDatabaseAppliedFloor(dbName) therefore answers -1 after a restart, and
      RaftHAServer.getTrustedAppliedIndex(dbName) returns the unclamped Ratis applied index.

Why it is narrow but not empty

markDatabasesNotAtSnapshotIndex also calls markStateDiverged(dbName, SNAPSHOT_INSTALL_INCOMPLETE), and that
mark IS durable since #7735. So after a restart the database is still quarantined, isResyncInProgress() is true,
/api/v1/ready answers 503 and the critical alert fires - the readiness half of #6760 survives.

What does not survive is the clamp: a client that reaches the node directly (not through the Service that the
503 took it out of) and asks for a LINEARIZABLE or read-your-writes read of that database is no longer refused at
an honest floor. The floor was the mechanism #6760 added precisely so such a read fails or degrades rather than
being served from a copy known to be behind.

Suggested fix

Persist the floors the same way the quarantine now is - a floors object beside quarantine in
.raft/applied-index, written and cleared by the same three helpers under appliedIndexFileLock, restored by
ensureAppliedIndexLoaded(). The file already carries the per-database applied positions the floors are derived
from, so the shapes match.

Scope

Follow-up from the completeness sweep on #7735; out of scope there because it is a different invariant (what a
read may be served, not whether the node is ready) with its own tests.

Activity

  1. added
    storage
    ha
    on Sep 22, 2026
  2. added
    severity:major
    on Sep 22, 2026
  3. added this to the 26.10.1 milestone on Sep 22, 2026
  4. added
    in progress
    on Sep 25, 2026
  5. self-assigned this
    on Sep 25, 2026
  6. added 5 commits that reference this issue on Sep 26, 2026
  7. lvca commented on Sep 26, 2026

    @lvca
    Member

    Fixed in #8425 (26.10.1).

    When a snapshot install could not refresh one database, the node already stayed not-ready for it after a restart, but LINEARIZABLE / read-your-writes reads of that database were no longer limited to the data it actually has. That limit is now saved together with the database's quarantine and restored at startup, and the install writes both in a single step so a crash cannot lose them.


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  8. removed
    in progress
    on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bughaseverity:majorstorage

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions