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

[01/10] cassandra git commit: Improve checking for minor compactions in CompactionsCQLTest

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 3ea34aa3f -> 393c6ec4f
  refs/heads/cassandra-2.2 b59da28c0 -> 984e174de
  refs/heads/cassandra-3.0 fdd2cd0a9 -> 11bfd1963
  refs/heads/trunk 11de522b5 -> 559280bf1


Improve checking for minor compactions in CompactionsCQLTest

Patch by marcuse; reviewed by Sylvain Lebresne for CASSANDRA-11080


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

Branch: refs/heads/cassandra-2.1
Commit: 393c6ec4ff4a17aab2fb4d159d9f24f44394c3cd
Parents: 3ea34aa
Author: Marcus Eriksson <ma...@apache.org>
Authored: Fri Jan 29 14:36:47 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 11 08:56:14 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/CompactionsCQLTest.java       | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/393c6ec4/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java b/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
index 46ade76..4553a45 100644
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
@@ -26,9 +26,9 @@ import org.apache.cassandra.cql3.CQLTester;
 import org.apache.cassandra.cql3.UntypedResultSet;
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.Keyspace;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 public class CompactionsCQLTest extends CQLTester
 {
@@ -41,8 +41,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -54,8 +53,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
 
@@ -68,8 +66,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -81,8 +78,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -96,8 +92,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -111,8 +106,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -126,8 +120,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -141,8 +134,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -226,15 +218,23 @@ public class CompactionsCQLTest extends CQLTester
         return Keyspace.open(KEYSPACE).getColumnFamilyStore(currentTable());
     }
 
-    private boolean minorWasTriggered(String keyspace, String cf) throws Throwable
+    private void waitForMinor(String keyspace, String cf, long maxWaitTime, boolean shouldFind) throws Throwable
     {
-        UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
-        boolean minorWasTriggered = false;
-        for (UntypedResultSet.Row r : res)
+        long startTime = System.currentTimeMillis();
+        while (System.currentTimeMillis() - startTime < maxWaitTime)
         {
-            if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
-                minorWasTriggered = true;
+            UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
+            for (UntypedResultSet.Row r : res)
+            {
+                if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
+                    if (shouldFind)
+                        return;
+                    else
+                        fail("Found minor compaction");
+            }
+            Thread.sleep(100);
         }
-        return minorWasTriggered;
+        if (shouldFind)
+            fail("No minor compaction triggered in "+maxWaitTime+"ms");
     }
 }


[07/10] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

Posted by ma...@apache.org.
Merge branch 'cassandra-2.1' into cassandra-2.2


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

Branch: refs/heads/trunk
Commit: 984e174dea689f510b24df6ec32581147e96613f
Parents: b59da28 393c6ec
Author: Marcus Eriksson <ma...@apache.org>
Authored: Thu Feb 11 08:57:13 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 11 08:57:13 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/CompactionsCQLTest.java       | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------



[10/10] cassandra git commit: Merge branch 'cassandra-3.0' into trunk

Posted by ma...@apache.org.
Merge branch 'cassandra-3.0' into trunk


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

Branch: refs/heads/trunk
Commit: 559280bf1b3e8a3e2a04380119963fc5d52bbe7e
Parents: 11de522 11bfd19
Author: Marcus Eriksson <ma...@apache.org>
Authored: Thu Feb 11 09:03:24 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 11 09:03:24 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/CompactionsCQLTest.java       | 53 +++++++++-----------
 1 file changed, 25 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/559280bf/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
----------------------------------------------------------------------


[08/10] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by ma...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/cassandra-3.0
Commit: 11bfd1963249491981d78d6bc47185c5dbb1b78c
Parents: fdd2cd0 984e174
Author: Marcus Eriksson <ma...@apache.org>
Authored: Thu Feb 11 09:03:15 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 11 09:03:15 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/CompactionsCQLTest.java       | 53 +++++++++-----------
 1 file changed, 25 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/11bfd196/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
index 3c0098b,4553a45..5d42aae
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
@@@ -24,19 -24,14 +24,16 @@@ import org.junit.Test
  
  import org.apache.cassandra.cql3.CQLTester;
  import org.apache.cassandra.cql3.UntypedResultSet;
--import org.apache.cassandra.db.ColumnFamilyStore;
--import org.apache.cassandra.db.Keyspace;
- import org.apache.cassandra.utils.FBUtilities;
 +
- import static org.junit.Assert.assertEquals;
  import static org.junit.Assert.assertFalse;
  import static org.junit.Assert.assertTrue;
