mirror of https://github.com/apache/cassandra
Dont throw IOExceptions in when opening sstables
Patch by marcuse; reviewed by Ariel Weisberg for CASSANDRA-13620
This commit is contained in:
parent
95f1b23bf0
commit
dfbe3fabd2
|
|
@ -1,4 +1,5 @@
|
|||
3.0.15
|
||||
* Don't skip corrupted sstables on startup (CASSANDRA-13620)
|
||||
* Fix the merging of cells with different user type versions (CASSANDRA-13776)
|
||||
* Copy session properties on cqlsh.py do_login (CASSANDRA-13640)
|
||||
* Potential AssertionError during ReadRepair of range tombstone and partition deletions (CASSANDRA-13719)
|
||||
|
|
|
|||
|
|
@ -59,8 +59,10 @@ import org.apache.cassandra.exceptions.ConfigurationException;
|
|||
import org.apache.cassandra.index.SecondaryIndexManager;
|
||||
import org.apache.cassandra.index.internal.CassandraIndex;
|
||||
import org.apache.cassandra.index.transactions.UpdateTransaction;
|
||||
import org.apache.cassandra.io.FSError;
|
||||
import org.apache.cassandra.io.FSWriteError;
|
||||
import org.apache.cassandra.io.sstable.Component;
|
||||
import org.apache.cassandra.io.sstable.CorruptSSTableException;
|
||||
import org.apache.cassandra.io.sstable.Descriptor;
|
||||
import org.apache.cassandra.io.sstable.SSTableMultiWriter;
|
||||
import org.apache.cassandra.io.sstable.format.*;
|
||||
|
|
@ -691,7 +693,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
SSTableReader.logOpenException(entry.getKey(), e);
|
||||
FileUtils.handleCorruptSSTable(new CorruptSSTableException(e, entry.getKey().filenameFor(Component.STATS)));
|
||||
logger.error("Cannot read sstable {}; other IO error, skipping table", entry, e);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -718,9 +721,22 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
{
|
||||
reader = SSTableReader.open(newDescriptor, entry.getValue(), metadata);
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (CorruptSSTableException ex)
|
||||
{
|
||||
SSTableReader.logOpenException(entry.getKey(), e);
|
||||
FileUtils.handleCorruptSSTable(ex);
|
||||
logger.error("Corrupt sstable {}; skipping table", entry, ex);
|
||||
continue;
|
||||
}
|
||||
catch (FSError ex)
|
||||
{
|
||||
FileUtils.handleFSError(ex);
|
||||
logger.error("Cannot read sstable {}; file system error, skipping table", entry, ex);
|
||||
continue;
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
FileUtils.handleCorruptSSTable(new CorruptSSTableException(ex, entry.getKey().filenameFor(Component.DATA)));
|
||||
logger.error("Cannot read sstable {}; other IO error, skipping table", entry, ex);
|
||||
continue;
|
||||
}
|
||||
newSSTables.add(reader);
|
||||
|
|
|
|||
|
|
@ -446,7 +446,16 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted<SS
|
|||
assert !descriptor.version.storeRows() || components.contains(Component.STATS) : "Stats component is missing for sstable " + descriptor;
|
||||
|
||||
EnumSet<MetadataType> types = EnumSet.of(MetadataType.VALIDATION, MetadataType.STATS, MetadataType.HEADER);
|
||||
Map<MetadataType, MetadataComponent> sstableMetadata = descriptor.getMetadataSerializer().deserialize(descriptor, types);
|
||||
|
||||
Map<MetadataType, MetadataComponent> sstableMetadata;
|
||||
try
|
||||
{
|
||||
sstableMetadata = descriptor.getMetadataSerializer().deserialize(descriptor, types);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new CorruptSSTableException(e, descriptor.filenameFor(Component.STATS));
|
||||
}
|
||||
ValidationMetadata validationMetadata = (ValidationMetadata) sstableMetadata.get(MetadataType.VALIDATION);
|
||||
StatsMetadata statsMetadata = (StatsMetadata) sstableMetadata.get(MetadataType.STATS);
|
||||
SerializationHeader.Component header = (SerializationHeader.Component) sstableMetadata.get(MetadataType.HEADER);
|
||||
|
|
@ -488,6 +497,11 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted<SS
|
|||
|
||||
return sstable;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
sstable.selfRef().release();
|
||||
throw new CorruptSSTableException(e, sstable.getFilename());
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
sstable.selfRef().release();
|
||||
|
|
@ -534,6 +548,7 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted<SS
|
|||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
FileUtils.handleCorruptSSTable(new CorruptSSTableException(ex, entry.getKey().filenameFor(Component.DATA)));
|
||||
logger.error("Cannot read sstable {}; other IO error, skipping table", entry, ex);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1177,7 +1192,7 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted<SS
|
|||
{
|
||||
if (this.first.compareTo(this.last) > 0)
|
||||
{
|
||||
throw new IllegalStateException(String.format("SSTable first key %s > last key %s", this.first, this.last));
|
||||
throw new CorruptSSTableException(new IllegalStateException(String.format("SSTable first key %s > last key %s", this.first, this.last)), getFilename());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ public class ScrubTest
|
|||
SSTableReader.open(desc, cfs.metadata);
|
||||
fail("SSTR validation should have caught the out-of-order rows");
|
||||
}
|
||||
catch (IllegalStateException ise)
|
||||
catch (CorruptSSTableException ise)
|
||||
{ /* this is expected */ }
|
||||
|
||||
// open without validation for scrubbing
|
||||
|
|
|
|||
Loading…
Reference in New Issue