Commit Graph

31353 Commits

Author SHA1 Message Date
Alex Petrov 68aea4b15f Fix simulator after rebase
* avoid running python3-dependent tasks when running simulator tasks
  * fix a problem with simulated snitch rebase
  * add a distinction between short-lived daemon threads and infinite loop ones for cases when we need to simulate user-implemented infinite loops

Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20542
2025-04-17 11:59:56 -07:00
David Capwell 49740f87d2 Accord: Fix issue where 3 tests would crash consistently in CI
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20543
2025-04-17 11:59:56 -07:00
Benedict Elliott Smith e87d5e5020 Various fixes and improvements
Improve:
 - InMemoryJournal compaction should simulate files to ensure we compact the same cohorts of records (so shadowing applied correctly)
 - Don't update CFK deps if already known
 - avoid unnecessary heapification of LogGroupTimers
 - begin removal of Guava (mostly unused)
 - consider medium path on fast path delayed
 - add Seekables.indexOf to support faster serialization
 - unboxed Invariant.requires variant
 - AsyncChains.addCallback -> invoke
Fix:
 - Recovery must wait for earlier transactions on shards that have not yet been accepted, even if we recover a fast Stable record on another shard
 - only skip Dep calculation on PreAccept if vote is required by coordinator
 - ReadTracker must slice Minimal the first unavailable collection
 - If PreLoadContext cannot acquire shared caches, still consider existing contents
 - CFK: make sure to insert UNSTABLE into missing array
 - Fix failed task stops DelayedCommandStore task queue processing further tasks
 - short circuit AbstractRanges.equals()
 - Handle edge case where we can take fast/medium path but one of the Deps replies contains a future TxnId
 - update executeAtEpoch when retryInFutureEpoch
 - Fix incorrect validation in validateMissing (should only validate newInfo is not in missing when in witnessedBy; all other additions should be included)

patch by Benedict; reviewed by David Capwell for CASSANDRA-20522
2025-04-17 11:59:56 -07:00
David Capwell 92212b2255 Fix upgrade TTL tests that fail due to improved error detection in cep-15-accord
patch by David Capwell; reviewed by Caleb Rackliffe for CASSANDRA-20535
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith 265511f6de Fix CQLSSTableWriterConcurrencyTest
patch by Benedict; reviewed by David Capwell for CASSANDRA-20529
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith f519538092 Switch to plain Thread for AccordExecutor, and improve testing for ASYNC mode
patch by Benedict; reviewed by David Capwell for CASSANDRA-20521
2025-04-17 11:59:55 -07:00
Caleb Rackliffe 7f7ac0781b fixing post-rebase checkstyle problems 2025-04-17 11:59:55 -07:00
Alex Petrov 14b6395434 Accord: test fixes and stability improvements
* Fix short accord simulation test (seed 0x6bea128ae851724b), ConcurrentModificationException
  * Increase wait time during closing to avoid Unterminated threads
  * Increase timeouts, improve test stability
  * More descriptive output from CQL test
  * Shorten max CMS delay
  * Improve future handling in config service

Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20440
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith fb05d224e7 Fix:
- Accord Journal purging was disabled
 - remove unique_id from schema keyspace
 - avoid String.format in Compactor hot path
 - avoid string concatenation on hot path; improve segment compactor partition build efficiency
 - Partial compaction should update records in place to ensure truncation of discontiguous compactions do not lead to an incorrect field version being used
 - StoreParticipants.touches behaviour for RX was erroneously modified; should touch all non-redundant ranges including those no longer owned
 - SetShardDurable should correctly set DurableBefore Majority/Universal based on the Durability parameter
 - fix erroneous prunedBefore invariant
 - Journal compaction should not rewrite fields shadowed by a newer record
 - Don't save updates to ERASED commands
 - Simplify CommandChange.getFlags
 - fix handling of Durability for Invalidated
 - Don't use ApplyAt for GC_BEFORE with partial input, as might be a saveStatus >= ApplyAtKnown but with executeAt < ApplyAtKnown

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20441
2025-04-17 11:59:55 -07:00
Alex Petrov 289dbb7a05 Accord repin: turn pruning back on
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20114
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith 890be9c6e5 Fix:
- Decouple command serialization from TableMetadata version; introduce ColumnMetadata ids; gracefully handle missing TableId
 - DataInputPlus.readLeastSignificantBytes must truncate high bits
 - Fix RandomPartitioner accord serialization
 - Fast path stable commits must not override recovery propose/commit decisions regarding visibility of a transaction
 - RejectBefore must mergeMax, not merge, to ensure we maintain epoch and hlc increasing independently
 - Bad commitInvalidate decision
 - consistent filtering for touches and stillTouches
 - ensure TRUNCATE_BEFORE implies SHARD_APPLIED
 - TopologyManager.unsyncedOnly off-by-one error
 - DurabilityQueue should not retry SyncPointErased
 - handle rare case of no deps but none needed
 - not updating CFK synchronously on recovery, which can lead to erroneous recovery decisions for other transactions
 - Don't return partial read response when one commandStore rejects the commit
 - Filter touches/stillTouches consistently
 - WaitingState computeLowEpoch must use hasTouched to handle historic key with no route
