Commit Graph

30961 Commits

Author SHA1 Message Date
Ariel Weisberg 6522d52b0b Live migration for non-serial reads
Patch by Ariel Weisberg; Reviewed by David Capwell for CASSANDRA-19439
2025-04-17 11:59:54 -07:00
Alex Petrov cf9e34df45 Fix empty LatestDepsSerializer
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20252
2025-04-17 11:59:54 -07:00
Benedict Elliott Smith 7f0e5f8e8b Follow-up to CASSANDRA-20228:
- Fix waiting state callback computes different route to initiator
 - Invariants.checkX -> Invariants.requireX (to allow complementary Invariants.expectX as appropriate)

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20228

Follow-up to CASSANDRA-20228:
 - Fix AccordUpdateParameters to correctly supply List cell paths derived from applyAt
 - Fix ExecuteAtSerialize.serialiseNullable
 - Fix topologies flush regression caused by markRetired forcing a flush on every call

patch by Benedict; reviewed by Ariel Weisberg for CASSANDRA-20228
2025-04-17 11:59:54 -07:00
Alex Petrov 2e850db02d Fix testClearSnapshot_RemoveMultiple
Patch by Alex Petrov; reviewed by David Capwell for CASSANDRA-20246
2025-04-17 11:59:54 -07:00
Alex Petrov 894536ab71 Fix "modifiers" missing field exception on JDK17
Patch by Alex Petrov; reviewed by David Capwell for CASSANDRA-20247
2025-04-17 11:59:54 -07:00
Benedict Elliott Smith 5be214a417 Agree a distributed uniqueHlc to use for Apply
- detect and save whether RX can be used as a GC bound for HLCs
 - have RX durably record if they witnessed any superseding epoch and use this for HLC GC
 - rework GC to retain applyAt for writes

Also improve:
 - PreCommitted overwrites fast path vote, then loses tie-break with NotAccept, so we don't recover
 - track executeAtLeast and uniqueHlc separately from WaitingOn in CommandChange
 - Always propose executeAt.hlc() >= txnId.hlc()
 - Short-circuit recovery if ApplyAt already known
Also fix:
 - Dangling recovery when Commit rejected
 - Failed epoch fetch handling in DefaultProgressLog
 - CommandsForKey must track Accept executeAt for computing earlierWait collection on recovery
 - Report DefaultProgressLog exceptions before retrying
 - Fix inverted condition in RecoverWithRoute
 - Remove laterNoWait from laterWait collection in recovery
 - Invalidate incorrectly selected maxNotTruncated if max had a not truncated component
 - WaitingState.fetch not request/propagating prior epochs
 - CFK visit active pruning was comparing txn against maxCommittedWriteBefore rather than maxCommittedWriteForEpoch

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20228
2025-04-17 11:59:54 -07:00
Alex Petrov f3e61c153f Fix race condition in AccordExecutor#cancelExclusive
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20242
2025-04-17 11:59:54 -07:00
Alex Petrov b50536f1a4 Fix Simulator Tests
Patch by Alex Petrov and Benedict Elliott Smith; reviewed by Alex Petrov and Benedict Elliott Smith for CASSANDRA-20240.
2025-04-17 11:59:54 -07:00
Alex Petrov 70382b13cc Fix deps serializers
Patch by Alex Petrov; reviewed by David Capwell for CASSANDRA-20241
2025-04-17 11:59:54 -07:00
Aleksey Yeschenko b8a3706ef9 Remove Journal record ownership tags functionality
patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith for
CASSANDRA-20229
2025-04-17 11:59:54 -07:00
David Capwell 3c7cb1e3b3 Migrate route index from commands table to journal, and drop the commands table
patch by David Capwell; reviewed by Alex Petrov for CASSANDRA-20144
2025-04-17 11:59:54 -07:00
Benedict Elliott Smith 3e16efa490 Protocol optimisations:
- Privileged coordinator. If the coordinator is a replica we can reduce our quorum sizes by including the coordinator's vote.
   - with deps: if we include coordinator's preaccept deps we can reliably reduce quorum size by 1, at the expense of recovery sometimes requiring additional phases and waiting for future txns
   - with only vote: if we only include the vote we can avoid any additional recovery phases or waiting for future txns, but can reduce our quorum size for only some configurations
 - Medium path. If t=t0 at a simple majority we can take just two rounds.
   - with additional phase: on recovery, earlier txns must wait for medium path to be disabled (or committed) so we do not accidentally recover a transaction that won't be witnessed
   - with unstable deps: on slow path commit, deps not found in accept as committed as unstable and do not affect recovery decisions for earlier transactions
