Commit Graph

31194 Commits

Author SHA1 Message Date
Ariel Weisberg e06b8eabb1 Ninja fix .gitmodules 2025-07-16 12:50:19 -04:00
Ariel Weisberg e6cf2132ab Add testing of consensus live migration to simulator
Patch by Ariel Weisberg; Reviewed by Benedict Elliott Smith for CASSANDRA-20587
2025-07-16 11:31:54 -04:00
Alex Petrov 54a9c407bd Improve Interval B-Tree test coverage; add pprinter for B-Trees
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20766
2025-07-16 11:32:51 +02:00
Benedict Elliott Smith e8bd2319f4 Accord Fixes:
- Don't try to update metrics when no TxnId (e.g. GetMaxConflict)
 - maybeExecuteImmediately did not guarantee mutual exclusivity
 - Cancellation of a running 'plain' task could corrupt AccordExecutor state
 - GetLatestDeps message serializer
 - txn_blocked_by StackOverflowError
 - Not updating CommandsForKey in all cases on restart
Also Improve:
 - TableId.from/toString
 - Route toString methods
 - Tracing coverage of FetchRoute
 - Replay command store parallelism

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20763
2025-07-14 23:22:45 +01:00
Alex Petrov ccf12ef845 Add accord journal standalone dump tool
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20738
2025-07-12 13:38:53 +02:00
Benedict Elliott Smith 674b8d5100 Deduplicate ranges in WatermarkCollector
Also: collect ranges before submitting to TopologyManager to avoid quadratic complexity

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20757
2025-07-12 10:36:53 +01:00
David Capwell 28edf72bce Fix flakey test org.apache.cassandra.utils.SimpleBitSetSerializerTest
patch by David Capwell; reviewed by Benedict Elliott Smith, David Capwell for CASSANDRA-20759
2025-07-11 14:09:50 -07:00
Benedict Elliott Smith 7e32d92d06 Fix/Improve IntervalBTree
- Use AsymmetricComparator for seeking
 - Reimplement AbstractTransformer for more efficienct operation when only transforming a subset (i.e. Subtraction)
 - Reuse source node IntervalMaxIndex calculations for first branch level (to save iterating leaves)

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20756
2025-07-11 19:42:03 +01:00
Benedict Elliott Smith 92cbde1fde Introduce PseudoUtf8Type for virtual tables to search on types that are otherwise treated as strings for pretty printing;
Use this facility to make Accord debug virtual tables more useful

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20755
2025-07-11 19:00:26 +01:00
Benedict Elliott Smith fd2e11f0d2 Accord Fixes:
- WatermarkCollector should not report same closed/retired epoch N times
 - AccordSyncPropagator can merge pending requests and back-off retries
 - AccordCommandLoader should notify listeners
 - AccordSegmentCompactor should estimate number of keys to ensure bloom filters work
 - txn_blocked_by table should report what it can, not throw IllegalStateException
 - Permit uncompressed system tables

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20754
2025-07-11 15:19:36 +01:00
David Capwell 8289bb4cde Accord: Topology serializer has a lot of repeated data, can dedup to shrink the cost
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20715
2025-07-10 20:06:02 -07:00
Marcus Eriksson f6c1002e44 Stream individual files in their own transactions and hand over ownership to a parent transaction on completion
patch by Marcus Eriksson; reviewed by Caleb Rackliffe and Jon Meredith for CASSANDRA-20728
2025-07-10 12:57:51 -05:00
Caleb Rackliffe 7b140f6a01 Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  SSTableIndexWriter#abort() should log more quietly in cases where an exception is not provided
2025-07-09 13:49:02 -05:00
Caleb Rackliffe f9d759dc38 SSTableIndexWriter#abort() should log more quietly in cases where an exception is not provided
patch by Caleb Rackliffe; reviewed by Jon Meredith for CASSANDRA-20695
2025-07-09 13:41:40 -05:00
Benedict Elliott Smith cba4208568 Standardise Replay logic to ensure SafeCommandStore.update is called
Also Fix:
 - Initialise home state when calling waiting() if not already initialised
 - Don't reportClosed/reportRetired for epochs that are already closed/retired
