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 2020/07/06 11:45:00 UTC

[GitHub] [cassandra] adelapena commented on a change in pull request #624: CASSANDRA-10968 2.2

adelapena commented on a change in pull request #624:
URL: https://github.com/apache/cassandra/pull/624#discussion_r450165010



##########
File path: test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
##########
@@ -2356,4 +2360,41 @@ public void testRebuildSecondaryIndex() throws IOException
 
         PerRowSecondaryIndexTest.TestIndex.reset();
     }
+
+    @Test
+    public void testSnapshotWithoutFlushWithSecondaryIndexes() throws Exception
+    {
+        String keyspaceName = KEYSPACE1;
+        String cfName= CF_INDEX1;
+        Keyspace keyspace = Keyspace.open(keyspaceName);
+        ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
+        cfs.truncateBlocking();
+
+        List<Mutation> rms = new LinkedList<>();
+        Mutation rm;
+
+        rm = new Mutation(keyspaceName, ByteBufferUtil.bytes("k1"));
+        rm.add(cfName, cellname("birthdate"), ByteBufferUtil.bytes(1L), 0);
+        rm.add(cfName, cellname("nobirthdate"), ByteBufferUtil.bytes(1L), 0);
+        rms.add(rm);
+        Util.writeColumnFamily(rms);
+
+        String snapshotName = "newSnapshot";
+        cfs.snapshotWithoutFlush(snapshotName);
+
+        File snapshotManifestFile = cfs.directories.getSnapshotManifestFile(snapshotName);
+        JSONParser parser = new JSONParser();
+        JSONObject manifest = (JSONObject) parser.parse(new FileReader(snapshotManifestFile));
+        JSONArray files = (JSONArray) manifest.get("files");
+
+        // Keyspace1-Indexed1 and the corresponding index
+        assert files.size() == 2;
+
+        // Snapshot of the secondary index is stored in the subfolder with the same file name
+        String file0 = (String)files.get(0);

Review comment:
       Optional nit: we might name this file `baseTableFile`, and the one below `indexTableFile`, to slightly improve readability.




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