You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by st...@apache.org on 2016/09/01 02:08:22 UTC

[2/3] cassandra git commit: Fix legacy regex for temporary files from 2.2

Fix legacy regex for temporary files from 2.2

Patch by Stefania Alborghetti; reviewed by Robert Stupp for CASSANDRA-12565


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

Branch: refs/heads/trunk
Commit: a1d9a0295c54aa044eedef7812f8ac89cc62fb2b
Parents: b56def4
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Tue Aug 30 17:09:16 2016 +0800
Committer: Stefania Alborghetti <st...@datastax.com>
Committed: Thu Sep 1 10:05:37 2016 +0800

----------------------------------------------------------------------
 CHANGES.txt                                           |   1 +
 .../org/apache/cassandra/io/sstable/Descriptor.java   |   2 +-
 .../tmp-lb-3-big-Data.db                              | Bin 0 -> 93 bytes
 .../tmp-lb-3-big-Index.db                             | Bin 0 -> 54 bytes
 .../org/apache/cassandra/db/SystemKeyspaceTest.java   |   8 ++++----
 5 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a1d9a029/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 30931d3..8fde74e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.9
+ * Fix legacy regex for temporary files from 2.2 (CASSANDRA-12565)
  * Add option to state current gc_grace_seconds to tools/bin/sstablemetadata (CASSANDRA-12208)
  * Fix file system race condition that may cause LogAwareFileLister to fail to classify files (CASSANDRA-11889)
  * Fix file handle leaks due to simultaneous compaction/repair and

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a1d9a029/src/java/org/apache/cassandra/io/sstable/Descriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/Descriptor.java b/src/java/org/apache/cassandra/io/sstable/Descriptor.java
index ff4abfc..e979a7d 100644
--- a/src/java/org/apache/cassandra/io/sstable/Descriptor.java
+++ b/src/java/org/apache/cassandra/io/sstable/Descriptor.java
@@ -186,7 +186,7 @@ public class Descriptor
 
     private final static String LEGACY_COMP_IN_PROG_REGEX_STR = "^compactions_in_progress(\\-[\\d,a-f]{32})?$";
     private final static Pattern LEGACY_COMP_IN_PROG_REGEX = Pattern.compile(LEGACY_COMP_IN_PROG_REGEX_STR);
-    private final static String LEGACY_TMP_REGEX_STR = "^((.*)\\-(.*)\\-)?tmp(link)?\\-(la|ka)\\-(\\d)*\\-(.*)$";
+    private final static String LEGACY_TMP_REGEX_STR = "^((.*)\\-(.*)\\-)?tmp(link)?\\-((?:l|k).)\\-(\\d)*\\-(.*)$";
     private final static Pattern LEGACY_TMP_REGEX = Pattern.compile(LEGACY_TMP_REGEX_STR);
 
     public static boolean isLegacyFile(File file)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a1d9a029/test/data/migration-sstables/2.2/keyspace1/test-dfcc85801bc811e5aa694b06169f4ffa/tmp-lb-3-big-Data.db
----------------------------------------------------------------------
diff --git a/test/data/migration-sstables/2.2/keyspace1/test-dfcc85801bc811e5aa694b06169f4ffa/tmp-lb-3-big-Data.db b/test/data/migration-sstables/2.2/keyspace1/test-dfcc85801bc811e5aa694b06169f4ffa/tmp-lb-3-big-Data.db
new file mode 100644
index 0000000..2d5e60a
Binary files /dev/null and b/test/data/migration-sstables/2.2/keyspace1/test-dfcc85801bc811e5aa694b06169f4ffa/tmp-lb-3-big-Data.db differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a1d9a029/test/data/migration-sstables/2.2/keyspace1/test-dfcc85801bc811e5aa694b06169f4ffa/tmp-lb-3-big-Index.db
----------------------------------------------------------------------
diff --git a/test/data/migration-sstables/2.2/keyspace1/test-dfcc85801bc811e5aa694b06169f4ffa/tmp-lb-3-big-Index.db b/test/data/migration-sstables/2.2/keyspace1/test-dfcc85801bc811e5aa694b06169f4ffa/tmp-lb-3-big-Index.db
new file mode 100644
index 0000000..d3923ab
Binary files /dev/null and b/test/data/migration-sstables/2.2/keyspace1/test-dfcc85801bc811e5aa694b06169f4ffa/tmp-lb-3-big-Index.db differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a1d9a029/test/unit/org/apache/cassandra/db/SystemKeyspaceTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/SystemKeyspaceTest.java b/test/unit/org/apache/cassandra/db/SystemKeyspaceTest.java
index d770610..8e58373 100644
--- a/test/unit/org/apache/cassandra/db/SystemKeyspaceTest.java
+++ b/test/unit/org/apache/cassandra/db/SystemKeyspaceTest.java
@@ -178,23 +178,23 @@ public class SystemKeyspaceTest
     @Test
     public void testMigrateDataDirs_2_1() throws IOException
     {
-        testMigrateDataDirs("2.1");
+        testMigrateDataDirs("2.1", 5); // see test data for num legacy files
     }
 
     @Test
     public void testMigrateDataDirs_2_2() throws IOException
     {
-        testMigrateDataDirs("2.2");
+        testMigrateDataDirs("2.2", 7); // see test data for num legacy files
     }
 
-    private void testMigrateDataDirs(String version) throws IOException
+    private void testMigrateDataDirs(String version, int numLegacyFiles) throws IOException
     {
         Path migrationSSTableRoot = Paths.get(System.getProperty(MIGRATION_SSTABLES_ROOT), version);
         Path dataDir = Paths.get(DatabaseDescriptor.getAllDataFileLocations()[0]);
 
         FileUtils.copyDirectory(migrationSSTableRoot.toFile(), dataDir.toFile());
 
-        assertEquals(5, numLegacyFiles()); // see test data
+        assertEquals(numLegacyFiles, numLegacyFiles());
 
         SystemKeyspace.migrateDataDirs();