mirror of https://github.com/apache/cassandra
Fix formatting and set buffer size in test
This commit is contained in:
parent
e83c85aed0
commit
8214ae208d
|
|
@ -18,13 +18,13 @@
|
|||
|
||||
package org.apache.cassandra.io.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.cassandra.io.compress.BufferType;
|
||||
import org.apache.cassandra.io.compress.CorruptBlockException;
|
||||
import org.apache.cassandra.io.sstable.CorruptSSTableException;
|
||||
import org.apache.cassandra.utils.Closeable;
|
||||
import org.apache.cassandra.utils.memory.MemoryUtil;
|
||||
|
|
@ -106,9 +106,8 @@ public class ThreadLocalReadAheadBuffer implements Closeable
|
|||
Block block = getBlock();
|
||||
ByteBuffer blockBuffer = block.buffer;
|
||||
if (position >= channelSize)
|
||||
throw new CorruptSSTableException(new IOException(String.format("Chunk read past EOF: requested position %d must be less than file size %d",
|
||||
position, channelSize)),
|
||||
channel.filePath());
|
||||
throw new CorruptSSTableException(new CorruptBlockException(channel.filePath(), position, bufferSize),
|
||||
channel.filePath());
|
||||
|
||||
int blockNo = (int) (position / bufferSize);
|
||||
long blockPosition = blockNo * (long) bufferSize;
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class StandardCompressedChunkReaderTest extends CompressedChunkReaderTest
|
|||
|
||||
long longsToWrite = 600; // 4800 uncompressed bytes -> 2 compressed chunks (second one partial)
|
||||
CompressionMetadata metadata;
|
||||
try (CompressedSequentialWriter writer = new CompressedSequentialWriter(f, offsets, digest, writerOption, params,new MetadataCollector(new ClusteringComparator())))
|
||||
try (CompressedSequentialWriter writer = new CompressedSequentialWriter(f, offsets, digest, writerOption, params, new MetadataCollector(new ClusteringComparator())))
|
||||
{
|
||||
for (long i = 0; i < longsToWrite; i++)
|
||||
writer.writeLong(i);
|
||||
|
|
@ -139,9 +139,7 @@ public class StandardCompressedChunkReaderTest extends CompressedChunkReaderTest
|
|||
metadata = writer.open(0);
|
||||
}
|
||||
|
||||
// Sanity: read-ahead must actually engage for this test to exercise the scan path
|
||||
Assert.assertTrue("read-ahead must be larger than chunk length for scanReader to be non-null",
|
||||
DatabaseDescriptor.getCompressedReadAheadBufferSize() > metadata.chunkLength());
|
||||
DatabaseDescriptor.setCompressedReadAheadBufferSizeInKb(256);
|
||||
|
||||
// Truncate file so that chunk metadata expects a chunk to extend further than the actual file size
|
||||
long originalSize = Files.size(f.toPath());
|
||||
|
|
|
|||
Loading…
Reference in New Issue