Commit Graph

30903 Commits

Author SHA1 Message Date
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
Alex Petrov cc321720e3 Fix condition on where we shut down accord; move scheduled executor shutdown until after MS.
Wake up segment prepared after shutting down allocator, as no new segments will ever be allocated.

Shut down flusher slightly differently: we do not signal from fsync complete, since all blocks should have been fsynced by then, but we will add invariant check to notice runaway threads.

Wait for quiescense

Truncate blocking

Wait for scheduler shutdown before shutting down command store

Shut down accord after shutting down messaging

Truncate caches before replay
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
Ariel Weisberg 5693d0e2f4 ninja: Fix AcceptSerializer 2025-04-17 11:59:52 -07:00
Benedict Elliott Smith 282bacb84b ninja: fix CFK serializer 2025-04-17 11:59:52 -07:00
David Capwell d034661ae2 Support Restart node in Accord
patch by David Capwell; reviewed by Alex Petrov for CASSANDRA-19969
2025-04-17 11:59:52 -07:00
Alex Petrov d0a3586bd9 Add purging to Accord Journal table
Patch by Alex Petrov; reviewed by Aleksey Yeshchenko and Benedict Elliott Smith for CASSANDRA-19877
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
Blake Eggleston 1c7c311a2d ninja: handle serialization of truncated accept responses 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
Blake Eggleston fbfb633bda CEP-15 (C*) - misc accord perf improvements
Patch by Blake Eggleston; Reviewed by David Capwell for CASSANDRA-19940

Changes:
Increase accord repair range splitting
Streamline table metadata fetching - removes some unnecessary abstraction from the table metadata lookup path
Remote unnecessary set building when building lists of overlapping keys
Add separate recover delay for repair and increase default recover delay
2025-04-17 11:59:51 -07:00
Blake Eggleston dd1230f2a2 CEP-15 (C*): Read accord repair cfk keys from sstable index.
Patch by Blake Eggleston; Reviewed by David Capwell for CASSANDRA-19920
2025-04-17 11:59:51 -07:00
David Capwell 8f7532bc10 Rebase fixup: Accord should follow the pattern and use requestTime.computeDeadline like the rest of the code, and Accord timeout MUST be less than user timeout
Rebase fixup: when a local keyspace is being open but it isnt present return null so error msg can be provided
Rebase fixup: improved metrics error msg when the exception doesnt match what is expected
Rebase improvement: when we see a timeout or preempt use the new vtable to show the status cross the cluster
Rebase improvement: Cluster.checkForThreadLeaks now groups similar stack traces to make the output less dense
2025-04-17 11:59:51 -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
David Capwell f87c22cbbd Rebase fixup: SerializationsTest needed to recreate the service.SyncComplete.bin file 2025-04-17 11:59:51 -07:00
Blake Eggleston 0f51ee407b CEP-15: C* - Early repair failures hang nodetool
Patch by Blake Eggleston; Reviewed by Ariel Weisberg for CASSANDRA-19834
2025-04-17 11:59:51 -07:00
Blake Eggleston 058640be4e CEP-15 (C*) increase message timeouts for range barrier messages
Patch by Blake Eggleston; Reviewed by Ariel Weisberg for CASSANDRA-19926
2025-04-17 11:59:51 -07:00
Alex Petrov ef5f793dab Journal segment compaction
Patch by Alex Petrov and Aleksey Yeschenko, reviewed by Aleksey Yeschenko and Alex Petrov for CASSANDRA-19876
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
Alex Petrov 1866b8ec73 Fix Journal segment allocation/switch race condition
Patch by Alex Petrov; reviewed by Aleksey Yeschenko for CASSANDRA-19866
2025-04-17 11:59:51 -07:00
Alex Petrov 00ebcdc9f2 Fix a problem with static segments being opened with an empty offset after switch unless active segments offset file was closed
Patch by Alex Petrov; reviewed by Aleksey Yeschenko for CASSANDRA-19867
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
David Capwell 26d517f4ff txns that update a static row when the desired row doesn't exist leads to an error
patch by David Capwell; reviewed by Caleb Rackliffe for CASSANDRA-19855
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
Alex Petrov 788caeeef3 Switch to infinite loop executor instead of a while-loop thread.
Patch by Alex Petrov; reviewed by David Capwell for CASSANDRA-19864
2025-04-17 11:59:51 -07:00
Alex Petrov 66c50d796a Revert acccord module to absolute path 2025-04-17 11:59:51 -07:00
Alex Petrov c16297f862 Add an ability to reconstruct arbitrary epoch state from the log to TCM
Patch by Alex Petrov; reviewed by Marcus Eriksson for CASSANDRA-19790.
2025-04-17 11:59:51 -07:00
David Capwell a7c2bcafcd CommandsForRanges does not support slice which cause over returned data being sent
patch by David Capwell; reviewed by Alex Petrov for CASSANDRA-19857
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
Alex Petrov 1439fe8d31 Bring back Journal simulator (w/o Accord at least for now); add semaphore interceptor.
Patch by Alex Petrov; reviewed by David Capwell for CASSANDRA-19695.
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
Benedict Elliott Smith ac58a62c51 Introduce Periodic mode to Accord Journal
patch by Benedict; reviewed by Aleksey Yeschenko, Alex Petrov and David Capwell for CASSANDRA-19720
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 d6bf8ec3d0 Don't run incremental repairs for consensus only repairs
Patch by Blake Eggleston; reviewed by David Capwell for CASSANDRA-19717
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
Blake Eggleston c909f2d669 ninja: fix cqlsh tests 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