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/06/11 15:41:26 UTC

[GitHub] [cassandra] Gerrrr opened a new pull request #624: CASSANDRA-10968 2.2

Gerrrr opened a new pull request #624:
URL: https://github.com/apache/cassandra/pull/624


   


----------------------------------------------------------------
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 commented on a change in pull request #624: CASSANDRA-10968 2.2

Posted by GitBox <gi...@apache.org>.
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


[GitHub] [cassandra] Gerrrr closed pull request #624: CASSANDRA-10968 2.2

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


   


----------------------------------------------------------------
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 commented on a change in pull request #624: CASSANDRA-10968 2.2

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



##########
File path: src/java/org/apache/cassandra/db/Directories.java
##########
@@ -809,6 +809,11 @@ public long getTrueAllocatedSizeIn(File input)
         return result;
     }
 
+    public static boolean isSecondaryIndexFolder(File dir)

Review comment:
       Nice new method




----------------------------------------------------------------
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 commented on a change in pull request #624: CASSANDRA-10968 2.2

Posted by GitBox <gi...@apache.org>.
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. There is also a missed space:
   ```suggestion
           String file0 = (String) files.get(0);
   ```




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