Commit Graph

9362 Commits

Author SHA1 Message Date
Minal Kyada feef3fcf51 Fix operationMode reporting DECOMMISSION_FAILED instead of LEAVING when resuming a failed decommission
Patch by Minal Kyada; reviewed by Caleb Rackliffe and Sam Tunnicliffe for CASSANDRA-21493
2026-07-29 15:15:02 -05:00
koo.taejin aa1447571b [CASSANDRA-21536] Profile pollution in AbstractType.writeValue makes serialization slow for all column types
Description:
AbstractType.writeValue() is one shared method. All column types use it.

Inside writeValue(), it calls valueLengthIfFixed(). This is a virtual call. Many types override this method (Int32Type, LongType, UTF8Type, ...).

In a real cluster, many column types pass through writeValue(). So the profile always sees lots types.

Because of this, the JIT cannot inline the call. It stays as a vtable call. Also, the compiled body of writeValue() becomes big, so the JIT refuses to inline writeValue() itself ("already compiled into a big method").

We also see the same itable/vtable stubs in async-profiler output from a real cluster, running with default production options and a normal workload.

How to solve:
Add a final int field to AbstractType. Set it in the constructor. writeValue() reads this field instead of calling valueLengthIfFixed().

A field read needs no type profile. So profile pollution has no effect on it. The valueLengthIfFixed() method is not changed. Only the write path uses the field.

Result:
Production is always the polluted state, so this is the real-world comparison

 JMH, JDK 17 / arm64, 1 thread, 10 x 1s warmup and measurement:

                    before          after       improvement
   readValue        49.99M ops/s    56.44M ops/s  +12.90%
   writeValue       99.63M ops/s   114.46M ops/s  +14.88%

patch by Koo Taejin; reviewed by Dmitry Konstantinov, Francisco Guerrero for CASSANDRA-21536
2026-07-29 14:16:15 -05:00
Francisco Guerrero 247289d7b6 Merge branch 'cassandra-5.0' into cassandra-6.0
* cassandra-5.0:
  Bound declared value length against readable bytes in CBUtil
2026-07-27 10:13:42 -05:00
Francisco Guerrero ecc0a3e77b Merge branch 'cassandra-4.1' into cassandra-5.0
* cassandra-4.1:
  Bound declared value length against readable bytes in CBUtil
2026-07-27 10:05:03 -05:00
Francisco Guerrero 2507eceb29 Merge branch 'cassandra-4.0' into cassandra-4.1
* cassandra-4.0:
  Bound declared value length against readable bytes in CBUtil
2026-07-27 10:01:06 -05:00
Francisco Guerrero 251b0e9b91 Bound declared value length against readable bytes in CBUtil
A 32-bit length field read from the wire by CBUtil.readValue (and its
siblings) flowed directly into new byte[length] with no upper bound,
allowing an unauthenticated client to drive the JVM into
OutOfMemoryError: 'Requested array size exceeds VM limit' — and, with
the default -XX:OnOutOfMemoryError=kill -9 %p, terminate the process —
by declaring Integer.MAX_VALUE as the SASL-token length in AUTH_RESPONSE.

Guard the allocation in the single private readRawBytes(ByteBuf, int)
that all int32-length readers funnel through, rejecting lengths that
exceed the buffer's readable bytes with a ProtocolException.

patch by Francisco Guerrero; reviewed by Stefan Miklosovic for CASSANDRA-21521
2026-07-27 09:51:36 -05:00
Maxim Muzafarov c4c3048b13
Allow unreserved keywords as user and identity names in USER and IDENTITY statements
patch by Maxim Muzafarov; reviewed by Dmitry Konstantinov for CASSANDRA-21510
2026-07-27 16:03:06 +02:00
Francisco Guerrero 8fc52f5d2f
Reduce allocations in DefaultQueryOptions when read thresholds are enabled
patch by Francisco Guerrero; reviewed by Dmitry Konstantinov, Stefan Miklosovic for CASSANDRA-21467
2026-07-27 15:50:28 +02:00
Francisco Guerrero f7f52421c7 Merge branch 'cassandra-5.0' into cassandra-6.0
* cassandra-5.0:
  Ensure a Message's Response streamId is always set
