Commit Graph

7917 Commits

Author SHA1 Message Date
Aparna Naik a7695a6220 Forbid nodes upgrading to a version which cannot read existing log entries
Patch by Aparna Naik; reviewed by Marcus Eriksson and Sam Tunnicliffe
for CASSANDRA-21174
2026-02-27 14:46:14 +00:00
Dmitry Konstantinov 5b819f94fd Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Dynamically skip sharding L0 when SAI Vector index present
2026-02-26 12:51:43 +00:00
Michael Marshall 5172a0df3b Dynamically skip sharding L0 when SAI Vector index present
This is a partial solution to IllegalStateException thrown by VectorPostings. It works by using a single shard at L0 when a vector index is present. As noted in the jira ticket, there are edge cases that may still produce errors, notably the case where there are multiple data directories.
The key trade offs here are related to the time complexity for search. Since graph search is log(n), and searching m graphs is m * log(n), we see better search performance by building bigger graphs which is essentially log(m * n). We could pre-shard, which comes at a cost of increased search time complexity.

patch by Michael Marshall,Dmitry Konstantinov; reviewed by Caleb Rackliffe,Dmitry Konstantinov,Michael Semb Wever for CASSANDRA-19661

Co-authored-by: Michael Marshall <mmarshall@apache.org>
Co-authored-by: Dmitry Konstantinov <netudima@gmail.com>
2026-02-26 12:45:05 +00:00
Stefan Miklosovic 9303ca04de
Introduce a check for minimum time to pass to train or import a compression dictionary from the last one
patch by Stefan Miklosovic; reviewed by Yifan Cai for CASSANDRA-21179
2026-02-26 09:43:40 +01:00
Paulo Motta a9ee34b62d Add compaction strategy override via system properties
Introduce the ability to override compaction strategy for specific keyspaces
and tables at startup via two new system properties:
- cassandra.override_compaction.entities: comma-separated list of keyspaces
  and keyspace.table pairs (e.g. "ks1,ks2.tbl1,ks3.tbl2")
- cassandra.override_compaction.params: JSON compaction parameters to apply

Patch by Paulo Motta; Reviewed by Jaydeepkumar Chovatia for CASSANDRA-21169
2026-02-20 11:49:10 -05:00
Maxim Muzafarov b7eb323c5a
Fix nodetool sjk dropping all arguments after the first one
Patch by Maxim Muzafarov; reviewed by Dmitry Konstantinov for CASSANDRA-21009
2026-02-20 11:03:12 +01:00
Stefan Miklosovic 0be5ffa8c8
Introduce created_at column to system_distributed.compression_dictionaries
patch by Stefan Miklosovic; reviewed by Yifan Cai for CASSANDRA-21178
2026-02-19 03:53:19 +01:00
Dmitry Konstantinov eee06be567 Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Improve diagnostics for JUnit tests which crashed or timed out on Jenkins
2026-02-18 23:10:39 +00:00
Dmitry Konstantinov 8303257297 Improve diagnostics for JUnit tests which crashed or timed out on Jenkins
Add test container memory events printing to check if Linux OOM killer was active
Fix thread dump printing on junit test timeout
Process.pid() API is available since JDK9

patch by Dmitry Konstantinov; reviewed by Michael Semb Wever for CASSANDRA-21172
2026-02-18 22:53:39 +00:00
Dmitry Konstantinov 52d3b23df2 junit fix: avoid creating of thousands of threads by MatcherResponse when many messages are handled using MockMessagingSpy
Too many threads can lead to OOM, so new Thread is replaced with an executor
spin wait is added to HintsServiceTest.testPageSeek to avoid flaky NPE (HintsStore is populated in an async way)

patch by Dmitry Konstantinov; reviewed by Brandon Williams for CASSANDRA-21166
2026-02-18 22:34:03 +00:00
Stefan Miklosovic 3fc830a19c
Be able to detect and remove orphaned compression dictionaries
patch by Stefan Miklosovic; reviewed by Yifan Cai for CASSANDRA-21157
2026-02-17 11:07:49 +11:00
samlightfoot a3a834ad31 Reduce memory footprint of IndexSummaryTest large summary tests
The runtime overflow guard test (testLargeIndexSummary) required ~2 GiB of
off-heap memory to trigger the Integer.MAX_VALUE boundary in
IndexSummaryBuilder.maybeAddEntry. SafeMemoryWriter's 50% buffer growth
strategy caused ~5 GiB peak memory during reallocation (old + new buffer),
exceeding CI medium node limits (3.5-5 GB).

Extract the hardcoded Integer.MAX_VALUE threshold in IndexSummaryBuilder
into a @VisibleForTesting field (maxEntriesSize), allowing the test to
exercise the same guard logic with a 2 MB threshold instead. Rename both
large summary tests to reflect their distinct code paths: runtime truncation
vs constructor-initiated downsampling.

patch by Sam Lightfoot; reviewed by Brandon Williams,Dmitry Konstantinov,Michael Semb Wever for CASSANDRA-20599
2026-02-13 13:05:50 +00:00
samlightfoot ee124d2658 Fix flaky test2DeleteRangeWithOverlapingBoundAndSameTimestampCompaction
The two deletes use the same CQL timestamp, so compaction should merge
their overlapping range tombstones into a single open/close pair (no
boundary markers). However, DeletionTime also includes local_delete_time
(wall-clock seconds), which may differ between deletes if a second
boundary is crossed during the flush. Differing local_delete_time causes
the merger to treat them as distinct deletions, producing boundary
markers instead. Using executeInternalWithNowInSec with a fixed nowInSec
ensures both deletes get identical DeletionTime values.

patch by Sam Lightfoot; reviewed by Dmitry Konstantinov,Brandon Williams for CASSANDRA-21163
2026-02-12 18:06:15 +00:00
Jaydeepkumar Chovatia 4ada37e940 No need to evict already prepared statements, as it creates a race condition between multiple threads
patch by Jaydeepkumar Chovatia; reviewed by Alex Petrov for CASSANDRA-17401
2026-02-10 17:07:22 -08:00
jaydeepkumar1984 077b7ebe22 No need to evict already prepared statements, as it creates a race condition between multiple threads
patch by Jaydeepkumar Chovatia; reviewed by Alex Petrov for CASSANDRA-17401
2026-02-10 16:53:19 -08:00
Jaydeepkumar Chovatia 4a2bf29a34 ninja: ant check after CASSANDRA-17401 landed 2026-02-08 11:07:51 -08:00
Jaydeepkumar Chovatia d90fe76c8e No need to evict already prepared statements, as it creates a race condition between multiple threads
patch by Jaydeepkumar Chovatia; reviewed by Alex Petrov for CASSANDRA-17401
2026-02-08 10:49:16 -08:00
MichaelMorris 8b6195a975
Upgrade logback version to 1.5.18 and slf4j dependencies to 2.0.17
Dropback of CASSANDRA-20429 to cassandra-5.0

patch by Michael Morris; reviewed by Stefan Miklosovic, Brandon Williams for CASSANDRA-21137
2026-02-06 13:28:03 +11:00
Stefan Miklosovic 3dd460bf34
Remove traces of sampling and auto training for Zstd dictionary compression
This is unnecessary code as the current implementation of CEP-54 is not implemeting / exercising these features.

patch by Stefan Miklosovic; reviewed by Yifan Cai for CASSANDRA-21154
2026-02-05 22:27:18 +11:00
samlightfoot 6f5fe8c06d Add Direct IO support for compaction reads
This change adds support for using O_DIRECT (direct I/O) when reading SSTables
during compaction. Direct I/O bypasses the OS page cache, which can be beneficial
for compaction workloads where data is typically read once and not accessed again
soon after.

Key changes:
- Add DiskAccessMode.direct option for scan operations
- Introduce DirectThreadLocalByteBufferHolder and DirectThreadLocalReadAheadBuffer
  for aligned buffer management required by O_DIRECT
- Add ByteBufferHolder interface to abstract buffer management
- Modify FileHandle to support building direct I/O readers via toBuilder()
- Add startup check to verify Direct IO support on configured data directories
- Enable read-ahead for uncompressed data in Direct CompressedChunkReader
- Move direct IO support logic into FileHandle (from SSTableReader)
- Add comprehensive tests for direct I/O chunk readers and buffer holders

patch by Sam Lightfoot; reviewed by Ariel Weisberg and Maxwell Guo for CASSANDRA-19987
2026-02-04 12:40:42 -05:00
Josh McKenzie 940739a488 Add JDK21 support
Patch by Josh McKenzie; reviewed by Mick Semb Wever and Ekaterina Dimitrova for CASSANDRA-18831

Co-authored-by: Aleksey Yeschenko
Co-authored-by: Achilles Benetopoulos
Co-authored-by: Mick Semb Wever
2026-02-02 12:39:05 -05:00
arvindksi274-ksolves d1b4ddc32a
Fix JMXFeatureTest failure due to disabled AsyncProfiler
patch by Arvind Kandpal; reviewed by Jyothsna Konisa, Stefan Miklosovic for CASSANDRA-21135
2026-02-02 16:51:27 +11:00
nickbar01234 585f89bb42
Support custom StartupCheck implementations via SPI
patch by Nick Bar; reviewed by Stefan Miklosovic, Jyothsna Konisa for CASSANDRA-21093