Also improve:
 - Recovery of await conditions simply recalculates the rejects flag rather than restarting to ensure faster forward progress
 - refactor Command hierarchy
 - tweak: don't save Writes for non-write transactions
Also fix:
 - isOutOfRange when invoked from callback for some txn < Committed
 - handle loadingPruned that is pre-bootstrap on update to bootstrappedAt
 - journal replay can overwrite in memory state loaded for a command not yet replayed
 - subtle ordering bug in LatestDeps.mergeProposal
 - fix occasional class initialisation order bug
 - handle race condition on learning of topology

patch by Benedict; reviewed by Aleksey Yeschenko for CASSANDRA-20222
2025-04-17 11:59:54 -07:00
Alex Petrov 13625288c6 Fix ForceSnapshotTest
Patch by Alex Petrov; reviewed by David Capwell for CASSANDRA-20223.
2025-04-17 11:59:54 -07:00
Alex Petrov 72f3828c0b Fix CoordinatorReadLatencyMetricTest
Patch by Alex Petrov; reviewed by David Capwell for CASSANDRA-20216
2025-04-17 11:59:54 -07:00
Alex Petrov 21f9f248cd Fix serialization order for topology updates
Patch by Alex Petrov; reviewed by David Capwell for CASSANDRA-20219.
2025-04-17 11:59:54 -07:00
Alex Petrov 5bfd944bcb Fix problem with iteration order in AccordJournal
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20206
2025-04-17 11:59:54 -07:00
Benedict Elliott Smith ed2ca6e2fb FetchRequest should report as unavailable any slice that executes in a later epoch that is not owned by the replicas
Improve:
 - Remove GetMaxConflict; use local MaxConflict collection

Fix:
 - Invalidated should retain StoreParticipants so we can update CFK on journal replay
 - loading pruned uninitialised commands via CFK: make sure hasTouched contains key so that if invalidated we are notified
 - updateExecuteAtLeast should always be higher than TxnId
 - Async CFK callbacks treated pruned transactions incorrectly
 - node.withEpoch when ExecuteEphemeralRead in futureEpoch
 - Deps.without should be key/range aware
 - Durably mark bootstrapBeganAt and safeToReadAt in MaxConflicts
 - Don't attempt to calculate local deps when DepsErased in GetLatestDeps (command has durably applied to this shard)
 - filter StoreParticipants before invoking shouldCleanup

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20183
2025-04-17 11:59:54 -07:00
Alex Petrov dfcf3aff4e Fix topology replay during bootstrap and startup, decouple Accord from TCM
Includes multiple changes, primary ones:
  * Make HarrySimulatorTest work with Accord
  * Removed nodes now live in TCM, no need to discover historic epochs in order to find removed nodes
  * CommandStore <-> RangesForEpochs mappings required for startup are now stored in journal, and CS can be set up _without_ topology replay
  * Topology replay is fully done via journal (where we store topologies themselves), and topology metadata table (where we store redundant/closed information)
  * Fixed various bugs related to propagation and staleness
     * TCM was previously relied on for "fetching" epoch: we can not rely on it as there's no guarantee we will see a consecutive epoch when grabbing Metadata#current
     * Redundant / closed during replay was set with incorrect ranges in 1 of the code paths
     * TCM was contacted multiple times for historical epochs, which made startup much longer under some circumstances