2026-07-26 21:06:39 -05:00
Francisco Guerrero 79c8669b84 Merge branch 'cassandra-4.1' into cassandra-5.0
* cassandra-4.1:
  Ensure a Message's Response streamId is always set
2026-07-26 20:59:15 -05:00
Francisco Guerrero 9ddfe0fb22 Ensure a Message's Response streamId is always set
patch by Francisco Guerrero; reviewed by Caleb Rackliffe, Benedict Elliot Smith, Tejal Chakeres, Alexander Mitin for CASSANDRA-21508
2026-07-26 20:51:21 -05:00
Dmitry Konstantinov ddfdf5d69f Reduce number of scheduledTasks on metric id release in ThreadLocalMetrics
Use a single one-time scheduled task with two tick-tock buffers to recycle metric IDs after a sufficiently long delay.
Use phantom references for ThreadLocalMetrics cleanup ony if it is needed to reduce the references processing overhead.

patch by Dmitry Konstantinov; reviewed by Benedict Elliott Smith for CASSANDRA-21475
2026-07-26 17:46:40 +01:00
Arvind Kandpal f51c29c196
Add compound primary key example to nodetool getendpoints help
patch by Arvind Kandpal; reviewed by Dmitry Konstantinov, Stefan Miklosovic for CASSANDRA-15904
2026-07-25 09:53:44 +02:00
Dmitry Konstantinov 0040482e26
Reduce disk space usage by CommitLogSegmentManagerCDCTest
patch by Dmitry Konstantinov; reviewed by Michael Semb Wever for CASSANDRA-21534
2026-07-24 13:13:17 +02:00
Stefan Miklosovic 15a6bac06d
Merge branch 'cassandra-5.0' into cassandra-6.0 2026-07-20 20:45:18 +02:00
Stefan Miklosovic bd345213c1
Merge branch 'cassandra-4.1' into cassandra-5.0 2026-07-20 20:43:56 +02:00
Stefan Miklosovic 1c702382de
Merge branch 'cassandra-4.0' into cassandra-4.1 2026-07-20 20:42:36 +02:00
Jeremiah Jordan 26d7b166ba
Verify extension type before initializing reflectively-loaded classes
Cassandra resolves pluggable extensions by class name from configuration, schema, and tooling
inputs. These names were loaded with an initializing Class.forName(name) and type-checked only
afterward, so the named class ran its static initializer before its type was confirmed. After this
change such classes will be loaded without initialization, verified against the expected interface or
base class, and initialized only through normal use after validation.

A shared FBUtilities.classForNameWithoutInitialization helper and typed
instanceOrConstruct/construct overloads apply this to the configurable extension points loaded by
class name: the authentication, authorization, role-management, network and
internode-authenticator backends, the partitioner, audit logger, configuration loader, seed provider,
snitch, abstract types, secondary and custom indexes, compaction strategy, compressor, replication
strategy, SASI analyzers, key and cache providers, query handler, storage and stream hooks, tracing,
the JMX authorization proxy, MBeans, the monotonic clock, nodetool Sjk, triggers, the
sstableloader and stress class options, and diagnostic event classes (loaded without initialization
and checked against DiagnosticEvent, preserving the InvalidClassException contract and the existing
package restriction).

Regression tests confirm that an invalid-type load is rejected without initializing the target
class, and that valid implementations still resolve.

Hadoop client integration and hard-coded JDK and internal class probes are left unchanged.

patch by Jeremiah Jordan; reviewed by Stefan Miklosovic for CASSANDRA-21525
2026-07-20 20:03:45 +02:00
Caleb Rackliffe 27cc24bc79 Merge branch 'cassandra-5.0' into cassandra-6.0
* cassandra-5.0:
  SAI Component Checksum Validation Should be Segment-Aware