Co-authored-by: Stefan Miklosovic <smiklosovic@apache.org>
2026-02-02 10:12:37 +11:00
Dmitry Konstantinov 1f220921dc Fix flakiness of AuditLoggerAuthTest and CQLUserAuditTest by awaiting of default superuser role creation
patch by Dmitry Konstantinov; reviewed by Michael Semb Wever for CASSANDRA-19165
2026-02-01 17:57:30 +00:00
arvindksi274-ksolves 350c83dc15 Fix CI regression in CompactionHistoryTest by enforcing STCS
patch by Arvind Kandpal; reviewed by Dmitry Konstantinov, Maxwell Guo for CASSANDRA-21145
2026-01-31 16:01:12 +00:00
Stefan Miklosovic 6bf598dcde
Make sstableexpiredblockers support human-readable output with SSTable sizes
patch by Stefan Miklosovic; reviewed by Brad Schoening, Rishabh Saraswat for CASSANDRA-20448
2026-01-31 20:57:23 +11:00
David Capwell 0fa26aa75d Fix flakey tests due to tests updating SSTable format dynamically
patch by David Capwell; reviewed by Jyothsna Konisa, Nitsan Wakart for CASSANDRA-21130
2026-01-27 09:55:21 -08:00
Maxwell Guo 21c4726b57 ninja: fix import check style problem for CASSANDRA-20081 2026-01-26 20:00:09 +08:00
Maxwell Guo 6d60102422 Enhance nodetool compactionhistory to report compaction type and strategy
patch by Arvind Kandpal; reviewed by Maxwell Guo and Jyothsna Konisa for CASSANDRA-20081
2026-01-26 18:39:40 +08:00
Paulo Motta afa55123c8 Fix initial auto-repairs skipped by too soon check
patch by Paulo Motta; reviewed by Jaydeepkumar Chovatia for CASSANDRA-21115
2026-01-23 11:32:25 -05:00
Paulo Motta 099f376635 Merge branch 'cassandra-5.0' into trunk 2026-01-22 14:19:32 -05:00
Paulo Motta 45afd18a13 Automatically disable zero-copy streaming for legacy sstables
Legacy Cassandra 3.x sstables use an old bloom filter format that is
incompatible with zero-copy streaming in Cassandra 5.0+. This patch
automatically detects sstables with the old bloom filter format
(pre-4.0) and disables zero-copy streaming for them, allowing legacy
sstables to be loaded via sstableloader without requiring manual flags.

The fix adds a version check in CassandraOutgoingFile.computeShouldStreamEntireSSTables()
that calls descriptor.version.hasOldBfFormat() to detect legacy sstables.

patch by Paulo Motta; reviewed by Stefan Miklosovic for CASSANDRA-21092
2026-01-22 14:16:16 -05:00
ireath 7fe688b000 CASSANDRA-21024: Add configuration to disk usage guardrails to stop writes across all replicas of a keyspace when any node replicating that keyspace exceeds the disk usage failure threshold.
This commit adds a new configuration, data_disk_usage_keyspace_wide_protection_enabled, which ensures that if any node which replicates a given keyspace is full, all writes to that keyspace are blocked.

patch by Isaac Reath; reviewed by Stefan Miklosovic, Paulo Motta for CASSANDRA-20124

Closes #4547
2026-01-21 16:53:54 -05:00
Arvind Kandpal bad0a10343 BETWEEN where token(Y) > token(Z) returns wrong answer
patch by Arvind Kandpal; reviewed by Caleb Rackliffe, David Capwell for CASSANDRA-20154
2026-01-21 09:33:27 -08:00
Jaydeepkumar Chovatia aa4da838ec ninja: ant check after CASSANDRA-17401 landed 2026-01-18 21:12:35 -08:00
Jaydeepkumar Chovatia a06df099f4 No need to evict already prepared statements, as it creates a race condition between multiple threads
patch by Jaydeepkumar Chovatia; reviewed by Alex Petrov for CASSANDRA-17401
2026-01-18 20:11:35 -08:00
Alan Wang 8974fdb821 Include Level information for UnifiedCompactionStrategy in nodetool tablestats output
Patch by Alan Wang, reviewed by Jyothsna Konisa and marcuse for CASSANDRA-20820
2026-01-13 14:12:38 +01:00
Stefan Miklosovic a3c40f1a67
ninja: skip AsyncProfiler tests in CI when kernel parameters are not right
Based on the official documentation here (1), AsyncProfiler works best with these kernel parameters.
Not all CI environments have them set. That would fail the tests which run the startup check
if kernel parameters are not like that.

It might be empirically observed that some AsyncProfiler functionality works even without these
kernel parameters, it might be investigated in follow-up work if we should not relax these conditions a bit.

(1) https://github.com/async-profiler/async-profiler/blob/master/docs/GettingStarted.md#before-profiling
2026-01-13 12:26:47 +01:00
Yaman Ziadeh 7c3c3a1d86 Initial async-profiler Nodetool implementation
patch by Yaman Ziadeh, Bernardo Botella, Stefan Miklosovic; reviewed by Dmitry Konstantinov, Jyothsna Konisa for CASSANDRA-20854
2026-01-12 15:02:13 -08:00
Nivy Kani bc9773ea0a Fix non-determinism of repair fuzz tests by passing randomizer to RetryStrategy
patch by Nivy Kani; reviewed by David Capwell, Jyothsna Konisa for CASSANDRA-21087
2026-01-09 16:17:43 -08:00
David Capwell 86e024b416 NPE when trying to use CAS on local system tables
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-21112
2026-01-09 16:13:01 -08:00
Nivy Kani 386183fce1 Fix off-by-one bug in exponential backoff for repair retry config
patch by Nivy Kani; reviewed by David Capwell, Jyothsna Konisa for CASSANDRA-21102
2026-01-09 10:15:09 -08:00
Stefan Miklosovic 98ec8970e1
Move training parameters for Zstd dictionary compression to CQL
It is also possible to override them via nodetool if necessary.

This patch also fixes the computation of sampling ratio to not lose the precision.

patch by Stefan Miklosovic; reviewed by Jyothsna Konisha, Yifan Cai for CASSANDRA-21078
2026-01-07 16:21:47 +01:00
Maxim Muzafarov 3dc33de6ea
Organize imports and standartize import order across entire codebase
Patch by Maxim Muzafarov; Reviewed by Michael Semb Wever for CASSANDRA-17925
2025-12-30 22:34:14 +01:00
Stefan Miklosovic 3c69bd2367
ninja: fix tests after CASSANDRA-21074 landed 2025-12-22 13:02:40 +01:00
Stefan Miklosovic b08da36770
Change the eager reference counting of compression dictionaries to lazy
patch by Stefan Miklosovic; reviewed by Yifan Cai, Jyothsna Konisa for CASSANDRA-21074
2025-12-20 15:03:25 +01:00
Nitsan Wakart ff78780d61 Add cursor based optimized compaction path
Adds a compaction implementation utilizing new fixed allocation SSTable reader/writer implementations, and other purpose built code, leading to improved efficiencies.

patch by Nitsan Wakart; reviewed by Branimir Lambov, Dmitry Konstantinov for CASSANDRA-20918
2025-12-19 12:45:25 -05:00
Sam Tunnicliffe ad3f0e8f41 Ensure that gossip state for LEFT nodes is expired eventually
By default the expiry time is calculated on each peer independently. It can be
made to converge by disabling gossip quarantine using the configuration setting
gossip_quarantine_disabled or via a hotprop on GossiperMBean.

Patch by Sam Tunnicliffe; reviewed by Marcus Eriksson for CASSANDRA-21035
2025-12-18 10:04:17 +00:00
Lukasz Antoniak 25c7c71b19 Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Fix CQLSSTableWriter serialization of vector of date and time patch by Lukasz Antoniak; reviewed by Andres de la Pena, Yifan Cai for CASSANDRA-20979
2025-12-18 07:41:44 +01:00
Lukasz Antoniak 0136fc9c8f Fix CQLSSTableWriter serialization of vector of date and time
patch by Lukasz Antoniak; reviewed by Andres de la Pena, Yifan Cai for CASSANDRA-20979
2025-12-18 07:35:45 +01:00
Benedict Elliott Smith e14816e244 Journal reads must select segments before sstables to avoid compaction races
Also Fix Cassandra:
 - In memory size calculation for CommandsForKey include Unmanaged
 - Accord load out-of-band cleanup should use SafeRedundantBefore
ALso Improve Cassandra:
 - Report replay information on begin replay
 - Improve AccordService shutdown
 - Log command store RedundantBefore on shutdown
 - Segment compaction should wait for readOrder barrier to replace segments, for additional safety
 - Journal segments should share readOrder with sstables
Also Improve Accord:
 - Iterate LocalListeners in order, so can query more effectively on node
 - Refine AbstractReplay.minReplay/shouldReplay

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-21804
2025-12-17 19:34:44 +00:00
Dmitry Konstantinov c295c33a26 Optimize UTF8Validator.validate for ASCII prefixed Strings
Use a plain loop to check if it is ASCII symbol before going into more complicated UTF8 parsing.
Avoid ValueAccessor to get extra boost for the ASCII check, especially in non-monomorphic cases.

Patch by Dmitry Konstantinov; reviewed by Jyothsna Konisa, Stefan Miklosovic for CASSANDRA-21075
2025-12-17 13:01:18 +00:00
David Capwell 9c8ab8809d Accord: write rejections would be returned to users as server errors rather than INVALID and TxnReferenceOperation didn't handle all collections prperly
patch by David Capwell; reviewed by Benedict Elliott Smith, Caleb Rackliffe, Jyothsna Konisa for CASSANDRA-21061
2025-12-15 16:32:07 -08:00
Benedict Elliott Smith e4684a11ec Fix:
- DefaultLocalListeners.ComplexListeners iterator IndexOutOfBoundsException
 - Race condition initialising empty ActiveEpochs, when minimum pending epoch can move backwards
 - SyncPoints must be declared in an epoch containing the ranges, and PENDING_REMOVAL ranges will reject non-syncpoint transactions
 - AccordExecutorMetrics is now registered on startup
 - getRecentValues for non-cumulative histogram should not subtract prior values
