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/09/10 18:15:28 UTC

[GitHub] [cassandra] smiklosovic commented on a change in pull request #1150: CASSANDRA-15134 - include SASI components to snapshots

smiklosovic commented on a change in pull request #1150:
URL: https://github.com/apache/cassandra/pull/1150#discussion_r706380195



##########
File path: test/unit/org/apache/cassandra/index/sasi/SASIIndexTest.java
##########
@@ -137,7 +146,87 @@ public void cleanUp()
     }
 
     @Test
-    public void testSingleExpressionQueries()
+    public void testSASIComponentsAddedToSnapshot() throws Throwable
+    {
+        String snapshotName = "sasi_test";
+        Map<String, Pair<String, Integer>> data = new HashMap<>();
+        Random r = new Random();
+
+        for (int i = 0; i < 100; i++)
+        {
+            data.put(UUID.randomUUID().toString(), Pair.create(UUID.randomUUID().toString(), r.nextInt()));
+        }
+
+        ColumnFamilyStore store = loadData(data, true);
+        store.forceMajorCompaction();
+
+        try
+        {
+            // left holds table component sizes, right holds total size of index components (SI_*)
+            Pair<Long, Long> tableIndexSizes = takeSnapshotAndCheckComponents(store, snapshotName);
+            Map<String, Pair<Long, Long>> details = store.getSnapshotDetails();
+
+            // check that SASI components are included in the computation of snapshot size
+            Assert.assertEquals((long) details.get("sasi_test").right, tableIndexSizes.left + tableIndexSizes.right);
+        }
+        finally
+        {
+            store.clearSnapshot("sasi_test");
+        }
+    }
+
+    private Pair<Long, Long> takeSnapshotAndCheckComponents(ColumnFamilyStore cfs, String snapshotName) throws Throwable

Review comment:
       I can definitely inline it, I just think it is more obvious what it does when it is separated to another method. I am not sure about checking the components ... I am already checking that on line 211 that sasi components are all contained in the set of all components. Do you want me to actually check this on a file-name level? I guess that is overkill.




-- 
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.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

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