cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [1/3] git commit: Fix cf name extraction from manifest in Directories.migrateFile()
Date Tue, 02 Apr 2013 18:07:10 GMT
Updated Branches:
  refs/heads/trunk b2a949ecd -> 313c79a1d


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

patch by Marcus Eriksson; reviewed by Aleksey Yeschenko for
CASSANDRA-5242


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d4744e17
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d4744e17
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d4744e17

Branch: refs/heads/trunk
Commit: d4744e178df071dbffe74499335d8ca6fd7c395e
Parents: b4d26bb
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Tue Apr 2 20:54:06 2013 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Tue Apr 2 20:54:06 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                       |    1 +
 src/java/org/apache/cassandra/db/Directories.java |   10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d4744e17/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0580d15..d82bb74 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -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

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d4744e17/src/java/org/apache/cassandra/db/Directories.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Directories.java b/src/java/org/apache/cassandra/db/Directories.java
index 7ee2823..7867875 100644
--- a/src/java/org/apache/cassandra/db/Directories.java
+++ b/src/java/org/apache/cassandra/db/Directories.java
@@ -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)
     {


Mime
View raw message