Improve:
 - Report ephemeral read, epoch waits and timeout metrics
 - Remove Topologies.SelectNodeOwnership, as no need to SLICE anymore
 - Introduce SystemEventListener for epoch waiting and timeout metrics
 - No-op but log if gcBefore provided to CFK is in the past

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-21076
2025-12-15 20:26:55 +00:00
Dmitry Konstantinov 8a72868066 Use byte[] directly in QueryOptions instead of ByteBuffer and convert them to ArrayCell instead of BufferCell.
Additionally replace List with array for bind values (we know the size in advance during a decoding), so in total: List<List> is replaced with byte[][] QueryOptions classes support both ways to get values now: using an old API with ByteBuffer and a new API with byte[].

Patch by Dmitry Konstantinov; reviewed by Michael Semb Wever for CASSANDRA-20166
2025-12-15 10:58:43 +00:00
Sunil Ramchandra Pawar a84abe7ba1 Extend nodetool verify to (optionally) validate SAI files
patch by Sunil Ramchandra Pawar; reviewed by Caleb Rackliffe and David Capwell for CASSANDRA-20949
2025-12-12 13:22:06 -06:00
Stefan Miklosovic a14406022d
Merge branch 'cassandra-5.0' into trunk 2025-12-11 11:24:51 +01:00
Stefan Miklosovic f894b8440d
Merge branch 'cassandra-4.1' into cassandra-5.0 2025-12-11 11:10:58 +01:00
Stefan Miklosovic efa0ead445
Merge branch 'cassandra-4.0' into cassandra-4.1 2025-12-11 11:02:05 +01:00
Mikołaj Diakowski 4c33f1f2d7
Restrict BytesType compatibility to scalar types only
Converting collections or UDTs to raw bytes is nonsensical - it
allows reading raw serialized bytes which have no meaningful
interpretation.

patch by Mikołaj Diakowski; reviewed by Stefan Miklosovic, Brandon Williams for CASSANDRA-20982
2025-12-11 10:53:29 +01:00
Benedict Elliott Smith 13a3ae9297 Fix:
- DurabilityQueue/ShardScheduler deadlock
 - MemtableCleanerThread.Cleanup assumes Boolean parameter is non-null, which is invalid if an exception has been thrown
 - AccordDurableOnFlush may be invoked while Accord is starting up, so should use AccordService.unsafeInstance
 - AccordCache shrink without lock regression
 - Cleanup system_accord compaction leftovers before starting up
 - system_accord_debug.txn order
 - system_accord_debug.txn_blocked_by order
 - system_accord_debug.shard_epochs order
Improve:
 - Set DefaultProgressLog.setMode(Catchup) during Catchup
 - IdentityAccumulators only need to readLast, not readAll
 - Limit number of static segments we compact at once to sstable
 - If too many static segments on startup, wait for them to be compacted

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-21053
2025-12-09 14:01:38 +00:00
Yifan Cai 21382e6874 Fix CompressionDictionary being closed while still in use
Patch by Yifan Cai; Reviewed by Stefan Miklosovic for CASSANDRA-21047
2025-12-08 14:37:13 -08:00
David Capwell c08666567d When updating a multi cell collection element, if the update is rejected then the shared Row.Builder is not freed causing all future mutations to be rejected
patch by David Capwell; reviewed by Bernardo Botella Corbi, Caleb Rackliffe, Dmitry Konstantinov for CASSANDRA-21055
2025-12-05 16:14:40 -08:00
jkonisa c4e1e2c8a8 CASSANDRA-21046 Schema annotations escape validation on CREATE and ALTER DDL statements
Patch by Jyothsna Konisa; Reviewed by Sam Tunnicliffe, Yifan Cai, Stefan Miklosovic for CASSANDRA-21046
2025-12-05 12:00:39 -08:00
Dmitry Konstantinov 241f478ce6 Fix flaky ThreadLocalMeterTest by disabling background triggering of ThreadLocalMeter#tickAll within the test case
Patch by Dmitry Konstantinov; reviewed by Brandon Williams, Stefan Miklosovic for CASSANDRA-21056
2025-12-03 16:55:53 +00:00
Valery Baranov 7ed0dc33d0
Add a test for checking permissions after grant authorize
patch by Valery Baranov; reviewed by Stefan Miklosovic, Brandon Williams for CASSANDRA-21051
2025-12-03 16:17:15 +01:00
Yifan Cai 0212713750 Fix flaky test CompressionDictionarySchedulerTest.testScheduleSSTableBasedTrainingWithSSTables
Patch by Yifan Cai; Reviewed by Dmitry Konstantinov for CASSANDRA-21054
2025-12-02 16:13:55 -08:00
Alan Wang fd2986b8bc
Added additional parameter to JVM shutdown to allow for logs to be properly shutdown
patch by Alan Wang; reviewed by Abe Ratnofsky, Caleb Rackliffe for CASSANDRA-20978
2025-12-01 19:32:51 +01:00
Marcus Eriksson e1e39b074a Refactor the way we check if a transformation is allowed to be committed during upgrades
Patch by marcuse and Sam Tunnicliffe; reviewed by Sam Tunnicliffe for CASSANDRA-21043

Co-authored-by: Sam Tunnicliffe <samt@apache.org>
2025-12-01 10:39:25 +01:00
Sam Tunnicliffe f2406b1070 Merge branch 'cassandra-5.0' into trunk 2025-11-28 11:12:04 +00:00
Sam Tunnicliffe f8f456f0f6 Fix default max interval calculation in FailureDetector
Patch by Sam Tunnicliffe; reviewed by Maxim Muzafarov and Stefan Miklosovic
for CASSANDRA-21025
2025-11-28 09:28:57 +00:00
Benedict Elliott Smith 4defbb9b1c Make TopologyException a checked exception to ensure they are handled carefully, as they may occur at surprising times
Also Fix:
 - Restore MaxDecidedRX on replay
 - When catchup_on_start_exit_on_failure == false, should startup on any kind of failure, not only timeout
 - lazy vtable LIMIT clause regression
 - DurabilityService.onEpochRetired
 - Command.validate when uniqueHlc differs
 - Avoid unsafe publication of AccordExecutor to scheduledFastTasks
 - AccordCache hitRate metric names
 - use long for return type of DurationSpec.toNanoseconds
 - Repair without all replicas should not request all Accord replicas participate
 - ExecuteAtSerializer
 - SyncPoints should be coordinated in an epoch that contains the ranges
Also Improve:
 - Split Accord startup into local+distributed, ensure we
 - Add logging to FetchDurableBefore on startup
 - Add randomised testing of AbstractLazyVirtualTable
 - Add validation of lazy virtual table key ordering
 - Don't send requests to faulty replicas
 - shrinkOrEvict large objects without holding lock
 - Accord dtest shutdown

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-21042
2025-11-27 13:12:25 +00:00
Sam Tunnicliffe dbfcd52fd5 Fix schema diffs when comments or security labels are modified
Patch by Sam Tunnicliffe; reviewed by Marcus Eriksson for
CASSANDRA-21045
2025-11-27 11:05:44 +00:00
Sam Tunnicliffe 209288cebe Reject PrepareJoin if tokens already assigned
Patch by Sam Tunnicliffe; reviewed by Marcus Eriksson for CASSANDRA-21006
2025-11-25 17:44:57 +00:00
Sam Tunnicliffe 856db2afa0 Retry without time limit calculates wait time correctly
Patch by Sam Tunnicliffe; reviewed by Marcus Eriksson for CASSANDRA-21002
2025-11-25 16:10:36 +00:00
Sam Tunnicliffe 44f6a32718 AlterSchemaStatement with no effect locally isn't submitted to CMS
Patch by Sam Tunnicliffe; reviewed by Marcus Eriksson for CASSANDRA-21001
2025-11-25 16:09:34 +00:00
Dmitry Konstantinov 909ed8b949 Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Fix cleanup of old incremental repair sessions in case of owned token range changes or a table deleting
2025-11-22 11:49:07 +00:00
Dmitry Konstantinov 1a12cbb349 Merge branch 'cassandra-4.1' into cassandra-5.0
* cassandra-4.1:
  Fix cleanup of old incremental repair sessions in case of owned token range changes or a table deleting
2025-11-22 11:35:37 +00:00
Dmitry Konstantinov 7f592803a4 Merge branch 'cassandra-4.0' into cassandra-4.1
* cassandra-4.0:
  Fix cleanup of old incremental repair sessions in case of owned token range changes or a table deleting
2025-11-22 11:23:21 +00:00
Dmitry Konstantinov 8d2c11ed2e Fix cleanup of old incremental repair sessions in case of owned token range changes or a table deleting
Patch by Dmitry Konstantinov; reviewed by Marcus Eriksson, Jaydeepkumar Chovatia for CASSANDRA-20877
2025-11-22 11:17:35 +00:00
Sam Tunnicliffe f05b27502f Improve CMS initialization
* Better handling of DOWN unupgraded nodes
* Test that aborted CMS initialization cleans up state properly
* Clean up orphaned PreInitialize entries in the log on bounce
* Unconditionally reset initiator during abort
* Ensure that metadata log entries aren't exchanged before CMS
  initialization is complete
* Precalculate common serialization version, excluding non-upgraded and
  LEFT nodes
* Decide if metadata-impacting upgrade is in progress using min common
  version
* Add metadata identifier to nodetool cms output