Improve:
 - Use format parameters to defer building Invariants.requireArgument string
 - streamline RedundantStatus/RedundantBefore
2025-04-17 11:59:55 -07:00
David Capwell 94f720476e Topology mixup tests should do repairs for host replacement and other required topology changes
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20426
2025-04-17 11:59:55 -07:00
Alex Petrov 03053b14bf Implement Nemesis compactor, improve partial compaction
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20424.
2025-04-17 11:59:55 -07:00
Alex Petrov 2999d8f235 Epoch/Topology Garbage Collection
Patch by Alex Petrov; reviewed by Benedict Elliott Smith CASSANDRA-20347.
2025-04-17 11:59:55 -07:00
David Capwell e3982ce0bb When bootstrap fails the retry field is not populated which leads to a NPE
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20417
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith ab556ab545 InterceptingExecutor.schedule returns a simulator-unsafe Future
patch by Benedict Elliott Smith; reviewed by David Capwell for CASSANDRA-20420
2025-04-17 11:59:55 -07:00
Alex Petrov fa1157203f Add initial Accord Overview Doc
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20393.
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith 430c55dbc4 Integrate RX with Cassandra Repair, so that repair safely flushes pending topology and other durability requirements.
Also improve:
 - Introduce DurabilityService
 - Retire SyncPoint, replace Barrier with Write and RX
 - MessageType -> enum, restore GetMaxConflict
 - Standardise backoff logic with WaitStrategy
 - improve TimeoutStrategy/RetryStrategy specification strings
 - Forbid KX, remove directKeyDeps
 - Introduce UniqueTimeService, permitting hlc reservations for sync points avoid delay when min TxnId is sufficiently in the past
 - Remove ListStore custom purge logic
Also fix:
 - RejectBefore should reject on both epoch and hlc
 - Do not record sync success for removed nodes
 - Support GlobalDurability detecting no command store to run on
 - Incorrect ballot constructor
 - Serializing 15-bit ballot flags incorrectly
 - TopologyManager.hasEpoch deadlock
 - Computing withOpenEpochs incorrectly, sometimes stopping one epoch short
 - PartitionKey serializer should not depend on schema information that can be erased

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20395
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith a12f0ac9db Accord fixes:
- Bad ArrayBuffers recycling logic
 - RX must ensure dependencies TRANSITIVE_VISIBLE
 - Permit constructing "antiRange" that spans multiple prefixes
 - Not computing range CommandSummary IsDep correctly
 - Truncated commands that aren't shard durable could not repopulate CFK on replay, permitting recovery of another command to make an incorrect decision
 - NPE on async persist of RX (i.e. supplying no callback)
 - NPE in Builder.shouldCleanup when durability is null

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20370
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith 5086846494 Fix:
- Only use persisted RedundantBefore for compaction
 - RouteIndex should index only touches, not Route
 - Flush RangesForEpoch updates to journal immediately, so we do not rely on the command we are processing succeeding
 - DurableBefore updates must wait for the epochs to be known locally
 - Shard.mustWitnessEpoch to support guaranteeing to witness relevant non-topology schema changes
 - We must propagate RedundantBefore RX shard bounds along with epoch syncs
 - Prevent a truncated transaction FetchData infinite loop
 - GC_BEFORE status being overwritten by bootstrappedAt, permitting old transaction state to be resurrected
 - Avoid CFK.maxUniqueHlc read race on bootstrap
 - TopologyManager.awaitEpoch could wait for wrong epoch
 - Journal fsync thread could miss notifications
