Commit Graph

183 Commits

Author SHA1 Message Date
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
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 c4e0f3cf8f Follow-up to: Do not contact faulty replicas, and support reporting slow replies for preaccept/read. Do not wait for stale or left nodes for durability. 2025-04-17 11:59:52 -07:00
Benedict Elliott Smith b8f3b74587 Journal diff serialization: validateFlags and WaitingOn size 2025-04-17 11:59:52 -07:00
Benedict Elliott Smith 25b1bd74b8 Enable and test purging 2025-04-17 11:59:52 -07:00
Benedict Elliott Smith aa6ebc140f Halve cache memory consumption by not retaining 'original' to diff; dedup RoutingKey tableId; avoid calculating rejectsFastPath in more cases; delay retry of fetchMajorityDeps; fix SetShardDurable marking shards durable 2025-04-17 11:59:52 -07:00
Benedict Elliott Smith 82ae3adcb2 ExclusiveSyncPoints should always wait for a simple quorum
split JournalKey in journal table so we can index it
reorder journal fields so we can easily index on route (when present)
use Message.expiresAtNanos for callback expiration
do not notify slow for range barriers

Accord: Do not contact faulty replicas, and promptly report slow replies for preaccept/read. Do not wait for stale or left nodes for durability.
2025-04-17 11:59:52 -07:00
Benedict Elliott Smith d8ccc36e4d visit journal backwards to save time parsing
don't load range commands that are redundant, and load least possible
use MISC verb handler for maintenance tasks
2025-04-17 11:59:52 -07:00
Benedict Elliott Smith ab6ef97d28 ninja: increase durability scheduling delays
ninja: fix NPE
disable ephemeral reads
2025-04-17 11:59:52 -07:00
Benedict Elliott Smith 0e1819bbb3 Accord: Share DurableBefore between CommandStores 2025-04-17 11:59:52 -07:00
Alex Petrov 8f7b1c2351 Follow-up to CASSANDRA-19967 and CASSANDRA-19869
patch by Alex Petrov, Ariel Weisberg, Benedict Elliott Smith, Blake Eggleston and David Capwell
2025-04-17 11:59:52 -07:00
Benedict Elliott Smith 282bacb84b ninja: fix CFK serializer 2025-04-17 11:59:52 -07:00
Benedict Elliott Smith 562894dcb1 improve AccordLoadTest to support more keys 2025-04-17 11:59:52 -07:00
Alex Petrov 1c269348a4 Implement Journal replay on startup:
* reconstruct CFK, TFK, progressLog
  * migrate CommandStore collection state from Accord table to the log
  * make memtable writes non-durable; reconstruct memtable state from Writes

Patch by Alex Petrov and Benedict Elliott Smith; reviewed by Benedict Elliott Smith and Alex Petrov for CASSANDRA-19869
2025-04-17 11:59:52 -07:00
Aleksey Yeschenko 3ef74f5948 Change MaxConflicts to use a BTree under the hood
patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith for
CASSANDRA-19952
2025-04-17 11:59:52 -07:00
David Capwell 1ed52038ce This commits contains the following two patches in order to reduce the amount of conflicts resolution necessary for future rebasing:
(Accord): C* stores table in Range which will cause ranges to be removed from Accord when DROP TABLE is performed
patch by David Capwell, Sam Tunnicliffe; reviewed by Sam Tunnicliffe for CASSANDRA-18675

CEP-15: (Accord) sequence EpochReady.coordinating to allow syncComplete to be learned from newer epochs
patch by David Capwell; reviewed by Alex Petrov, Blake Eggleston for CASSANDRA-19769
2025-04-17 11:59:52 -07:00
David Capwell 6265ce5187 Ninja fix: RandomSource.asJdkRandom did not provide a seed. This should have been fixed in CASSANDRA-19847 as it was fixed on Cassadnra trunk 2025-04-17 11:59:51 -07:00
Benedict Elliott Smith 9ebce5d6df Redesign progress mechanisms to be memory efficient, use fewer messages and to resolve dependency chains promptly.
The SimpleProgressLog had a number of problems:

1. It polled for progress with no attempt to determine whether progress could realistically be made, so:
 - as the number of pending transactions grew, the proportion of useful work dropped (as many would be unable to make progress without earlier transactions completing)
 - each transaction in the chain could recover only on average 1/2 poll interval behind the last transaction to complete
2. It requested full transaction state from every replica on each attempt
3. It maintained a lot of in-memory state
4. Polling happened en-masse, allowing for little per-transaction control