Also Improve:
 - Implement waitForQuiescence in AccordExecutor
 - Permit replay parallelism

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20750
2025-07-08 21:23:47 +01:00
Benedict Elliott Smith a866f92fcf Improve:
- Journal debugging vtable support
 - Background task tracing support
Fix:
 - HLC_BOUND only valid for strictly lower HLC
 - HAS_UNIQUE_HLC can only be safely computed if READY_TO_EXECUTE
 - Break recursion in CommandStore.ensureReadyToCoordinate
 - Fix find intersecting shard scheduler
 - Separate adhoc ShardScheduler from normal to avoid overwriting
 - Should still use execution listeners to detect invalid reads for certain transactions even with dataStoreDetectsFutureReads

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20746
2025-07-04 09:08:50 +01:00
Caleb Rackliffe 30f094080f Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Ensure CassandraIndexTest sets up properly when using SAI in the wake of CASSANDRA-20732
2025-07-02 12:04:23 -05:00
Caleb Rackliffe 81fcacdfa4 Ensure CassandraIndexTest sets up properly when using SAI in the wake of CASSANDRA-20732
patch by Caleb Rackliffe; reviewed by Stefan Miklosovic for CASSANDRA-20740
2025-07-02 11:52:34 -05:00
Benedict Elliott Smith c9e52399e6 Fix:
- Lock inversion when restarting durability for erased sync point
 - Initialise durability cycle start time
Improve:
 - Improve durability reporting
 - Timeout durability requests
 - DurabilityQueue concurrency should limit only until quorum is achieved
 - Some exceptions that may be thrown when starting coordination may not be propagated

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20328
2025-07-02 14:09:45 +01:00
Igor Kamyshnikov 7bf6eef9d4
Limit the number of held heap dumps to not consume disk space excessively
patch by Igor Kamyshnikov; reviewed by Dmitry Konstantinov, Stefan Miklosovic for CASSANDRA-20457
2025-06-30 11:34:23 +02:00
Benedict Elliott Smith 0a7797ca85 Fix:
- Cannot shrink CommandsForKey if loading pruned
 - NoSpamLogger to suppress AccordSyncPropagator repeats
 - Minor performance improvement to BTree.Subtraction
 - EphemeralReads should retry in a later epoch if replication factor changes
 - Fix no local epoch for NotAccept
 - Invalidate a command with no route but for which we know we own some key that has applied locally
 - Don't pre-merge existing DurableBefore, to reduce duplicate/redundant persistence
 - Misc purging bugs and improve testing of purging

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20739
2025-06-29 12:59:09 +01:00
David Capwell 78d6892dfb Fix flakey test AbstractTypeTest#meaninglessEmptyness why is equality so hard
patch by David Capwell; reviewed by Caleb Rackliffe for CASSANDRA-20733
2025-06-27 12:29:00 -07:00
Caleb Rackliffe 1c2307bd62 Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Avoid availability gap between UP and queryability marking for already built SAI indexes on bounce
2025-06-27 11:38:25 -05:00
Caleb Rackliffe f553acea3e Avoid availability gap between UP and queryability marking for already built SAI indexes on bounce
patch by Caleb Rackliffe; reviewed by David Capwell and Dmitry Konstantinov for CASSANDRA-20732
2025-06-27 11:30:13 -05:00
Alex Petrov d516ea2f0f Fix topology reporting bugs
- remove the immediate topology reporting for single-node clusters before subscribing to TCM events
- move the TCM listener subscription to occur before reporting the current topology
- add topology reporting after subscribing to TCM events with proper conditional logic
- add gap-filling failsafe to fetch any missing topologies