+ import static org.junit.Assert.fail;
  
  public class CompactionsCQLTest extends CQLTester
  {
 +
-     public static final int SLEEP_TIME = FBUtilities.isWindows()? 2000 : 1000;
++    public static final int SLEEP_TIME = 5000;
 +
      @Test
      public void testTriggerMinorCompactionSTCS() throws Throwable
      {
@@@ -46,8 -41,7 +43,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, true);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, true);
      }
  
      @Test
@@@ -59,8 -53,7 +55,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, true);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, true);
      }
  
  
@@@ -73,8 -66,7 +68,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, true);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, true);
      }
  
      @Test
@@@ -86,8 -78,7 +80,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, false);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, false);
      }
  
      @Test
@@@ -101,8 -92,7 +94,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, true);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, true);
      }
  
      @Test
@@@ -116,8 -106,7 +108,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, false);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, false);
      }
  
      @Test
@@@ -131,8 -120,7 +122,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, false);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, false);
      }
  
      @Test
@@@ -146,8 -134,7 +136,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, true);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, true);
      }
  
      @Test
@@@ -224,15 -213,28 +213,23 @@@
          return found;
      }
  
-     private boolean minorWasTriggered(String keyspace, String cf) throws Throwable
 -    private ColumnFamilyStore getCurrentColumnFamilyStore()
 -    {
 -        return Keyspace.open(KEYSPACE).getColumnFamilyStore(currentTable());
 -    }
 -
+     private void waitForMinor(String keyspace, String cf, long maxWaitTime, boolean shouldFind) throws Throwable
      {
-         UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
-         boolean minorWasTriggered = false;
-         for (UntypedResultSet.Row r : res)
+         long startTime = System.currentTimeMillis();
+         while (System.currentTimeMillis() - startTime < maxWaitTime)
          {
-             if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
-                 minorWasTriggered = true;
+             UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
+             for (UntypedResultSet.Row r : res)
+             {
+                 if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
+                     if (shouldFind)
+                         return;
+                     else
+                         fail("Found minor compaction");
+             }
+             Thread.sleep(100);
          }
-         return minorWasTriggered;
+         if (shouldFind)
+             fail("No minor compaction triggered in "+maxWaitTime+"ms");
      }
  }


[02/10] cassandra git commit: Improve checking for minor compactions in CompactionsCQLTest

Posted by ma...@apache.org.
Improve checking for minor compactions in CompactionsCQLTest

Patch by marcuse; reviewed by Sylvain Lebresne for CASSANDRA-11080


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

Branch: refs/heads/cassandra-2.2
Commit: 393c6ec4ff4a17aab2fb4d159d9f24f44394c3cd
Parents: 3ea34aa
Author: Marcus Eriksson <ma...@apache.org>
Authored: Fri Jan 29 14:36:47 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 11 08:56:14 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/CompactionsCQLTest.java       | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/393c6ec4/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java b/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
index 46ade76..4553a45 100644
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
@@ -26,9 +26,9 @@ import org.apache.cassandra.cql3.CQLTester;
 import org.apache.cassandra.cql3.UntypedResultSet;
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.Keyspace;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 public class CompactionsCQLTest extends CQLTester
 {
@@ -41,8 +41,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -54,8 +53,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
 
@@ -68,8 +66,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -81,8 +78,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -96,8 +92,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -111,8 +106,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -126,8 +120,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -141,8 +134,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -226,15 +218,23 @@ public class CompactionsCQLTest extends CQLTester
         return Keyspace.open(KEYSPACE).getColumnFamilyStore(currentTable());
     }
 
-    private boolean minorWasTriggered(String keyspace, String cf) throws Throwable
+    private void waitForMinor(String keyspace, String cf, long maxWaitTime, boolean shouldFind) throws Throwable
     {
-        UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
-        boolean minorWasTriggered = false;
-        for (UntypedResultSet.Row r : res)
+        long startTime = System.currentTimeMillis();
+        while (System.currentTimeMillis() - startTime < maxWaitTime)
         {
-            if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
-                minorWasTriggered = true;
+            UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
+            for (UntypedResultSet.Row r : res)
+            {
+                if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
+                    if (shouldFind)
+                        return;
+                    else
+                        fail("Found minor compaction");
+            }
+            Thread.sleep(100);
         }
-        return minorWasTriggered;
+        if (shouldFind)
+            fail("No minor compaction triggered in "+maxWaitTime+"ms");
     }
 }


[04/10] cassandra git commit: Improve checking for minor compactions in CompactionsCQLTest

Posted by ma...@apache.org.
Improve checking for minor compactions in CompactionsCQLTest

Patch by marcuse; reviewed by Sylvain Lebresne for CASSANDRA-11080


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