2026-07-18 23:14:02 -05:00
Caleb Rackliffe 4bd98de6ee SAI Component Checksum Validation Should be Segment-Aware
patch by Caleb Rackliffe; reviewed by Francisco Guerrero for CASSANDRA-21516
2026-07-18 22:53:56 -05:00
Dmitry Konstantinov a14a954788 Fix flakiness in CommitLogSegmentManagerCDCTest
Restore deleteCDCRawFiles logic which is present in 6.0 and trunk but probably lost in 5.0 due to merges
Files may be concurrently removed by the CDC management thread, so we tolerate a file that has already been deleted rather than failing the test.
Fix IndexOutOfBoundsException at commitlog.AbstractCommitLogSegmentManager.forceRecycleAll - it is already fixed in 6.0/trunk.
Cleanup test data after run to reduce disk usage.

Patch by Dmitry Konstantinov; reviewed by Michael Semb Wever for CASSANDRA-20091
2026-07-12 21:55:58 +01:00
Maxim Muzafarov 7874fdae57
Forbid ambiguous option/parameter keys in nodetool command hierarchy
patch by Maxim Muzafarov; reviewed by Dmitry Konstantinov for CASSANDRA-21509
2026-07-11 21:31:41 +02:00
Dmitry Konstantinov 480320f3cf Expose immediately-executed tasks in the queries virtual table
SEPExecutor.maybeExecuteImmediately() runs a task synchronously on the
calling worker thread, nested within the task the worker is already
running. Such immediate tasks were invisible in system_views.queries, which only exposed each worker's primary running task.
This is common on the coordinator path, where a local read or mutation is executed immediately within the enclosing QUERY task.

Each SEPWorker now also tracks an immediate current task, set around
maybeExecuteImmediately(), and exposes it as an additional
DebuggableTaskRunner, so the queries table reports both the enclosing
task and the immediate one as separate rows.

patch by Dmitry Konstantinov; reviewed by Caleb Rackliffe for CASSANDRA-21471
2026-07-09 09:22:10 +01:00
Sam Tunnicliffe 1df3a8cef0 Setup async transformation before making internode request
Patch by Sam Tunnicliffe and Dmitry Konstantinov; reviewed by Sam
Tunnicliffe and Dmitry Konstantinov for CASSANDRA-21384

Co-authored-by: Dmitry Konstantinov <netudima@gmail.com>
2026-07-08 15:35:09 +01:00
Sam Tunnicliffe e1e56e5d5d Add CMS membership directly to ClusterMetadata
Patch by Sam Tunnicliffe; reviewed by Marcus Eriksson for
CASSANDRA-20736
2026-07-06 11:52:18 +01:00
Caleb Rackliffe bf4437296b Merge branch 'cassandra-5.0' into cassandra-6.0
* cassandra-5.0:
  Make synchronization on VectorMemoryIndex inserts more granular
2026-07-02 15:50:45 -05:00
Caleb Rackliffe 448d98ce31 Make synchronization on VectorMemoryIndex inserts more granular
patch by Caleb Rackliffe; reviewed by David Capwell for CASSANDRA-21160

Co-authored-by: Caleb Rackliffe <calebrackliffe@gmail.com>
Co-authored-by: David Capwell <dcapwell@apache.org>
2026-07-02 15:22:41 -05:00
Jon Meredith b1f30e94f5 Move long running TCM operations to a longer timout
Replaces the fixed-retry commit loop with deadline-based exponential
backoff for long running CMS commit operations (cms_commit_timeout=1h, 5s-60s jitter)
to allow heavily contended CMS nodes time to commit transforms.

Patch by Jon Meredith and Sam Tunnicliffe; reviewed by Jon Meredith and
Sam Tunnicliffe for CASSANDRA-21453