We also separately maintained fairly expensive per-command listener state that negatively affected our command loading and caching.

The new DefaultProgressLog makes use of several new features: LocalListeners, RemoteListeners, Timers and Await messages.
 - LocalListeners provide a memory-efficient collection for managing each CommandStore<E2><80><99>s transaction listeners, with dedicated record keeping for inter-transaction relationships.
 - RemoteListeners provide a mechanism for request/response pairs that may be separated by longer than the normal Cassandra message timeout, and require minimal state on sender and recipient. This permits replicas to cheaply update their local state machine as soon as distributed information becomes available.

The DefaultProgressLog tracks each transaction with separate timers to handle per-transaction scheduling, backoff etc, and a succinct state machine. To reduce overhead correspondence is preferentially limited to a handful of replicas, and limited to the home shard where appropriate.

patch by Benedict; reviewed by Ariel Weisberg for CASSANDRA-19870
2025-04-17 11:59:51 -07:00
David Capwell f1db115e73 Create a fuzz test that randomizes topology changes, cluster actions, and CQL operations
patch by David Capwell; reviewed by Alex Petrov for CASSANDRA-19847
2025-04-17 11:59:51 -07:00
David Capwell a21c0a75aa Add a table to inspect the current state of a txn
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-19838
2025-04-17 11:59:51 -07:00
Caleb Rackliffe 2b01b5fa79 Command to Exclude Replicas from Durability Status Coordination
patch by Caleb Rackliffe; reviewed by David Capwell, Sam Tunnicliffe, and Benedict Elliott Smith for CASSANDRA-19321
2025-04-17 11:59:51 -07:00
Alex Petrov 325e48ac39 Switch to streaming serialization of SavedCommand
Patch by Alex Petrov; reviewed by David Capwell for CASSANDRA-19865

Co-authored-by: dcapwell <dcapwell@gmail.com>
2025-04-17 11:59:51 -07:00
Alex Petrov b757cb8730 Add size to the segment index for safer journal reads
Patch by Alex Petrov; reviewed by Marcus Eriksson for CASSANDRA-19871
2025-04-17 11:59:51 -07:00
Ariel Weisberg 8ab5003118 Accord migration and interop correctness
Patch by Ariel Weisberg; Reviewed by Blake Eggleston for CASSANDRA-19744
2025-04-17 11:59:51 -07:00
Benedict Elliott Smith c377a066af CASSANDRA-19825: Fix various bugs and abstraction deficiencies, including:
- Remove concept of non-participating home keys; home keys are required to be a participant in the transaction
- Remove covering/covers concept
- Various invalidation/truncation/erase behaviours

patch by Benedict; reviewed by Blake for CASSANDRA-19825
2025-04-17 11:59:51 -07:00
Benedict Elliott Smith 6905157b0e CommandsForKey Improvements incl Pruning
CommandsForKey periodically self-prunes, so as to continue functioning well in-between garbage collections. Once we prune we are left with potentially incomplete information, and have to sometimes load per-command information from disk. But the payoff is ensuring CommandsForKey objects - which drive the majority of the state machine - are kept to a reasonable size.

