dcapwell commented on code in PR #3606:
URL: https://github.com/apache/cassandra/pull/3606#discussion_r1794245744
##########
src/java/org/apache/cassandra/io/util/CompressedChunkReader.java:
##########
@@ -83,20 +89,38 @@ public BufferType preferredBufferType()
}
@Override
- public Rebufferer instantiateRebufferer()
+ public Rebufferer instantiateRebufferer(boolean isScan)
{
- return new BufferManagingRebufferer.Aligned(this);
+ return new BufferManagingRebufferer.Aligned(this.setMode(isScan));
}
public static class Standard extends CompressedChunkReader
{
// we read the raw compressed bytes into this buffer, then
uncompressed them into the provided one.
private final ThreadLocalByteBufferHolder bufferHolder;
+ private final ThreadLocalReadAheadBuffer readAheadBuffer;
+
public Standard(ChannelProxy channel, CompressionMetadata metadata,
Supplier<Double> crcCheckChanceSupplier)
{
super(channel, metadata, crcCheckChanceSupplier);
bufferHolder = new
ThreadLocalByteBufferHolder(metadata.compressor().preferredBufferType());
+
+ int readAheadBufferSize =
DatabaseDescriptor.getCompressedReadAheadBufferSize();
+ readAheadBuffer = readAheadBufferSize > 0 ? new
ThreadLocalReadAheadBuffer(channel, readAheadBufferSize,
metadata.compressor().preferredBufferType()) : null;
+ }
+
+ @Override
+ public CompressedChunkReader setMode(boolean isScan)
Review Comment:
nit: style guide recommends to avoid `boolean` in favor of enums to help
make the code more expressive
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]