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
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
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
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>
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>
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>
- 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
* 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>
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
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
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
When BTreeRow.merge reconciles an update into a row whose existing deletion
shadows the update's cells, it filtered the update (incoming) side of the merge
with Reconciler.retain, which records the removal via
PostReconciliationFunction.delete. On the memtable write path that subtracts the
shadowed cells' on-heap size from the allocator's ownership even though that
incoming data was never allocated to the memtable. Under overwrite/delete churn
that re-applies cells already covered by a newer row/partition deletion (e.g.
repair re-streaming), the allocator's "owns" counter drifts negative and the next
flush trips "AssertionError: Negative released" in MemtablePool$SubPool.released
via MemtableAllocator$SubAllocator.releaseAll during discard.
Filter the update (incoming) side with a non-recording variant,
Reconciler.removeShadowed, and keep retain() for the existing side,
whose data the memtable already owns. The filtered result is identical; only the
erroneous accounting notification is dropped. This mirrors the already-correct
complex-column path in ColumnData.merge.
patch by Stefan Miklosovic; reviewed by Dmitry Konstantinov for CASSANDRA-21469
Assisted-By: Claude Opus 4.8 <noreply@anthropic.com>
CommandChanges.shouldCleanup short-circuits to NO if there is no data, but this is incorrect as Cleanup.EXPUNGE may have dropped the data and the record must receive cleanup EXPUNGE and be reported as ERASED.
Also Fix:
- Populate CFK system table row markers so we can stop reading sstables as soon as we have data
- system_accord_debug.executors has wrong clustering type
- RemoteToLocalVirtualTable should lazily allocate the partition collector to avoid LIMIT clause filtering removing it before it's populated
- ActiveEpochs.withNewEpochs should handle transition from 0 -> more than 1
- RedundantBefore.minGcBefore should be NONE if empty
- Update RangesForEpoch directly, so that we cannot have race conditions where the ownership is unknown
- Avoid reentrancy on local callbacks
- Ensure ReadCoordinator callbacks are invoked on owning thread
- Avoid deadlock when notifying ComplexListener(s)
- Release IntrusivePriorityHeap memory from large capacity heaps when empty
- Prevent SynchronousRecoverAwait reentrancy when invoking onDone (by exposing and invoking invokeOnDone that first sets isDone)
- maybeExecute must invoke either notWaiting or notifyWaiting to ensure tryExecuteListening terminates
Also Improve:
- Configurable execute_waiting_on_start
patch by Benedict; reviewed by Alan Wang and Alex Petrov for CASSANDRA-21440
This commit fixes several issues found using the Cassandra
edge case explorer skill for the BTI feature.
patch by Francisco Guerrero; reviewed by Aleksey Yeschenko for CASSANDRA-21353