Branch: refs/heads/trunk
Commit: 393c6ec4ff4a17aab2fb4d159d9f24f44394c3cd
Parents: 3ea34aa
Author: Marcus Eriksson <ma...@apache.org>
Authored: Fri Jan 29 14:36:47 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 11 08:56:14 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/CompactionsCQLTest.java       | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/393c6ec4/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java b/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
index 46ade76..4553a45 100644
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
@@ -26,9 +26,9 @@ import org.apache.cassandra.cql3.CQLTester;
 import org.apache.cassandra.cql3.UntypedResultSet;
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.Keyspace;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 public class CompactionsCQLTest extends CQLTester
 {
@@ -41,8 +41,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -54,8 +53,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
 
@@ -68,8 +66,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -81,8 +78,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -96,8 +92,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -111,8 +106,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -126,8 +120,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -141,8 +134,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -226,15 +218,23 @@ public class CompactionsCQLTest extends CQLTester
         return Keyspace.open(KEYSPACE).getColumnFamilyStore(currentTable());
     }
 
-    private boolean minorWasTriggered(String keyspace, String cf) throws Throwable
+    private void waitForMinor(String keyspace, String cf, long maxWaitTime, boolean shouldFind) throws Throwable
     {
-        UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
-        boolean minorWasTriggered = false;
-        for (UntypedResultSet.Row r : res)
+        long startTime = System.currentTimeMillis();
+        while (System.currentTimeMillis() - startTime < maxWaitTime)
         {
-            if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
-                minorWasTriggered = true;
+            UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
+            for (UntypedResultSet.Row r : res)
+            {
+                if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
+                    if (shouldFind)
+                        return;
+                    else
+                        fail("Found minor compaction");
+            }
+            Thread.sleep(100);
         }
-        return minorWasTriggered;
+        if (shouldFind)
+            fail("No minor compaction triggered in "+maxWaitTime+"ms");
     }
 }


[06/10] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

Posted by ma...@apache.org.
Merge branch 'cassandra-2.1' into cassandra-2.2


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

Branch: refs/heads/cassandra-2.2
Commit: 984e174dea689f510b24df6ec32581147e96613f
Parents: b59da28 393c6ec
Author: Marcus Eriksson <ma...@apache.org>
Authored: Thu Feb 11 08:57:13 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 11 08:57:13 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/CompactionsCQLTest.java       | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------



[09/10] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by ma...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/trunk
Commit: 11bfd1963249491981d78d6bc47185c5dbb1b78c
Parents: fdd2cd0 984e174
Author: Marcus Eriksson <ma...@apache.org>
Authored: Thu Feb 11 09:03:15 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 11 09:03:15 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/CompactionsCQLTest.java       | 53 +++++++++-----------
 1 file changed, 25 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/11bfd196/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
index 3c0098b,4553a45..5d42aae
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
@@@ -24,19 -24,14 +24,16 @@@ import org.junit.Test
  
  import org.apache.cassandra.cql3.CQLTester;
  import org.apache.cassandra.cql3.UntypedResultSet;
--import org.apache.cassandra.db.ColumnFamilyStore;
--import org.apache.cassandra.db.Keyspace;
- import org.apache.cassandra.utils.FBUtilities;
 +
- import static org.junit.Assert.assertEquals;
  import static org.junit.Assert.assertFalse;
  import static org.junit.Assert.assertTrue;
+ import static org.junit.Assert.fail;
  
  public class CompactionsCQLTest extends CQLTester
  {
 +
-     public static final int SLEEP_TIME = FBUtilities.isWindows()? 2000 : 1000;
++    public static final int SLEEP_TIME = 5000;
 +
      @Test
      public void testTriggerMinorCompactionSTCS() throws Throwable
      {
@@@ -46,8 -41,7 +43,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, true);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, true);
      }
  
      @Test
@@@ -59,8 -53,7 +55,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, true);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, true);
      }
  
  
@@@ -73,8 -66,7 +68,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, true);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, true);
      }
  
      @Test
@@@ -86,8 -78,7 +80,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, false);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, false);
      }
  
      @Test
@@@ -101,8 -92,7 +94,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, true);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, true);
      }
  
      @Test
@@@ -116,8 -106,7 +108,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, false);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, false);
      }
  
      @Test
@@@ -131,8 -120,7 +122,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, false);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, false);
      }
  
      @Test
@@@ -146,8 -134,7 +136,7 @@@
          flush();
          execute("insert into %s (id) values ('1')");
          flush();
-         Thread.sleep(SLEEP_TIME);
-         assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
 -        waitForMinor(KEYSPACE, currentTable(), 5000, true);
++        waitForMinor(KEYSPACE, currentTable(), SLEEP_TIME, true);
      }
  
      @Test
