Repository navigation
GEODE-vector-pr4: Adaptive Chordal Voronoi Continuous Vector Listener with RVV Monotonicity - #8157
Draft
gouthamaenugu wants to merge 30 commits into
Draft
gouthamaenugu wants to merge 30 commits into
gouthamaenugu wants to merge 30 commits into
Conversation
added 9 commits
November 21, 2026 03:55
… with RVV monotonicity
- Implement ChordalVoronoiRouter (Theorem 1 zero-false-negative chordal Voronoi metric pruning on S^{d-1} with IEEE-754 float32 safety bound; Proposition 1 analytical M_crit crossover with dual-threshold hysteresis [0.85 M_crit, 1.15 M_crit], live add/remove, spherical k-means++, telemetry & FNR verification hooks).
- Implement RvvMonotonicVectorDispatcher and RvvClientGate (Theorem 3 RVV-stamped events sourced from Geode VersionTag/VersionStamp/RegionVersionVector, per-bucket replayable delta tail buffer bounded by V_ckpt <= V_client, promoted-bucket snapshot recovery, and client high-water deduplication & strict per-(subscriptionId, bucketId, memberId) monotonicity).
- Implement ContinuousVectorQueryService facade with Geode CacheListener and PartitionListener bridges.
- Register new Serializable classes in sanctioned-geode-lucene-serializables.txt.
- Add unit tests (ChordalVoronoiRouterTest, RvvMonotonicVectorDispatcherTest) and 4-node failover chaos DUnit test (ContinuousVectorRvvFailoverDistributedTest).
…gate cleanup, serialized callbacks, overflow signal, high-d epsilon) - PR4-B1 [CRITICAL]: Add per-bucket async primary-promotion barrier (beginAsyncPromotion / completeAsyncPromotion / cancelAsyncPromotion) in RvvMonotonicVectorDispatcher and ContinuousVectorQueryService.createPartitionListener so live post-promotion writes buffer until async tail replay completes and drain in ascending version order. - PR4-B2 [CRITICAL]: Add RvvClientGate.removeSubscription(String) and ContinuousVectorQueryService.attachClientGate/detachClientGate + compactUpTo so unregisterSubscription purges stale high-water entries and never pins V_ckpt. - PR4-B3 [HIGH]: Serialize high-water check, advance, and downstream listener delivery per (subscriptionId, bucketId, memberId) StreamState in RvvClientGate.tryAccept to guarantee strict monotonic delivery under concurrent callers. - PR4-B4 [HIGH]: Replace silent tail eviction on maxTailPerStream overflow with explicit tailOverflowCount, resyncRequired stream tracking, Log4j warn log, and TailOverflowListener callback. - PR4-B5 [MEDIUM]: Scale ChordalVoronoiRouter float32 dot-product safety epsilon linearly with dimension (max(1e-4, d * 1e-6)) and validate finiteness (reject NaN/Inf) in routeNormalized. - Add reproducing unit tests covering all 5 defects (PR4-B1..B5).
…qrt-free coupled cosine bound
…orem 1 FNR=0 until 20% churn recluster
… per-bucket RVV batch dispatch
…ronoi CoW, and Theorem 1 float64 outward rounding
1. Periodic & promotion-end per-bucket RVV watermark heartbeats:
- Add ContinuousVectorEvent.watermarkHeartbeat(...) and heartbeat flag
(sanctioned-geode-lucene-serializables.txt updated).
- Advance RvvClientGate highWaterVersion monotonically across all active
subscriptions on heartbeat without invoking match callbacks; compute
strict Theorem 3 Invariant 4 safe checkpoint across all active subscriptions.
- Emit periodic heartbeats every heartbeatIntervalEvents (default 64,
configurable, 0 disables) in RvvMonotonicVectorDispatcher and promotion
watermarks on primary failover so healthy 0%-match subscribers advance
V_ckpt without tail buffer overflow.
2. True O((M/K)d) per-cell copy-on-write in ChordalVoronoiRouter:
- Omit global O(Md) flat arrays from CHORDAL_VORONOI RouterSnapshots and
maintain subscriptionCellIndex for O(1) cell lookup on incremental remove.
- Copy only the affected VoronoiCell on live insert/remove; materialize
flat SIMD arrays only on mode switch / survival guard reversion.
3. Exact Theorem 1 float64 arithmetic margin & outward rounding:
- Add FLOAT64_UNIT_ROUNDOFF (2^-53) and computeFloat64Eta(d) = 2*gamma_{d+2}^f64 + 4*u_f64
into computeNormMargin(d).
- Round VoronoiCell.minCosineThreshold outward via
Math.nextDown(1 - 0.5*(B_k^up)^2 - epsilon_dot - 8*u_f64) (and -Infinity
when B_k^up >= 2.0).
…al reprobe, and RVV reconnect replay
…ng, reconnect scoping, d=1 & underflow bounds
…ush, and IdempotentRvvConsumer crash recovery
4 of 6 tasks
added 20 commits
November 25, 2026 10:49
…tent watermark guard, subnormal/maxCellSize hardening
…er match pending guard, and d=1/tau=1/subnormal tests
… holdback expiry coverage
…ery, staggered-ACK minimum, and |S|=0 continuity
…nd live secondary shadow tail
…ealthy admission, and multi-sub failover trace
…ionEpoch fence, and FIFO reconnect barrier
…t, and V_ckpt admission lower-pin
…Fence epoch/intent revalidation, and holdback bound tests - RvvMonotonicVectorDispatcher / ContinuousVectorQueryService (R1 M2 / R2 M2): Expose V_recv (getReceivedHeadVersion) and V_contig (getContiguousHeadVersion), strictly capping V_S = V_contig (nextExpectedVersion - 1 when an active holdback gap exists) inside collectReplayableTailForReconnect so reconnect replay never emits a trailing heartbeat covering a missing hole and hands off live dispatch contiguously at V_contig + 1. - IdempotentRvvConsumer (R2 M4): Revalidate captured sessionEpoch, committed watermark, applied ledger, and durable PENDING intent after acquiring streamExecutionFences so an old-session staged batch paused before the execution fence cannot execute out of order after disconnect or reconnect recovery; add test-only setBeforeExecutionFenceHookForTest. - JUnit + DUnit coverage (R1 M2 / R2 M2, R2 M4, R1 M3 / R2 M3): Add deterministic JUnit tests for active-gap reconnect + crash during lower-pin, old-session staged batch pausing before execution fence, and exact maxHoldbackGap=128 forward-span bound + combined delayed hole/continuing arrivals/age trigger near C_tail, plus a 3-server cluster DUnit test covering active-gap reconnect, primary crash during lower-pin admission, and near-capacity holdback age trigger.
…nnect uncovered heartbeat timer
- RvvMonotonicVectorDispatcher / ContinuousVectorQueryService (R1 M2, R1 M3, R2 M2):
- Add CheckpointPinReplicator synchronous replication hook invoked under
(subscriberRegistryLock, state) strictly BEFORE local lower-pin enrollment or
releasing any reconnect replay batches in admitAndReplayForReconnect and
admitSubscriberForContinuity, plus applyReplicatedLowerPin on backups so
promoted survivors honor lowered (V_floor, V_ckpt_lowered) under
compactUpToCheckpoint.
- Initialize oldestUncoveredMutationTimeMs (anchored to the oldest resident
entry in (V_ckpt, V_contig]) whenever reconnect lower-pin or recovery leaves
a contiguous uncheckpointed suffix (V_ckpt, V_contig], and clear uncovered
heartbeat counters in advanceCheckpoint once a stream is fully checkpointed
and compacted; expose getOldestUncoveredMutationTimeMs.
- JUnit + 3-server DUnit coverage:
- Add lowerPinDurabilityPointBothCrashSidesAndUncoveredHeartbeatTimerAcrossReconnect
(JUnit) and lowerPinDurabilityPointCrashSidesAndHeartbeatTimerAcrossCluster
(3-server kill -9 DUnit) exercising BOTH sides of the lower-pin durability
point (crash before replication -> survivor compacts to 64 -> resyncRequired;
crash after replication -> survivor stops compaction at 63 and replays [64..68])
and verifying oldestUncoveredMutationTimeMs across reconnect lower-pin.
…-2 WAL execution, and 2-backup partial lower-pin guard
- RvvMonotonicVectorDispatcher / ContinuousVectorQueryService (R1 M3 / R2 M2, R1 M4):
- Separate V_enq (getEnqueuedHeadVersion / getContiguousHeadVersion, strictly
max(V_floor, nextExpected - 1) while holdback is non-empty so physical entries
above V_enq are unconditionally bounded by maxHoldbackGap=128 independent of
async FIFO backlog) from V_disp (getSinkDispatchedVersion, updated strictly
after sink delivery in dispatchBatchToSinks); expose getPendingDispatchQueueSize.
- Guard applyReplicatedFloorAndCheckpoint so delayed older checkpoint updates
cannot raise V_ckpt above min_{s in S_healthy} ack[s] for surviving lower-pinned
subscribers with ack >= V_floor.
- IdempotentRvvConsumer (R2 M3):
- Add drainPendingBeforeLocked inside streamExecutionFences in Phase 2 so any
earlier unapplied PENDING intents (< ver) execute in strictly ascending
EventDeliveryId order before effectHandler runs for ver, eliminating reverse-order
handler execution when staged v+1 races ahead of pending v or across recovery.
- Deterministic JUnit coverage:
- Add delayedFifoWithNewlyOpenedGapSeparatesEnqueuedAndDispatchedFrontiersNearCapacity,
orderedPhase2ExecutionDrainsEarlierPendingIntentWhenLaterStagedIntentRacesIntoExecutionFence,
and twoBackupPartialLowerPinApplicationCrashWindowGuaranteesZeroSilentSkipForEveryPromotableSurvivor;
update legacy out-of-order consumer tests to assert strictly ascending handler order.
…tion HB(V_enq) re-emission, and overflow V_ckpt<=V_enq invariant
- IdempotentRvvConsumer (R1 M2 / R2 M3):
- Add per-(bucketId, memberId, sessionEpoch) OrderedIngressBarrier via
processOrderedFrame(event, sessionEpoch, ingressSeq) and
createOrderedSessionSink(bucketId, sessionEpoch), enforcing synchronous
Phase-1 durable PENDING staging before releasing the ingress turn for frame
k+1 (preventing later matches or covering heartbeats from overtaking an
unstaged earlier match); wake blocked ingress waiters on advanceSessionEpoch
and expose test-only setBeforeDurableStageHookForTest.
- RvvMonotonicVectorDispatcher (R1 M3, R2 m1):
- Update emitPromotionWatermarksLocked to immediately enqueue covering HB(V_enq)
for every active stream with V_enq > V_ckpt on promotion so count-triggered
heartbeats lost before wire dispatch on primary crash are immediately
re-emitted even when arrivals stop.
- Fix reconcileOverflowLocked empty-registry fallback to advance V_ckpt to
max(V_floor, V_enq) instead of V_recv, preserving V_floor <= V_ckpt <= V_enq
unconditionally when a holdback gap is open.
- JUnit + 3-server DUnit coverage:
- Add orderedClientIngressPreventsLaterMatchAndHeartbeatFromOvertakingPausedEarlierStaging
(JUnit) and primaryCrashBetweenCountTriggerHeartbeatEnqueueAndDispatchReEmitsHeartbeatOnPromotionWhenArrivalsStop
(JUnit + 3-server kill -9 DUnit), plus open-gap empty-registry overflow check.
… asymmetric lower-pin tests, and durable t_0 boundary tests
- RvvMonotonicVectorDispatcher / ContinuousVectorQueryService (R1 M2, R2 M2):
- Expose getTailSize(int bucketId, String memberId) and document the monotone
multi-replica occupancy invariant across partial lower-pin replication and
up to f promotions: |tail_{r*}(t)| <= max_{r in P(b)} |tail_r(t_0)| +
|arrivals(t_0, t]| < C_tail.
- Deterministic JUnit + 3-server rf=2 DUnit coverage:
- Add multiReplicaAsymmetricTailOccupancyAfterPartialLowerPinPromotesLargestReplicaWithoutOverflow
(JUnit): verifies largest-occupancy backup B2 (missing lower-pin, |tail_{B2}(t_0)|=24 >
|tail_P|=|tail_{B1}|=21) promotes and replays without overflow under
max_r |tail_r(t_0)| + arrivals = 31 < C_tail = 32.
- Add primaryCrashOnBothSidesOfReplicationBoundaryWithArrivalsStoppedPreservesDurableHeartbeatLiveness
(JUnit): exercises crash before v_0=5 replicates (survivor stays at V_enq=V_ckpt=4,
zero phantom HB) vs crash after v_0=5 replicates before dispatch (survivor immediately
emits covering HB(5) with arrivals stopped).
- Add multiReplicaAsymmetricTailAndDurableReplicationBoundaryCrashSidesAcrossCluster
(3-server rf=2 kill -9 DUnit): exercises both durable t_0 crash sides and asymmetric
partial lower-pin promotion of the largest-occupancy replica B2 across a live cluster.
…t, monotone timer anchor, and FLAT_SIMD latch snapshot rebuild
- IdempotentRvvConsumer (R1 M1):
- Route processOrderedFrame directly into executeStagedPhase2 after releasing
OrderedIngressBarrier; explicitly recheck isStaleSessionEpoch and
isAppliedOrRetiredLocked inside (streamExecutionFences, streamStageLock)
before invoking effectHandler; add JUnit tests for both pause schedules.
- RvvMonotonicVectorDispatcher / ContinuousVectorQueryService (R1 M2, R2 M1, R1 M3 + R2 M2):
- Have applyReplicatedLowerPin return boolean (false + resyncRequired if
backup V_floor > V_client) and add applyReplicatedLowerPinOrThrow /
ReplayFloorExceededException (sanctioned in serializables.txt) so primary
reconnect admission atomically aborts into RESYNC_REQUIRED if any backup
already compacted past V_client.
- Enforce strictly monotone Math.min(existingOldest, anchorTs) in
ensureUncoveredHeartbeatTimerInitialized so reconnect/lower-pin never moves
oldestUncoveredMutationTimeMs forward.
- Add JUnit + 3-server rf=2 DUnit tests for backup-floor resync abort, pre-t_0
2-backup partial-replication promotion of both B1 and B2 in turn, and
disjoint pre-t_0 holdbacks merged under universal union bound U_0 + monotone
heartbeat timer.
- ChordalVoronoiRouter (R2 M3):
- Track probeCellsExact on RouterSnapshot so any subscription add/remove
while latched in FLAT_SIMD above M_down forces rebuilding and atomically
publishing a single immutable RouterSnapshot covering current membership S,
centroids, r_max, and cell lists on Voronoi re-entry; add JUnit test
verifying 100% recall of newly added subs and 0 stale removed subs.
… age g_0, and add file-backed batched WAL crash recovery
…nt, atomic backup-compaction floor import, and CRC32 WAL torn-append recovery tests
…c whole-frame WAL durability, and multi-blocker zero-frame tests
…ation, immutable admission match sets, and OP_COVERING_WM integrated recovery
…tion, sessionEpoch ACK fencing, S1/S2 Window-A WAL recovery, Algorithm 2 latch/gen guards, and integrated rf=2 DUnit
…VE/CANONICAL promotion finalization & durableCanonicalFrontier, and L1 WAL barrier / handler non-reentrancy hardening
…orithm 2) and monotonic canonicalTerm fencing + promotion publication guard (Theorem 3)
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.
PR 4: Adaptive Chordal Voronoi Continuous Vector Listener with RVV Monotonicity
feature/GEODE-vector-pr4-rvv-listenerdevelop(46643af515)d0a418420c6e1f162b9c85129f58eac9efa9927d(14 files changed, +27227 / -0)geode-lucene(Apache Geode 2.1, bundled Apache Lucene9.12.3)For all changes, please confirm:
GEODE-*JIRA ticket assignment and commit prefix update.)develop)?O(|V_k|)Voronoi removal, online survival-rate SIMD guard + coalesced async RVV batch dispatch, RVV watermark heartbeats + trueO((M/K)d)per-cell Voronoi CoW + Theorem 1 float64 outward rounding, float64 max-abs norm +taustratification + periodic survival re-probe + RVV reconnect replay, equal-versionv_hdata-before-heartbeat FIFO ordering + reconnect sink scoping +d=1/binary32 underflow guards, contiguous RVV holdback + idle-tail heartbeat flush +IdempotentRvvConsumercrash recovery, oldest-uncovered trickle heartbeats + pending-intent watermark guard + subnormal/maxCellSizehardening, bounded holdback gap-closure/resync + out-of-order match pending-intent guard +d=1/tau=1/subnormal boundary coverage, sequential per-stream WAL staging + two-sided holdback expiry coverage, atomic durable intake + ordinary-reconnect recovery + staggered-ACK checkpoint minimum +|S|=0version continuity, atomic per-stream consumer execution/recovery fencing + compacted replay floorV_floorresync gate + live secondary shadow-tail buffering,V_floor <= V_client < V_ckptexact> V_clientreplay fix + atomicS_healthyre-admission + batch-levelIdempotentRvvConsumerstaging, atomic overflowV_floor <= V_ckptreconciliation + receiversessionEpochfence + FIFO reconnect barrier, atomicV_floorphysical-retention compaction + replicated(V_floor, V_ckpt)+V_ckptadmission lower-pin, contiguousV_S = V_contigactive-gap reconnect handoff +streamExecutionFencespost-lock epoch/intent revalidation +maxHoldbackGap = 128forward-span verification, synchronous lower-pin durability point (CheckpointPinReplicator/applyReplicatedLowerPin) + reconnect uncovered heartbeat timer,V_enq/V_dispfrontier separation + ordered Phase-2 WAL execution (drainPendingBeforeLocked) + 2-backup partial lower-pin guard, ordered client ingress durable-admission barrier (OrderedIngressBarrier) + immediate promotionHB(V_enq)re-emission + overflowV_floor <= V_ckpt <= V_enq, per-streamgetTailSizeoccupancy invariant + multi-replica asymmetric lower-pin & durablet_0crash-boundary verification, Phase-2 execution-lock rechecks + backup-floorReplayFloorExceededExceptionresync abort + monotoneMath.minheartbeat timer anchor +probeCellsExactFLAT_SIMDlatch snapshot rebuild, fairsessionEpochLifecycleLockRWLock serialization + inherited holdback gap ageg_0visibility + CRC32FileBackedDurableDeliveryStorebatchedFileChannel.force(true)client-crash recovery, durable deferred covering-watermark advancement onPENDINGretirement + atomicimportBackupFloorLockedfloor/checkpoint/subscriber/timer transition + CRC32 WAL torn-append/unforced-record prefix recovery, shared durable replay frontierV_enq_durviaLowerPinAck+ atomic whole-frameOP_FRAME_BEGIN..OP_FRAME_COMMITWAL durability + multi-blocker stepwise zero-frame retirement, replay-to-live handoff gap closure aboveV_enq_dur+ holdback preservation for held acknowledged versions above an open gap on promotion + immutable admission match-set retention under intervening subscription churn +OP_COVERING_WMcrash-prefix hardening & integrated mid-frame WAL recovery, canonical cross-replica admission match-set replication (CanonicalAdmissionMatchReplicator) + server-sidesessionEpochACK fencing (staleSessionAcksRejectedCount) + global client WAL lock-order & Window-A Contracts S1/S2 verification + Algorithm 2M <= M_downlatch clearing + churn probe reset +(subscriptionGeneration, snapshotGeneration)rebuild guard + integrated 3-serverrf=2promotion/partial-frame-WAL/reconnect DUnit composition, Algorithm 2 NaN-safe first-sample EWMA init + probe-stat capture before burst reset + generation-checkedtripSurvivalGuardToFlatSimdpublication underwriteLock, explicitTailMutation.AdmissionMatchState { SPECULATIVE, CANONICAL }+getDurableCanonicalFrontier+finalizeSpeculativeOnPromotionLocked,OrderedIngressBarrierL1pre-OP_FRAME_COMMITWAL ordering & runtime-enforcedEffectHandlernon-reentrancy (assertNotReentrantFromEffectHandler), and generation-localRouterSnapshotsurvival/re-probe statistics (zero cross-generation contamination under stale paused routes andM == 0no-op) + monotoniccanonicalTermfencing (TermFencedCanonicalAdmissionMatchReplicator,CanonicalApplyOutcome) and promotion/reconnect/covering-HB publication guard for inherited canonical entries — ready to squash on upstream submission.)gradlew buildrun cleanly? (Verified:geode-lucene:spotlessCheck,:geode-lucene:checkPom,:geode-lucene:javadoc,:geode-lucene:test --rerun,:geode-lucene:distributedTest --tests "*ContinuousVectorRvv*DistributedTest*" --rerun, and:geode-lucene:integrationTest --tests "*AnalyzeLuceneSerializablesIntegrationTest*" --rerun.)Summary / Motivation
Continuous Query (CQ) in Apache Geode evaluates scalar predicates over incoming region mutations, but has no native mechanism for standing semantic similarity subscriptions (
cos(v, q_i) >= tau_i) over high-dimensional vector streams — nor a streaming failover delivery guarantee tied to Geode's Region Version Vectors (RVV).This PR introduces an adaptive continuous vector matching and RVV-monotonic dispatch subsystem in
org.apache.geode.cache.lucene.internal.vector.continuous:ChordalVoronoiRouter&VectorSubscription): Normalizes all finite non-zero float32 vectors (from all-subnormal vectors toFloat.MAX_VALUE) via direct binary32-to-binary64 widening before max-abs pre-scaling, and routes incoming vectors against standing cosine-similarity subscriptions by adaptively switching between direct linear scan (FLAT_SIMD) and Chordal Voronoi cell pruning (CHORDAL_VORONOI, using a closed-form crossover threshold with hysteresis to prevent mode oscillation). Supports heterogeneous-tauquantile stratification (thresholdStrata=4) so low-tauoutliers do not poison high-taucells, exposesgetMaxCellSize()telemetry onRouterTelemetry, and runs periodic survival-guardO(Kd)re-probing (survivalGuardReprobeInterval=4096,survivalGuardRecoveryMargin=0.10) to recoverCHORDAL_VORONOIafter workload regime shifts. Stage-1 pruning operates directly in inner-product space via precomputed float64 coupled cell thresholdss_k^min = 1 - (B_k^up)^2 / 2 - epsilon_dot(d)derived from Higham's IEEE-754 Theorem 3.1 plus the binary32 FTZ/subnormal underflow bound (d * 2^-126), eliminatingMath.sqrtfrom the hot path, safely guardingd == 1, empty clusters, and antipodal zero-sum centroids, and guaranteeing zero pruning-induced false negatives (FNR = 0relative to Stage-2 float32 scan) across all boundary dimensions (d in {1, 7, 8, 9, ..., 4096}) even attau_i = 1.0.V_floor, Live Secondary Shadow Tail & Atomic Per-Stream Consumer Fencing (RvvMonotonicVectorDispatcher,ContinuousVectorQueryService,RvvClientGate, &IdempotentRvvConsumer): Tracks per-(bucketId, memberId)RVV high-watermarks and monotonic compacted replay floorV_floor[b, m](advancing cleanly even during|S|=0empty intervals; immediately flaggingresyncRequiredif a connecting/rejoining client presentsV_client < V_floor), buffers replicated secondary vector mutations live via per-bucketBucketRegionshadow-tailCacheListeners so repeated hot-key overwrites never coalesce across failover, advancesV_ckptunconditionally tomin_{i in healthy} ack[i]across staggered multi-subscriber ACKs, enforces contiguous-version holdback sequencing (enforceContiguousVersions=true,maxHoldbackGap=128,maxHoldbackAgeMillis=5000,onNonMatchingBucketVersionfor destroys/invalidates/non-vector updates), provides age-bounded oldest-uncovered-mutation heartbeat flushing (flushIdleHeartbeats+ optional scheduler), gates live writes behind asynchronous tail replay during primary promotion, enforces equal-versionv_hdata-before-heartbeat ordering within atomic per-bucket serial FIFO batches, and providesIdempotentRvvConsumerwith single-lock atomic durable admission (v <= committedWatermark || isEffectApplied(id) || isPendingIntent(id)+stagePendingIntentIfAbsentinsidestreamStageLock, removing any unlockedRvvClientGatepre-check) plus strict per-stream execution/recovery fencing (streamExecutionFences, lock ordersorted execFences -> streamStageLock) serializing in-flight handlers against concurrent versions,recover(), andprepareForReconnect().Key Changes
Adaptive Continuous Vector Routing & Subnormal-Safe Normalization
VectorSubscription:subscriptionId,normalizedQueryVector,similarityThreshold, and derivedchordalTolerance.VectorSubscription.normalize(float[])widens binary32 inputs to binary64 ((double) v) prior to any DAZ/FTZ operation and applies unconditional max-abs pre-scaling in float64 (maxAbs,scaled = (double) v / maxAbs,normSq += scaled * scaled,invNorm = 1.0d / Math.sqrt(normSq)) so all finite non-zero float32 vectors including all-subnormal inputs (Float.MIN_VALUE,1e-19f,1e-30f) andFloat.MAX_VALUEnormalize with zero overflow/underflow.ChordalVoronoiRouter(org.apache.geode.cache.lucene.internal.vector.continuous):VectorSubscriptionregistrations with normalized query vectors and chordal tolerances, exposinggetMaxCellSize()(max_k m_k) on bothChordalVoronoiRouterandRouterTelemetry.FLAT_SIMDandCHORDAL_VORONOIrouting modes using closed-form crossoverM_critwith hysteresis band to eliminate thrashing.tauQuantile Stratification (thresholdStrata, default4): Automatically stratifies subscriptions into up tomin(thresholdStrata, K)quantiletau-bands whentauMax - tauMin >= 0.03fandK >= 4with proportionalKallocation per band, plus bound-aware incremental insert (minMemberThreshold/maxMemberThresholdonVoronoiCell) preferringtau-compatible cells so low-tauoutliers do not poison high-taucell bounds.d = 1/ Degenerate Centroid Safety:computeHighamDotEpsilon(int dim)explicitly includesdim * FLOAT32_UNDERFLOW_QUANTUM(dim * 2^-126) alongside2 * gamma_d + HIGHAM_DOT_SAFETY_FLOOR.buildSphericalVoronoiCellsandbuildSingleStratumVoronoiCellsguard empty bands,d = 1(K > |S^0|empty cluster collapse), and antipodal zero-sum centroids via deterministic fallback centroids (assignDeterministicFallbackCentroid), preserving zero pruning-induced FNR relative to the Stage-2 float32 scan across alld >= 1.B_k^up = max(||q_i - c_k||_2 + rho_i^up) + delta_norm(d)(including explicit float64 arithmetic margineta_f64(d) = 2 * gamma_{d+2}^f64 + 4 * u_f64viacomputeFloat64Eta(d), plus configurableuseCoupledBound(false)decoupled ablation toggle) and outward-rounded sqrt-free cosine thresholdss_k^min = Math.nextDown(1 - (B_k^up)^2 / 2 - epsilon_dot(d) - 8 * u_f64)(or-InfinitywhenB_k^up >= 2.0).O((M/K)d)per-cell copy-on-write live incremental add and remove inCHORDAL_VORONOImode: omits globalO(Md)flat arrays from VoronoiRouterSnapshots, maintainssubscriptionCellIndexfor O(1) cell lookup on remove, replaces only the single affectedVoronoiCell(retaining conservative cell bounds to preserve zero false negatives) with periodic spherical k-means compaction at 20% churn, and materializes flat SIMD arrays only on mode switch or survival-guard reversion.RouterSnapshot(survivalSampleCount,observedSurvivalEwmaBitsinitialized toDouble.NaN,flatRoutesSinceLastProbe,probeBurstLock/probeBurstCollected/probeBurstSurvivalSum, pluswithFreshStatistics(newSnapshotGeneration)forresetSurvivalGuard()and diagnosticgetSurvivalRateAtLastLatch()), withDEFAULT_SURVIVAL_EWMA_ALPHA = 0.10d,DEFAULT_SURVIVAL_GUARD_MIN_SAMPLES = 32, and configurablemaxVoronoiSurvivalRate(default0.85):routeNormalizedWithGenerationcaptures a singleRouterSnapshotand immediately returns empty onsnap.subscriptionCount == 0without touching any statistic;recordSurvivalObservationandmaybeRunSurvivalGuardProbewrite strictly to their capturedsnap's fields so a stale route paused after snapshot validation can never contaminate a newer generation's counters, EWMA, probe burst, or mode.computeMCritreturnsInteger.MAX_VALUEwheneverp_bar >= 1.0orp_bar >= maxVoronoiSurvivalRate, and sustained isotropic streams (p_bar_hat >= 0.85) automatically downgrade toFLAT_SIMDviatripSurvivalGuardToFlatSimd(expectedSnap)checkingcur == expectedSnap && cur.snapshotGeneration == expectedSnap.snapshotGeneration && cur.subscriptionGeneration == expectedSnap.subscriptionGenerationunderwriteLock. UnderwriteLock,addSubscription/addSubscriptions/removeSubscriptionincrement monotonicsubscriptionGeneration(paired withsnapshotGenerationon immutableRouterSnapshotand exposed via atomicrouteNormalizedWithGeneration(float[]) -> RoutingDecision) and callmaybeClearSurvivalLatchAtLowerThresholdLocked(subscriptions.size())->resetSurvivalGuardLocked()wheneverM <= M_down(orcount == 0) BEFORE mode evaluation and snapshot rebuild, while every freshRouterSnapshotstarts cleanly at(cs=0, ewma=NaN, cflat=0, probe=(0, 0.0)). When tripped aboveM_down, retainsprobeCellsand tracksprobeCellsExact, running a 16-sample (DEFAULT_SURVIVAL_GUARD_PROBE_BURST_SIZE = 16)O(Kd)re-probe burst everysurvivalGuardReprobeIntervalroutes (default4096,0disables) capturingpProbe = probeBurstSurvivalSum / probeBurstCollectedstrictly before resetting burst accumulators without alteringFLAT_SIMDresults and automatically restoringCHORDAL_VORONOIwhenp_probe <= maxVoronoiSurvivalRate - survivalGuardRecoveryMargin—checkingcurSnap == snap && curSnap.snapshotGeneration == snap.snapshotGenerationbefore acquiringwriteLock, re-verifyingsurvivalGuardTripped && cur == expectedSnap && cur.snapshotGeneration == expectedSnap.snapshotGeneration && cur.subscriptionGeneration == expectedSnap.subscriptionGenerationunderwriteLock, and rebuilding/publishing a freshRouterSnapshotcovering 100% of current membershipSwhenever!cur.probeCellsExact || churnSinceLastCluster > 0(tracked viasurvivalGuardRecoveryCount).RVV-Monotonic Failover, Compacted
V_floorGate, Live Secondary Shadow Tail & Atomic Per-Stream FencingRvvMonotonicVectorDispatcher,ContinuousVectorQueryService,ContinuousVectorEvent,ContinuousVectorEventSink, &RvvStreamKey:RvvStreamKey), bounded replay tail buffers, checkpoint compaction (ignoring regressive ACKs), and explicit tail-buffer overflow resync signals + overflow callbacks.V_floor[b, m]), Atomic Backup-Compaction Floor Import, Synchronous Lower-Pin Durability Point, Atomic Overflow/Compaction Retention & Live Secondary Shadow Tail: Enforces the exact physical-retention invariantV_floor == highest version physically removed by compaction/overflow(compactToFloor,compactUpToCheckpoint,applyReplicatedFloorAndCheckpoint,getReplayFloorVersion,getReplayFloorResyncCount,ReplayFloorResyncListener,recordReplicatedCheckpoint) undersubscriberRegistryLock -> state, removing ONLY<= targetwhile atomically advancingV_floor = targetin the SAMEsynchronizedstep (and replicatingV_flooralongsideV_ckptso every version in(V_floor, V_head]is guaranteed physically present intail). When overflow bumpsV_floor,reconcileOverflowLocked(zero fast-path overhead) atomically evicts every lagging subscriber withV_client[i] < V_floorintoresyncRequiredSubscribersByStream(isSubscriberResyncRequired,getResyncRequiredSubscribers) and recomputesV_ckpt = max(V_floor, min_{i in S_healthy'} V_client[i])(ormax(V_floor, V_enq)— neverV_recvwhen a gap is open — preserving(V_floor, V_head]whenS_healthy'is empty), keepingV_floor <= V_ckpt <= V_enqatomically across all transitions.admitSubscriberForContinuity(...),admitAndReplayForReconnect(...), and non-nullreplayUncheckpointedForReconnect(...)immediately flagresyncRequired(0partial replay, not enrolled) wheneverV_client < V_floor, and otherwise synchronously invokeCheckpointPinReplicator(setCheckpointPinReplicator->applyReplicatedLowerPin/applyReplicatedLowerPinOrThrowthrowing sanctionedReplayFloorExceededExceptionif any backup already compacted pastV_client) under(subscriberRegistryLock, state)strictly BEFORE committing local lower-pin enrollment (pinCheckpointForAdmittedSubscriber) or releasing any replay batches; onReplayFloorExceededException,importBackupFloorLockedatomically advancesV_floor = max(V_floor, importedFloor), compacts local tail<= V_floor, transitions EVERY subscriber< V_floor(both reconnecting and active healthy subscribers) intoRESYNC_REQUIRED, recomputesV_ckpt = min(V_enq, max(V_floor, minRemainingHealthyAck))(orV_enqif empty, preservingV_floor <= V_ckpt <= V_enq), and reconciles the uncovered heartbeat timer (clearing whenV_enq <= V_ckptor preserving the monotoneMath.minanchor otherwise), whileBucketState.ensureUncoveredHeartbeatTimerInitialized(getOldestUncoveredMutationTimeMs) enforces a strictly monotoneMath.min(existingOldest, anchorTs)timer anchor andemitPromotionWatermarksLockedimmediately enqueues coveringHB(V_enq)on promotion for every active stream withV_enq > V_ckpteven if arrivals stop. Wires per-bucketBucketRegionsecondary shadow-tailCacheListenerinsidecreatePartitionListener(afterRegionCreate/afterBucketCreated/afterSecondary) with hardened secondary member-ID fallback inextractFromEntryEvent, buffering replicated vector mutation versions live on secondaries so repeated overwrites to hot keys never suffer state-store coalescing loss on primary failover.|S|=0Continuity: AddsregisterSubscriberForCheckpoint,unregisterSubscriberForCheckpoint, andacknowledgeSubscriberCheckpointadvancingV_ckptunconditionally tomin_{i in healthy} ack[i]on idle tails and subscriber exit without regression, plus|S|=0empty-subscription version continuity (getLastDispatchedVersion,getNextExpectedVersion, and zero tail overflow across empty intervals).g_0& Bounded Gap-Closure (enforceContiguousVersions, defaulttrue): Holds out-of-orderregionVersion > nextExpectedentries inholdbackByMember(up tomaxHoldbackGap=128and ageDEFAULT_MAX_HOLDBACK_AGE_MILLIS=5000, configurable viasetMaxHoldbackAgeMillis), exposesgetHoldbackGapStartTimeMs(bucketId, memberId)andgetHoldbackGapAgeMillis(bucketId, memberId, nowMillis)preserving inherited open-gap ageg_0 = max(0, t_0 - gapStartMs)across lower-pin reconnect and promotion (exact Theorem 3(6) preconditiong_0 + Delta_tot < T_gap), and drains contiguous ready versions strictly in ascending order; exposesonNonMatchingBucketVersion(bucketId, memberId, regionVersion)wired intoContinuousVectorQueryService.createCacheListener(afterDestroy,afterInvalidate, null/non-vector updates).flushExpiredHoldbackGaps(...)(also integrated intoflushIdleHeartbeats/scheduler) deterministically closes stalled gaps exceedingmaxHoldbackGapormaxHoldbackAgeMillis, marksresyncRequiredStreams, notifiesHoldbackGapListener, incrementsholdbackGapClosedCount, and drains ready successors contiguously so a missing predecessor can never stall delivery indefinitely (while gaps repaired before expiry preserveresyncRequired=false).oldestUncoveredMutationTimeMsByMember(set only wheneventsSinceHeartbeattransitions0 -> 1and cleared on heartbeat reset) andlastDispatchedVersionByMember, firingflushIdleHeartbeats(long nowMillis, long maxAgeMillis)(andstartIdleHeartbeatScheduler/stopIdleHeartbeatScheduler) whenevereventsSinceHeartbeat > 0and(nowMillis - oldestUncoveredMs) >= maxAgeMillis, preventing heartbeat starvation under both idle tails and steady sub-interval zero-match trickles.(bucketId, memberId)RVV watermark heartbeats (ContinuousVectorEvent.watermarkHeartbeat(..., replayed)) periodically everyheartbeatIntervalEventsprimary mutations (default64, configurable,0disables) and at the end of primary-promotion and reconnect replays.v_hData-Before-Heartbeat Ordering & Serial Per-Bucket FIFO: When a mutation atv_hproduces both match events andemitHeartbeat == true,evaluateAndDispatchplaces all match events forv_hstrictly beforewatermarkHeartbeat(..., v_h)in one atomicPendingDispatchBatchenqueued ontoBucketState.pendingDispatchBatches. Both synchronous and multi-threaded async executors drain each bucket serially (dispatchDrainingCAS +drainOwnerThreadreentrancy guard) without concurrent overlapping sink dispatches.getReceivedHeadVersion(bucketId, memberId)(V_recv),getEnqueuedHeadVersion(bucketId, memberId)(V_enq, aliased bygetContiguousHeadVersion, strictlyMath.max(V_floor, nextExpected - 1)whenholdbackByMemberis non-empty — separated fromgetSinkDispatchedVersion(V_disp, updated strictly after sink delivery indispatchBatchToSinks) andgetPendingDispatchQueueSize(bucketId)so physical entries strictly aboveV_enqremain unconditionally bounded bymaxHoldbackGap = 128independent of async FIFO backlog),applyReplicatedFloorAndCheckpoint(capping delayed older checkpoints atmin_{s in S_healthy} ack[s]so a delayed checkpoint cannot overwrite a surviving backup's lower pin),LowerPinAck(bucketId, memberId, backupFloor, backupContiguousEnq)/AckCheckpointPinReplicator/applyReplicatedLowerPinWithAck(..., sessionEpoch)+ReconnectAdmissionResult(admitAndReplayForReconnectWithResult(..., sessionEpoch, ...)) computing shared durable replay frontierV_enq_dur = min(localContiguousEnq, min_{r in P(b)} V_enq^(r))across all promotable replicas while atomically enqueuing the full local contiguous suffix(Math.max(V_floor[b, m], clientHighWaterByMember[m]), V_enq^(local)]plus trailingHB(V_enq^(local))(including trailing non-matching versions whentailByMemberis empty) onto the per-bucket serial FIFO strictly beforeonReplayedUnderLockattaches live dispatch atV_enq^(local) + 1, server-sidesessionEpochACK fencing (advanceCheckpointWithEpoch,recordSubscriberAckWithEpoch,acknowledgeCheckpoint(b, m, ver, sessionEpoch),acknowledgeSubscriberCheckpoint(subId, b, m, ver, sessionEpoch),advanceClientSessionEpoch/advanceSubscriberSessionEpoch, propagated to backups viaapplyReplicatedLowerPinWithAckso delayed ACKs withsessionEpoch < currentClientSessionEpochare strictly rejected viastaleSessionAcksRejectedCount++without advancingV_ckptor compacting tail),replayTailOnPromotionLockedpreserving shadow-buffered entries strictly above an open gapvinsideholdbackByMemberwithnextExpectedVersion = v(plusonSecondaryNonMatchingBucketVersioninContinuousVectorQueryServicerecording secondaryafterDestroy/afterInvalidate/non-vector markers to prevent false holes), cross-replica canonical admission match-set agreement with monotoniccanonicalTermfencing & promotion/reconnect/covering-HB publication guard (INITIAL_CANONICAL_TERM = 1L,TailMutation.AdmissionMatchState { SPECULATIVE, CANONICAL },TailMutation.canonicalTerm,CanonicalMatchRecord.canonicalTerm, sanctionedCanonicalApplyOutcome,TermFencedCanonicalAdmissionMatchReplicator/CanonicalAdmissionMatchReplicatorinvoked on primary strictly before live dispatch/ACK, Rule 1BucketState.applyCanonicalAdmissionMatches+fenceCanonicalTerm+applyReplicatedCanonicalAdmissionMatches(..., long canonicalTerm)accepting incoming(matches, subGen, term)iff!existing.isCanonicalConfirmed() || term > existing.getCanonicalTerm()— overwriting stale lower-term canonical decisions, rejecting delayed strictly-lower-term deliveries viagetStaleCanonicalTermRejectedCount(), treating equal-term re-deliveries as idempotent no-ops, and staging reverse-order arrivals inpendingCanonicalMatchesByMemberwith the same higher-term precedence — and Rule 2beginPromotionTermadvancingcanonicalTerm/promotedPrimaryTermononPrimaryPromotion/completeAsyncPromotionpaired withfinalizeSpeculativeOnPromotionLocked,needsCanonicalPublicationLocked, andpublishBeforeReconnectExposureLockedreplicating BOTH newly finalized speculative entries AND inherited canonical entries withcanonicalTerm < promotedPrimaryTermas(matches, subGen, newTerm)to all surviving promotable backups strictly BEFORE dispatch, coveringHB, ordurableCanonicalFrontier[isDurablyCanonicalLocked] advancement, tracked viaspeculativeEntriesFinalizedOnPromotionCountandgetInheritedCanonicalRepublishedCount(), so live dispatch and multi-crash promoted-backup/reconnect replays reproduce identical canonical admission match tuples even underr=3, f=2chained failovers and adversarial subscription churn),admitAndReplayForReconnect(...), andreplayUncheckpointedForReconnect(int bucketId, Map<String, Long> clientHighWaterByMember[, ContinuousVectorEventSink targetSink, Runnable onReplayedUnderLock])undersynchronized (state)across all retained streamsm(both pre-crashm_Pand post-promotionm_S) onto the same per-bucket serial FIFO queue (PendingDispatchBatch.barrierAction/enqueueOrDispatchBarrierLocked, tracked viatotalReconnectReplaysHandled).RvvClientGate&IdempotentRvvConsumer:RvvClientGateenforces strictly monotonic per-(subscriptionId, bucketId, memberId)delivery across out-of-order and multi-subscription streams (tryAcceptandtryAcceptBatch), serializes concurrent callbacks on the same stream, advanceshighWaterVersionmonotonically on watermark heartbeats without invoking match listeners, enforces strict Theorem 3 Invariant 4 safe checkpoint bounds across all active subscriptions, exposesgetSafeHighWaterByMember(int bucketId)for slow-reconnect handoff, and documents its gate-delivery contract in Javadoc.IdempotentRvvConsumerkeys durable delivery strictly by(subscriptionId, bucketId, memberId, regionVersion)(EventDeliveryId), enforces a strictly acyclic global lock hierarchy acrossL1: OrderedIngressBarrier(standalone around ingress wait/advance, holding frame admission untilOP_FRAME_COMMIT+force(true)completes so covering heartbeatsprocessCoveringWatermarkcannot overtake an uncommitted frame, always released beforeL2..L5),L2: streamExecutionFences[subId|b|m](multi-fence pathsrecover/prepareForReconnectacquiring strictly in ascending lexicographic order viaacquireSortedExecutionFenceswithrecoverUnderFencesLockeddeferring un-held fences to the outer sorted re-acquisition loop, while single-streamdrainPendingBeforeLockedfilters strictly to(subId, b, m)),L3: sessionEpochLifecycleLocks[b](fairReentrantReadWriteLock:readLock()insideL2or standalone in Phase 1/heartbeat beforeL4;writeLock()strictly standalone inadvanceSessionEpoch/onSessionDisconnect/prepareForReconnectStep 1 before incrementingactiveSessionEpochByBucket[b]),L4: streamStageLocks[b|m], andL5: leaf locks(FileBackedDurableDeliveryStore.walLock,RvvClientGate.StreamState), explicitly documents AND runtime-enforces theEffectHandlernon-reentrancy contract viaassertNotReentrantFromEffectHandler()(rejecting re-entry intoL1..L5-acquiring consumer methods from insideeffectHandler.apply(...)withIllegalStateException), and explicitly documents Window A ContractsS1(idempotent sink keyed by(subId, b, m, v)) andS2(transactional sink atomically committing(effect, dedupKey=(subId, b, m, v))in one sink transaction). Phase-1 staging, heartbeat watermark commits, and Phase-2 execution (drainPendingBeforeLocked-> finalisStaleSessionEpoch&isAppliedOrRetiredLockedcheck ->effectHandler.apply->markEffectAppliedIfAbsent->forceAppliedAndWatermarkDurability()->markPendingCompleted+ committed watermark advance) all holdsessionEpochLifecycleLocks[bucketId].readLock(), proving zero old-session handler or heartbeat can execute after epoch transition even if paused immediately after its final epoch check. Persists per-(bucketId, memberId)highestReceivedCoveringWatermark(persistCoveringWatermark/OP_COVERING_WM = 6, forced on heartbeat receipt even when blocked behind aPENDINGintent) and enforcesV_client = min(max(completed, highestReceivedCoveringWatermark), lowestPendingVersion - 1)across all threeOP_COVERING_WM(v_h)crash-prefix classes (absent, torn/CRC-invalid truncated onopen(), and intact checksum-valid unforced recovered asW_covbut unconditionally capped by durablePENDINGblockers, withrecoverUnderFencesLockedcallingstore.forceAppliedAndWatermarkDurability()whenever non-pending watermark restoration advances from recoveredOP_COVERING_WMbefore emitting ACKs), advancing stepwise as each blockingPENDINGversion retires and reachingW_covupon retirement of the last blocker<= W_covwith zero additional server frames. Includes CRC32-framed append-onlyFileBackedDurableDeliveryStore([int payloadLen][int crc32][byte[] payload]with atomic whole-frameOP_FRAME_BEGIN = 7/OP_FRAME_COMMIT = 8brackets carryingexpectedPendingCountaroundstageBatchPhase1,open(Path)scanning longest CRC32-valid prefix and atomically truncating both partial/corrupt EOF bytes [getTruncatedTailBytesOnOpen()] and any incomplete multi-match frame lackingOP_FRAME_COMMITback toOP_FRAME_BEGIN[getIncompleteFramesTruncatedOnOpen()] viachannel.truncate+force(true),simulateCrashCloseWithoutFlush(),forcePendingDurability(),forceAppliedAndWatermarkDurability()) enforcing batched frame-levelFileChannel.force(true)boundaries (1PENDINGforce strictly before ingress release/callback;1APPLIEDforce strictly before retirement/watermark advance/ACK) acrossonEventBatch/processEventBatch/processOrderedFrameBatch, guaranteeing strictly ordered, zero-loss, zero-duplicate notifications/effects across ordinary connection loss and client crashes across all four admissible WAL prefixes.New Unit & Distributed Chaos Tests (96 Unit + 25 Failover DUnit)
ChordalVoronoiRouterTest(24 tests): zero-FNR verification across thousands of random and boundary vectors, unconditional max-abs float64 widening/normalization across all-subnormal/extreme vectors (Float.MIN_VALUE,1e-19f,1e-30f,Float.MAX_VALUE) +d=1/tau=1.0+ boundaryd in {1, 7, 8, 9}+ exactdot == tauthreshold equality +getMaxCellSize()telemetry withFNR == 0, heterogeneous-tauquantile stratification + bound-aware incremental insert outlier isolation withFNR == 0, periodic survival-guard 16-sampleO(Kd)re-probe restoringCHORDAL_VORONOIafter isotropic-to-clustered regime shift withFNR == 0, subscription add/remove duringFLAT_SIMDlatch aboveM_downtriggering atomicRouterSnapshotrebuild on Voronoi re-entry (probeCellsExact) with100%recall of new subs,0stale removed subs, and0FNR (subscriptionAddAndRemoveDuringFlatSimdLatchRebuildsSnapshotOnVoronoiReentryWithZeroFnrAndZeroStaleMatches), Algorithm 2 latch clearing atM <= M_down, unconditional probe burst reset on churn, and(subscriptionGeneration, snapshotGeneration)stale re-probe rebuild rejection underwriteLock(survivalLatchClearsAtLowerSwitchThresholdResetsProbeOnChurnAndRejectsStaleReprobeRebuild), NaN-safe first-sample EWMA initialization after reset and stale-snapshot route rejection against latching a newer snapshot underwriteLock(resetToLatchEwmaInitAndStaleSnapshotRouteCannotLatchNewerSnapshot, assertingg+1starts fresh at(0, NaN)and requires its own 32 samples), stale route paused strictly after snapshot validation (afterSnapshotValidationHookForTest) across subscription churn unable to contaminate newer generationsnap'counters/EWMA/probe burst/mode on BOTHCHORDAL_VORONOIEWMA/latch (32nd sample) andFLAT_SIMDre-probe paths plusM == 0no-op (staleRoutePausedAfterValidationCannotContaminateNewGenerationCountersOrEwma),d == 1cluster collapse + antipodal zero-sum centroid fallback +(1,1)attau=1.0zero pruning FNR + binary32 underflow boundd * 2^-126, sqrt-free Higham cosine bound adversarial verification atx == c_k == q_iwithtau_i in {1.0, 1 - 1e-7, 0.9999}acrossd in {128, 1536, 4096}, Theorem 1eta_f64(d)+8 * u_f64+Math.nextDownoutward rounding verification nearB_k^up >= 2.0and antipodal pairs withtau = 1.0, trueO((M/K)d)per-cell CoW verification, coupledB_k^upvs decoupledR_k + rho_k^maxtightness, incremental removal until 20% churn,computeMCritsurvival-ceiling handling, online EWMA survival-rate guard reversion toFLAT_SIMD, 4096-D safety epsilon, high-selectivity pruning efficiency, closed-formM_crit+ hysteresis anti-oscillation, live add/remove/recluster safety, and invalid input rejection.RvvMonotonicVectorDispatcherTest(72 tests): failover replay exactly-once monotonic delivery, out-of-order holdback ordering65,66strictly behind delayed64+ non-vector destroy/gap without drops, temporary predecessor gap repaired before expiry preserving contiguous delivery without resync, delayed predecessor exceedingmaxHoldbackAgeMillisclosing gap + emittingHoldbackGapListenerresync notification + unblocking zero-match checkpoints, exactDEFAULT_MAX_HOLDBACK_GAP = 128forward-span bound (127 <= 128buffered vs129 > 128closing gap) + delayed hole/continuing arrivals/age trigger nearC_tail, inherited open-gap ageg_0 = 4,900 msnearT_gap = 5,000 msacross lower-pin reconnect and async promotion (4,950 < 5,000 ms->0resync vs5,000 >= 5,000 ms-> deterministicMAX_HOLDBACK_AGE_EXCEEDED,inheritedHoldbackGapAgeNearExpiryAcrossLowerPinAndPromotion), active holdback gap (65held behind missing64)V_S = V_enq = 63reconnect handoff + concurrent arrival + simulated crash during lower-pin admission, delayed FIFO (200undispatched queued batches) + newly opened gap separatingV_enqvsV_dispfrontiers nearC_tail, ordered client ingress barrier preventing later matchv=4and coveringHB(4)from overtaking paused pre-streamStageLockv=3+ clean disconnect rejection on pre-stage crash, delayed frame admission paused beforeOP_FRAME_COMMIT+force(true)blocking coveringHB(10)viaL1, crash truncation (pending=0, applied=27, W_cov=9, V_client=9), reconnect replay + pre-APPLIEDcrash recovery (pending=0, applied=30, W_cov=10, V_client=10, ACK(10)), and runtimeEffectHandlerreentrancy rejection (delayedFrameAdmissionFollowedByCoveringHeartbeatCrashAndReconnectPreservesWalOrdering), Phase-2 execution-lock rechecks ofisAppliedOrRetiredLockedandisStaleSessionEpochafterOrderedIngressBarrierrelease (phase2ExecutionLockRechecksAppliedRetiredAndSessionEpochAfterIngressBarrierRelease), fairsessionEpochLifecycleLockRWLock serialization with old Phase-2 worker and old heartbeat worker paused strictly AFTER finalisStaleSessionEpochcheck and BEFORE handler/watermark commit (sessionEpochBumpSerializesWithPhase2WorkerPausedAfterFinalEpochCheckBeforeHandler,sessionEpochBumpSerializesWithHeartbeatWorkerPausedAfterFinalEpochCheckBeforeCommit, zero post-bump execution, zero deadlock), CRC32FileBackedDurableDeliveryStorebatchedFileChannel.force(true)client-crash recovery (M = 32subs/frame =32tuples/force) across BOTH Window A (afterPENDINGforce, mid-batch beforeAPPLIEDforce) and Window B (afterAPPLIEDforce, before retirement/ACK + server replay) yielding192/192exact tuples with0post-Window-B duplicates (fileBackedBatchedWalClientCrashRecoveryAcrossWindowAAndWindowB), Window-A crash recovery with proper-prefix validOP_APPLIED(sub-1)and tornOP_APPLIED(sub-2)preserving exact-once external state under both ContractsS1andS2(windowACrashRecoveryWithProperPrefixValidAppliedAndTornAppliedPreservesExactOnceUnderContractsS1AndS2), cross-subscription concurrent predecessor drains +recover()+prepareForReconnect(0)maintaining strict global lock order with zero deadlock (crossSubscriptionConcurrentPredecessorDrainAndRecoverMaintainsStrictLockOrderWithoutDeadlock), server-side stalesessionEpochACK rejection after reconnect lower-pin on both primary and promoted backup (staleSessionEpochAckRejectedAfterReconnectLowerPinOnPrimaryAndPromotedBackup), canonical admission match-set replication from primary to backup under both adversarial churn and reverse arrival order (canonicalAdmissionMatchSetReplicatesFromPrimaryToBackupUnderAdversarialChurnSchedule), partial canonical-publication crash promoting unconfirmedSPECULATIVEbackupB2with in-place finalization toCANONICAL+ reverse arrival + partial lower-pin epoch (partialCanonicalPublicationCrashPromotesUnconfirmedBackupAndHandlesReverseArrivalAndPartialLowerPinEpoch),r=3, f=2monotoniccanonicalTermfencing whereB2promotes first (term 2), derivesC2 != C1, overwritesB1's stale term-1C1, rejects delayed(C1, term=1), crashes, andB1promotes (term 3) replaying strictlyC2(canonicalTermFencingB2PromotesFirstOverwritesStaleC1RejectsDelayedOldTermAndSecondCrashReplaysC2),r=3, f=2promotion publication guard whereB1promotes first (term 2), replicates inherited(C1, term=2)toB2strictly beforeD6, coveringHB6, anddurableCanonicalFrontieradvancing past5, rejects delayed(C1, term=1), crashes, andB2promotes (term 3) replaying strictlyC1(publicationGuardB1PromotesFirstReplicatesInheritedC1BeforeExposureAndSecondCrashReplaysC1), durable deferredhighestReceivedCoveringWatermark(HB(8)blocked behindPENDING v=5) advancingV_clientto8and emittingACK(8)immediately onPENDINGretirement with zero additional server frames across normal execution and WAL Windows A & B (deferredCoveringHeartbeatAdvancesClientWatermarkAndEmitsAckOnPendingRetirementWithoutNewFrames), multiple blockingPENDINGversions{5, 7}underW_cov = 8advancing stepwise (4 -> 6 -> 8) and emittingACK(6)/ACK(8)across normal retirement and mixed Window B + Window A WAL recovery with zero new server frames (multipleBlockingPendingVersionsStepwiseAdvanceWatermarkToCoveringWithZeroNewFrames), atomic backup-compaction floor-import transition updatingV_floor <= V_ckpt <= V_enq, evicting< V_floorsubscribers (including active healthy ones), and reconciling the heartbeat timer (backupCompactionFloorImportAtomicallyUpdatesFloorCheckpointSubscribersAndHeartbeatTimer), shared durable replay frontierV_enq_durexcludingB1-only unacked version65across a post-lower-pin-ACK pre-dispatch two-crash schedule AND verifying survivingB1(durableReplayFrontier=64,localContiguousEnq=65) delivers64, 65, 66contiguously with zero skip (durableReplayFrontierExcludesPrimaryOnlyUnackedVersionAcrossTwoCrashSchedule), held acknowledged version above an open gap draining in strict ascending order after reconnect on both survivingB1and promotedB2(heldAcknowledgedVersionAboveOpenGapDrainsInOrderAfterReconnectOnPrimaryAndPromotedBackup), promoted-backup & reconnect replay reproducing exact admission match sets across intervening subscription churn rounds (promotedBackupReplayPreservesExactAdmissionMatchSetUnderInterveningSubscriptionChurn), integrated mid-frame client crash & reconnect acrossINTACT_UNFORCED,TORN, andABSENTOP_COVERING_WM(12)variants reconciling ACK-time oracle, recovered WAL, committed idempotent sink effects, and finalACK(12)(integratedMidFrameClientCrashAndReconnectWithCoveringWatermarkReconcilesAllOracles), atomic whole-frameOP_FRAME_BEGIN..OP_FRAME_COMMITWAL truncation of incomplete multi-match frames replaying all 3 subscriptions fromV_client = 9toACK(10)(atomicWholeFrameWalTruncatesIncompleteMultiMatchFrameAndReplaysAllSubsToAck), CRC32 WAL recovery over complete unforcedPENDINGrecords, torn partialPENDINGappends + bit-flipped CRC corruption, and torn partialAPPLIEDappends (fileBackedWalRecoveryHandlesCompleteUnforcedRecordsTornPendingAndTornAppliedAppends), primary crash strictly between count-triggeredHB(4)enqueue and wire dispatch immediately re-emittingHB(4)on promotion even when arrivals stop, reconnect against lower-floor primary aborting cleanly toRESYNC_REQUIREDviaReplayFloorExceededExceptionwhen backup already compacted pastV_client(reconnectAgainstLowerFloorPrimaryAbortsToResyncRequiredWhenBackupAlreadyCompactedPastClient), pre-t_0partial-replication crash across 2 backupsB1/B2promoting both in turn with arrivals stopped (preT0PartialReplicationCrashAcrossTwoBackupsPromotesB1AndB2InTurnWithArrivalsStopped), disjoint pre-t_0holdbacks merged on promotion under universal union boundU_0 + arrivals < C_tail+ strictly monotoneMath.minheartbeat timer anchor across repeated reconnects (disjointPreT0HoldbacksPromotionMergeAndReconnectPreserveUnionCapacityBoundAndMonotoneHeartbeatTimer), multi-replica asymmetric tail occupancy after partial lower-pin (|tail_{B2}(t_0)|=24 > |tail_P|=|tail_{B1}|=21,31 < C_tail=32) promoting largest replicaB2with zero overflow, primary crash on both sides of durable replication boundaryt_0with arrivals stopped, old-session staged batch pausing beforestreamExecutionFencesrejected after disconnect or reconnect recovery, ordered Phase-2 execution draining earlier pending intents ([1, 2, 3, 4]and[1..6]acrossprepareForReconnect) when later stagedv+1races intostreamExecutionFences, 2-backup partial lower-pin crash window (B1pinned63,B2at64compacted or uncompacted, plus delayed(60, 64)checkpoint guard) guaranteeing zero silent skip for every promotable survivor, synchronous lower-pin durability point exercising BOTH crash sides +oldestUncoveredMutationTimeMsinitialization & idle heartbeat flush across reconnect, staggered ACKs from multiple healthy subscribers advancingV_ckptto exactmin_i ack[i]on idle tails,|S|=0empty-subscription version continuity with zero tail overflow, subscriber rejoin below compactedV_floorimmediately flaggingresyncRequired,V_floor <= V_client < V_ckptexact> V_clientreplay (V_floor=60, V_client=63, V_ckpt=64-> replays[64..70]with atomicS_healthypin +V_client=59-> immediateresyncRequired), atomic tail overflow reconciliation evicting lagging subscribers< V_floorand preservingV_floor <= V_ckpt <= V_enqfor both non-empty and emptyS_healthy'(including open-gap empty-registry checkV_recv=13, V_enq=8, V_ckpt=8, V_floor=4), receiversessionEpochfence rejecting stale covering heartbeats after disconnect between match batch and heartbeat, idle heartbeat + floor-to-checkpoint reconnect nearC_tail - 1advancingV_ckpt >= v_0with zero overflow, post-compaction< V_floorresync vs uncompactedV_floor <= V_client < V_ckptadmission lower-pinningV_ckptacross promotion near capacity with concurrent heartbeat, multi-subscription (sub-A/sub-B) repeated-key promotion + delayed match pinned below coveringHB(63)+ lagging reconnect, promotion + slow consumer + pending checkpoint atC_tail - 1vsC_tail + 1(C_tail=64andDEFAULT_MAX_TAIL_PER_STREAM=100,000), repeated-key failover preserving every per-version(b, m, v)notification without coalescing loss, timed idle-tail heartbeat flush advancingV_ckptafter 63 zero-match mutations, steady zero-match trickle (40 msinterval) firing age-bounded heartbeats without starvation,IdempotentRvvConsumercrash-injection, ordinary-reconnect per-stream execution/recovery fencing, and durability boundary verification (BEFORE_DURABLE_PENDING_STAGE,AFTER_WATERMARK_PERSIST_BEFORE_EFFECT,AFTER_EFFECT_BEFORE_WATERMARK_COMMIT, connection loss after durablePENDINGstaging before effect retires, out-of-order match commit pending-intent guard, delayedPENDINGintent blocking later matches and heartbeats through restart recovery), slow client reconnect replaying both pre-crashm_Pand post-promotionm_Sretained streams with trailing heartbeats under concurrency, match-on-mutation-64 (v_h) delivering matches strictly beforev_hwatermark while advancing 0%-match client watermark, slow reconnect with 4-thread async executor + concurrent livem_Swrites + two clients atV_client_A != V_client_B, healthy 0%-match subscriber advancingV_ckptacross5 * maxTailwrites + failover replay via periodic & promotion RVV watermark heartbeats with 0 tail overflows and 0 spurious match callbacks, async replay barrier gating live writes, coalescedonEventBatch+ async per-bucket serial FIFO dispatch preserving strict RVV monotonicity across live writes & primary failover, concurrenttryAcceptcallback serialization, client gate multi-subscription ordering, checkpoint compaction + regressive ACK handling, unsubscription gate cleanup + tail compaction, tail-buffer overflow resync signaling, and service facade lifecycle/telemetry (getTailSize).ContinuousVectorRvvFailoverDistributedTest(20 tests) +ContinuousVectorRvvFloorImportDistributedTest(5 tests, 25 DUnit total): kills the primary server mid-ingestion on a real Geode cluster withenforceContiguousVersions=true, realafterDestroynon-matching version tracking, matching subscriptions, and a healthy 0%-match orthogonal subscriber, slow reconnect after primary kill with concurrent post-promotionm_Swrites, slow reconnect with 4-thread async executor + two clients + exact mutation GEODE-649: add more logging to see the reason of future failure. #64 boundary, steady-trickle + idle-tail age-bounded heartbeat flush advancing checkpoints across the cluster, two-phase holdback gap behavior (repaired before expiry vs exceedingmaxHoldbackAgeMillis), connection loss after durablePENDINGstaging before effect retires, staggered multi-subscriber ACKs +|S|=0empty-subscription interval continuity across the cluster, ordinary reconnect fencing an in-flight handler against duplicate admission/overlap, 3-server promotion atC_tail - 1(0 resync) vsC_tail + 1overflow + rejoin belowV_floorimmediate rejection, 3-server repeated-key livekill -9failover delivering exact 32/32 per-version(b, m, v)notifications across 4 hot keys, 3-server reconnect betweenV_floorandV_ckptreplaying intermediate versions +< V_floorimmediate resync, 3-server multi-subscription (sub-A/sub-B) repeated-keykill -9promotion + delayed match pinned below coveringHB(63)+ lagging reconnect delivering152/152(subId, b, m, v)effects with 0 misses/duplicates/resyncs, 3-server disconnect between match batch and covering heartbeat rejecting stale-session heartbeats, 3-server idle heartbeat + floor-to-checkpoint reconnect nearC_tail - 1+ atomic overflow subscriber eviction, 3-serverkill -9reconnect after compaction (V_client=63 < V_floor=64->resyncRequired) vs uncompactedV_floor=60 <= V_client=63 < V_ckpt=64nearC_tail - 1 = 31with concurrent heartbeat +compactUpToCheckpointdelivering91/91versions, 3-server active-gapV_S = V_enqreconnect + live primarykill -9during lower-pin admission + delayed-hole continuing-arrivalsmaxHoldbackAgeMillisage trigger nearC_tail=32, 3-serverkill -9verification of BOTH sides of the lower-pin durability point (pre-durability compaction ->resyncRequiredvs post-durability replication -> lossless[64..68]replay) plusoldestUncoveredMutationTimeMsidle heartbeat flush across reconnect, 3-serverkill -9crash strictly between count-triggeredHB(4)enqueue and wire dispatch proving promoted backup immediately re-emitsHB(4)even when arrivals stop, 3-serverrf = 2livekill -9verification of both durablet_0replication-boundary crash sides + asymmetric partial lower-pin promotion of largest-occupancy backupB2, 3-serverrf = 2verification of backup-floorRESYNC_REQUIREDabort (primary floor60vs backup compacted64,V_client = 63->0events released) plus pre-t_0partial replication across two backups promoting both in turn with arrivals stopped (partialBackupCompactionResyncAndPreT0TwoBackupPartialReplicationAcrossCluster), 3-serverrf = 2cross-JVM atomic backup-compaction floor-import verification (ContinuousVectorRvvFloorImportDistributedTest.backupCompactionFloorImportAcrossTwoSurvivingReplicasPreservesFloorCheckpointAndSubscribers), 3-serverrf = 2post-lower-pin-ACK pre-dispatch primary crash verifying shared durable replay frontierV_enq_dur = 64(excludingB1-only unacked65) replayed losslessly on promotedB2with0resync (ContinuousVectorRvvFloorImportDistributedTest.postLowerPinAckPreDispatchPrimaryCrashReplaysSharedDurableFrontierOnSurvivingBackup), 3-serverrf = 2failover with interveningunregisterSubscription("sub-old")+registerSubscription("sub-new")before primary crash verifying promoted-backup replay reproduces exact admission match sets (ContinuousVectorRvvFloorImportDistributedTest.promotedBackupReplayReproducesExactAdmissionMatchSetUnderInterveningSubscriptionChurn), 3-serverrf = 2adversarial cross-replica subscription churn pausing primaryPafter backups speculatively capture{sub-persist, sub-old}forv=6, committingunregister("sub-old")+register("sub-new")cluster-wide, replicating canonical{sub-persist, sub-new}(geng1) before dispatch/ACK, crashingP, and verifying promotedB1replays exact{sub-persist, sub-old}forv=1..5and{sub-persist, sub-new}forv=6(ContinuousVectorRvvFloorImportDistributedTest.crossReplicaCanonicalAdmissionMatchesAgreeUnderAdversarialSubscriptionChurnAndPrimaryCrash), and 3-serverrf = 2integrated composition test combining primary crash + promotion, multi-sub mid-frame file-backed WAL client crash under ContractS2(1 Window-A retry deduplicated), reconnect insessionEpoch=2rejecting staleepoch=1ACK(12)(staleSessionAcksRejectedCount=1), and coveringHB(12)advancingV_ckpt=12, V_floor=12, tailSize=0with exact30/30oracle == WAL == S2 sink == promotedB1agreement (ContinuousVectorRvvFloorImportDistributedTest.integratedPromotionPartialFrameClientCrashReconnectAndCoveringWatermarkTest).Backward Compatibility & Serialization Notes
+27227 / -0across 14 files) underorg.apache.geode.cache.lucene.internal.vector.continuousandsanctioned-geode-lucene-serializables.txt. Zero existing production classes are modified.ChordalVoronoiRouter$RoutingMode,ContinuousVectorEvent(includingheartbeat:boolean),IdempotentRvvConsumer$CrashPhase,RvvMonotonicVectorDispatcher$CanonicalApplyOutcome,RvvMonotonicVectorDispatcher$ReplayFloorExceededException,RvvMonotonicVectorDispatcher$TailMutation$AdmissionMatchState,RvvStreamKey, andVectorSubscriptioninsanctioned-geode-lucene-serializables.txt, verified viaAnalyzeLuceneSerializablesIntegrationTest(6/6 PASS).Exact Gradle Verification Commands & Pass Counts
:geode-lucene:test --rerunChordalVoronoiRouterTest24/24,RvvMonotonicVectorDispatcherTest72/72)ContinuousVectorRvv*DistributedTest(Failover20/20 +FloorImport5/5)AnalyzeLuceneSerializablesIntegrationTest:geode-lucene:spotlessCheck,:checkPom,:javadoc