Skip to content

GEODE-vector-pr4: Adaptive Chordal Voronoi Continuous Vector Listener with RVV Monotonicity - #8157

Draft
gouthamaenugu wants to merge 15 commits into
apache:developfrom
gouthamaenugu:feature/GEODE-vector-pr4-rvv-listener
Draft

gouthamaenugu wants to merge 15 commits into
apache:developfrom
gouthamaenugu:feature/GEODE-vector-pr4-rvv-listener

Conversation

@gouthamaenugu

@gouthamaenugu gouthamaenugu commented Nov 24, 2026 •

Copy link
Copy Markdown

PR 4: Adaptive Chordal Voronoi Continuous Vector Listener with RVV Monotonicity

  • Draft PR: #8157
  • Branch: feature/GEODE-vector-pr4-rvv-listener
  • Base: develop (46643af515)
  • Head Commit: d00c27af63ae414b1f157190825a3f8d665d4c94 (13 files changed, +13775 / -0)
  • Module: geode-lucene (Apache Geode 2.1, bundled Apache Lucene 9.12.3)

For all changes, please confirm:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? (Draft PR ready for upstream GEODE-* JIRA ticket assignment and commit prefix update.)
  • Has your PR been rebased against the latest commit within the target branch (typically develop)?
  • Is your initial contribution a single, squashed commit? (Currently 15 clean logical commits — feature implementation, review hardening, Higham sqrt-free cosine pruning, incremental O(|V_k|) Voronoi removal, online survival-rate SIMD guard + coalesced async RVV batch dispatch, RVV watermark heartbeats + true O((M/K)d) per-cell Voronoi CoW + Theorem 1 float64 outward rounding, float64 max-abs norm + tau stratification + periodic survival re-probe + RVV reconnect replay, equal-version v_h data-before-heartbeat FIFO ordering + reconnect sink scoping + d=1/binary32 underflow guards, contiguous RVV holdback + idle-tail heartbeat flush + IdempotentRvvConsumer crash recovery, oldest-uncovered trickle heartbeats + pending-intent watermark guard + subnormal/maxCellSize hardening, 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|=0 version continuity, atomic per-stream consumer execution/recovery fencing + compacted replay floor V_floor resync gate + live secondary shadow-tail buffering, and V_floor <= V_client < V_ckpt exact > V_client replay fix + atomic S_healthy re-admission + batch-level IdempotentRvvConsumer staging — ready to squash on upstream submission.)
  • Does gradlew build run cleanly? (Verified :geode-lucene:spotlessCheck, :geode-lucene:checkPom, :geode-lucene:javadoc, :geode-lucene:test --rerun, :geode-lucene:distributedTest --tests "*ContinuousVectorRvvFailoverDistributedTest*" --rerun, and :geode-lucene:integrationTest --tests "*AnalyzeLuceneSerializablesIntegrationTest*" --rerun.)
  • Have you written or updated unit tests to verify your changes? (52 new unit tests across 2 JUnit suites + 12 multi-node failover chaos DUnit tests.)
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0? (No new external dependencies added; uses Geode 2.1's standard libraries.)

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:

  1. Zero-Pruning-FNR Adaptive Routing (ChordalVoronoiRouter & VectorSubscription): Normalizes all finite non-zero float32 vectors (from all-subnormal vectors to Float.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-tau quantile stratification (thresholdStrata=4) so low-tau outliers do not poison high-tau cells, exposes getMaxCellSize() telemetry on RouterTelemetry, and runs periodic survival-guard O(Kd) re-probing (survivalGuardReprobeInterval=4096, survivalGuardRecoveryMargin=0.10) to recover CHORDAL_VORONOI after workload regime shifts. Stage-1 pruning operates directly in inner-product space via precomputed float64 coupled cell thresholds s_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), eliminating Math.sqrt from the hot path, safely guarding d == 1, empty clusters, and antipodal zero-sum centroids, and guaranteeing zero pruning-induced false negatives (FNR = 0 relative to Stage-2 float32 scan) across all boundary dimensions (d in {1, 7, 8, 9, ..., 4096}) even at tau_i = 1.0.
  2. RVV-Monotonic Failover, Compacted Replay Floor 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 floor V_floor[b, m] (advancing cleanly even during |S|=0 empty intervals; immediately flagging resyncRequired if a connecting/rejoining client presents V_client < V_floor), buffers replicated secondary vector mutations live via per-bucket BucketRegion shadow-tail CacheListeners so repeated hot-key overwrites never coalesce across failover, advances V_ckpt unconditionally to min_{i in healthy} ack[i] across staggered multi-subscriber ACKs, enforces contiguous-version holdback sequencing (enforceContiguousVersions=true, maxHoldbackGap=128, maxHoldbackAgeMillis=5000, onNonMatchingBucketVersion for 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-version v_h data-before-heartbeat ordering within atomic per-bucket serial FIFO batches, and provides IdempotentRvvConsumer with single-lock atomic durable admission (v <= committedWatermark || isEffectApplied(id) || isPendingIntent(id) + stagePendingIntentIfAbsent inside streamStageLock, removing any unlocked RvvClientGate pre-check) plus strict per-stream execution/recovery fencing (streamExecutionFences, lock order sorted execFences -> streamStageLock) serializing in-flight handlers against concurrent versions, recover(), and prepareForReconnect().

Key Changes

Adaptive Continuous Vector Routing & Subnormal-Safe Normalization

  • VectorSubscription:
    • Immutable subscription descriptor storing subscriptionId, normalizedQueryVector, similarityThreshold, and derived chordalTolerance.
    • 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) and Float.MAX_VALUE normalize with zero overflow/underflow.
  • ChordalVoronoiRouter (org.apache.geode.cache.lucene.internal.vector.continuous):
    • Maintains standing VectorSubscription registrations with normalized query vectors and chordal tolerances, exposing getMaxCellSize() (max_k m_k) on both ChordalVoronoiRouter and RouterTelemetry.
    • Dynamically transitions between FLAT_SIMD and CHORDAL_VORONOI routing modes using closed-form crossover M_crit with hysteresis band to eliminate thrashing.
    • Heterogeneous-tau Quantile Stratification (thresholdStrata, default 4): Automatically stratifies subscriptions into up to min(thresholdStrata, K) quantile tau-bands when tauMax - tauMin >= 0.03f and K >= 4 with proportional K allocation per band, plus bound-aware incremental insert (minMemberThreshold / maxMemberThreshold on VoronoiCell) preferring tau-compatible cells so low-tau outliers do not poison high-tau cell bounds.
    • Theorem 1 Underflow & d = 1 / Degenerate Centroid Safety: computeHighamDotEpsilon(int dim) explicitly includes dim * FLOAT32_UNDERFLOW_QUANTUM (dim * 2^-126) alongside 2 * gamma_d + HIGHAM_DOT_SAFETY_FLOOR. buildSphericalVoronoiCells and buildSingleStratumVoronoiCells guard 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 all d >= 1.
    • Precomputes float64 coupled cell bounds B_k^up = max(||q_i - c_k||_2 + rho_i^up) + delta_norm(d) (including explicit float64 arithmetic margin eta_f64(d) = 2 * gamma_{d+2}^f64 + 4 * u_f64 via computeFloat64Eta(d), plus configurable useCoupledBound(false) decoupled ablation toggle) and outward-rounded sqrt-free cosine thresholds s_k^min = Math.nextDown(1 - (B_k^up)^2 / 2 - epsilon_dot(d) - 8 * u_f64) (or -Infinity when B_k^up >= 2.0).
    • Supports true O((M/K)d) per-cell copy-on-write live incremental add and remove in CHORDAL_VORONOI mode: omits global O(Md) flat arrays from Voronoi RouterSnapshots, maintains subscriptionCellIndex for O(1) cell lookup on remove, replaces only the single affected VoronoiCell (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.
    • Tracks online empirical survival rate (observedSurvivalRate EWMA) with configurable maxVoronoiSurvivalRate (default 0.85): computeMCrit returns Integer.MAX_VALUE whenever p_bar >= 1.0 or p_bar >= maxVoronoiSurvivalRate, and sustained isotropic streams (p_bar_hat >= 0.85) automatically downgrade to FLAT_SIMD. When tripped, retains probeCells on RouterSnapshot and runs a 16-sample (DEFAULT_SURVIVAL_GUARD_PROBE_BURST_SIZE = 16) O(Kd) re-probe burst every survivalGuardReprobeInterval routes (default 4096, 0 disables) without altering FLAT_SIMD results, automatically restoring CHORDAL_VORONOI when p_probe <= maxVoronoiSurvivalRate - survivalGuardRecoveryMargin (default margin 0.10, tracked via survivalGuardRecoveryCount).

RVV-Monotonic Failover, Compacted V_floor Gate, Live Secondary Shadow Tail & Atomic Per-Stream Fencing

  • RvvMonotonicVectorDispatcher, ContinuousVectorQueryService, ContinuousVectorEvent, ContinuousVectorEventSink, & RvvStreamKey:
    • Coordinates per-bucket RVV sequence tracking (RvvStreamKey), bounded replay tail buffers, checkpoint compaction (ignoring regressive ACKs), and explicit tail-buffer overflow resync signals + overflow callbacks.
    • Monotonic Compacted Replay Floor (V_floor[b, m]), Atomic S_healthy Re-Admission & Live Secondary Shadow Tail: Tracks V_floor[b, m] <= V_ckpt[b, m] (getReplayFloorVersion, getReplayFloorResyncCount, ReplayFloorResyncListener, recordReplicatedCheckpoint) advancing monotonically on advanceCheckpoint (including empty |S_healthy| == 0 && |S| == 0 intervals via unregisterSubscriberForCheckpoint) and tail overflow eviction; admitSubscriberForContinuity(...), admitAndReplayForReconnect(...) (lock order subscriberRegistryLock -> state), and non-null replayUncheckpointedForReconnect(...) immediately flag resyncRequired (0 partial replay, not enrolled) whenever V_client < V_floor, and otherwise atomically pin subscriberId in S_healthy at V_client (so concurrent faster ACKs cannot push V_floor past V_client) and replay strictly over (Math.max(V_floor[b, m], V_client[m]), V_S[b, m]] (> V_client even when V_floor <= V_client < V_ckpt, bounding tail retention by V_floor). Wires per-bucket BucketRegion secondary shadow-tail CacheListener inside createPartitionListener (afterRegionCreate/afterBucketCreated/afterSecondary) with hardened secondary member-ID fallback in extractFromEntryEvent, buffering replicated vector mutation versions live on secondaries so repeated overwrites to hot keys never suffer state-store coalescing loss on primary failover.
    • Multi-Subscriber Staggered-ACK Tracking & |S|=0 Continuity: Adds registerSubscriberForCheckpoint, unregisterSubscriberForCheckpoint, and acknowledgeSubscriberCheckpoint advancing V_ckpt unconditionally to min_{i in healthy} ack[i] on idle tails and subscriber exit without regression, plus |S|=0 empty-subscription version continuity (getLastDispatchedVersion, getNextExpectedVersion, and zero tail overflow across empty intervals).
    • Contiguous Version Holdback Buffer & Bounded Gap-Closure (enforceContiguousVersions, default true): Holds out-of-order regionVersion > nextExpected entries in holdbackByMember (up to maxHoldbackGap=128 and age DEFAULT_MAX_HOLDBACK_AGE_MILLIS=5000, configurable via setMaxHoldbackAgeMillis) and drains contiguous ready versions strictly in ascending order; exposes onNonMatchingBucketVersion(bucketId, memberId, regionVersion) wired into ContinuousVectorQueryService.createCacheListener (afterDestroy, afterInvalidate, null/non-vector updates). flushExpiredHoldbackGaps(...) (also integrated into flushIdleHeartbeats/scheduler) deterministically closes stalled gaps exceeding maxHoldbackGap or maxHoldbackAgeMillis, marks resyncRequiredStreams, notifies HoldbackGapListener, increments holdbackGapClosedCount, and drains ready successors contiguously so a missing predecessor can never stall delivery indefinitely (while gaps repaired before expiry preserve resyncRequired=false).
    • Age-Bounded Oldest-Uncovered Heartbeat Flush: Tracks oldestUncoveredMutationTimeMsByMember (set only when eventsSinceHeartbeat transitions 0 -> 1 and cleared on heartbeat reset) and lastDispatchedVersionByMember, firing flushIdleHeartbeats(long nowMillis, long maxAgeMillis) (and startIdleHeartbeatScheduler / stopIdleHeartbeatScheduler) whenever eventsSinceHeartbeat > 0 and (nowMillis - oldestUncoveredMs) >= maxAgeMillis, preventing heartbeat starvation under both idle tails and steady sub-interval zero-match trickles.
    • Emits lightweight per-(bucketId, memberId) RVV watermark heartbeats (ContinuousVectorEvent.watermarkHeartbeat(..., replayed)) periodically every heartbeatIntervalEvents primary mutations (default 64, configurable, 0 disables) and at the end of primary-promotion and reconnect replays.
    • Equal-Version v_h Data-Before-Heartbeat Ordering & Serial Per-Bucket FIFO: When a mutation at v_h produces both match events and emitHeartbeat == true, evaluateAndDispatch places all match events for v_h strictly before watermarkHeartbeat(..., v_h) in one atomic PendingDispatchBatch enqueued onto BucketState.pendingDispatchBatches. Both synchronous and multi-threaded async executors drain each bucket serially (dispatchDraining CAS + drainOwnerThread reentrancy guard) without concurrent overlapping sink dispatches.
    • Uses an async replay barrier during primary failover promotion that gates live writes until tail replay completes, eliminating reordering and duplicate windows.
    • Provides admitAndReplayForReconnect(...) and replayUncheckpointedForReconnect(int bucketId, Map<String, Long> clientHighWaterByMember[, ContinuousVectorEventSink targetSink, Runnable onReplayedUnderLock]) under synchronized (state), pushing replayed batches strictly over (Math.max(V_floor[b, m], clientHighWaterByMember[m]), V_S[b, m]] across all retained streams m (both pre-crash m_P and post-promotion m_S, including (V_client, V_ckpt] when V_floor <= V_client < V_ckpt) and trailing replayed watermark heartbeats onto the same per-bucket serial FIFO queue BEFORE invoking onReplayedUnderLock and releasing synchronized (state) (tracked via totalReconnectReplaysHandled).
  • RvvClientGate & IdempotentRvvConsumer:
    • RvvClientGate enforces strictly monotonic per-(subscriptionId, bucketId, memberId) delivery across out-of-order and multi-subscription streams (tryAccept and tryAcceptBatch), serializes concurrent callbacks on the same stream, advances highWaterVersion monotonically on watermark heartbeats without invoking match listeners, enforces strict Theorem 3 Invariant 4 safe checkpoint bounds across all active subscriptions, exposes getSafeHighWaterByMember(int bucketId) for slow-reconnect handoff, and documents its gate-delivery contract in Javadoc.
    • IdempotentRvvConsumer keys durable delivery strictly by (subscriptionId, bucketId, memberId, regionVersion) (EventDeliveryId), overrides onEventBatch(List<ContinuousVectorEvent>) -> processEventBatch (atomically staging all matches in a batch into PENDING before any effect or trailing covering heartbeat executes), adds admitAndReconnectReplay(...), eliminates any unlocked RvvClientGate pre-check prior to PENDING staging (v <= committedWatermark || isEffectApplied(id) || isPendingIntent(id) + stagePendingIntentIfAbsent(event, id) atomically inside streamStageLock, durableAdmissionsCount, CrashPhase.BEFORE_DURABLE_PENDING_STAGE), and enforces a strict per-stream execution/recovery fence (streamExecutionFences, lock order sorted execFences -> streamStageLock) serializing in-flight handler execution against concurrent versions, recover(), and prepareForReconnect(bucketId) alongside DurableDeliveryStore (PENDING WAL + APPLIED ledger + advanceContiguousCommittedWatermarkLocked + lowestPending > ver guard), guaranteeing zero lost, overlapping, or duplicate notifications/effects across ordinary connection loss and client crashes at all persistence boundaries.

New Unit & Distributed Chaos Tests (52 Unit + 12 Failover DUnit)

  • ChordalVoronoiRouterTest (20 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 + boundary d in {1, 7, 8, 9} + exact dot == tau threshold equality + getMaxCellSize() telemetry with FNR == 0, heterogeneous-tau quantile stratification + bound-aware incremental insert outlier isolation with FNR == 0, periodic survival-guard 16-sample O(Kd) re-probe restoring CHORDAL_VORONOI after isotropic-to-clustered regime shift with FNR == 0, d == 1 cluster collapse + antipodal zero-sum centroid fallback + (1,1) at tau=1.0 zero pruning FNR + binary32 underflow bound d * 2^-126, sqrt-free Higham cosine bound adversarial verification at x == c_k == q_i with tau_i in {1.0, 1 - 1e-7, 0.9999} across d in {128, 1536, 4096}, Theorem 1 eta_f64(d) + 8 * u_f64 + Math.nextDown outward rounding verification near B_k^up >= 2.0 and antipodal pairs with tau = 1.0, true O((M/K)d) per-cell CoW verification, coupled B_k^up vs decoupled R_k + rho_k^max tightness, incremental removal until 20% churn, computeMCrit survival-ceiling handling, online EWMA survival-rate guard reversion to FLAT_SIMD, 4096-D safety epsilon, high-selectivity pruning efficiency, closed-form M_crit + hysteresis anti-oscillation, live add/remove/recluster safety, and invalid input rejection.
  • RvvMonotonicVectorDispatcherTest (32 tests): failover replay exactly-once monotonic delivery, out-of-order holdback ordering 65,66 strictly behind delayed 64 + non-vector destroy/gap without drops, temporary predecessor gap repaired before expiry preserving contiguous delivery without resync, delayed predecessor exceeding maxHoldbackAgeMillis closing gap + emitting HoldbackGapListener resync notification + unblocking zero-match checkpoints, staggered ACKs from multiple healthy subscribers advancing V_ckpt to exact min_i ack[i] on idle tails, |S|=0 empty-subscription version continuity with zero tail overflow, subscriber rejoin below compacted V_floor immediately flagging resyncRequired, V_floor <= V_client < V_ckpt exact > V_client replay (V_floor=60, V_client=63, V_ckpt=64 -> replays [64..70] with atomic S_healthy pin + V_client=59 -> immediate resyncRequired, reconnectBetweenFloorAndCheckpointReplaysIntermediateVersionsAndBelowFloorTriggersResync), multi-subscription (sub-A/sub-B) repeated-key promotion + delayed match pinned below covering HB(63) + lagging reconnect (multiSubscriptionRepeatedKeyPromotionCoveringHeartbeatAndLaggingReconnect), promotion + slow consumer + pending checkpoint at C_tail - 1 vs C_tail + 1 (C_tail=64 and DEFAULT_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 advancing V_ckpt after 63 zero-match mutations, steady zero-match trickle (40 ms interval) firing age-bounded heartbeats without starvation, IdempotentRvvConsumer crash-injection, ordinary-reconnect per-stream execution/recovery fencing (ordinaryReconnectFencesInFlightHandlerAndPreventsDuplicateAdmissionOrOverlap), and durability boundary verification (BEFORE_DURABLE_PENDING_STAGE, AFTER_WATERMARK_PERSIST_BEFORE_EFFECT, AFTER_EFFECT_BEFORE_WATERMARK_COMMIT, connection loss after durable PENDING staging before effect retires, out-of-order match commit pending-intent guard, delayed PENDING intent blocking later matches and heartbeats through restart recovery), slow client reconnect replaying both pre-crash m_P and post-promotion m_S retained streams with trailing heartbeats under concurrency, match-on-mutation-64 (v_h) delivering matches strictly before v_h watermark while advancing 0%-match client watermark, slow reconnect with 4-thread async executor + concurrent live m_S writes + two clients at V_client_A != V_client_B, healthy 0%-match subscriber advancing V_ckpt across 5 * maxTail writes + failover replay via periodic & promotion RVV watermark heartbeats with 0 tail overflows and 0 spurious match callbacks, async replay barrier gating live writes, coalesced onEventBatch + async per-bucket serial FIFO dispatch preserving strict RVV monotonicity across live writes & primary failover, concurrent tryAccept callback 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.
  • ContinuousVectorRvvFailoverDistributedTest (12 multi-node failover chaos DUnit tests): kills the primary server mid-ingestion on a real Geode cluster with enforceContiguousVersions=true, real afterDestroy non-matching version tracking, matching subscriptions, and a healthy 0%-match orthogonal subscriber, slow reconnect after primary kill with concurrent post-promotion m_S writes, 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 exceeding maxHoldbackAgeMillis), connection loss after durable PENDING staging before effect retires, staggered multi-subscriber ACKs + |S|=0 empty-subscription interval continuity across the cluster, ordinary reconnect fencing an in-flight handler against duplicate admission/overlap, 3-server promotion at C_tail - 1 (0 resync) vs C_tail + 1 overflow + rejoin below V_floor immediate rejection, 3-server repeated-key live kill -9 failover delivering exact 32/32 per-version (b, m, v) notifications across 4 hot keys, 3-server reconnect between V_floor and V_ckpt replaying intermediate versions + < V_floor immediate resync (reconnectBetweenFloorAndCheckpointReplaysIntermediateVersionsAndBelowFloorTriggersResync), and 3-server multi-subscription (sub-A/sub-B) repeated-key kill -9 promotion + delayed match pinned below covering HB(63) + lagging reconnect delivering 152/152 (subId, b, m, v) effects on both consumers with 0 misses, 0 duplicates, and 0 resyncs (multiSubscriptionRepeatedKeyPromotionCoveringHeartbeatAndLaggingReconnect).

Backward Compatibility & Serialization Notes

  • Zero Public API Breakage: All changes are purely additive (+13775 / -0 across 13 files) under org.apache.geode.cache.lucene.internal.vector.continuous and sanctioned-geode-lucene-serializables.txt. Zero existing production classes are modified.
  • Sanctioned Serializables: Registered ChordalVoronoiRouter$RoutingMode, ContinuousVectorEvent (including heartbeat:boolean), IdempotentRvvConsumer$CrashPhase, RvvStreamKey, and VectorSubscription in sanctioned-geode-lucene-serializables.txt, verified via AnalyzeLuceneSerializablesIntegrationTest (6/6 PASS).

Exact Gradle Verification Commands & Pass Counts

./gradlew --no-daemon --max-workers=2 \
  :geode-lucene:spotlessCheck \
  :geode-lucene:checkPom \
  :geode-lucene:javadoc \
  :geode-lucene:test --rerun

./gradlew --no-daemon --max-workers=2 \
  :geode-lucene:distributedTest \
  --tests "*ContinuousVectorRvvFailoverDistributedTest*" --rerun

./gradlew --no-daemon --max-workers=2 \
  :geode-lucene:integrationTest --rerun \
  --tests "*AnalyzeLuceneSerializablesIntegrationTest*"
Verification Suite Total Passed Failed Skipped Status
:geode-lucene:test --rerun 335 331 0 4 (pre-existing) PASS
PR 4 Continuous Vector Unit Suites (ChordalVoronoiRouterTest 20/20, RvvMonotonicVectorDispatcherTest 32/32) 52 52 0 0 PASS
ContinuousVectorRvvFailoverDistributedTest (multi-node failover + V_floor<=V_client<V_ckpt + multi-sub repeated-key + C_tail +/- 1) 12 12 0 0 PASS
AnalyzeLuceneSerializablesIntegrationTest 6 6 0 0 PASS
:geode-lucene:spotlessCheck, :checkPom, :javadoc — — 0 — PASS

Goutham 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).
…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).
…ng, reconnect scoping, d=1 & underflow bounds
…ush, and IdempotentRvvConsumer crash recovery
Goutham added 6 commits November 25, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant