Commit Graph

27706 Commits

Author SHA1 Message Date
Dmitry Konstantinov 93ab0c7a02
Merge 99161b2107 into 172099f4a8 2026-08-01 15:38:17 +00:00
Dmitry Konstantinov 99161b2107 add protection against flushing during a test to avoid flakiness for PartitionRowAccountingTest
(cherry picked from commit 451246e17aac5b0c00918666a27c7b8e4d992601)
2026-08-01 15:41:24 +01:00
Dmitry Konstantinov 5119cb1c02 Make PartitionRowAccountingTest tests robust to memtable flushes
(cherry picked from commit 4efc40af90317e2794424fea09c2661fc9b51a2b)
2026-08-01 15:09:58 +01:00
Stefan Miklosovic 172099f4a8
Prepare debian changelog for 4.0.21 2026-07-28 11:38:14 +02: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
Arvind Kandpal 28ec2730bd
Remove unused cassandra.boot_without_jna from cassandra-env.sh documentation
patch by Arvind Kandpal; reviewed by Stefan Miklosovic for CASSANDRA-20611
2026-07-22 10:45:06 +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
Dmitry Konstantinov ce353ffe9f Fix memtable on-heap accounting drift in BTree.update and BTreeRow.merge
Several paths report on-heap allocation through UpdateFunction.onAllocatedOnHeap in a
way that diverges from the heap actually retained (BTree.sizeOnHeapOf), so the memtable's
owned-heap counter drifts. Five under/over-counting causes are fixed so that reported
allocation matches sizeOnHeapOf:

1) BTree.update over-counts on node split/overflow and never counts branch sizeMaps.
   The Updater's running 'allocated' was not a true net delta: leaf drain() cleared the
   source before subtracting it, the redistribute/overflow paths added new nodes without
   releasing the source they replace, and branch sizeMaps were never counted.
   Fix: account each node net - add every newly retained node's shallow heap (array plus
   sizeMap) and subtract it for every replaced source, releasing before the source is
   cleared; and record the root as the top builder's source so the old root is released too.
   Test: BTreeUpdateHeapAccountingTest (randomized small / contiguous-block / overlapping /
   height-4, coverage verified by JaCoCo).

2) BTreeRow.merge does not release a row's column tree when a row tombstone shadows its
   cells: the retain branch rebuilds it smaller via BTree.transformAndFilter (node accounting
   disabled) but never releases the freed structure. Fix: report sizeOnHeapOf(retained) -
   sizeOnHeapOf(existing) when the filter shrinks the tree, as ColumnData.Reconciler.merge does.

3) BTreeRow.merge does not account the row's LivenessInfo/Deletion change (e.g. a tombstone
   replacing a live row). Fix: account (reconciled liveness+deletion) - (existing liveness+deletion).

4) Allocation and release disagree on the branch sizeMap: allocation used sizeOfStructureOnHeap
   (excludes it), release used sizeOnHeapOf (includes it). Fix: remove sizeOfStructureOnHeap and
   use sizeOnHeapOf everywhere.

5) ColumnData.removeShadowed does not release a shadowed complex (collection) column's own
   structure: it releases the inner cells via recordDeletion.delete but not the column's cell
   tree (which can span multiple nodes) nor, when the column is dropped, its wrapper - both
   counted as owned when written. Fix: report (EMPTY_SIZE + sizeOnHeapOf(tree)) after - before
   (after is 0 when dropped); a no-op on the update side (recordDeletion == noOp), as required
   by CASSANDRA-21469.

Tests for 2-5: PartitionRowAccountingTest.rowTombstoneOverExistingRowDoesNotInflateOwnership and
.rowTombstoneOverExistingCollectionDoesNotInflateOwnership require two logically identical
partitions reached via different merge paths to own exactly the same on-heap (only with all
fixes does it match); SetCellAccountingTest guards that a grow/reset op mix on a set<text>
column never drives the owned heap negative.

patch by Dmitry Konstantinov; reviewed by Caleb Rackliffe for CASSANDRA-21472
2026-07-16 22:38:06 +01:00
Stefan Miklosovic 33c1dbe5b8
Prepare debian changelog for 4.0.21 2026-07-13 13:12:00 +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
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
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
Stefan Miklosovic 22bbac9d6a
Fix PasswordObfuscator failing to obfuscate certain passwords
patch by Stefan Miklosovic; reviewed by Dmitry Konstantinov for CASSANDRA-21113
2026-06-19 15:10:04 +02:00
Stefan Miklosovic d30ac083b8
Fix negative memtable allocator ownership when an update is shadowed by an existing row deletion
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>
2026-06-19 10:46:04 +02:00
Alan Wang 41fd7c3e22 Consider first token of SSTable when calculating SSTable intersection in LeveledScanner
patch by Alan Wang; reviewed by David Capwell, Marcus Eriksson for CASSANDRA-21369
2026-06-16 10:38:19 -07:00
Patrick McFadin 19ee803038 CASSANDRA-21342: Long-tail xref follow-up (cassandra-4.0 subset)
Subset of the trunk long-tail xref follow-up (commit cc97ee5332)
applicable to cassandra-4.0. Three files have broken patterns that
still apply on this branch after PR #4807's forward-merge: the
architecture index, finding_nodes, and use_tools self-page xrefs.