Co-authored-by: Sam Tunnicliffe <samt@apache.org>
2026-07-01 14:36:28 +01:00
Arvind Kandpal 26d6b4f665
Offline nodetool commands should not print network options in help
- Introduced LocalCommand marker interface to identify commands that execute purely locally without a JMX connection.
- Updated History command to implement LocalCommand.
- Updated CassandraCliHelpLayout to check for LocalCommand instead of calling execution-flow methods, safely suppressing JMX options for offline commands.

patch by Arvind Kandpal; reviewed by Stefan Miklosovic, Maxim Muzafarov for CASSANDRA-20876
2026-06-30 10:23:39 +02:00
Sam Tunnicliffe 896d1d6415 Defer the creation of system_cluster_metadata keyspace until CMS initialization
* Insert the actual PreInitialize entry in the distribute metadata log
  table using a callback after the log is bootstrapped.
* Remove the implicit insert on subsequent commit, i.e. of the Initialize entry
* Enables the full specifics of PreInit to be encoded in the serialized form,
  removing the special casing for the first CMS member and other nodes
* Correctly invalidate cached KeyspaceMetadata when in a pre-initialized state
* Update Host ids in the system.peers_v2 table directly following CMS initialization
* Initialise gossip/local host id after CMS initialization completes
* Clean up CMS initialization errors which occur after the PreInitialize stage

Co-authored-by: Alex Petrov <oleksandr.petrov@gmail.com>
Co-authored-by: Marcus Eriksson <marcuse@apache.org>
2026-06-29 18:09:42 +01:00
samlightfoot 002190748b Support direct I/O for background SSTable writes
Adds an opt-in O_DIRECT write path for background SSTable producers,
bypassing the OS page cache for data that is unlikely to be re-read
soon after being written. Memtable flushes remain buffered.

Enabled via two new YAML knobs:
 - background_write_disk_access_mode: standard (default) | direct
 - direct_write_buffer_size: 1MiB (default; aligned up to FS block
   size, auto-grown to fit a worst-case compressed chunk)

The path is gated by config, table compression being enabled, and an
OperationType allowlist in DataComponent. The allowlist is exhaustive
over OperationType: any new value left unclassified fails static
initialization.

Operations on the DIO path: COMPACTION, MAJOR_COMPACTION,
TOMBSTONE_COMPACTION, ANTICOMPACTION, GARBAGE_COLLECT, CLEANUP,
UPGRADE_SSTABLES, WRITE, STREAM (chunked receiver only), RELOCATE,
UNKNOWN (offline sstablesplit).

Operations off the DIO path:
 - FLUSH (policy: just-flushed data is hot, keep in page cache)
 - SCRUB (correctness: tryAppend needs mark/resetAndTruncate)
 - Zero-Copy Streaming (bypasses DataComponent.buildWriter)
 - Uncompressed writers (only CompressedSequentialWriter has a DIO
   subclass in this change)

StartupChecks fails fast if 'direct' is requested on a platform/FS
that does not support O_DIRECT.

patch by Sam Lightfoot; reviewed by Ariel Weisberg, Dmitry Konstantinov for CASSANDRA-21134
2026-06-24 14:57:46 +01:00
Sam Tunnicliffe 03422edb4b Relax assertion on partitioner instances in SinglePartitionReadCommand
Patch by Sam Tunnicliffe; reviewed by Marcus Eriksson for CASSANDRA-21251
2026-06-24 14:12:51 +01:00
Stefan Miklosovic 3c23da478f
Merge branch 'cassandra-5.0' into cassandra-6.0 2026-06-24 13:49:23 +02:00
Patrick Lee db631675df
Fix AssertionError in hasReplicaWithOngoingRepair when parallel_repair_count > 1
patch by Patrick Lee; reviewed by Paulo Motta, Jaydeepkumar Chovatia for CASSANDRA-21426

