diff --git a/CHANGES.txt b/CHANGES.txt index f8e024181a..22efd72eff 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -83,6 +83,25 @@ Merged from 5.0: * Deprecate and ignore use_deterministic_table_id (CASSANDRA-19809) * Prioritize built indexes in IndexStatusManager (CASSANDRA-19400) * Add java.base/java.lang.reflect among opens for jvm11-client.options (CASSANDRA-19780) +Merged from 4.1: +Merged from 4.0: + * Fix memory leak in BTree.FastBuilder (CASSANDRA-19785) + * Fix millisecond and microsecond precision for commit log replay (CASSANDRA-19448) + * Improve accuracy of memtable heap usage tracking (CASSANDRA-17298) + * Fix rendering UNSET collection types in query tracing (CASSANDRA-19880) + * Fix latency reported by ideal consistency level monitoring (CASSANDRA-19651) + * Do not spam log with SSLExceptions (CASSANDRA-18839) + +5.0.0 +5.0-rc2 + * Fix direct IO support always being evaluated to false upon the first start of a node (CASSANDRA-19779) + * Memtable allocation type unslabbed_heap_buffers_logged will cause an assertion error for TrieMemtables and SegmentedTrieMemtables (CASSANDRA-19835) +Merged from 4.0: + * Use default commitlog settings in test YAMLs (CASSANDRA-19830) + + +5.0-rc1 +>>>>>>> cassandra-5.0 * Move bcpkix-jdk18on to build dependencies, update to 1.78 and explicitly enumerate transitive dependencies (CASSANDRA-19739) * Avoid streams in the common case for UpdateTransaction creation (CASSANDRA-19675) * Only wait until native_transport_timeout for dispatcher to finish (CASSANDRA-19697) @@ -131,6 +150,24 @@ Merged from 4.1: * Refresh stale paxos commit (CASSANDRA-19617) * Reduce info logging from automatic paxos repair (CASSANDRA-19445) * Support legacy plain_text_auth section in credentials file removed unintentionally (CASSANDRA-19498) +Merged from 4.0: + * Fix millisecond and microsecond precision for commit log replay (CASSANDRA-19448) + * Improve accuracy of memtable heap usage tracking (CASSANDRA-17298) + * Fix rendering UNSET collection types in query tracing (CASSANDRA-19880) + * Fix latency reported by ideal consistency level monitoring (CASSANDRA-19651) + * Use default commitlog settings in test YAMLs (CASSANDRA-19830) + * Do not spam log with SSLExceptions (CASSANDRA-18839) + * Fix schema.cql created by a snapshot after dropping more than one column (CASSANDRA-19747) + * UnsupportedOperationException when reducing scope for LCS compactions (CASSANDRA-19704) + * Make LWT conditions behavior on frozen and non-frozen columns consistent for null column values (CASSANDRA-19637) + * Add timeout specifically for bootstrapping nodes (CASSANDRA-15439) + * Bring Redhat packge dirs/ownership/perms in line with Debian package (CASSANDRA-19565) +Merged from 3.0: + * Upgrade OWASP to 10.0.0 (CASSANDRA-19738) + + +4.1.5 +>>>>>>> cassandra-4.1 * Make queries visible to the "system_views.queries" virtual table at the coordinator level (CASSANDRA-19577) * Fix hints delivery for a node going down repeatedly (CASSANDRA-19495) * Do not go to disk for reading hints file sizes (CASSANDRA-19477) diff --git a/src/java/org/apache/cassandra/utils/btree/BTree.java b/src/java/org/apache/cassandra/utils/btree/BTree.java index 7377ca129f..2ac80df48e 100644 --- a/src/java/org/apache/cassandra/utils/btree/BTree.java +++ b/src/java/org/apache/cassandra/utils/btree/BTree.java @@ -3317,28 +3317,52 @@ public class BTree public void close() { reset(); - pool.offer(this); - pool = null; + if (pool != null) + { + pool.offer(this); + pool = null; + } } @Override void reset() { - // we clear precisely to leaf().count and branch.count because, in the case of a builder, - // if we ever fill the buffer we will consume it entirely for the tree we are building - // so the last count should match the number of non-null entries - Arrays.fill(leaf().buffer, 0, leaf().count, null); + Arrays.fill(leaf().buffer, null); leaf().count = 0; BranchBuilder branch = leaf().parent; while (branch != null && branch.inUse) { - Arrays.fill(branch.buffer, 0, branch.count, null); - Arrays.fill(branch.buffer, MAX_KEYS, MAX_KEYS + 1 + branch.count, null); + Arrays.fill(branch.buffer, null); branch.count = 0; branch.inUse = false; branch = branch.parent; } } + + public boolean validateEmpty() + { + LeafOrBranchBuilder cur = leaf(); + boolean hasOnlyNulls = true; + while (hasOnlyNulls && cur != null) + { + hasOnlyNulls = hasOnlyNulls(cur.buffer) && hasOnlyNulls(cur.savedBuffer) && cur.savedNextKey == null; + cur = cur.parent; + } + return hasOnlyNulls; + } + + private static boolean hasOnlyNulls(Object[] buffer) + { + if (buffer == null) + return true; + + for (int i = 0 ; i < buffer.length ; ++i) + { + if (buffer[i] != null) + return false; + } + return true; + } } private static abstract class AbstractUpdater extends AbstractFastBuilder implements AutoCloseable diff --git a/test/burn/org/apache/cassandra/utils/LongBTreeTest.java b/test/burn/org/apache/cassandra/utils/LongBTreeTest.java index 9aa13f9467..d8a4f81637 100644 --- a/test/burn/org/apache/cassandra/utils/LongBTreeTest.java +++ b/test/burn/org/apache/cassandra/utils/LongBTreeTest.java @@ -730,6 +730,9 @@ public class LongBTreeTest Object[] btree = builder.build(); assertEquals(i + 1, BTree.size(btree)); assertTrue(""+i, BTree.isWellFormed(btree, naturalOrder())); + assertTrue(""+i, BTree.isWellFormed(btree, naturalOrder())); + builder.close(); + assertTrue(builder.validateEmpty()); } } }