Patch by Alex Petrov; reviewed by  Benedict Elliott Smith for CASSANDRA-20142
2025-04-17 11:59:54 -07:00
David Capwell 17dbba770b Refactor the ast package to enable harry model based testing
patch by David Capwell; reviewed by Abe Ratnofsky, Caleb Rackliffe for CASSANDRA-20155
2025-04-17 11:59:54 -07:00
Alex Petrov b664d3e616 Migrate in memory journal to CommandChange logic shared with AccordJournal
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20115
2025-04-17 11:59:54 -07:00
Benedict Elliott Smith 52242f23a8 Remove TimestampsForKey
patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20174
2025-04-17 11:59:53 -07:00
Benedict Elliott Smith 44cd181438 Fixes
- Fix notifying unmanaged after update redundant before/bootstrap
     - Do not infer invalid if we have a single round of replies with minKnown not decided and maxKnown erased - in this case store the knowledge for next request.
     - Fix SyncPoint topology selection
     - Fix CheckStatusOkFull.with(InvalidIf)
     - Fix NotifyWaitingOn
     - ExecuteTxn should only contact latest topology for follow-up requests
     - DurableBefore.min should not go backwards on new epoch topology, journal replay was not correctly handling PreApplied, partialTxn can be null if not owned
     - Fix notify pre-bootstrap that arrives post-bootstrap
     - Avoid GC race condition on Propagate where we can incorrectly infer a shard is stale
     - Ensure redundantBefore on previously-owned range does not imply redundant before for overlapping queries on still-owned range
     - Ensure we don't mark stale unless all of the quorum we contacted had erased, else we may have raced with the agreement and erase
     - Fix Invalidate when no route found for FetchData does not report to all requested local epochs
     - Fix WAS_OWNED_RETIRED without durableBefore at Universal can lead to assertions with RX that we permit to execute but that have not yet
     - Fix initialiseWaitingOn can in some cases transitively notify the command we're updating via maybeCleanup of dependencies, but the command isn't yet updated so isn't ready
     - Fix encountering a command that is pre-bootstrap, and for which we have locally 'applied' a supserseding RX, so that we do not know its outcome locally (so we do not cleanup the command), but also it must have been decided - and we should not respond with future dependencies.
     - Epoch failures on CoordinatePreAccept should trigger the CoordinatePreAccept failure handler
     - Use the shard bound rather than GC bound for fallback dependency
     - LatestDeps should be sliced to actual route, so as not to use both PreAccepted AND Stable deps as though Stable
     - Fix various callback issues with node.withEpoch and Recover/Propose.isDone
     - RecoverWithRoute can encounter a partially truncated transaction where the Deps for one shard are not committed. Must fetch LatestDeps.
     - Tighten LatestDeps semantics for Recover
     - CommandsForKey: do not restore pruned as APPLIED
     - Ensure prune points execute in the epoch in which they are declared
     - must merge all fast path votes including those from earlier epochs that may have witnessed a later transaction
     - Recoveries that know the transaction is committed a priori should skip the Accept phase
     - Maintain GC behaviour for redundant commands that are pre-bootstrap
     - don't apply ERASE to CommandsForKey to avoid breaking pruning
     - Introduce clearBefore to ProgressLog to more consistently handle cleaning up redundant transactions (and avoid triggering burn test invariants)
     - don't replay journal of a bootstrapping node in burn test
     - Recover, Accept or Commit reply from epoch that has been retired should be treated as Success rather than Redundant
     - Distinguish completely REDUNDANT+PRE_BOOTSTRAP from partially GC_BEFORE and REDUNDANT+PRE_BOOTSTRAP - latter can make stronger inferences based on the GC_BEFORE intersection (could perhaps be treated as simply GC_BEFORE)
     - RX must register historical transactions with CFK
     - CommandStore.bootstrapper must wait for coordinate sync via same mechanism as sync()
     - Don't start topology change for shard where all replicas are already bootstrapping
     - Reify executes et al in StoreParticipants
     - LocalListeners txn listener reentry may erase the entry entirely
     - use registerAt in AbstractRequest for expirations, use correct time for expiresAt in ListAgent
     - use txnId.epoch() for pruning, as must be before both txnId and executeAt of prune point for coordinating dependencies
     - compute accurate KnownMap when affected by bootstrap or staleness
     - upgradeTruncated should calculate Definition and Deps separately
     - Invalidate should not sort before Erased when calculating max reply or max knowledge reply
     - avoid another infinite loop at end of burn test
     - avoid another epoch loading edge case
     - pass through low/high epochs to ensure we propagate information to all waiting command stores
     - RX must adopt a non-pruned dependency that has a higher TxnId (if is itself behind prune point)
     - rejects should also be calculated on COMMITTED started before
     - remove Apply Factory wrapper for RX, redundant now we have CoordinationAdapters (and has faulty epoch logic)
     - for RX ensure we return maximum  writes for each epoch we intersect (same effectively as pruning logic)
     - rework updateUnmanaged to improve clarity
     - BeginRecovery constructor of LatestDeps should use touches() not owns() for compute localDeps
     - BeginRecovery superseding calculation was incorrectly treating startedBefore Committed and Accepted the same, when the point at which a dep should be known differs
     - Refactor Command visiting, porting C* integration to accord-core
     - RelationMultiMap Builder should resize keys and keyLimits independently
     - CommandsForKey Serialization moved to accord-core
     - losing ownership of range should trigger re-registration of unmanaged waiting on commit of a no-longer owned txn

    patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20172
