cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stefa...@apache.org
Subject [2/3] cassandra git commit: Fixed flacky SSTableRewriterTest: check file counts before calling validateCFS (CASSANDRA-12348)
Date Tue, 02 Aug 2016 02:09:19 GMT
Fixed flacky SSTableRewriterTest: check file counts before calling validateCFS (CASSANDRA-12348)

patch by Stefania Alborghetti; reviewed by Paulo Motta for CASSANDRA-12348


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

Branch: refs/heads/trunk
Commit: e89028d34c699916b8c94b52f4cb3e086d8b81c1
Parents: b447ffc
Author: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Authored: Mon Aug 1 14:45:29 2016 +0800
Committer: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Committed: Tue Aug 2 10:07:37 2016 +0800

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../io/sstable/SSTableRewriterTest.java         | 12 ++++++------
 .../io/sstable/SSTableWriterTestBase.java       | 20 ++++++++++++++++++++
 3 files changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e89028d3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e7d9066..0f6bc50 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.9
+ * Fixed flacky SSTableRewriterTest: check file counts before calling validateCFS (CASSANDRA-12348)
  * cqlsh: Fix handling of $$-escaped strings (CASSANDRA-12189)
  * Fix SSL JMX requiring truststore containing server cert (CASSANDRA-12109)
 Merged from 3.0:

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e89028d3/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java
index 9c6da77..246a7f0 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java
@@ -99,9 +99,9 @@ public class SSTableRewriterTest extends SSTableWriterTestBase
             writer.finish();
         }
         LifecycleTransaction.waitForDeletions();
+        assertEquals(1, assertFileCounts(sstables.iterator().next().descriptor.directory.list()));
+
         validateCFS(cfs);
-        int filecounts = assertFileCounts(sstables.iterator().next().descriptor.directory.list());
-        assertEquals(1, filecounts);
         truncate(cfs);
     }
     @Test
@@ -131,9 +131,9 @@ public class SSTableRewriterTest extends SSTableWriterTestBase
             writer.finish();
         }
         LifecycleTransaction.waitForDeletions();
+        assertEquals(1, assertFileCounts(sstables.iterator().next().descriptor.directory.list()));
+
         validateCFS(cfs);
-        int filecounts = assertFileCounts(sstables.iterator().next().descriptor.directory.list());
-        assertEquals(1, filecounts);
     }
 
     @Test
@@ -186,9 +186,9 @@ public class SSTableRewriterTest extends SSTableWriterTestBase
             writer.finish();
         }
         LifecycleTransaction.waitForDeletions();
+        assertEquals(1, assertFileCounts(sstables.iterator().next().descriptor.directory.list()));
+
         validateCFS(cfs);
-        int filecounts = assertFileCounts(sstables.iterator().next().descriptor.directory.list());
-        assertEquals(1, filecounts);
         truncate(cfs);
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e89028d3/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTestBase.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTestBase.java b/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTestBase.java
index 9c3bb19..c04fd35 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTestBase.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTestBase.java
@@ -111,6 +111,25 @@ public class SSTableWriterTestBase extends SchemaLoader
         validateCFS(cfs);
     }
 
+    /**
+     * Validate the column family store by checking that all live
+     * sstables are referenced only once and are not marked as
+     * compacting. It also checks that the generation of the data
+     * files on disk is the same as that of the live sstables,
+     * to ensure that the data files on disk belong to the live
+     * sstables. Finally, it checks that the metrics contain the
+     * correct disk space used, live and total.
+     *
+     * Note that this method will submit a maximal compaction task
+     * if there are live sstables, in order to check that there is at least
+     * a maximal task when there are live sstables.
+     *
+     * This method has therefore side effects and should be called after
+     * performing any other checks on previous operations, especially
+     * checks involving files on disk.
+     *
+     * @param cfs - the column family store to validate
+     */
     public static void validateCFS(ColumnFamilyStore cfs)
     {
         Set<Integer> liveDescriptors = new HashSet<>();
@@ -136,6 +155,7 @@ public class SSTableWriterTestBase extends SchemaLoader
         assertEquals(spaceUsed, cfs.metric.liveDiskSpaceUsed.getCount());
         assertEquals(spaceUsed, cfs.metric.totalDiskSpaceUsed.getCount());
         assertTrue(cfs.getTracker().getCompacting().isEmpty());
+
         if(cfs.getLiveSSTables().size() > 0)
             assertFalse(CompactionManager.instance.submitMaximal(cfs, cfs.gcBefore((int)
(System.currentTimeMillis() / 1000)), false).isEmpty());
     }


Mime
View raw message