Repository navigation
Description
Five findings from #6221 / PR #6226, filed together because they are all small and share an origin. Split any of them out if you would rather track them separately - only item 1 is a defect, the rest are a measurement to collect, an observability gap, a cleanup, and a docs update.
1. DynamicMembershipTest poisons the cluster it shares, so a different method fails on every run
DynamicMembershipTest (ha-raft/src/test/java/com/arcadedb/server/ha/raft/DynamicMembershipTest.java) runs its methods against one 3-node cluster and removes peers from it without putting them back:
removePeerDecreasesClusterSize(:50) removes a non-leader and asserts 2 live peers.removePeerRefusedWhenItWouldBreakQuorum(:66) opens withassertThat(raftServer.getLivePeers()).hasSize(3)(:71), then removes one, then force-removes another, leaving 1.getLivePeersReturnsAllConfiguredPeers(:40) asserts 3, andregisterPeerDisplayNameUpdatesExistingPeer(:114) reads the peer set as well.
So every method here both depends on the peer set and mutates it, and JUnit's method order decides which one loses. Three runs on my machine produced three different failures, one of them on pristine main at d75174c92 with no local changes, which is what rules out the PR that found it:
DynamicMembershipTest.removePeerRefusedWhenItWouldBreakQuorum:68 (expected 3 live peers)
DynamicMembershipTest.registerPeerDisplayNameUpdatesExistingPeer:116
DynamicMembershipTest > endTest > checkDatabasesAreIdentical: DatabaseAreNotIdentical Types: DB1 5 <> DB2 15
The third is the interesting one: a class that ends with a 1-peer cluster fails the base class's endTest consistency check, which is a failure attributed to whatever ran last rather than to the test that removed the peers.
Suggested fix: give the membership tests a per-method cluster (or re-add the removed peers in an @AfterEach), and @Order them only if the shared-cluster shape has to stay. This is very likely contributing to the chronic ha-integration-tests redness of #5668 / #5702 - it is a deterministic failure whose visibility depends on ordering, not a timing flake, so it will keep costing that lane signal until the shared state is fixed.
2. Collect the RESYNC_RETRY_TIMEOUT_MS measurement, then lower it
BaseRaftHATest.RESYNC_RETRY_TIMEOUT_MS (:66) is still 120 s. #6221 asked whether it could come down now that notifyInstallSnapshotFromLeader has its own executor, and #6226 deliberately did not lower it: a green run of a chronically red lane proves nothing, and a budget nothing exhausts leaves no trace of how much of it was needed.
The instrument is in place now - reportSlowWait (:473) logs what a wait actually cost whenever it exceeds SLOW_WAIT_REPORT_MS (:68, 10 s), for both withResyncRetry and awaitValue. This item is the other half: read a handful of ha-integration-tests runs, find the worst real wait, and set the budget from it. If no run ever reports a line, the 120 s has never been needed and can drop to something that fails fast.
3. Nothing tells an operator that their peer addresses identify nobody
getUnambiguousPeerHttpAddress / getUnambiguousPeerHttpsAddress withhold silently (RaftHAServer:1927): they return null and every caller decides for itself whether to say anything. The refusal is therefore visible only where a caller happens to log it - the snapshot paths log a WARNING per attempt, the verify endpoint reports it per peer - and invisible everywhere else.
The one warning that does exist does not cover this. deriveHttpAddressWithWarning / deriveHttpsAddressWithWarning (RaftHAServer:2050, :2082) fire once per JVM whenever an address is derived at all, which is also what a perfectly healthy homogeneous Kubernetes StatefulSet does, so it cannot distinguish "deriving, and fine" from "deriving, and two peers just collapsed onto one address". warnAmbiguousRouting (:1931) does exactly the right thing - once per protocol, naming the config field to write - but only for the client routing tables of #6183, not for the peer-to-peer endpoints.
Two suggestions, in order of value:
- a one-time WARNING when a peer-to-peer address is withheld, modelled on
warnAmbiguousRouting: which peers could not be told apart, and thehost:{raft:..,http:..}syntax that fixes it; - surface it in cluster status.
GetClusterHandler:253/:258andRaftClusterStatusExporter:85report the raw best-effort addresses, so on a misconfigured cluster the status endpoint and the Studio HA panel display an address for every peer with nothing to say that it identifies none of them. A flag per peer (or simply reporting the unambiguous address, withnullwhere there is none) would make the misconfiguration visible before anyone runs a verify.
4. Seven now-redundant awaits around findLeaderIndex()
findLeaderIndex() (BaseRaftHATest:323) waits up to LEADER_ELECTION_TIMEOUT_MS (:74) for an election since #6226; it used to sample once and answer -1 the instant it was called during a leaderless window. Seven call sites had worked around that by hand and can now drop the wrapper:
RaftTimeSeriesReplication3NodesIT:74, :113, :180, :234
SuperNodeAppendHAConsistencyIT:65
RaftTimeSeriesOversizedSealedIT:69
SuperNodeConcurrentAppendHABenchmark:106
Pure cleanup - they are correct as they stand, just saying twice what the helper now says once.
5. Docs: two API-visible changes from #6226
Both are already in docs/release-26.9.1.md and in the OpenAPI spec, but the arcadedb-docs HTTP API reference has not caught up:
retriesin thePOST /api/v1/command(and every auto-committing endpoint's) payload now defaults toarcadedb.txRetries(3) instead of a hard-coded 1. Worth documenting alongside the caveat: onlyNeedRetryException/DuplicatedKeyExceptionare retried, always after a rollback, but a SQL/JS function with a side effect outside the database can now run more than once per request.POST /api/v1/cluster/verify/{database}has a thirdoverallStatusvalue,VERIFICATION_INCOMPLETE, for "no divergence observed, but at least one peer could not be verified". Alerting that keys on!= ALL_CONSISTENTis unaffected; alerting that keys onINCONSISTENCY_DETECTEDspecifically needs to add it to keep catching an unreachable node.
Activity
fix(#6267): the cluster status resolves peer endpoints once for the g…
fix(#6267): the ambiguity warning names every collision it found, in …
fix(#6267): drop the TimeUnit import the removed await left behind in…
fix(#6267): say what the ambiguity latch is scoped to, and why the ev…
fix(#6267): a peer address that identifies nobody says so, and a memb…
chore(#6281): merge main (#6267, #6264)
fix(#6297, #6280, #6279, #6270): a teardown that deletes what the tes…
fix(#6297, #6280, #6279, #6270): a teardown that deletes what the tes…
fix(#6343): the threshold has been a sixth since #6267, not since the…