Six edits total. Mechanical retargets only; no prose was rewritten.

Edits omitted (trunk-only):
* Twenty files introduced in 5.0 or later (developing/cql/, reference/
  cql-commands/, managing/operating/, etc).
* use_tools.adoc edits 4 and 5 (different line state on 4.x;
  packet-capture anchor section structure differs).

 patch by Patrick McFadin; reviewed by Mick Semb Wever for CASSANDRA-21342
2026-06-10 10:59:01 -07:00
Cameron Zemek 8aa71cea52
Remove inFlightEcho entry on ECHO_REQ failure
patch by Cameron Zemek; reviewed by Stefan Miklosovic, Caleb Rackliffe for CASSANDRA-21428
2026-06-08 10:47:24 +02:00
Stefan Miklosovic 1362ac6f69
Validate snapshot names
The validation of snapshot names is turned off by default.
It is controlled by system property cassandra.snapshot.validation which is by default
set to false except 7.0 branch.

When the validation is turned on, the allowed characters are AWS safe characters together
with "+" character. A user can not specify any path separators in snapshot names even if
the validation as such is turned off.

patch by Stefan Miklosovic; reviewed by Francisco Guerrero, Matt Byrd for CASSANDRA-21389
2026-06-04 10:18:27 +02:00
abeckruiz 863cb651e7 BTree.FastBuilder.reset() fails to clear savedBuffer and savedNextKey, causing ClassCastException and SSTable header corruption during schema disagreement
patch by Andrés Beck-Ruiz, Runtian Liu; reviewed by Zhao Yang, Benedict Elliott Smith for CASSANDRA-21216

Co-authored-by: Runtian Liu <runtian@uber.com>
2026-06-02 10:14:26 +01:00
Patrick McFadin a1fc6c8761 CASSANDRA-21342: Fix broken Antora xref/anchor targets in cassandra docs
Forward-merge of the Phase 3 A2 fix from trunk (part of commit
32826fe563) to cassandra-4.0. Retargets the ROOT-nav and ROOT-index
Contact us xrefs from the removed master@_:ROOT:contactus.adoc page
to the existing master@_:ROOT:community.adoc.

The fix is applied as a direct edit rather than a cherry-pick: 4.0's
ROOT/nav.adoc has a different surrounding structure from trunk's (no
ifndef::local-build wrapper, no development sub-nav), so a clean
cherry-pick of the trunk patch is not possible. The net effect on
the targeted xrefs is identical.

 patch by Patrick McFadin; reviewed by TBD for CASSANDRA-21342
2026-05-14 12:36:21 -07:00
Stefan Miklosovic 04febb75f1
Fix flaky CompactionTaskTest.testFullyExpiredSSTablesAreNotReleasedPrematurely
This fix was taken from e397aa06b1 (diff-3dbddb89a91055a1394ad89dcca2cd4506f01e40b7d73cb38fb0b0413fb0611a)

patch by Stefan Miklosovic; reviewed by Brandon Williams for CASSANDRA-21329
2026-04-23 13:38:29 +02:00
David Capwell de20468edd generate-eclipse-files missing simulator/harry and missing src class path
patch by David Capwell; reviewed by Aleksey Yeschenko for CASSANDRA-21312
2026-04-17 04:51:54 -07:00
Pedro Gordo 5aec56de3b
Backport CASSANDRA-17810 fix and improve RTBoundValidator error messages
patch by Pedro Gordo; reviewed by Josh McKenzie, Stefan Miklosovic for CASSANDRA-18282
2026-04-17 10:28:16 +02:00
mck 636409baac
Increment versions to 4.0.21, 4.1.12, 5.0.8 2026-03-23 09:51:45 +01:00
Mick Semb Wever c48b9f011d
Prepare debian changelog for 4.0.20 2026-03-17 23:47:42 +01:00
Ekaterina Dimitrova b47179b7d4
Add option to disable cqlsh history
We can disable saving of the history either via command-line parameter --disable-history, or by setting disabled = True in the history section of the cqlshrc. Both options will read existing history, and just won't save new commands.

Update help and docs for cqlsh history.
Add startup info logline whenr history logging is enabled.
Add a fix for cqlshrc file path not correctly expanding.