patch by Benedict; reviewed by Blake Eggleston and David Capwell
2025-04-17 11:59:51 -07:00
Youki Shiraishi 6d01bc2535 CEP-15 (Accord): When starting a transaction in a table where Accord is not enabled, should fail fast rather than fail with lack of ranges
patch by Youki Shiraishi; reviewed by Caleb Rackliffe, David Capwell for CASSANDRA-19759
2025-04-17 11:59:51 -07:00
David Capwell 0d4c0961be CEP-15: (Accord) When nodes are removed from a cluster, need to update topology tracking to avoid being blocked
patch by David Capwell; reviewed by Blake Eggleston for CASSANDRA-19719
2025-04-17 11:59:51 -07:00
David Capwell d83de7fbb4 CEP-15: (Accord) SyncPoint timeouts become a Exhausted rather than a Timeout and doesn’t get retried
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-19718
2025-04-17 11:59:50 -07:00
Ariel Weisberg 3dfd80ff78 ApplyThenWaitUntilApplied supplies wrong epoch for executeAtEpoch
Patch by Ariel Weisberg; Reviewed by Benedict Elliott Smith for CASSANDRA-19687
2025-04-17 11:59:50 -07:00
Blake Eggleston 17c186ad64 Move burn test read timestamp validation from replica to coordination
Patch by Blake Eggleston; reviewed by David Capwell for CASSANDRA-19288
2025-04-17 11:59:50 -07:00
David Capwell 39efba9c6a CEP-15: (Accord) Bootstraps LocalOnly txn can not be recreated from SerializerSupport
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-19674
2025-04-17 11:59:50 -07:00
Alex Petrov 128f526f4a Accord Journal Determinism: PreAccept replay stability
Patch by Alex Petrov; reviewed by Aleksey Yeschenko for CASSANDRA-19664
2025-04-17 11:59:50 -07:00
Ariel Weisberg feb8d2e2b2 Accord barrier/inclusive sync point fixes
Patch by Ariel Weisberg, Benedict Elliott Smith; reviewed by Benedict Elliott Smith for CASSANDRA-19641
2025-04-17 11:59:50 -07:00
Caleb Rackliffe 1c87bb96ed Baseline Diagnostic vtables for Accord
patch by Caleb Rackliffe; reviewed by David Capwell and Ariel Weisberg for CASSANDRA-18732
2025-04-17 11:59:50 -07:00
David Capwell 11ed5309b5 IndexOutOfBoundsException while serializing CommandsForKey
patch by David Capwell; reviewed by Blake Eggleston for CASSANDRA-19642
2025-04-17 11:59:50 -07:00
Aleksey Yeschenko 3127c558d3 Move preaccept expiration logic away from Agent
patch by Aleksey Yeschenko; reviewed by Alex Petrov and Benedict Elliott Smith for CASSANDRA-18888
2025-04-17 11:59:50 -07:00
Caleb Rackliffe 1b3c3f32a4 post-rebase fixes, mostly around CASSANDRA-19341 and CASSANDRA-19567 2025-04-17 11:59:50 -07:00
ci worker 980f1963f3 Accord: NPE in RangeDeps.forEach
patch by Benedict Elliott Smith, David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-19605
2025-04-17 11:59:50 -07:00
Blake Eggleston 543210ae12 CEP-15 (C*) Integrate accord with repair
Patch by Blake Eggleston; Reviewed by Ariel Weisberg and David Capwell for CASSANDRA-19472
2025-04-17 11:59:50 -07:00
David Capwell 64da7141f7 (Accord) Cassandra bootstrap no longer using the range txn and instead uses the sync point empty txn for reads
patch by David Capwell; reviewed by Blake Eggleston for CASSANDRA-19503
2025-04-17 11:59:50 -07:00
David Capwell 777cf84f64 Accord: PreLoadContext must properly and consistently support ranges
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-19355
2025-04-17 11:59:50 -07:00
Benedict Elliott Smith 7dadc080cb perf improvements 2025-04-17 11:59:50 -07:00
Blake Eggleston 599cd59736 post-trunk rebase fixes 2025-04-17 11:59:50 -07:00
Benedict Elliott Smith 763bcf2de5 Fast single-partition "Ephemeral Reads"
Introduce a special kind of non-durable read that provides only per-key linearizable isolation; i.e. strict-serializable isolation for single partition-key reads.
This read creates only a happens-before edge, by collecting dependencies for execution and ensuring that execution happens strictly after these dependencies
have executed, but at no precise time otherwise. So later writes may be witnessed, and if multiple keys are read they may represents different points in time.

patch by Benedict; reviewed by Ariel Weisberg for CASSANDRA-19305

Refactor CommandsForKey for efficiency, and to support transitive dependency elision

patch by Benedict; reviewed by Aleksey Yeshchenko for CASSANDRA-19310
2025-04-17 11:59:50 -07:00
Benedict Elliott Smith 8de3dfc711 CASSANDRA-18365: Protocol fixes 2025-04-17 11:59:49 -07:00
Aleksey Yeschenko 20af77031a Pre-requisite changes for CASSANDRA-18888
patch by Aleksey Yeschenko; reviewed by Ariel Weisberg for
CASSANDRA-18888
2025-04-17 11:59:49 -07:00
David Capwell 633bbee1a6 (Accord): Bug fixes from CASSANDRA-18675 to better support adding keyspaces
patch by David Capwell; reviewed by Benedict Elliott Smith, Blake Eggleston for CASSANDRA-18804
2025-04-17 11:59:49 -07:00
David Capwell a95f072e35 (Accord) NPE while trying to serialize FoundKnownMap as value is null half the time but unexpected while serializing
patch by David Capwell; reviewed by Blake Eggleston for CASSANDRA-19253
2025-04-17 11:59:49 -07:00
Blake Eggleston cb1a05c5d4 Schema based accord fast path configuration
Patch by Blake Eggleston; Reviewed by David Capwell and Alex Petrov for CASSANDRA-19009
2025-04-17 11:59:49 -07:00
Ariel Weisberg 1f4675a902 Fix AccordCommandsPurger universal durability check 2025-04-17 11:59:49 -07:00
Ariel Weisberg a9cb71833a Fix additional live migration/interop merge issues
s fc83325fa9 Fix AccordObjectSizes empty sizes
s 44bce6a08c Fix error handling when there are no column families to repair
s f1459540e5 Fix broken nowInSec deserialization
s 91c1befd1c Fix Mutation serializedSize
s b11467c200 Using simulated clock instead of raw nanoTime
s 6412b35924 Accord repair needs to use sentinel tokens
s d19c01ff01 Enable Accord repair with HappyPathFuzzTest
s 2da87f91b8 Implement abort in AccordRepairJob
s e12877c4fa move barrier to accord spec