Patch by Alex Petov; reviewed by Benedict Elliott Smith for CASSANDRA-20730
2025-06-27 09:45:29 +02:00
Benedict Elliott Smith 115c553984 Follow-up to CASSANDRA-20726:
- Fix shouldCleanup handling of erase/expunge
 - Fix CommandChange handling of minUniqueHlc being cleared
 - Don't clear minUniqueHlc when fast applying; instead simply validate !isWaiting

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20726
2025-06-26 20:31:19 +01:00
Pranav Shenoy 4437fa4fd4 Ensuring Row reference is only used for IS Null/IS Not Null expressions
patch by Pranav Shenoy; reviewed by David Capwell and Maxwell Guo for CASSANDRA-20596
2025-06-26 09:32:32 +08:00
David Capwell 15ded6a68d Ninja for CASSANDRA-20727: fixed imports for src/java/org/apache/cassandra/utils/btree/BTree.java 2025-06-25 08:28:52 -07:00
David Capwell 2b94317572 Ninja for CASSANDRA-20667: Fixing checkstyle for src/java/org/apache/cassandra/service/accord/txn/AbstractParameterisedVersionedSerialized.java 2025-06-25 08:27:18 -07:00
Benedict Elliott Smith fadc64c17d (Accord) Fix:
- Attempt to fix CommandsForKey StackOverflowError (presumed to be reachable via SaveStatus->InternalStatus map returning null)
 - Bound recursion with SafeCommandStore.tryRecurse()
 - IndexOutOfBoundsException in CINTIA checkpoint list encoding bounds logic
 - Maintain MaxDecidedRX to save majority of work when deciding RX that are newer than those we have previously agreed
 - Introduce IntervalBTree and use in CommandsForRanges to limit time spent in critical section when there are millions of RX

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20727
2025-06-25 15:07:27 +01:00
Benedict Elliott Smith 6d303e6843 Improve:
- Introduce SequentialAgentExecutor
 - ExecuteEphemeralRead.LocalExecute (matching ExecuteTxn.LocalExecute)
 - remove AgentExecutor (agent() only used as implementation detail)
 - Skip CommandStore/CommandsForKey on read or apply, when safe to do so
 - Implement maybeExecuteImmediately
 - Faster maxTimestamp
Fix:
 - Marking vestigial without knowing all covering keys
 - Incorrect size in WaitingOn.none
 - Cleanup RX that are not known but are no longer needed, due to being defunct
 - Home should not abort because of local truncation; may still be incomplete on another shard
 - Invalidate infinite loop due to interpreting Vestigial as a possible decision (as though it were another Truncated state)
 - Known.isTruncated reporting incorrect answer in some cases, leading to infinite RecoverWithRoute loops as not slicing to correct subset and some shards are truncated and reject the deps collection
 - BurnTest slowCoordinatorDelay should grow with retryCount
 - NotAccept should check both ballot and saveStatus; PreCommitted or later can be propagated by Apply that has an earlier ballot
 - Handle awaiting locally retired epoch
 - Fix propagate low epoch of sync points
 - Fix GetEphemeralReadDeps.reduce NPE
 - Don't use tombstones to ERASE journal entries, as want to produce an Erased SaveStatus until EXPUNGE

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20726
2025-06-25 15:01:54 +01:00
David Capwell 8d641e06fc Accord: BEGIN TRANSACTIONs IF condition logic does not properly support meaningless emptiness and null values
patch by David Capwell; reviewed by Caleb Rackliffe for CASSANDRA-20667
2025-06-24 21:48:31 -07:00
Alex Petrov 6b2331560a Ninja: fix compilation after rebase 2025-06-23 14:59:42 +02:00
Alex Petrov 64934507ae Avoid waiting for topology indefinitely; print out debug string if topology can not be fetched
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20716
2025-06-23 14:54:10 +02:00
Alex Petrov 5746db0384 Accord Fixes / Improvments:
* Fix typos in AccordDebugKeyspace
  * Make durability service listen to topology changes
  * Account for truncated epoch when computing the low bound
  * Add a test to make sure GC issues do not slip past us in the future
  * Fix compilation

 Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20718