Also improve:
 - CommandStores uses SearchableRangeList for finding matching stores
 - Refactor RedundantBefore to use a sorted array of TxnId/RedundantStatus pairs (to better fix GC_BEFORE issue)
 - Accord debug keyspace operates on keyspace/table, and sorts correctly by token

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20361
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith e9a0d8ef8e Accord: Serialization Improvements
Improve:
 - Introduce pre/accept fast execution flags
 - Introduce searchable Deps serialization
 - Flatten AccordRoutingKey(s) into single type, using sentinel bits
 - Introduce new fast byte-comparable serialization methods for Token and TableId to support above
Fix:
 - Fix journal re-serialization logic
 - Enable RandomPartitioner for Accord by supporting fixed-width serialization for RouteIndex

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20349
2025-04-17 11:59:55 -07:00
Alex Petrov 1d5146a22e Improve stability of tests with many epochs
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20358
2025-04-17 11:59:55 -07:00
Alex Petrov 67e21ec4ba Fix AccordMigrationTest, preclude possible races in topology propagation
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20316
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith 64c4aa88f5 (Accord) Fix recovery when one shard is committed/stable and another is preaccepted
Also fix:
 - Topology slicing must declare whether we share/slice node ownership (to assist above)
 - CFK.visit removes transitive dependencies too eagerly across epoch change
 - apply cleanup to builder consistently, and construct the same value we would produce by purge (so that replay is idempotent)
 - Invoke ExecuteTxn.LocalExecute callbacks on originating CommandStore
 - misc other minor issues

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20325
2025-04-17 11:59:55 -07:00
David Capwell 3fb23e0247 Fix flakey test org.apache.cassandra.simulator.test.ShortPaxosSimulationTest#casOnAccordSimulationTest
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-20322
2025-04-17 11:59:55 -07:00
David Capwell b81d13f994 Expose epoch ready state as a vtable for operators to inspect things
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20302
2025-04-17 11:59:55 -07:00
Alex Petrov 1aaf0bb336 Fix null field accounting
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20297
2025-04-17 11:59:55 -07:00
Alex Petrov 3324e23f64 Fix topology loading
Use initializeTopologyUnsafe to for-load the last topology and create shards rather than replaying all topologies.

Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20294
2025-04-17 11:59:55 -07:00
David Capwell 5e9e2b2b04 Accord: TableParamsTest is flakey due to bad generators and production validation logic missed the argument to String.format causing confusing errors
patch by David Capwell; reviewed by Blake Eggleston for CASSANDRA-20286
2025-04-17 11:59:55 -07:00
David Capwell 341b493863 Fixed an issue where table walk and token conflict mutations would use server timestamps which made multinode tests unstable
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-20156
2025-04-17 11:59:55 -07:00
Benedict Elliott Smith b017ae8175 Add @Ignore to failing tests while we triage 2025-04-17 11:59:55 -07:00
Benedict Elliott Smith d7ed1ad391 Fix:
- Even if we can decide autonomously that we took the fast path, we must still wait for earlier transactions to decide themselves
 - We must update a command that is in CFK.loadingPruned whether or not it is outOfRange
 - We must visit pruned commands that are transitive dependencies of RX to ensure dependencies are propagated
 - flagsWithoutDomainAndKind() -> flagsWithoutDomainOrKindOrCardinality() [to fix integration regression]
 - Don't invoke uniqueNow() twice when allocate nextTxnId
 - BTreeReducingRangeMap edge case that corrupts map when merge function does not return one of its inputs

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20292
2025-04-17 11:59:55 -07:00
Alex Petrov 080d6c633d Avoid double loading in Cassandra side of journal; make sure to include records appended to journal.
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20244
2025-04-17 11:59:55 -07:00
David Capwell 4f2e306c26 Accord: jvm-dtest changed semantics of uncaughtExceptions handling which broke tests that depended on the prior semantics
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20248
2025-04-17 11:59:54 -07:00
David Capwell f345011822 When generating AbstractTypeGenerators.safeTypeGen() for tests composite types limit depth but collections didnt
patch by David Capwell; reviewed by Caleb Rackliffe for CASSANDRA-20283
2025-04-17 11:59:54 -07:00
Benedict Elliott Smith af7dfcc327 Refactor RedundantStatus to encode vector of states that can be merged independently
Also fix:
 - Truncate command on first access, without participants
 - Use Ballot.ZERO when invoking CFK.insertOutOfRange where appropriate
 - Don't supply a command's own route to ProgressLog.waiting to ensure new keys are incorporated
 - Ensure progress in CommandsForKey by setting vestigial commands to ERASED
 - Add any missing owned keys to StoreParticipants.route to ensure fetch can make progress
 - Recovery must wait for earlier not-accepted transactions if either has the privileged coordinator optimisation
 - Inclusive SyncPoint used incorrect topologies for propose phase
 - Barrier must not register local listener without up-to-date topology information
 - Stop home shard truncating a TxnId to vestigial rather than Invalidated so other shards can make progress