Patch by Sam Tunnicliffe and Marcus Eriksson; reviewed by Sam
Tunnicliffe and Marcus Eriksson for CASSANDRA-21036

Co-authored-by: Marcus Eriksson <marcuse@apache.org>
Co-authored-by: Sam Tunnicliffe <samt@apache.org>
2025-11-21 16:40:24 +00:00
jkonisa b11633be4f CASSANDRA-20943 Introducing comments and security labels for schema elements 2025-11-19 11:32:50 -08:00
Stefan Miklosovic dc89b8c802
Extend nodetool tablestats for dictionary memory usage
patch by Stefan Miklosovic; reviewed by Yifan Cai for CASSANDRA-20940
2025-11-19 19:12:26 +01:00
Yuqi Yan e621d8a6c1 Introduce separate GCInspector thresholds for concurrent GC events.
For GC like ShenandoahGC/ZGC etc., there are GC events that do not have STW pauses (Concurrent phases).
Operator might find it reasonable to use lower thresholds for events require STW pauses and higher thresholds for concurrent phases.
gc_concurrent_phase_log_threshold and gc_concurrent_phase_warn_threshold configuration options are introduced in cassandra.yaml

Patch by Yuqi Yan; reviewed by Dmitry Konstantinov, Stefan Miklosovic for CASSANDRA-20980
Co-authored-by: Stefan Miklosovic
2025-11-16 21:29:00 +00:00
Dmitry Konstantinov 6b57acc7f4 Reduce contention in MemtableAllocator.allocate
- Estimate memory required to allocate for applying a partition update into a memtable and allocate this memory in one shot, then use it as a request-local SLAB
- Reduce contention by switching MemtableAllocator.SubAllocator#owns from updates via AtomicLongFieldUpdater to LongAdder usage. MemtableAllocator.SubAllocator#acquired(..) method updates "owns" value but does not use the updated result.
- Reduce contention by replacing of CAS loop in MemtablePool.SubPool#tryAllocate with allocatedUpdater.addAndGet(this, size)

Patch by Dmitry Konstantinov; reviewed by Michael Semb Wever for CASSANDRA-20226
2025-11-15 15:33:02 +00:00
Dmitry Konstantinov 4cf684b464 Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Fix memory leak in BufferPoolAllocator when a capacity needs to be extended
2025-11-14 17:53:46 +00:00
Dmitry Konstantinov 2fec119f09 Merge branch 'cassandra-4.1' into cassandra-5.0
* cassandra-4.1:
  Fix memory leak in BufferPoolAllocator when a capacity needs to be extended
2025-11-14 17:46:13 +00:00
Dmitry Konstantinov ed7d5840b7 Merge branch 'cassandra-4.0' into cassandra-4.1
* cassandra-4.0:
  Fix memory leak in BufferPoolAllocator when a capacity needs to be extended
2025-11-14 17:34:10 +00:00
Dmitry Konstantinov 3f079b2345 Fix memory leak in BufferPoolAllocator when a capacity needs to be extended
Before the fix during a capacity extension BufferPoolAllocator returned to BufferPool a sliced ByteBuffer wrapper object instead of the originally allocated one, so the ByteBuffer was not recycled by BufferPool
Adjust BufferPoolAllocatorTest to test the ByteBuf capacity extension with a real BufferPool behavior

Patch by Dmitry Konstantinov; reviewed by Michael Semb Wever for CASSANDRA-20753
2025-11-14 17:11:25 +00:00
Stefan Miklosovic 99be618ec1
Merge branch 'cassandra-5.0' into trunk 2025-11-13 16:46:06 +01:00
shruti-p-s e2f74ed65b
Adding missing configs in system_views.settings to be backward compatible
patch by Sudipta Laha; reviewed by Stefan Miklosovic, Tiago L. Alves, Francisco Guerrero, Yifan Cai for CASSANDRA-20863
2025-11-13 16:42:38 +01:00
Stefan Miklosovic 136e5fd222
Add export, list, import sub-commands for nodetool compressiondictionary
patch by Stefan Miklosovic; reviewed by Yifan Cai for CASSANDRA-20941
2025-11-13 15:38:42 +01:00
Benedict Elliott Smith 494c3c7bef Add AccordExecutorMetrics
Also Introduce:
 - Sharded/LogLinearDecayingHistogram
Also Improve:
 - Do not take a reference to CFK unless relevant
Also Fix:
 - Sharded/LogLinearHistogram
 - ExecuteFlags serialization bug in ReadData

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-21017
2025-11-13 14:36:15 +00:00
David Capwell f43d9d0f7f Add support in the binary protocol to allow transactions to have multiple conditions
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20883
2025-11-12 10:13:41 -08:00
Benedict Elliott Smith f6fd49566f Improve DurabilityQueue:
- All retries are appended to a delay queue so overlaps can be pruned
 - Quorum successes are not retried if there are superseding sync points covering the ranges
 - User-initiated requests are not purged unless the request has timed out or otherwise completed
 - Overlapping requests are queued up against the next to run
Alsp (C*):
 - Catch-up with quorums on restart
 - Manage an ordered set of keys in cache for faster range searches
Also (Accord):
 - Update copy of BTree and import IntervalBTree
 - Fix RedundantStatus WAS_OWNED_OVERRIDE_MASK
 - Add Catchup mechanism to reach parity with a quorum on restart

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-21013
2025-11-12 17:20:25 +00:00
David Capwell 9a534ba06f Merge branch 'cassandra-5.0' into trunk 2025-11-07 11:53:48 -08:00
David Capwell 4091613298 Merge branch 'cassandra-4.1' into cassandra-5.0 2025-11-07 11:52:14 -08:00
David Capwell e4ea61c1cc Merge branch 'cassandra-4.0' into cassandra-4.1 2025-11-07 11:46:57 -08:00
Nikhil Kumawat 61014f2ae7 Leveled Compaction doesn't validate maxBytesForLevel when the table is altered/created
patch by Nikhil Kumawat, Nikhil; reviewed by David Capwell, guo Maxwell for CASSANDRA-20570
2025-11-07 11:44:12 -08:00
Stefan Miklosovic f0cb7f1c1a
Merge branch 'cassandra-5.0' into trunk 2025-11-07 14:09:41 +01:00
Stefan Miklosovic 5ea935d6b8
Merge branch 'cassandra-4.1' into cassandra-5.0 2025-11-07 14:04:21 +01:00
Stefan Miklosovic 7b312d4329
Merge branch 'cassandra-4.0' into cassandra-4.1 2025-11-07 13:57:43 +01:00
Ruslan Fomkin 2d7e99f7b9
Document new table name length limit
CASSANDRA-20389 implemented limit on table name length of 222
characters. This commit updates the documentation to reflect this.

It also adds an assert in CreateTableValidationTest to ensure that the
documented limit matches the actual constant.