Patch by Ariel Weisberg; Reviewed by David Capwell for CASSANDRA-19023
2025-04-17 11:59:49 -07:00
Blake Eggleston d07a36106d Reduce command deps
Patch by Blake Eggleston; Reviewed by Benedict Elliott Smith for CASSANDRA-18784
2025-04-17 11:59:49 -07:00
Benedict Elliott Smith 050688228f Improve validation and address various discovered faults
patch by Benedict; reviewed by Ariel Weisberg for CASSANDRA-19045
2025-04-17 11:59:49 -07:00
Ariel Weisberg c10c84b9cd Accord/non-Accord interoperability and support for live migration
Patch by Ariel Weisberg; Reviewed by Blake Eggleston for CASSANDRA-18129

Co-authored-by: Blake Eggleston <beggleston@apple.com>
2025-04-17 11:59:49 -07:00
Jon Meredith 9e766f46a3 Several simulator fixes not yet merged to cep-15-accord
s c4bf1533b4 Add more JVM arg checks to the paxos simulation runner
s 1b650a0636 break circular dependency between FileSystemOwnershipCheck and CassandraRelevantProperties
s e0111748dd fix verify with-rng and interrupts
s f8475f2a18 make SimulatedFailureDetector deterministic
s ee77734bbe Deterministic transformation
s 890f23696a Add mechanism forsimulator to intercept password salting
s 5205b99874 Specify Paxos V2 because it is the only linearizable option

Patch by Ariel Weisberg; Reviewed by David Capwell for CASSANDRA-19008
2025-04-17 11:59:49 -07:00
David Capwell 18d3aa47bc CEP-15: (C*) Implement TopologySorter to prioritise hosts based on DynamicSnitch and/or topology layout
patch by Blake Eggleston, David Capwell; reviewed by Blake Eggleston for CASSANDRA-18929
2025-04-17 11:59:49 -07:00
Jacek Lewandowski dfd1e99fd1 CEP-15: Add Accord configuration stub
Patch by Jacek Lewandowski; reviewed by David Capwell for CASSANDRA-18221
2025-04-17 11:59:49 -07:00
Jacek Lewandowski 27a9313970 CEP-15: Accord metrics
Patch by Jacek Lewandowski, reviewed by Caleb Rackliffe, David Capwell and Henrik Ingo for CASSANDRA-18580
2025-04-17 11:59:49 -07:00
Caleb Rackliffe cffe1cc61a ninja-fix: minor post-TCM-rebase cleanup 2025-04-17 11:59:49 -07:00
Aleksey Yeschenko c0a63c9164 CEP-15: Minimize transaction state kept in system tables
patch by Aleksey Yeschenko; reviewed by Ariel Weisberg for CASSANDRA-18573
2025-04-17 11:59:48 -07:00
Caleb Rackliffe 08428a2750 - Avoid persisting fragments that do not require completion as Updates in TxnWrite, as they can simply be pulled from PartialTxn when needed in Write#apply()
- Avoid serializing full TxnData instances to Accord state tables

patch by Caleb Rackliffe; reviewed by David Capwell, Benedict Elliot Smith, and Ariel Weisberg for CASSANDRA-18355
2025-04-17 11:59:48 -07:00
David Capwell 10e065ffe5 Fix Accord compaction purger tombstone logic
Accord compaction purgers see random slices of Accord state during compaction (based on randomly selected compaction inputs).

For at least the `durability` column in the `commands` table the tombstone being created when truncating was deleting the latest value since we can get enough information to truncate without actuall yhaving the latest `durability` value.