2025-06-23 14:54:05 +02:00
Alex Petrov 259b1a532e Fix StackOverflow exception on topology replay with a large number of active epochs/topologies
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20702
2025-06-23 14:54:05 +02:00
Alex Petrov f3bf24c89e Make durability service listen to topology changes
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20703
2025-06-23 14:54:05 +02:00
Alex Petrov 9d6fb76cfa Improve journal corruption detection
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20718
2025-06-23 14:54:05 +02:00
Alex Petrov eb4c6b66fb Mark last min known epoch - 1 as "truncated"
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20689
2025-06-23 14:54:04 +02:00
Alex Petrov eafd55170a Accord Improvements:
* Further relax conditions of 'unsafe' startup
  * Allow skipping unfinished allocations
  * Relax assertion: allow same key accross multiple different stores
  * Fix SegmentTest

Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20718
2025-06-23 14:54:04 +02:00
Alex Petrov 0936286ebd Fix visiting same key multiple times during replay
* Make sure to wait for Mutation stage quiesence during replay
* Fix visiting same key multiple times during replay

Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20675
2025-06-23 14:54:04 +02:00
Benedict Elliott Smith 1c7e96b5d7 Fix journal out of order iteration
Patch by Benedict Elliott Smith; reviewed by Alex Petrov for CASSANDRA-20718
2025-06-23 14:54:04 +02:00
Sam Tunnicliffe 693eab8776 Revert changes to serving FetchCMSLog/FetchPeerLog requests & remove ReconstructLogState
Patch by Sam Tunnicliffe; reviewed by Alex Petrov for CASSANDRA-20719

Co-authored-by: Sam Tunnicliffe <samt@apache.org>
2025-06-23 14:54:04 +02:00
Alex Petrov 6a37d88f5d Allow unsafe startup if accord.journal.failurePolicy is set to ALLOW_UNSAFE_STARTUP
Background: we want to have an escape hatch to pull / copy journal files to investigate locally, but at that stage, we would rather allow the cluster to skip a log entry rather than wipe an entire cluster.

Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20702
2025-06-23 14:54:04 +02:00
Alex Petrov b506665478 Fix CRC errors in Journal
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20661
2025-06-23 14:54:04 +02:00
Alex Petrov 9471016c4f Accord Fixes / Improvements:
* Ignore storage compat mode errors
  * Fix restart test (Cannot invoke "org.slf4j.Logger.debug(String, Object, Object)" because "this.inInstancelogger" is null)
  * Always speculate in accord replacement test to avoid read timeouts
  * Make sure not to cleanup fields before persisting them
        Background: we would clean up redundantBefore and some other fields.
        We are calling persistFieldUpdates, during which we "flush" field updates to command store, but then set it back to null:
            fieldUpdates = null;
        so when we get to persistFieldUpdatesInternal in AccordTask, we don't have any field updates.

Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20718
2025-06-23 14:54:04 +02:00
Alex Petrov 1350082a13 Avoid re-serializing all-equivalent topologies
patch by Alex Petrov; reviewed by Benedict for CASSANDRA-20721
2025-06-19 12:40:38 +01:00
Benedict Elliott Smith 7ef2ccd4a1 Erase should consistently erase all content
Also Fix:
 - slowCoordinatorDelay should bound its start point, and log more detail if its expectations are breached
 - Erased SaveStatus can be reported for all queried owned participants on a replica (the saved participants have been erased)

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20722
2025-06-19 12:40:38 +01:00
Maxwell Guo 9a3fda57cd Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Make Commitlog flush data safely in Direct IO mode
2025-06-17 23:33:23 +08:00
Maxwell Guo 8de4c9250e Make Commitlog flush data safely in Direct IO mode
patch by Maxwell Guo; reviewed by Ariel Weisberg for CASSANDRA-20692
2025-06-17 23:24:06 +08:00