patch by Ruslan Fomkin; reviewed by Brad Schoening, Dmitry Konstantinov for CASSANDRA-20914
2025-11-07 13:54:03 +01:00
Benedict Elliott Smith aa5c3aba1d Improve Topology Management
Merge ConfigurationService with TopologyManager to remove cyclic dependency and duplicated work.
Also:
 - Improve visibility of work blocking topology processing
 - Ensure we cannot double-count peers when deciding an epoch's distributed readiness
 - Remove the possibility of distributed stalls, by processing new topologies as soon as a
   contiguous sequence is known locally, regardless of whether anyprior local epoch is ready to
   coordinate or has recorded this fact to peers. The notification of local readiness continues
   to be processed only once all prior epochs are ready, but we can begin using and readying
   later epochs immediately.

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20998
2025-11-06 14:38:01 +00:00
Stefan Miklosovic 1a96b8803a
Enable CQLSSTableWriter to create SSTables compressed with a dictionary
patch by Stefan Miklosovic; reviewed by Yifan Cai for CASSANDRA-20938
2025-11-04 11:11:14 +01:00
Benedict Elliott Smith c9e31f297c Introduce "hardRemoved" concept for marking nodes permanently offline, to permit recovery from availability loss
Also fix:
 - Paxos should not update minHlc if AccordService is not setup
 - Remove EndpointMapper methods that require non-null, to ensure call-sites handle null case explicitly
 - AccordRepair should specify the Node Ids that must participate, but these should not affect the durability requirements for GC
 - Avoid erroneously marking UniversalOrInvalidated when only known to quorum
 - AccordSyncPropagator should not consult FailureDetector as it may throw UnknownEndpointException
 - Refuse ReplaceSameAddress if accord enabled
 - Reset Accord topologies on restart if no local command stores to ensure we can catch up (as intervening epochs may have otherwise been GC'd)
 - MaybeRecover should not abort if found durable if either: 1) prevProgressToken already witnessed durable; or 2) Home state has requested we recover anyway
 - Invariant in MaybeRecover is too strong now we permit recovering when known to be stable
 - ReadData must respond with InsufficientAndWaiting if not Stable to ensure Durability is inferred correctly by ExecuteTxn
 - Avoid StackOverflowException in NotifyWaitingOn
 - PreAccept should honour the REJECTED flag of any member of the latest topology if the vote would be relied upon for any prior epoch's quorum
 - Resume Accord bootstrap on restart
 - Fix burn test non-determinism
 - Reset Accord topologies on restart if no local command stores to ensure we can catch up (as intervening epochs may have otherwise been GC'd)
 - Exclude stale or removed ids from sync points
 - Terminate a failed DurabilityRequest if a required participant is now removed/hardRemoved
Also improve:
 - Introduce accord_debug_keyspace.{listeners_txn, listeners_local}
 - Filter and record faulty in AbstractCoordination
 - If we are the home shard, and our home progress status is done, we should not wait for the home shard to advance the waiting progress state
 - Introduce CommandStore.tryExecuteListening to try to execute all waiting transactions and their dependencies
 - ExecuteTxn on recovery should not wait, to avoid consuming progress log concurrency slots for transactions that cannot execute
 - HomeState should update its phase based on the command status to handle operator request to retry all states
 - Separate home/wait queue in DefaultProgressLog
 - Additional tracing
 - Do not call trySendMore from prerecordFailure
 - Force full recovery for sync points if we have lost quorum

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20921
2025-11-03 15:16:27 +00:00
Yifan Cai 307603a4ad Support ZSTD dictionary compression
patch by Yifan Cai; reviewed by Jon Haddad, Stefan Miklosovic for CASSANDRA-17021
2025-10-30 16:18:37 -07:00
Stefan Miklosovic 9142d0c851
Fix ExceptionsTable when stacktrace has zero elements
patch by Stefan Miklosovic; reviewed by Brandon Williams, Dmitry Konstantinov for CASSANDRA-20992
2025-10-30 17:37:17 +01:00
Benedict Elliott Smith e768418696 Accord: Improve Tracing
- Introduce pattern tracing, that can intercept failed or new coordinations matching various filters
     - Support additional tracing event collection modes (SAMPLE and RING)

    patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20911
2025-10-29 10:16:32 +00:00
Benedict Elliott Smith b712cfb930 RemoteToLocalVirtualKeyspace: supporting access to all nodes' local virtual tables from any node in the cluster
patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20900
2025-10-28 18:51:44 +00:00
Benedict Elliott Smith f7743fe3ab Lazy Virtual Tables
Also Improve:
 - Searchable system_accord_debug.txn
 - Integrate txn_blocked_by deadline and depth filter with execution logic, to ensure we terminate promptly and get a best effort reply

patch by Benedict; reviewed by Aleksey Yeschenko for CASSANDRA-20899
2025-10-28 11:19:37 +00:00
Alex Petrov 3d2b0efc34 Accord: Add Rebootstrap and unsafe Bootstrap
To support recovering a node that has lost some of its local transaction log, introduce rebootstrap and unsafe bootstrap modes, where Accord ensures no responses are produced for transactions the node cannot be certain it had not previously answered.

patch by Benedict and Alex Petrov for CASSANDRA-20908
2025-10-27 14:24:06 +00:00
Mick Semb Wever 74de57713a
Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  ninja-fix – Fix eclipse-warnings error for CASSANDRA-19564
  ReadCommandController should close fast to avoid deadlock when building secondary index
2025-10-27 10:02:07 +01:00
Mick Semb Wever d0c5f6b0ce
Merge branch 'cassandra-4.1' into cassandra-5.0
* cassandra-4.1:
  ninja-fix – Fix eclipse-warnings error for CASSANDRA-19564
  ReadCommandController should close fast to avoid deadlock when building secondary index
2025-10-27 09:52:51 +01:00
Runtian Liu 59574a86a3 ReadCommandController should close fast to avoid deadlock when building secondary index
patch by Runtian Liu; reviewed by Caleb Rackliffe, Jaydeepkumar Chovatia for CASSANDRA-19564
2025-10-26 17:39:39 -07:00
Stefan Miklosovic 035a220d55
Implementation of CEP-55 - Generation of role names
patch by Stefan Miklosovic; reviewed by Bernardo Botella for CASSANDRA-20897
2025-10-23 13:53:56 +02:00
blambov 9cc3c085de Merge branch 'cassandra-5.0' into trunk 2025-10-20 16:30:49 +03:00
blambov 1db6f54925 Fix range queries on early-open BTI files
patch by Branimir Lambov; reviewed by Stefan Miklosovic for CASSANDRA-20976
2025-10-20 16:28:01 +03:00
Marcus Eriksson 0afa31cd5c Merge branch 'cassandra-5.0' into trunk 2025-10-14 13:21:30 +02:00
Marcus Eriksson e721705152 Avoid re-initializing underlying iterator in LazilyInitializedUnfilteredRowIterator after closing
Patch by marcuse; reviewed by Aleksey Yeschenko and Branimir Lambov for CASSANDRA-20972
2025-10-14 13:19:51 +02:00
Caleb Rackliffe 11278547e1 Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Flush SAI segment builder when current SSTable writer is switched
2025-10-13 15:45:20 -05:00
Caleb Rackliffe 98e7cd5d99 Flush SAI segment builder when current SSTable writer is switched
patch by Pranav Shenoy; reviewed by Caleb Rackliffe and Zhao Yang for CASSANDRA-20752
2025-10-13 15:17:27 -05:00
Aparna Naik 61959e215c Add DDL Guardrail enabling administrators to disallow creation/modification of keyspaces with durable_writes = false
patch by Aparna Naik; reviewed by Caleb Rackliffe and Stefan Miklosovic for CASSANDRA-20913
2025-10-02 15:50:31 -05:00
Dmitry Konstantinov e6a97025bd Optimize Counter, Meter and Histogram metrics using thread local counters
Codahale metrics do not provide the ability to create custom metric implementations, so we have to inherit from Codahale classes.
For better cache locality rate and counter values are extracted to a common thread-local arrays.
Threads death is tracked using 2 approaches: FastThreadLocal.onRemoval callback and phantom references to Thread objects.
Phantom references are used to track aliveness of metric users and reusing of metric IDs.

Patch by Dmitry Konstantinov; reviewed by Benedict Elliott Smith for CASSANDRA-20250
2025-09-28 16:47:50 +01:00
Stefan Miklosovic 608a1b59e2
Merge branch 'cassandra-5.0' into trunk 2025-09-24 10:25:23 +02:00
Stefan Miklosovic b23db408c5
Merge branch 'cassandra-4.1' into cassandra-5.0 2025-09-24 10:22:16 +02:00
Stefan Miklosovic 4a201d4f6f
Merge branch 'cassandra-4.0' into cassandra-4.1 2025-09-24 10:20:21 +02:00
Yifan Cai 90f231ad56
Fixed incorrect error message constant for keyspace name length validation
patch by Yifan Cai; reviewed by Maxwell Guo, Stefan Miklosovic for CASSANDRA-20915
2025-09-24 10:13:04 +02:00
Stefan Miklosovic e42599a094
Expose uncaught exceptions in system_views.uncaught_exceptions table
patch by Stefan Miklosovic; reviewed by Dmitry Konstantinov for CASSANDRA-20858
2025-09-23 13:52:00 +02:00
Stefan Miklosovic 02ef8f8a0d
Merge branch 'cassandra-4.0' into cassandra-4.1 2025-09-19 14:18:29 +02:00
Stefan Miklosovic 818de8e11e
Merge branch 'cassandra-5.0' into trunk 2025-09-19 12:05:59 +02:00
Marko Tsymbaluk b26e33d506
Represent complex settings as JSON on system_views.settings table
The patch for 5.0 is preserving old behavior, it is possible to turn on JSON representation by a system property.
The patch for trunk is by default transforming collections to JSON string but there is the property (same as in 5.0) which has default to be set to true.

patch by Marko Tsymbaluk; reviewed by Paulo Motta, Stefan Miklosovic for CASSANDRA-20827

Co-authored-by: Stefan Miklosovic <smiklosovic@apache.org>
2025-09-19 11:58:23 +02:00
Benedict Elliott Smith 12000406c3 Follow-up to CASSANDRA-20906: Fix Simulator 2025-09-18 14:14:53 +01:00
Benedict Elliott Smith 0b2012826a Split AsyncChain and AsyncResult; normalise AsyncResult with C* Future
patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20906
2025-09-18 12:31:13 +01:00
jaydeepkumar1984 bf2c1c124e Improved observability in AutoRepair to report both expected vs. actual repair bytes and expected vs. actual keyspaces
patch by Jaydeepkumar Chovatia; reviewed by Chris Lohfink for CASSANDRA-20581
2025-09-16 20:38:39 -07:00
Maxwell Guo dddbe1ad87 Execution of CreateTriggerStatement should not rely on external state
patch by Maxwell Guo; reviewed by Sam Tunnicliffe for CASSANDRA-20287
2025-09-15 17:49:05 +08:00
Pranav Shenoy cf806cac1a Support LIKE expressions in filtering queries
patch by Pranav Shenoy; reviewed by Caleb Rackliffe and David Capwell for CASSANDRA-17198
2025-09-11 11:20:20 -05:00
Dmitry Konstantinov 06440e947a Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Prevent too long table names not fitting file names
2025-09-10 23:39:17 +01:00
Dmitry Konstantinov 7f92e1ac2c Merge branch 'cassandra-4.1' into cassandra-5.0
* cassandra-4.1:
  Prevent too long table names not fitting file names
2025-09-10 23:09:58 +01:00
Dmitry Konstantinov bff43df7db Merge branch 'cassandra-4.0' into cassandra-4.1
* cassandra-4.0:
  Prevent too long table names not fitting file names
2025-09-10 22:59:34 +01:00
Ruslan Fomkin 6c29686ea7 Prevent too long table names not fitting file names
The length of table names was not controlled. This is likely due to
confusion between validation methods with similar names. As result
creating tables with too long names led to the too long file name
exceptions during table creations.

This commit adds a validation of table name lengths to avoid the too
long file name errors. The validation length is based on how the table
name is used to create file/directory names, and needs to be exact to
prevent the too long file name exception, but allow all other table
names, which didn't lead to the too long file name exception. This
length limit is different from the existing name length limit of 48
characters used by common validation functions.

Thus, this commit moves out the length validation from the validation
methods into a separate length validation method, so the errors on
names are more specific. The non-length validation methods combined
into a single method, which checks for empty names and valid characters.

New constants are added for the length limits.

Table name related code are moved into methods in TableMetadata class,
so their semantics are more clear and to allow reuse, e.g., in
asserting the table name length constant.
Tests are added for the long table names and non-alphanumeric names.

Keyspace name validation function is now shared between two classes and
a unit test of it is added.

Patch by Ruslan Fomkin; reviewed by Piotr Kołaczkowski, Dmitry
Konstantinov, Maxwell Guo for CASSANDRA-20389
2025-09-10 22:48:43 +01:00
Marcus Eriksson 55db3181fb Make legacy index rebuilds safe on Gossip -> TCM upgrades
patch by Caleb Rackliffe; reviewed by Marcus Eriksson for CASSANDRA-20887

Co-authored-by: Caleb Rackliffe <calebrackliffe@gmail.com>
Co-authored-by: Marcus Eriksson <marcuse@apache.org>
2025-09-09 13:59:26 -05:00
Benedict Elliott Smith b4f6c7c617 Topology compaction omits image records if minEpoch is ahead of last image
Also Fix:
 - RegisteredCallback should remove itself from callback map when cancelled
 - Do not throw CancellationException when processing requests that have been aborted, as may be caused by a successful meaningful reply that can be overridden
 - system_accord_debug.{executors,coordinations} fail with ClassCastException
 - CommandStore.updateMinHlc eats up CPU as called much too often
 - AccordCache not notifying flushed on shutdown
Also Improve:
 - Support skipping Deps
 - Violation information reported
 - Sort CommandStore shards by id

patch by Benedict; reviewed by Aleksey Yeschenko for CASSANDRA-20896
2025-09-09 11:11:23 +01:00
Himanshu Jindal 965a39166c Stop repair scheduler if two major versions are detected
patch by Himanshu Jindal; reviewed by Jaydeepkumar Chovatia, Andy Tolbert for CASSANDRA-20048
2025-09-08 09:26:31 -07:00
Benedict Elliott Smith b91731b5a3 All pending topology notifications must be propagated to a newly published epoch, not only the pending notification for that epoch
Also Fix:
 - JournalAndTableKeyIterator not merging in consistent order, which can lead to replaying topologies in non-ascending order
 - Invariant failure when reporting topologies if fetchTopologies on startup yields a gap
 - removeRedundantMissing could erroneously remove missing dependencies occurring after the new appliedBeforeIndex
 - Invariant failure for some propagate calls supplying 'wrong' addRoute
 - Disambiguate nextTxnId and nextTxnIdWithDefaultFlags
Also Improve:
 - LocalLog should not use NoSuchElementException for control flow (instead use ConcurrentSkipListMap)

patch by Benedict; reviewed by Aleksey Yeschenko for CASSANDRA-20886

 - JournalAndTableKeyIterator not merging in consistent order
2025-09-04 16:40:42 +01:00
Alex Petrov 0151131e43 Split out Topologies into Partitions
patch by Alex Petrov; reviewed by Benedict for CASSANDRA-20838
2025-09-03 19:04:45 +01:00
Benedict Elliott Smith a813a51f7c Improve Observability:
- Track all active Coordinations
 - Refactor Replica/Coordinator metrics and report Coordinator exhausted/preempted/timeout
 - DurabilityQueue metrics and visibility
Also Fix:
 - WaitingState can get cause distributed stall when asked to wait for CanApply if not yet PreCommitted; track separate querying state and advance this to the next achievable state rather than the desired final state
 - Stalled coordinators should not prevent recovery
 - Edge case with fetch unable to make progress when pre-bootstrap and all peers have GC'd
 - Dependency initialisation for sync points across certain ownership changes
 - SyncPoint propagation may not include all of the epochs required on the receiving node for ranges they have lost but not closed, and receiving node does not validate them
 - Stable tracker accounting with LocalExecute
 - Do not prune non-durable APPLIED as must be reported in dependencies until durably applied (so as not to break recovery)
 - Ensure we cannot race with replies when initiating Coordination
 - ProgressLog does not guarantee to clear home or waiting states when erased or invalidated by compaction
 - WaitingState on non-home shard cannot guarantee progress once home shard is Erased
 - WaitingOnSync handles retired ranges incorrectly
Also Improve:
 - Standardise failure accounting, use null to represent single reply timeouts
 - BurnTest record/replay to/from file

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20878
2025-09-02 18:47:46 +01:00
Stefan Miklosovic 9c93d52ac9
Implement nodetool history
patch by Stefan Miklosovic; reviewed by Maxim Muzafarov for CASSANDRA-20851
2025-09-01 16:18:19 +02:00
Stefan Miklosovic 63fb8741b8
Merge branch 'cassandra-5.0' into trunk 2025-09-01 13:00:36 +02:00
Stefan Miklosovic e45a330f54
Merge branch 'cassandra-4.1' into cassandra-5.0 2025-09-01 12:53:53 +02:00
Stefan Miklosovic c9717b4ed5
Redact security-sensitive information in system_views.settings
patch by Stefan Miklosovic; reviewed by Maxwell Guo, Francisco Guerrero for CASSANDRA-20856
2025-09-01 12:44:43 +02:00
Isaac Reath f41b625e48 Expose Metric for Prepared Statement Cache Size (in bytes)
Patch by Isaac Reath; Reviewed by Paulo Motta and guo Maxwell for
CASSANDRA-20864

Closes #4345
2025-08-28 10:54:00 -04:00
Marcus Eriksson f53c051118 Accord: Minor serialization changes
Patch by marcuse; reviewed by David Capwell and Benedict Elliott Smith for CASSANDRA-20840
2025-08-28 13:31:35 +02:00
David Capwell bf6a82ec82 SSTableLoaderEncryptionOptionsTest#bulkLoaderSuccessfullyStreamsOverSslWithDeprecatedSslStoragePort failing on missing stdout content
patch by David Capwell; reviewed by Caleb Rackliffe for CASSANDRA-20698
2025-08-27 10:32:07 -07:00
Stefan Miklosovic 792e823af0
Merge branch 'cassandra-4.0' into cassandra-4.1 2025-08-27 19:01:31 +02:00
Dmitry Konstantinov 1c5286f4d1
Fix IndexOutOfBoundsException in sstablemetadata tool when a range tombstone is a max clustering value
patch by Dmitry Konstantinov; reviewed by Stefan Miklosovic for CASSANDRA-20855
2025-08-27 18:54:10 +02:00
David Capwell 61b3d5a54b Add support for BEGIN TRANSACTION to allow mutations that touch multiple partitions
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-20857
2025-08-25 16:09:28 -07:00
Himanshu Jindal daef7b5b98 Safeguard Full repair against disk protection
As per CASSANDRA-20045, we want to prevent full repair against
disk full scenarios. Current protection exists only for incremental
repair. This change updates the config name to not be
incremental repair specific, using the Replace annotation.

patch by Himanshu Jindal; reviewed by David Capwell, Jaydeepkumar Chovatia for CASSANDRA-20045
2025-08-22 14:34:15 -07:00
Stefan Miklosovic b7e2b3b9dc
Merge branch 'cassandra-5.0' into trunk 2025-08-20 10:55:52 +02:00
Stefan Miklosovic 74e0794d92
Merge branch 'cassandra-4.1' into cassandra-5.0 2025-08-20 10:53:22 +02:00
Stefan Miklosovic 4824ecc4a5
Merge branch 'cassandra-4.0' into cassandra-4.1 2025-08-20 10:50:20 +02:00
Stefan Miklosovic eb9586dc68
Make secondary index implementations notified about rows in fully expired SSTables in compaction
patch by Stefan Miklosovic; reviewed by Branimir Lambov for CASSANDRA-20829
2025-08-20 10:42:01 +02:00
David Capwell acec78abf4 BEGIN TRANSACTION crashes if a mutation touches multiple rows
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-20844
2025-08-19 18:07:12 -07:00
Dmitry Konstantinov 657d9578f0 Fix version range check in MessagingService.getVersionOrdinal
ninja: remove unused imports in CommandsForRanges to pass checkstyle

Patch by Dmitry Konstantinov; reviewed by Stefan Miklosovic, Caleb Rackliffe for CASSANDRA-20842
2025-08-19 18:25:06 +01:00
Benedict Elliott Smith fdff319739 Accord fixes:
- Fix erroneous call to registerWithDelay with absolute deadline
 - ExecuteSyncPoint should discount votes from unbootstrapped replicas
 - Bootstrap no longer needs to first ensure durability (now ExecuteSyncPoint discounts votes from unbootstrapped replicas)
 - Progress stall with home shard stopping before Stable is propagated to all shards
 - Only upgrade Durability.HasPhase if we have queried all shards
 - Incorrectly inferring Durability in CheckStatus.finish
 - Incorrectly inferring/propagating stable from fast unstable reply; clarify to prevent further mistakes
 - MaxDecidedRX should track separate hlc bounds for filtering non-RX dependencies
 - minGcBefore.hlc() can move backwards across epochs, even if each shard moves forwards; must track minHlc directly
 - slowTimeout init in ExecuteTxn.LocalExecute
 - TxnId.parse for RV
Also improve:
 - Don't query recovery state if fast path durably decided
 - Support deferred partial dep deserialisation
 - Support both orientations of KeyDeps/RangeDeps
 - Support partialDeps as ByteBuffer
Also improve in Cassandra:
 - Deps serialization and Journal skipping
 - Don't inflate when reading from cache for CommandsForRanges

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20847
2025-08-19 15:20:26 +01:00
Stefan Miklosovic 9d5cef7f8c
Allow custom constraints to be loaded via SPI
patch by Stefan Miklosovic; reviewed by Bernardo Botella, Saranya Krishnakumar for CASSANDRA-20824
2025-08-18 10:05:38 +02:00
Alex Petrov 59b45eb8bf Add max depth to blocked txn vtable
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20839
2025-08-18 09:39:22 +02:00
Paulo Motta b2037e473f
Allow overriding arbitrary settings via environment variables
This also allows overriding complex settings as a JSON value and adds documentation about these overrides to conf/jvm-server.options

patch by Paulo Motta; reviewed by Stefan Miklosovic, David Capwell for CASSANDRA-20749
2025-08-14 19:00:30 +02:00
Alex Petrov 2de6078289 Improve / simplify topology reporting on startup
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20822
2025-08-14 09:39:22 +02:00
Benedict Elliott Smith 81bc18ad63 Enrich Durability with each phase, so we can both prune unapplied dependencies to mitigate replicas that are behind causing Deps growth,
and more reliably avoid initialising recovery progress log state of transactions that cannot yet make progress
Also fix:
 - Harden AccordExecutor state cleanup to failures
 - Handle SAVING state in AccordCache.tryEvict, as now possible to save for reasons besides eviction so normal to both be in evict queue and saving
 - Infer invalid in MaybeRecover and FetchData
 - MaybeRecover sometimes aborts before home shard knows outcome
 - Epoch sync with VisibilitySyncPoint
 - Retired implies synced
 - Don't interpret force repair as excluding nodes from Accord sync conditions
 - TxnData.without
Also improve:
 - Add Topology.removedNodes
 - If Durability implies we can fetch a status, update the waiting state to fetch it
 - DurableBefore debug table should have searchable txnId

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20832
2025-08-13 11:10:18 +01:00
Dmitry Konstantinov 7546d9e895 Optimize MessagingService.getVersionOrdinal
The map lookup (with an implicit auto-boxing) can be replaced with a plain arithmetic operation.
A unit test is used to ensure that the assumption about serialization version incrementing for new versions is still correct.
greaterThanOrEqual method is removed as unused.

Patch by Dmitry Konstantinov; reviewed by Stefan Miklosovic for CASSANDRA-20816
2025-08-08 14:20:13 +01:00
Dmitry Konstantinov 19118a6cff Optimize TrieMemtable#getFlushSet
A flushing range is a combination of partial and full shards, for full shards we use write time captured values for count and total size of partition keys, for partial shards we iterate over keys
When we iterate over partial shards we count key bytes only instead of reading them and also try to skip tokens full parsing

Patch by Dmitry Konstantinov; reviewed by Branimir Lambov for CASSANDRA-20760
2025-08-08 13:34:34 +01:00
Stefan Miklosovic 429b2f8be4
Merge branch 'cassandra-5.0' into trunk 2025-08-08 09:16:21 +02:00
Isaac Reath 170bf57eac
Fix ThreadLocalReadAheadBufferTest to avoid FileNotFoundException when -Djava.io.tmpdir set to /tmp
patch by Isaac Reath; reviewed by Paulo Motta, Stefan Miklosovic for CASSANDRA-20819
2025-08-08 09:00:57 +02:00
Stefan Miklosovic bb7e706213
Merge branch 'cassandra-5.0' into trunk 2025-08-06 18:37:11 +02:00
Romain Hardouin 3b9669b116
Sort SSTable TOC entries for determinism
patch by Romain Hardouin; reviewed by Stefan Miklosovic, Dmitry Konstantinov for CASSANDRA-20494

Co-authored-by: Stefan Miklosovic <smiklosovic@apache.org>
2025-08-06 18:34:26 +02:00
Benedict Elliott Smith 46bda174d5 Bootstrap must first wait for a quorum to apply the sync point to ensure the DurableBefore Majority condition holds transitively,
since later quorums may include the bootstrapping node which does not participate in the durability of preceding transactions
Also Improve:
 - Apply MaxDecidedRX filtering to CommandsForKey RX dependencies
 - Optimise AbstractRanges.sliceMinimal (burn test hotspot)
 - Don't start shard schedulers on topology changes if not already started
 - Only registerTransitive if waitingOnSync
 - Reserve DurabilityRequest until ShardDurability is started
 - Don't notify progress log if stopped
 - Remove duplicated CFK unmanaged filtering
Also fix:
 - Edge case in notification across bootstrap boundary by resubmitting Unmanaged to be recomputed
 - Serialization of CommandsForKey.TxnInfo.missing() collection when non-identity flag bits are present

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20811
2025-08-04 08:41:24 +01:00
Benedict Elliott Smith 54b2f6acbc Improve:
- system_accord_debug.txn_update->txn_ops + force_apply, force_update, try_execute
 - system_accord_debug.commands_for_key
 - system_accord_debug.commands_for_key_unmanaged
 - system_accord_debug.redundant_before + locally_durable_to_X_store
 - flush accord caches on shutdown

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20814
2025-08-03 15:16:00 +01:00
Caleb Rackliffe eb65c0e600 Support manual secondary index selection at the CQL level
patch by Caleb Rackliffe; reviewed by Andres de la Peña for CASSANDRA-18112

Co-authored-by: Caleb Rackliffe <calebrackliffe@gmail.com>
Co-authored-by: Andres de la Peña <a.penya.garcia@gmail.com>
2025-08-01 14:42:27 -05:00
Stefan Miklosovic 82e1c3d1c0
Merge branch 'cassandra-5.0' into trunk 2025-07-31 11:16:37 +02:00
Stefan Miklosovic 345df4e723
Merge branch 'cassandra-4.1' into cassandra-5.0 2025-07-31 11:15:15 +02:00
Dmitry Konstantinov b4210acd3d
Improve CommitLogSegmentReader to skip SyncBlocks correctly in case of CRC errors
patch by Dmitry Konstantinov; reviewed by Stefan Miklosovic for CASSANDRA-20664
2025-07-31 11:09:11 +02:00
David Capwell 6adac494aa When regulars CQL mutations run on Accord use the txn timestamp rather than server timestamp
patch by David Capwell; reviewed by Ariel Weisberg for CASSANDRA-20744
2025-07-30 13:19:41 -07:00
Benedict Elliott Smith 4102ea13e5 Fix CFK restore after replay:
- Remove from CFK any unapplied transactions we know cannot apply
 - Force notification of waiting commands in CFK on replay
Also fix:
 - Don't truncateWithOutcome if pre bootstrap or stale
 - Fix RangeDeps.without(RangeDeps)
 - Fix InMemoryCommandStore replay bug with clearing DefaultLocalListeners
 - Ensure SaveStatus and executeAt are updated together to prevent corruption via expunge
Improve:
 - Inform home shard that command is decided if we cannot execute, to avoid recovery contention
 - Don't recover sync points on the fast path
 - Don't calculate recovery info for RX (since we don't use it anymore, so no need to do the work)

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20797
2025-07-28 13:32:58 +01:00
Paulo Motta 07163cfb51
Fix StorageService JMX mbean not available during bootstrap
Patch by Paulo Motta; reviewed by Stefan Miklosovic for CASSANDRA-19902
2025-07-28 09:28:02 +02:00
Maxim Muzafarov 94b251f3ce
Migrate all nodetool commands from airline to picocli
Replace io.airlift:airline dependency with info.picocli:picocli across
all nodetool command implementations. This migration includes:

- Convert 160+ nodetool command classes from airline to picocli
- Add AbstractCommand base class for commands and utility methods
- Add NodetoolCommand top-level class for the cli utility
- Update all command classes to use @Command, @Option, and @Parameters
- Add plain text files to test command help output
- Add mock test classes for improved test coverage and parse validation
- Modify test infrastructure to work with picocli-based commands
- Add new layouts for cli formatting to preserve backwards compatibility

The migration maintains backward compatibility while providing improved
command-line parsing, better help system, and more robust argument
validation through picocli enhanced features.

patch by Maxim Muzafarov; reviewed by Caleb Rackliffe, Dmitry Konstantinov, Stefan Miklosovic for CASSANDRA-17445
2025-07-26 18:19:18 +02:00
David Capwell e48d0dcd2c Journal.TopologyUpdate should not store the local topology as it can be inferred from the global on
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20785
2025-07-24 18:51:24 -07:00
Benedict Elliott Smith fbe12e6291 Accord Query Tracing
Also improve:
 - Metric listeners

patch by Benedict; reviewed by David Capwell for CASSANDRA-20773
2025-07-24 20:20:17 +01:00
Stefan Miklosovic e8e312b4d1
Merge branch 'cassandra-5.0' into trunk 2025-07-24 10:27:58 +02:00
Stefan Miklosovic 922819dc08
Merge branch 'cassandra-4.1' into cassandra-5.0 2025-07-24 10:25:54 +02:00
Stefan Miklosovic f5f71b7fae
Rework / simplification of nodetool get/setguardrailsconfig commands
patch by Stefan Miklosovic; reviewed by Maxim Muzafarov for CASSANDRA-20778
2025-07-24 10:22:55 +02:00
Benedict Elliott Smith 54e39a90b0 Limit replay to those records not durably persisted to both command store and data store
Also fix:
 - Limit truncation to TruncatedApplyWithOutcome until data is persisted durably to local store
 - IntervalUpdater not invoking super.close()
 - Do not invoke preRunExclusive without holding lock
 - IntervalUpdater not correctly initialise BranchBuilder.inUse
 - AccordExecutor should notify if more work on unlock of caches
 - Relax paranoid CFK validation during restart
