You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/05/27 14:14:16 UTC

[GitHub] [cassandra] adelapena opened a new pull request #1026: CASSANDRA-16680 (4.0): TimeWindowCompactionStrategyTest flaky

adelapena opened a new pull request #1026:
URL: https://github.com/apache/cassandra/pull/1026


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] adelapena closed pull request #1026: CASSANDRA-16680 (4.0): TimeWindowCompactionStrategyTest flaky

Posted by GitBox <gi...@apache.org>.
adelapena closed pull request #1026:
URL: https://github.com/apache/cassandra/pull/1026


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] ekaterinadimitrova2 commented on a change in pull request #1026: CASSANDRA-16680 (4.0): TimeWindowCompactionStrategyTest flaky

Posted by GitBox <gi...@apache.org>.
ekaterinadimitrova2 commented on a change in pull request #1026:
URL: https://github.com/apache/cassandra/pull/1026#discussion_r640889614



##########
File path: test/unit/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategyTest.java
##########
@@ -253,37 +256,39 @@ public void testDropExpiredSSTables() throws InterruptedException
 
         ByteBuffer value = ByteBuffer.wrap(new byte[100]);
 
-        // create 2 sstables
-        DecoratedKey key = Util.dk(String.valueOf("expired"));
-        new RowUpdateBuilder(cfs.metadata(), System.currentTimeMillis(), 1, key.getKey())
+        // Create a expiring sstable with a TTL
+        DecoratedKey key = Util.dk("expired");
+        new RowUpdateBuilder(cfs.metadata(), System.currentTimeMillis(), TTL_SECONDS, key.getKey())
             .clustering("column")
             .add("val", value).build().applyUnsafe();
-
         cfs.forceBlockingFlush();
         SSTableReader expiredSSTable = cfs.getLiveSSTables().iterator().next();
         Thread.sleep(10);
 
-        key = Util.dk(String.valueOf("nonexpired"));
+        // Create a second sstable without TTL
+        key = Util.dk("nonexpired");
         new RowUpdateBuilder(cfs.metadata(), System.currentTimeMillis(), key.getKey())
             .clustering("column")
             .add("val", value).build().applyUnsafe();
-

Review comment:
       Not a big deal, but I would keep this line probably, for readability. I will leave it up to you

##########
File path: test/unit/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategyTest.java
##########
@@ -253,37 +256,39 @@ public void testDropExpiredSSTables() throws InterruptedException
 
         ByteBuffer value = ByteBuffer.wrap(new byte[100]);
 
-        // create 2 sstables
-        DecoratedKey key = Util.dk(String.valueOf("expired"));
-        new RowUpdateBuilder(cfs.metadata(), System.currentTimeMillis(), 1, key.getKey())
+        // Create a expiring sstable with a TTL
+        DecoratedKey key = Util.dk("expired");
+        new RowUpdateBuilder(cfs.metadata(), System.currentTimeMillis(), TTL_SECONDS, key.getKey())
             .clustering("column")
             .add("val", value).build().applyUnsafe();
-
         cfs.forceBlockingFlush();
         SSTableReader expiredSSTable = cfs.getLiveSSTables().iterator().next();
         Thread.sleep(10);
 
-        key = Util.dk(String.valueOf("nonexpired"));
+        // Create a second sstable without TTL
+        key = Util.dk("nonexpired");
         new RowUpdateBuilder(cfs.metadata(), System.currentTimeMillis(), key.getKey())
             .clustering("column")
             .add("val", value).build().applyUnsafe();
-
         cfs.forceBlockingFlush();
+
         assertEquals(cfs.getLiveSSTables().size(), 2);
 
         Map<String, String> options = new HashMap<>();
-
         options.put(TimeWindowCompactionStrategyOptions.COMPACTION_WINDOW_SIZE_KEY, "30");
         options.put(TimeWindowCompactionStrategyOptions.COMPACTION_WINDOW_UNIT_KEY, "SECONDS");
         options.put(TimeWindowCompactionStrategyOptions.TIMESTAMP_RESOLUTION_KEY, "MILLISECONDS");
         options.put(TimeWindowCompactionStrategyOptions.EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS_KEY, "0");
         TimeWindowCompactionStrategy twcs = new TimeWindowCompactionStrategy(cfs, options);
         for (SSTableReader sstable : cfs.getLiveSSTables())
             twcs.addSSTable(sstable);
+
         twcs.startup();
-        assertNull(twcs.getNextBackgroundTask((int) (System.currentTimeMillis() / 1000)));
-        Thread.sleep(2000);
-        AbstractCompactionTask t = twcs.getNextBackgroundTask((int) (System.currentTimeMillis()/1000));
+        assertNull(twcs.getNextBackgroundTask(nowInSeconds()));
+
+        // wait for the expiration of the first sstable

Review comment:
       wait with capital letter, just mentioning because I saw you corrected it before :-) 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org