Co-authored-by: Paulo Motta <paulo@apache.org>
2026-06-24 13:45:43 +02:00
Stefan Miklosovic 39d18f50d2
Merge branch 'cassandra-5.0' into cassandra-6.0 2026-06-24 13:14:22 +02:00
Stefan Miklosovic 4b821d1bc7
Merge branch 'cassandra-4.1' into cassandra-5.0 2026-06-24 13:12:29 +02:00
Stefan Miklosovic 19dcb2b784
Merge branch 'cassandra-4.0' into cassandra-4.1 2026-06-24 13:10:18 +02:00
Arvind Kandpal c2901c71eb
Fix skipped tests and flakiness in CassandraRoleManagerTest
Adds missing @Test annotations to testPasswordUpdateRateLimiting and testPasswordUpdateRateLimitingDisabled.
Also fixes minor typos in comments and assertion strings.
Fix flaky CassandraRoleManagerTest by grouping per-role rate limit checks consecutively.

patch by Arvind Kandpal; reviewed by Stefan Miklosovic, Michael Semb Wever for CASSANDRA-21262
2026-06-24 13:04:14 +02:00
Stefan Miklosovic 0673d743aa
Merge branch 'cassandra-5.0' into cassandra-6.0 2026-06-24 11:25:16 +02:00
Stefan Miklosovic a3ee4c4f9a
Merge branch 'cassandra-4.1' into cassandra-5.0 2026-06-24 11:23:40 +02:00
Stefan Miklosovic 003f35ba51
Merge branch 'cassandra-4.0' into cassandra-4.1 2026-06-24 11:21:42 +02:00
maoling 0f9f6dd6e5
Fix flaky Test org.apache.cassandra.io.sstable.VerifyTest.testMutateRepair
patch by Ling Mao; reviewed by Stefan Miklosovic, Dmitry Konstantinov for CASSANDRA-18919
2026-06-24 11:18:15 +02:00
Dmitry Konstantinov 105694f625 Merge branch 'cassandra-5.0' into cassandra-6.0
* cassandra-5.0:
  Fix TLS-related tests after a JDK update in build image
2026-06-21 22:05:32 +01:00
Dmitry Konstantinov fb7efd6219 Fix TLS-related tests after a JDK update in build image
add SAN to certificates used by tests
add TLS_ECDHE_* to ciphers list in SSTableLoaderEncryptionOptionsTest

Patch by Dmitry Konstantinov; reviewed by Michael Semb Wever for CASSANDRA-21441
2026-06-21 21:56:39 +01:00
Maxim Muzafarov d1212e8017
Merge branch 'cassandra-5.0' into cassandra-6.0
* cassandra-5.0:
  Rename conflicting nodetool import --copy-data short option from -p to -cd
2026-06-19 22:24:25 +02:00
Maxim Muzafarov 3fa111c70f
Merge branch 'cassandra-4.1' into cassandra-5.0
* cassandra-4.1:
  Rename conflicting nodetool import --copy-data short option from -p to -cd
2026-06-19 22:17:16 +02:00
Maxim Muzafarov 95088443ff
Merge branch 'cassandra-4.0' into cassandra-4.1
* cassandra-4.0:
  Rename conflicting nodetool import --copy-data short option from -p to -cd
2026-06-19 22:00:30 +02:00
Maxim Muzafarov bd835726f2
Rename conflicting nodetool import --copy-data short option from -p to -cd
Patch by Maxim Muzafarov; reviewed by Stefan Miklosovic, Caleb Rackliffe, Bernardo Botella Corbi for CASSANDRA-20214
2026-06-19 21:58:04 +02:00
Jon Meredith 9a896cbaeb Add policy for selecting CMS host when submitting commit request
Patch by Jon Meredith; reviewed by Sam Tunnicliffe for CASSANDRA-21456
2026-06-19 16:07:57 +01:00
Jon Meredith 44ee9d6167 Unable to catch up TCM Log from peer with gaps in log sequence
Patch by Jon Meredith and Marcus Eriksson; reviewed by Sam Tunnicliffe
for CASSANDRA-21455

Co-authored-by: Marcus Eriksson <marcuse@apache.org>
2026-06-19 16:07:41 +01:00