Also improve:
 - Flush logs before System.exit
 - Start/stop progress log explicitly
 - Limit progress log concurrency
 - Clear heavy fields in some messages once processed

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20780
2025-07-23 12:19:06 +01:00
Alex Petrov 260c9c9334 Add a way to patch accord journal commands via virtual tables
Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20765
2025-07-23 11:06:33 +01:00
David Capwell 0574db7bd9 Accord Route Index does not filter based off txn_id range which causes segments which cant contain the data to be queried
patch by David Capwell; reviewed by Benedict Elliott Smith for CASSANDRA-20772
2025-07-22 15:21:14 -07:00
David Capwell 8014eec7aa Merge branch 'cassandra-5.0' into trunk 2025-07-18 16:06:36 -07:00
David Capwell 169c37b030 Merge branch 'cassandra-4.1' into cassandra-5.0 2025-07-18 16:04:46 -07:00
Yuqi Yan 4962f3da3f IntrusiveStack.accumulate is not accumulating correctly
patch by Yuqi Yan; reviewed by Benedict Elliott Smith, David Capwell for CASSANDRA-20670
2025-07-18 16:02:17 -07:00
Benedict Elliott Smith d229eaf667 ninja: remove accidental file 2025-07-18 13:10:38 +01:00
Stefan Miklosovic 418e3a4899
Merge branch 'cassandra-5.0' into trunk 2025-07-18 07:52:31 +02:00
Stefan Miklosovic 5fb3ae4473
Merge branch 'cassandra-4.1' into cassandra-5.0 2025-07-18 07:41:32 +02:00
Yuqi Yan 5c94bc8820
Add nodetool get/setguardrailsconfig commands
patch by Yuqi Yan; reviewed by Brandon Williams, Maxwell Guo, Stefan Miklosovic for CASSANDRA-19552