To fix we can wait to emit a tombstone until we are erasing the entire command row when truncating or truncating with outcome and meanwhile we can drop the extra columns that are no longer needed instead of using a tombstone. We don't need to emit cell tombstones we can drop them from the purger when processing each row.

patch by Ariel Weisberg; reviewed by David Capwell for CASSANDRA-18795
2025-04-17 11:59:48 -07:00
David Capwell 6167e436c3 CEP-15 (C*): when loading commands that have empty waiting_on, make sure not to loose the partial deps (#3590)
patch by David Capwell; reviewed by Aleksey Yeschenko for CASSANDRA-18783
2025-04-17 11:59:48 -07:00
Ariel Weisberg 82acd3e950 Allow exceptions to be propagated remotely
https://github.com/apache/cassandra-accord/pull/56

Patch by Ariel Weisberg; Reviewed by David Capwell for CASSANDRA-18779
2025-04-17 11:59:48 -07:00
David Capwell 76994f8196 CEP-15 (C*) When a host replacement happens don't loose the peer mapping right away (#3575)
patch by David Capwell; reviewed by Blake Eggleston for CASSANDRA-18764
2025-04-17 11:59:48 -07:00
Benedict Elliott Smith a6bb08d926 Support state eviction (i.e. permit the state machine to erase transactions that are known to be applied across the cluster)
patch by Benedict Elliott Smith; reviewed by Ariel Weisberg, Aleksey Yeschenko, and David Capwell for CASSANDRA-18883

Co-authored-by: Benedict Elliott Smith <benedict@apache.org>
Co-authored-by: Ariel Weisberg <aweisberg@apple.com>
Co-authored-by: Aleksey Yeschenko <aleksey@apache.org>
Co-authored-by: David Capwell <dcapwell@gmail.com>
2025-04-17 11:59:48 -07:00
Blake Eggleston 00bbf4ec8e CEP-15: Accord Bootstrap Integration
Patch by Blake Eggleston and Benedict Elliott Smith; Reviewed by David
Capwell for CASSANDRA-17101

CEP-15: Accord TCM integration

Patch by Blake Eggleston; Reviewed by David Capwell for CASSANDRA-18444
2025-04-17 11:59:48 -07:00
Aleksey Yeschenko 8f156fc5dc CEP-15: Extend Accord MessageType with a side effect flag
patch by Aleksey Yeschenko; reviewed by Benedic Elliott Smith for
CASSANDRA-18561
2025-04-17 11:59:48 -07:00
David Capwell f76f806de1 CEP-15: (C*) Add notion of CommandsForRanges and make this durable in C*
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-18519
2025-04-17 11:59:48 -07:00
Benedict Elliott Smith 537c1f991a (Accord only) Permit nodes to join a cluster without the full transaction history
patch by Benedict; reviewed by Blake Eggleston for CASSANDRA-18523
2025-04-17 11:59:48 -07:00
David Capwell 8633a301f7 CEP-15: (C*) Accord message processing should avoid being passed on to a Stage and run directly in the messageing handler
patch by David Capwell; reviewed by Ariel Weisberg, Benedict Elliott Smith for CASSANDRA-18364
2025-04-17 11:59:48 -07:00
David Capwell 7ad2bf672c CEP-15 (Accord) Original and recover coordinators may hit a race condition with PreApply where reads and writes are interleaved, causing one of the coordinators to see the writes from the other
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-18422
2025-04-17 11:59:48 -07:00
David Capwell f092461114 CEP-15: (Accord) Migrate Accord away from JDK random to a new interface RandomSource
patch by David Capwell; reviewed by Blake Eggleston for CASSANDRA-18213
2025-04-17 11:59:48 -07:00
Blake Eggleston 34bd73e2a7 CEP-15/Accord Immutable State Refactor
Patch by Blake Eggleston; Reviewed by David Capwell and Benedict Elliott Smith for Cassandra-18192
2025-04-17 11:59:48 -07:00
Blake Eggleston e6a8c030c1 add AsyncChain implementations and tests
Patch by Blake Eggleston; Reviewed by David Capwell & Benedict Elliott Smith for CASSANDRA-18004
2025-04-17 11:59:47 -07:00
Blake Eggleston 09c8fa1030 CEP-15 (C*): Messaging and storage engine integration
patch by Blake Eggleston; reviewed by Benedict Elliott Smith, David Capwell for CASSANDRA-17103
2025-04-17 11:59:47 -07:00