@@@ -224,15 -213,28 +213,23 @@@
          return found;
      }
  
-     private boolean minorWasTriggered(String keyspace, String cf) throws Throwable
 -    private ColumnFamilyStore getCurrentColumnFamilyStore()
 -    {
 -        return Keyspace.open(KEYSPACE).getColumnFamilyStore(currentTable());
 -    }
 -
+     private void waitForMinor(String keyspace, String cf, long maxWaitTime, boolean shouldFind) throws Throwable
      {
-         UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
-         boolean minorWasTriggered = false;
-         for (UntypedResultSet.Row r : res)
+         long startTime = System.currentTimeMillis();
+         while (System.currentTimeMillis() - startTime < maxWaitTime)
          {
-             if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
-                 minorWasTriggered = true;
+             UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
+             for (UntypedResultSet.Row r : res)
+             {
+                 if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
+                     if (shouldFind)
+                         return;
+                     else
+                         fail("Found minor compaction");
+             }
+             Thread.sleep(100);
          }
-         return minorWasTriggered;
+         if (shouldFind)
+             fail("No minor compaction triggered in "+maxWaitTime+"ms");
      }
  }


[03/10] cassandra git commit: Improve checking for minor compactions in CompactionsCQLTest

Posted by ma...@apache.org.
Improve checking for minor compactions in CompactionsCQLTest

Patch by marcuse; reviewed by Sylvain Lebresne for CASSANDRA-11080


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

Branch: refs/heads/cassandra-3.0
Commit: 393c6ec4ff4a17aab2fb4d159d9f24f44394c3cd
Parents: 3ea34aa
Author: Marcus Eriksson <ma...@apache.org>
Authored: Fri Jan 29 14:36:47 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 11 08:56:14 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/CompactionsCQLTest.java       | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/393c6ec4/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java b/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
index 46ade76..4553a45 100644
--- a/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
+++ b/test/unit/org/apache/cassandra/db/compaction/CompactionsCQLTest.java
@@ -26,9 +26,9 @@ import org.apache.cassandra.cql3.CQLTester;
 import org.apache.cassandra.cql3.UntypedResultSet;
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.Keyspace;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 public class CompactionsCQLTest extends CQLTester
 {
@@ -41,8 +41,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -54,8 +53,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
 
@@ -68,8 +66,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -81,8 +78,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -96,8 +92,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -111,8 +106,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -126,8 +120,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertFalse(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, false);
     }
 
     @Test
@@ -141,8 +134,7 @@ public class CompactionsCQLTest extends CQLTester
         flush();
         execute("insert into %s (id) values ('1')");
         flush();
-        Thread.sleep(1000);
-        assertTrue(minorWasTriggered(KEYSPACE, currentTable()));
+        waitForMinor(KEYSPACE, currentTable(), 5000, true);
     }
 
     @Test
@@ -226,15 +218,23 @@ public class CompactionsCQLTest extends CQLTester
         return Keyspace.open(KEYSPACE).getColumnFamilyStore(currentTable());
     }
 
-    private boolean minorWasTriggered(String keyspace, String cf) throws Throwable
+    private void waitForMinor(String keyspace, String cf, long maxWaitTime, boolean shouldFind) throws Throwable
     {
-        UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
-        boolean minorWasTriggered = false;
-        for (UntypedResultSet.Row r : res)
+        long startTime = System.currentTimeMillis();
+        while (System.currentTimeMillis() - startTime < maxWaitTime)
         {
-            if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
-                minorWasTriggered = true;
+            UntypedResultSet res = execute("SELECT * FROM system.compaction_history");
+            for (UntypedResultSet.Row r : res)
+            {
+                if (r.getString("keyspace_name").equals(keyspace) && r.getString("columnfamily_name").equals(cf))
+                    if (shouldFind)
+                        return;
+                    else
+                        fail("Found minor compaction");
+            }
+            Thread.sleep(100);
         }
-        return minorWasTriggered;
+        if (shouldFind)
+            fail("No minor compaction triggered in "+maxWaitTime+"ms");
     }
 }


[05/10] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

Posted by ma...@apache.org.
Merge branch 'cassandra-2.1' into cassandra-2.2


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

Branch: refs/heads/cassandra-3.0
Commit: 984e174dea689f510b24df6ec32581147e96613f
Parents: b59da28 393c6ec
Author: Marcus Eriksson <ma...@apache.org>
Authored: Thu Feb 11 08:57:13 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Feb 11 08:57:13 2016 +0100

----------------------------------------------------------------------
 .../db/compaction/CompactionsCQLTest.java       | 48 ++++++++++----------
 1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------