Co-authored-by: Stefan Miklosovic <smiklosovic@apache.org>
2025-07-18 07:25:17 +02:00
Benedict Elliott Smith 0e9f0fab78 Improve:
- PreLoadContext descriptions
 - Introduce LoadKeysFor so we can avoid loading range transactions except where necessary

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20758
2025-07-17 07:21:04 +01:00
Benedict Elliott Smith 37b6ade9c9 Accord: Fix minDecidedId calculation
Also fix:
 - slowCoordinatorDelay calculation for locally truncated command throws ISE
 - Bad cast of Truncated during replay
 - Don't throw IllegalStateException in Invariants.expect if accord.testing == false
 - Replay of empty segment throws NPE
Also improve:
 - Support tracing of recovery and home progress

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20771
2025-07-16 19:37:26 +01: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
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
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
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
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
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 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 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 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
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 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
Caleb Rackliffe 0a3e624a28 Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Get SAI MemtableIndex refs before SSTableIndex refs at query time
2025-06-16 16:06:41 -05:00
Michael Marshall a72dcbc86a Get SAI MemtableIndex refs before SSTableIndex refs at query time
SAI predicate search currently has a bug that could result in missing rows due to a
concurrent flush during a query. The new test created in this PR shows the point of failure.
The problem is that we get the SSTable index references before getting the Memtable index
references. Note that we do it in the correct order in the ANN OF query path, but not
in the WHERE query path.

This commit updates the QueryView object to hold references to the appropriate Memtable indexes.

It also removes the problematic search methods from MemtableIndexManager to prevent future misuse.

patch by Michael Marshall; reviewed by Caleb Rackliffe and Ekaterina Dimitrova for CASSANDRA-20709
2025-06-16 16:00:47 -05:00
Benedict Elliott Smith 1b78bbdc35 Fix:
- Do not query local topology when deciding what keys to fetch to avoid TopologyRetiredException
 - Ensure we propagate information back to the requesting CommandStore by using the store id to ensure it is included
 - BurnTest topology fetching was broken by earlier patch
 - Topology callbacks were not being invoked as we were not calling .begin()
 - Topology mismatch failure during notAccept phase was not being reported due to CoordinatePreAccept already having isDone==true

patch by Benedict; reviewed by David Capwell for CASSANDRA-20711
2025-06-12 11:41:59 +01:00
Ariel Weisberg 83f58b4e1b Merge branch 'cassandra-5.0' into trunk 2025-06-10 16:33:34 -04:00
samlightfoot 53ccfd58f2 Fix MAX_SEGMENT_SIZE < chunkSize in MmappedRegions::updateState
patch by samlightfoot, Szymon Mi<C4><99><C5><BC>a<C5><82>; reviewed by Ariel Weisberg, Michael Semb Wever for CASSANDRA-20636
2025-06-10 16:32:11 -04:00
samlightfoot 58ee847968 Adopt Unsafe::invokeCleaner for Direct ByteBuffer cleaning
Patch by Samuel D Lightfoot; Reviewed by Ariel Weisberg and Abe Ratnosfky for CASSANDRA-20677
2025-06-09 14:14:40 -04:00
Marcus Eriksson 7c9af51cfa Merge branch 'cassandra-5.0' into trunk 2025-06-05 14:07:44 +02:00
Marcus Eriksson f07510a303 CASSANDRA-18119 followup - test fix, create STATS component when using BtiFormat
Patch by marcuse; reviewed by Mick Semb Wever for CASSANDRA-18119
2025-06-05 14:04:42 +02:00
Ariel Weisberg 5450a1f20e Support for add and replace in IntervalTree
Patch by Ariel Weisberg and Yuqi Yan; Reviewed by Marcus Eriksson for CASSANDRA-20513

Co-authored-by: Yuqi Yan <yukei0509@gmail.com>
2025-05-29 17:10:55 -04:00
Benedict Elliott Smith b3f035be1e Accord Fixes:
- cfk pruning+prebootstrap=invalid future dependency
 - exclude retired ranges when filtering RX stillTouches
 - propagate uses incorrect lowEpoch when fetch finds additional owned/touched ranges
 - node.withEpoch should callback with TopologyRetiredException, not throw
 - Recovery can race with durable-applied pruning; must not send durable unless latest ballot on apply
 - removeRedundantDependencies was not slicing pre-bootstrap range calculation to participating ranges
 - NPE in TopologyManager.atLeast caused by referencing an epoch that has been GC'd
 - use journal durableBeforePersister in burn test, not NOOP_PERSISTER
 - ServerUtils.cleanupDirectory use tryDeleteRecursive
 - FsyncRunnable shutdown
 - fix NPE in AccordJournalBurnTest

patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20688
2025-05-29 12:52:42 +01:00
nvharikrishna 53cdefb1de Enabling single sstable uplevel by default
Patch by Venkata Harikrishna Nukala; reviewed by Marcus Eriksson and Sam
Tunnicliffe for CASSANDRA-18509
2025-05-29 10:01:36 +01:00
Andy Tolbert 34650af75a Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Ensure prepared_statement INSERT timestamp precedes eviction DELETE
2025-05-27 22:35:02 -05:00
Andy Tolbert e90fece187 Merge branch 'cassandra-4.1' into cassandra-5.0
* cassandra-4.1:
  Ensure prepared_statement INSERT timestamp precedes eviction DELETE
2025-05-27 22:29:40 -05:00
Andy Tolbert 9c308ce2f3 Merge branch 'cassandra-4.0' into cassandra-4.1
* cassandra-4.0:
  Ensure prepared_statement INSERT timestamp precedes eviction DELETE
2025-05-27 22:22:41 -05:00
Andy Tolbert d077f69553 Ensure prepared_statement INSERT timestamp precedes eviction DELETE
Updates SystemKeyspace.writePreparedStatement to accept a timestamp
associated with the Prepared creation time. Using this timestamp
will ensure that an INSERT into system.prepared_statements will
always precede the timestamp for the same Prepared in
SystemKeyspace.removePreparedStatement.

This is needed because Caffeine 2.9.2 may evict an entry as soon
as it is inserted if the maximum weight of the cache is exceeded
causing the DELETE to be executed before the INSERT.

Additionally, any clusters currently experiencing a leaky
system.prepared_statements table from this bug may struggle to
bounce into a version with this fix as
SystemKeyspace.loadPreparedPreparedStatements currently does
not paginate the query to system.prepared_statements, causing heap
OOMs.  To fix this this patch adds pagination at 5000 rows and
aborts loading once the cache size is loaded. This should allow
nodes to come up and delete older prepared statements that may no
longer be used as the cache fills up (which should happen immediately).

This patch does not address the issue of Caffeine immediately evicting
a prepared statement, however it will prevent the
system.prepared_statements table from growing unbounded.  For most users
this should be adequate, as the cache should only be filled when there
are erroneously many unique prepared statements. In such a case we can
expect that clients will constantly prepare statements regardless
of whether or not the cache is evicting statements.

patch by Andy Tolbert; reviewed by Berenguer Blasi and Caleb Rackliffe for CASSANDRA-19703
2025-05-27 22:17:15 -05:00
David Capwell cfb393398f Merge branch 'cassandra-5.0' into trunk 2025-05-27 15:24:08 -07:00
Pranav Shenoy 823f48663e Unified Compaction does not properly validate min and target sizes
patch by Pranav Shenoy; reviewed by Branimir Lambov, Claude Warren, David Capwell for CASSANDRA-20398
2025-05-27 15:22:32 -07:00
Caleb Rackliffe 9c489b81a9 Merge branch 'cassandra-5.0' into trunk
* cassandra-5.0:
  Avoid lambda usage in TrieMemoryIndex range queries and ensure queue size tracking is per column
2025-05-27 15:53:30 -05:00
Caleb Rackliffe dd0d8c03b9 Avoid lambda usage in TrieMemoryIndex range queries and ensure queue size tracking is per column
patch by Caleb Rackliffe; reviewed by David Capwell for CASSANDRA-20668
2025-05-27 15:44:01 -05:00