Includes the Backport of
  Allows users to change cqlsh history location using env variable
  patch by Stefan Miklosovic; reviewed by Brandon Williams for CASSANDRA-17448

patch by Ekaterina Dimitrova; reviewed by Mick Semb Wever for CASSANDRA-XXX

Co-authored-by: Alex Ott alex.ott@datastax.com
Co-authored-by: Jaroslaw Grabowski jaroslaw.grabowski@datastax.com
2026-03-17 23:01:57 +01:00
mck 2ce273a118
ninjafix – CassandraRoleManagerTest (CASSANDRA-21202) 2026-03-17 22:07:03 +01:00
mck 17c573f800
Rate limit password changes
Introduces property cassandra.role_password_update_interval_in_ms, with default value of 5000.
Logging added when passwords on roles are changed or are rate-limited.

 patch by Mick Semb Wever; reviewed by Doug Rohrer, Jeremiah Jordan for CASSANDRA-21202
2026-03-16 22:02:41 +01:00
Stefan Miklosovic 3ad4794aa0
Node does not send multiple inflight echos
patch by Cameron Zemek; reviewed by Stefan Miklosovic, Brandon Williams for CASSANDRA-18866
2026-03-15 18:31:14 +01:00
arvindksi274-ksolves ee635f5c45
Fix instructions in README.asc of pylib
patch by Arvind Kandpal; reviewed by Stefan Miklosovic, Michael Semb Wever for CASSANDRA-20181
2026-03-11 14:10:57 +01:00
MichaelMorris 9c640a06eb
ninja CHANGES.txt entry for CASSANDRA-21052 2026-03-10 20:04:33 +01:00
Stefan Miklosovic 547187a229
Obsolete expired SSTables before compaction starts
patch by Stefan Miklosovic; reviewed by Branimir Lambov for CASSANDRA-19776
2026-03-05 16:03:13 +01:00
Bernardo Botella Corbi 1461e754e8
Update maven-shade-plugin to version 3.6.1
patch by Bernardo Botella Corbi; reviewed by Shailaja Koppu, Stefan Miklosovic, Doug Rohrer for CASSANDRA-21176
2026-02-25 09:13:04 +01: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
omniCoder77 5101d76b21
Fix links in README
patch by Rishabh Saraswat; reviewed by Brad Schoening, Jyothsna Konisa, Stefan Miklosovic for CASSANDRA-21110
2026-01-20 15:14:12 +01:00
Mick Semb Wever 3c66c74a0f
Merge branch 'cassandra-3.11' into cassandra-4.0
* cassandra-3.11:
  3.x cqlshlib tests broken on python2.7
2025-12-19 23:34:52 +01:00
Mick Semb Wever 0293e8b750
Merge branch 'cassandra-3.0' into cassandra-3.11
* cassandra-3.0:
  3.x cqlshlib tests broken on python2.7
2025-12-19 23:34:02 +01:00
Mick Semb Wever 9e04193c3f
3.x cqlshlib tests broken on python2.7
patch by Mick Semb Wever; reviewed by Brandon Williams for CASSANDRA-21079
2025-12-19 23:22:13 +01:00
Abe Ratnofsky ec3b425c38 Switch lz4-java to at.yawk.lz4 version due to CVE
Patch by Abe Ratnofsky; reviewed by Jyothsna Konisa, Dmitry Konstantinov for CASSANDRA-21052
2025-12-18 10:51:26 -08: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
Stefan Miklosovic 34c3736c9e
Backport fix to nodetool gcstats output for direct memory
patch by Stefan Miklosovic; reviewed by Brad Schoening for CASSANDRA-21037
2025-12-10 11:21:16 +01:00
Marcus Eriksson 76a7e43613 ArrayIndexOutOfBoundsException with repaired data tracking and counters
Patch by marcuse; reviewed by Sam Tunnicliffe for CASSANDRA-20871
2025-12-05 12:55:59 +01: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
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
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
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
Doug Rohrer aa0e2f1631 CASSANDRA-20884 - Move JMX classes to the in-jvm-dtest API project
patch by Doug Rohrer; reviewed by Francisco Guerrero and Bernardo Botella Corbi for CASSANDRA-20884
2025-10-24 13:37:08 -04:00
Mick Semb Wever 5d30dc17b8
increment version to 4.0.20 2025-10-20 13:45:57 +02:00
Mick Semb Wever 45fa31beb4
Prepare debian changelog for 4.0.19 2025-10-14 21:35:24 +02:00
Stefan Miklosovic 0026c0dc4c
Update OWASP dependency-check to 12.1.6, suppress unrelevant CVEs
patch by Stefan Miklosovic; reviewed by Brandon Williams for CASSANDRA-20924
2025-09-26 16:02:06 +02:00