You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "mike-tr-adamson (via GitHub)" <gi...@apache.org> on 2023/07/14 09:42:34 UTC
[GitHub] [cassandra] mike-tr-adamson commented on a diff in pull request #2487: Fix concurrency in bbtree reader by cloning state
mike-tr-adamson commented on code in PR #2487:
URL: https://github.com/apache/cassandra/pull/2487#discussion_r1263528563
##########
src/java/org/apache/cassandra/index/sai/disk/v1/bbtree/BlockBalancedTreeWalker.java:
##########
@@ -170,60 +242,18 @@ final static class TraversalState
@VisibleForTesting
int maxLevel;
- TraversalState(DataInput dataInput) throws IOException
+ private TraversalState()
{
- maxPointsInLeafNode = dataInput.readVInt();
- bytesPerValue = dataInput.readVInt();
-
- // Read index:
- numLeaves = dataInput.readVInt();
- assert numLeaves > 0;
- treeDepth = dataInput.readVInt();
- minPackedValue = new byte[bytesPerValue];
- maxPackedValue = new byte[bytesPerValue];
-
- dataInput.readBytes(minPackedValue, 0, bytesPerValue);
- dataInput.readBytes(maxPackedValue, 0, bytesPerValue);
-
- if (ByteArrayUtil.compareUnsigned(minPackedValue, 0, maxPackedValue, 0, bytesPerValue) > 0)
- {
- String message = String.format("Min packed value %s is > max packed value %s.",
- new BytesRef(minPackedValue), new BytesRef(maxPackedValue));
- throw new CorruptIndexException(message, dataInput);
- }
-
- valueCount = dataInput.readVLong();
-
- int numBytes = dataInput.readVInt();
- byte[] packedIndex = new byte[numBytes];
- dataInput.readBytes(packedIndex, 0, numBytes);
-
nodeID = 1;
level = 0;
leafBlockFPStack = new long[treeDepth];
leftNodePositions = new int[treeDepth];
rightNodePositions = new int[treeDepth];
splitValuesStack = new byte[treeDepth][];
-
- memoryUsage = ObjectSizes.sizeOfArray(packedIndex) +
- ObjectSizes.sizeOfArray(minPackedValue) +
- ObjectSizes.sizeOfArray(maxPackedValue) +
- ObjectSizes.sizeOfArray(leafBlockFPStack) +
- ObjectSizes.sizeOfArray(leftNodePositions) +
- ObjectSizes.sizeOfArray(rightNodePositions) +
- ObjectSizes.sizeOfArray(splitValuesStack) * bytesPerValue;
Review Comment:
Exactly that. We are only meant to report the memory used by the long-term objects, which in this case is the `packedIndex`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org