本文整理汇总了Java中org.apache.cassandra.io.sstable.CorruptSSTableException类的典型用法代码示例。如果您正苦于以下问题:Java CorruptSSTableException类的具体用法?Java CorruptSSTableException怎么用?Java CorruptSSTableException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CorruptSSTableException类属于org.apache.cassandra.io.sstable包,在下文中一共展示了CorruptSSTableException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inspectThrowable
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
/**
* Certain Throwables and Exceptions represent "Die" conditions for the server.
* This recursively checks the input Throwable's cause hierarchy until null.
* @param t
* The Throwable to check for server-stop conditions
*/
public static void inspectThrowable(Throwable t)
{
boolean isUnstable = false;
if (t instanceof OutOfMemoryError)
{
isUnstable = true;
HeapUtils.generateHeapDump();
}
if (DatabaseDescriptor.getDiskFailurePolicy() == Config.DiskFailurePolicy.die)
if (t instanceof FSError || t instanceof CorruptSSTableException)
isUnstable = true;
// Check for file handle exhaustion
if (t instanceof FileNotFoundException || t instanceof SocketException)
if (t.getMessage().contains("Too many open files"))
isUnstable = true;
if (isUnstable)
killer.killCurrentJVM(t);
if (t.getCause() != null)
inspectThrowable(t.getCause());
}
示例2: hasNext
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
public boolean hasNext()
{
try
{
return hasNextInternal();
}
catch (IOException | IndexOutOfBoundsException e)
{
try
{
closeInternal();
}
catch (IOException suppressed)
{
e.addSuppressed(suppressed);
}
sstable.markSuspect();
throw new CorruptSSTableException(e, reader.file.getPath());
}
}
示例3: next
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
public Unfiltered next()
{
try
{
return nextInternal();
}
catch (IOException e)
{
try
{
closeInternal();
}
catch (IOException suppressed)
{
e.addSuppressed(suppressed);
}
sstable.markSuspect();
throw new CorruptSSTableException(e, reader.file.getPath());
}
}
示例4: rebuffer
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
@Override
public Buffer rebuffer(long position)
{
try
{
metrics.requests.mark();
long pageAlignedPos = position & alignmentMask;
Buffer buf;
do
buf = cache.get(new Key(source, pageAlignedPos)).reference();
while (buf == null);
return buf;
}
catch (Throwable t)
{
Throwables.propagateIfInstanceOf(t.getCause(), CorruptSSTableException.class);
throw Throwables.propagate(t);
}
}
示例5: chunkFor
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
/**
* Get a chunk of compressed data (offset, length) corresponding to given position
*
* @param position Position in the file.
* @return pair of chunk offset and length.
*/
public Chunk chunkFor(long position)
{
// position of the chunk
int idx = 8 * (int) (position / parameters.chunkLength());
if (idx >= chunkOffsetsSize)
throw new CorruptSSTableException(new EOFException(), indexFilePath);
long chunkOffset = chunkOffsets.getLong(idx);
long nextChunkOffset = (idx + 8 == chunkOffsetsSize)
? compressedFileLength
: chunkOffsets.getLong(idx + 8);
return new Chunk(chunkOffset, (int) (nextChunkOffset - chunkOffset - 4)); // "4" bytes reserved for checksum
}
示例6: inspectThrowable
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
/**
* Certain Throwables and Exceptions represent "Die" conditions for the server.
* @param t
* The Throwable to check for server-stop conditions
*/
public static void inspectThrowable(Throwable t)
{
boolean isUnstable = false;
if (t instanceof OutOfMemoryError)
isUnstable = true;
if (DatabaseDescriptor.getDiskFailurePolicy() == Config.DiskFailurePolicy.die)
if (t instanceof FSError || t instanceof CorruptSSTableException)
isUnstable = true;
// Check for file handle exhaustion
if (t instanceof FileNotFoundException || t instanceof SocketException)
if (t.getMessage().contains("Too many open files"))
isUnstable = true;
if (isUnstable)
killer.killCurrentJVM(t);
}
示例7: chunkFor
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
/**
* Get a chunk of compressed data (offset, length) corresponding to given position
*
* @param position Position in the file.
* @return pair of chunk offset and length.
*/
public Chunk chunkFor(long position)
{
// position of the chunk
int idx = 8 * (int) (position / parameters.chunkLength());
if (idx >= chunkOffsets.size())
throw new CorruptSSTableException(new EOFException(), indexFilePath);
long chunkOffset = chunkOffsets.getLong(idx);
long nextChunkOffset = (idx + 8 == chunkOffsets.size())
? compressedFileLength
: chunkOffsets.getLong(idx + 8);
return new Chunk(chunkOffset, (int) (nextChunkOffset - chunkOffset - 4)); // "4" bytes reserved for checksum
}
示例8: hasNext
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
public boolean hasNext()
{
try
{
return hasNextInternal();
}
catch (IOException | IndexOutOfBoundsException e)
{
try
{
closeInternal();
}
catch (IOException suppressed)
{
e.addSuppressed(suppressed);
}
sstable.markSuspect();
throw new CorruptSSTableException(e, reader.file.getPath());
}
}
示例9: testVerifyCorrect
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
@Test
public void testVerifyCorrect() throws IOException
{
CompactionManager.instance.disableAutoCompaction();
Keyspace keyspace = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
fillCF(cfs, 2);
SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
try (Verifier verifier = new Verifier(cfs, sstable, false))
{
verifier.verify(false);
}
catch (CorruptSSTableException err)
{
fail("Unexpected CorruptSSTableException");
}
}
示例10: testVerifyCounterCorrect
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
@Test
public void testVerifyCounterCorrect() throws IOException
{
CompactionManager.instance.disableAutoCompaction();
Keyspace keyspace = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(COUNTER_CF);
fillCounterCF(cfs, 2);
SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
try (Verifier verifier = new Verifier(cfs, sstable, false))
{
verifier.verify(false);
}
catch (CorruptSSTableException err)
{
fail("Unexpected CorruptSSTableException");
}
}
示例11: testExtendedVerifyCorrect
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
@Test
public void testExtendedVerifyCorrect() throws IOException
{
CompactionManager.instance.disableAutoCompaction();
Keyspace keyspace = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF2);
fillCF(cfs, 2);
SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
try (Verifier verifier = new Verifier(cfs, sstable, false))
{
verifier.verify(true);
}
catch (CorruptSSTableException err)
{
fail("Unexpected CorruptSSTableException");
}
}
示例12: testExtendedVerifyCounterCorrect
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
@Test
public void testExtendedVerifyCounterCorrect() throws IOException
{
CompactionManager.instance.disableAutoCompaction();
Keyspace keyspace = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(COUNTER_CF2);
fillCounterCF(cfs, 2);
SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
try (Verifier verifier = new Verifier(cfs, sstable, false))
{
verifier.verify(true);
}
catch (CorruptSSTableException err)
{
fail("Unexpected CorruptSSTableException");
}
}
示例13: testVerifyCorrectUncompressed
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
@Test
public void testVerifyCorrectUncompressed() throws IOException
{
CompactionManager.instance.disableAutoCompaction();
Keyspace keyspace = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF3);
fillCF(cfs, 2);
SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
try (Verifier verifier = new Verifier(cfs, sstable, false))
{
verifier.verify(false);
}
catch (CorruptSSTableException err)
{
fail("Unexpected CorruptSSTableException");
}
}
示例14: testVerifyCounterCorrectUncompressed
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
@Test
public void testVerifyCounterCorrectUncompressed() throws IOException
{
CompactionManager.instance.disableAutoCompaction();
Keyspace keyspace = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(COUNTER_CF3);
fillCounterCF(cfs, 2);
SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
try (Verifier verifier = new Verifier(cfs, sstable, false))
{
verifier.verify(false);
}
catch (CorruptSSTableException err)
{
fail("Unexpected CorruptSSTableException");
}
}
示例15: testExtendedVerifyCorrectUncompressed
import org.apache.cassandra.io.sstable.CorruptSSTableException; //导入依赖的package包/类
@Test
public void testExtendedVerifyCorrectUncompressed() throws IOException
{
CompactionManager.instance.disableAutoCompaction();
Keyspace keyspace = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF4);
fillCF(cfs, 2);
SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
try (Verifier verifier = new Verifier(cfs, sstable, false))
{
verifier.verify(true);
}
catch (CorruptSSTableException err)
{
fail("Unexpected CorruptSSTableException");
}
}