jrwest commented on code in PR #3606:
URL: https://github.com/apache/cassandra/pull/3606#discussion_r1811687331
##########
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:
Will create a ReadMode enum in `CompressedChunkReader`
##########
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:
Will create a `ReadMode` enum in `CompressedChunkReader`
--
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]