Also improve:
 - Validate commands are constructed with non-empty participants
 - Remove some unnecessary synchronized keywords
 - Clear ok messages on PreAccept and Accept to free up memory
 - Introduce TxnId.Cardinality flag so we can optimise single key queries
 - Update CommandsForKey serialization to better handle larger flag space
 - Configurable which Txn.Kind can result in a CommandStore being marked stale
 - Process DefaultProgressLog queue synchronously when relevant state is resident in memory
 - Remove defunct CollectMaxApplied version of ListStore bootstrap
 - Standardise linearizability violation reporting
 - Improve CommandStore.execute method naming to reduce chance of misuse
 - Prune and address some comments

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20282
2025-04-17 11:59:54 -07:00
Alex Petrov c4a5971af3 Improve topology fetching
- preclude TCM of being behind Accord if newer epoch is reported via withEpoch/fetchTopologyInternal
  - improve topology discovery during first boot and replay
  - fix races between config service TCM listener reporting topologies, and fetched topologies during

Patch by Alex Petrov, reviewed by Ariel Weisberg and David Capwell for CASSANDRA-20245
2025-04-17 11:59:54 -07:00
David Capwell d543cc9107 To improve accord interoperability test coverage, need to extend the harry model domain to handle more possible CQL states
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-20156
2025-04-17 11:59:54 -07:00
Benedict Elliott Smith 113d83417e Follow-up to CASSANDRA-20222:
- Implement missing parts of protocol optimisations, refine some particulars and remove MEDIUM_PATH_WAIT_ON_RECOVERY
Also fix:
 - Deps.txnIds -> Deps.txnIdsWithFlags to make clear unsafety, and validate Command isn't created with flags
 - Save a lossy low/high epoch we're waiting on in WaitingState so that we can reconstruct the same Route on callback
 - Load any potentially invalidated commands we had in ProgressLog to ensure they are marked invalidated locally and notify any waiters
 - Refine Invariant to accept case where a truncated dependency should apply first but both transactions are redundant and only the waiter could not be cleaned up
 - only update CFK.maxUniqueHlc using commands we execute
 - Don't update uniqueHlc when zero to avoid incompatible transaction invariant check

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20222
2025-04-17 11:59:54 -07:00
Ariel Weisberg 9da41308d3 Fix TxnNamedRead discarding paging state
TxnNamedRead was incorrectly determining whether a query was a continuation because the comparison was on TokenKey
and when a MinTokenKey was encountered it would discard the paging state. Comparison on token should be sufficient
because multiple queries in the same batch won't share the same left token bound, only the continuation query will.

Patch by Ariel Weisberg; Reviewed by David Capwell for CASSANDRA-20261
2025-04-17 11:59:54 -07:00
Ariel Weisberg f55653ecb0 Fix paging with Accord range reads
With paging it's possible for the range Accord needs to read from to have the start and end token be the same in which case the LHS token needs to be converted to a MinTokenKey

Patch by Ariel Weisberg; Reviewed by David Capwell for CASSANDRA-20262
2025-04-17 11:59:54 -07:00
Ariel Weisberg d88596b6a4 Fix ShortAccordSimulationTest
Patch by Ariel Weisberg; Reviewed by Alex Petrov for CASSANDRA-20264
2025-04-17 11:59:54 -07:00
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