Skip to content

Commit

Permalink
fix intermittent failures in nodetool toppartitions caused by failure…
Browse files Browse the repository at this point in the history
… to validate invalid bytes

Patch by Jordan West; Reviewed by Brandon Williams and Cheng Wang for CASSANDRA-17254
  • Loading branch information
jrwest committed Nov 30, 2022
1 parent d9ef794 commit 13d495a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
@@ -1,5 +1,6 @@
3.0.29
* Fix running Ant rat targets without git (CASSANDRA-17974)
* Fix intermittent failure in nodetool toppartitions (CASSANDRA-17254)

This comment has been minimized.

Copy link
@michaelsembwever

michaelsembwever Dec 5, 2022

Member

should be one line up. (CHANGES.txt entries are listed in reverse chronological)



3.0.28
Expand Down
12 changes: 7 additions & 5 deletions src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Expand Up @@ -1625,12 +1625,14 @@ public CompositeData finishLocalSampling(String sampler, int count) throws OpenD
TabularDataSupport result = new TabularDataSupport(COUNTER_TYPE);
for (Counter<ByteBuffer> counter : samplerResults.topK)
{
byte[] key = counter.getItem().array();
//Not duplicating the buffer for safety because AbstractSerializer and ByteBufferUtil.bytesToHex
//don't modify position or limit
ByteBuffer key = counter.getItem();
result.put(new CompositeDataSupport(COUNTER_COMPOSITE_TYPE, COUNTER_NAMES, new Object[] {
Hex.bytesToHex(key), // raw
counter.getCount(), // count
counter.getError(), // error
metadata.getKeyValidator().getString(ByteBuffer.wrap(key)) })); // string
ByteBufferUtil.bytesToHex(key), // raw
counter.getCount(), // count
counter.getError(), // error
metadata.getKeyValidator().getString(key) })); // string
}
return new CompositeDataSupport(SAMPLING_RESULT, SAMPLER_NAMES, new Object[]{
samplerResults.cardinality, result});
Expand Down

0 comments on commit 13d495a

Please sign in to comment.