2025-04-17 11:59:53 -07:00
Ariel Weisberg 21383d2789 Fix Accord SAI tests and Accord double apply
Patch by Ariel Weisberg and David Capwell; Reviewed by David Capwell for CASSANDRA-20089
2025-04-17 11:59:53 -07:00
Alex Petrov 211249b8a9 Implement field saving/loading in AccordJournal
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20114
2025-04-17 11:59:53 -07:00
David Capwell c114fc46d2 Accord simulation test failing with "ClassNotFoundException: WARN [AccordExecutor[1,0]"
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20127
2025-04-17 11:59:53 -07:00
Benedict Elliott Smith a5dc44ad57 Fix infinite loop, and notify progress log of sync point durability while waiting to apply
patch by Benedict; reviewed by David Capwell for CASSANDRA-20125
2025-04-17 11:59:53 -07:00
Alex Petrov 74817bc83e Semi integrate burn test:
* Move serializers that previously were in static field into corresponding swappable accessors
  * Add a (no-op in Cassandra impl) Result serializer
  * Allow more than one Accord Journal table
  * Move some previously-Cassandra implementation details (such as FieldUpdates) to Accord
  * Fix a bug with sorting of Journal Key (incorrect non-identity flags)
  * Accord side: Make sure not to re-sort collection of events scheduled for application
  * Implement serializers for Accord/BurnTest List* items

Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20112.
2025-04-17 11:59:53 -07:00
Alex Petrov 4c0f9198de Fix restartWithEpochChanges test; make CMS nodes first gossip with CMS nodes
Patch by Alex Petrov; reviewed by Sam Tunnicliffe for CASSANDRA-20123
2025-04-17 11:59:53 -07:00
Alex Petrov bad9805b7a Make it easier to reuse generators, make Harry more extensible and accord-proof, refactor Harry's major subsystems
* SELECT is now a regular Harry operation, not a separate "validate" step
  * Flushes (or any custom operation) are now a part of a model, Harry will run them for you
  * Simplified validation of subset/wildcard queries
  * All Operations and are now SchemaSpec-agnostic, and can use any generators (like QT or whatever)
  * You read it right, Harry now can use any generator and still be able to not to keep generated values in memory
  * There are no concepts of “descriptor selectors”, or “bijection” exposed anymore. You just provide a Generator, Harry figures out the rest.
  * All Cassandra data types are now supported
  * No upper limit on the number of columns (also, clustering columns)
  * Basic (for now) support for Transactions
  * It is now possible to visit multiple partition in the same Visit (essentially, for transactions)
  * Much much simpler to generate synthetic workloads now (basically, you just write a Generator
  * Add support for all single-cell types.

Most of it was just a refactoring of Harry, to allow the following (still pending):

  * Easier to add subset SELECTION (important for SAI testing)
  * Easier add support for functions
  * Easier to add support for collections and UDTs
  * Easier to add support for LET bindings

Patch by Alex Petrov; reviewed by David Capwell, Caleb Rackliffe, and Abe Ratnofsky for CASSANDRA-20080.
2025-04-17 11:59:53 -07:00
Benedict Elliott Smith ec7c7c9fce Accord: Fix unit tests and improve burn test stability
patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20113
2025-04-17 11:59:53 -07:00
Benedict Elliott Smith f2ea674140 Key transaction recovery should witness range transactions
patch by Benedict; reviewed by David for CASSANDRA-20105
2025-04-17 11:59:53 -07:00
Benedict Elliott Smith 03cd31fc57 Fix AbstractKeys.without (and CoordinateEphemeralRead execution in future epoch)
patch by Benedict; reviewed by David Capwell for CASSANDRA-20095
2025-04-17 11:59:53 -07:00
Aleksey Yeschenko 304749ebda Set Accord debug tables partitioner to LocalPartitioner
patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith for
CASSANDRA-20062
2025-04-17 11:59:53 -07:00
Ariel Weisberg 16b5e191f9 Non-serial reads and range reads without live migration support
Patch by Ariel Weisberg; Reviewed by Benedict Elliott Smith for CASSANDRA-19437
2025-04-17 11:59:53 -07:00
Aleksey Yeschenko bcf1abbd16 Implement missing virtual tables for Accord debugging
patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith and David
Capwell for CASSANDRA-20062
2025-04-17 11:59:53 -07:00
Ariel Weisberg b29eac16fe Split accord migration into two phases
Patch by Ariel Weisberg; Reviewed by Benedict Elliott Smith for CASSANDRA-19436
2025-04-17 11:59:53 -07:00
David Capwell 513509ee2c Accord's ConfigService lock is held over large areas which cause deadlocks and performance issues
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20065
2025-04-17 11:59:53 -07:00
Ariel Weisberg 6c0ad476ed Miscellaneous migration test fixes
Patch by Ariel Weisberg; Reviewed by David Capwell for CASSANDRA-20060
2025-04-17 11:59:53 -07:00
David Capwell 9fe1a977b5 Get Harry working on top of Accord and fix various issues found by TopologyMixupTestBase
patch by David Capwell; reviewed by Alex Petrov, David Capwell for CASSANDRA-20054
2025-04-17 11:59:53 -07:00
Benedict Elliott Smith 5a12875b3a Use ExclusiveSyncPoints to join a new topology
For correctness, the dependencies we adopt on joining a new topology must exclude the possibility of respondents accepting additional transactions with a lower TxnId, so proxying on the existing `ExclusiveSyncPoint` mechanisms is logical for the time-being. This patch removes the `FetchMajorityDeps` logic in favour of simply waiting for a suitable `ExclusiveSyncPoint` to be proposed.

patch by Benedict, reviewed by Alex Petrov for CASSANDRA-20056
2025-04-17 11:59:53 -07:00
Alex Petrov 4e9110e881 Check for splittable ranges
Patch by Alex Petrov; reviewed by Ariel Weisberg for CASSANDRA-20032

Accord Deps tests have incorrect range semantics

patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-20029
2025-04-17 11:59:53 -07:00
David Capwell e94d86b1e5 TopologyMixupTestBase does not fix replication factor for Keyspaces after reaching rf=3
patch by David Capwell; reviewed by Alex Petrov for CASSANDRA-19975
2025-04-17 11:59:53 -07:00
David Capwell 1f80f99b71 Accord should block currently unsafe operations
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-20020
2025-04-17 11:59:53 -07:00
David Capwell 5afe99b7ca Accord metrics are isolated which cause existing coordination metrics to be empty, should also populate there as well
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20017
2025-04-17 11:59:53 -07:00
Alex Petrov d1af562705 Shut down scheduler with "now"
Fix NPE in MockJournal on null onFlush
Fix SavedCommandTest.
After the serialization change that serializes "changed" before "is null", null flag can no be written.
2025-04-17 11:59:53 -07:00
Ariel Weisberg a51bed1c77 Accord should not block partition restricted index queries
Patch by Ariel Weisberg; Reviewed by David Capwell for CASSANDRA-19955

Non-serial single partition reads on Accord

Patch by Ariel Weisberg; Reviewed by Benedict Elliott Smith for CASSANDRA-19951
2025-04-17 11:59:53 -07:00
Alex Petrov 042a6e9769 Add bounce to load test 2025-04-17 11:59:52 -07:00
Benedict Elliott Smith 22df42c7be Store historical transactions per epoch
update durability scheduling and majority deps fetching
do not deserialize deps in CommandsForRangesLoader unless required

AccordJournalPurger should use shouldCleanupPartial

load historical transactions when loading topology
2025-04-17 11:59:52 -07:00
Benedict Elliott Smith 91def31284 do not schedule additional durability attempts while some in flight; plus minor performance improvements 2025-04-17 11:59:52 -07:00
Benedict Elliott Smith 570d65249f disable TableId interning 2025-04-17 11:59:52 -07:00