ColumnFamily.onStart() was not checking files related to only it's column family. It was possible to remove files from other CFs thinking they were orphans. Skip files not apart of the CF. patch by goffinet; reviewed by jbellis for CASSANDRA-606

git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@887627 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Goffinet 2009-12-06 01:46:40 +00:00
parent b169800b90
commit b6aa09fa14
1 changed files with 7 additions and 3 deletions

View File

@ -189,6 +189,11 @@ public final class ColumnFamilyStore implements ColumnFamilyStoreMBean
for (File file : files)
{
String filename = file.getName();
String cfName = getColumnFamilyFromFileName(filename);
// skip files that are not from this column family
if (!cfName.equals(columnFamily_))
continue;
/* look for and remove orphans. An orphan is a -Filter.db or -Index.db with no corresponding -Data.db. */
Matcher matcher = auxFilePattern.matcher(file.getAbsolutePath());
@ -203,14 +208,13 @@ public final class ColumnFamilyStore implements ColumnFamilyStoreMBean
}
}
if (((file.length() == 0 && !filename.endsWith("-Compacted")) || (filename.contains("-" + SSTable.TEMPFILE_MARKER))) && (filename.contains(columnFamily_)))
if (((file.length() == 0 && !filename.endsWith("-Compacted")) || (filename.contains("-" + SSTable.TEMPFILE_MARKER))))
{
FileUtils.deleteWithConfirm(file);
continue;
}
String cfName = getColumnFamilyFromFileName(filename);
if (cfName.equals(columnFamily_) && filename.contains("-Data.db"))
if (filename.contains("-Data.db"))
{
sstableFiles.add(file.getAbsoluteFile());
}