Fix cf name extraction from manifest in Directories.migrateFile()

patch by Marcus Eriksson; reviewed by Aleksey Yeschenko for
CASSANDRA-5242
This commit is contained in:
Aleksey Yeschenko 2013-04-02 20:54:06 +03:00
parent b4d26bb4e4
commit d4744e178d
2 changed files with 10 additions and 1 deletions

View File

@ -11,6 +11,7 @@
* Add UseTLAB JVM flag (CASSANDRA-5361)
* cli: Quote ks and cf names in schema output when needed (CASSANDRA-5052)
* Fix bad default for min/max timestamp in SSTableMetadata (CASSANDRA-5372)
* Fix cf name extraction from manifest in Directories.migrateFile() (CASSANDRA-5242)
1.1.10

View File

@ -554,7 +554,7 @@ public class Directories
String name = file.getName();
boolean isManifest = name.endsWith(LeveledManifest.EXTENSION);
String cfname = isManifest
? name.substring(0, name.length() - LeveledManifest.EXTENSION.length())
? getCfNameFromManifest(name)
: name.substring(0, name.indexOf(Component.separator));
int idx = cfname.indexOf(SECONDARY_INDEX_NAME_SEPARATOR); // idx > 0 => secondary index
@ -571,6 +571,14 @@ public class Directories
}
}
private static String getCfNameFromManifest(String name)
{
String withoutExt = name.substring(0, name.length() - LeveledManifest.EXTENSION.length());
return withoutExt.endsWith("-old") || withoutExt.endsWith("-tmp")
? withoutExt.substring(0, withoutExt.length() - 4)
: withoutExt;
}
// Hack for tests, don't use otherwise
static void overrideDataDirectoriesForTest(String loc)
{