adelapena commented on a change in pull request #1150:
URL: https://github.com/apache/cassandra/pull/1150#discussion_r707227469
##########
File path: test/unit/org/apache/cassandra/index/sasi/SASIIndexTest.java
##########
@@ -137,7 +146,80 @@ 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
+ {
+ Set<SSTableReader> ssTableReaders = store.getLiveSSTables();
+ Set<Component> sasiComponents = new HashSet<>();
+
+ for (Index index : store.indexManager.listIndexes())
+ if (index instanceof SASIIndex)
+ sasiComponents.add(((SASIIndex)
index).getIndex().getComponent());
+
+ Assert.assertFalse(sasiComponents.isEmpty());
+
+ store.snapshot(snapshotName);
+ JSONObject manifest = (JSONObject) new JSONParser().parse(new
FileReader(store.getDirectories().getSnapshotManifestFile(snapshotName)));
+ JSONArray files = (JSONArray) manifest.get("files");
+
+ Assert.assertFalse(ssTableReaders.isEmpty());
+ Assert.assertFalse(files.isEmpty());
+ Assert.assertEquals(ssTableReaders.size(), files.size());
+
+ Map<Descriptor, Set<Component>> snapshotSSTables =
store.getDirectories().sstableLister(Directories.OnTxnErr.IGNORE).snapshots(snapshotName).list();
Review comment:
Nit: we could easily break this line to keep it under 120 chars:
```suggestion
Map<Descriptor, Set<Component>> snapshotSSTables =
store.getDirectories()
.sstableLister(Directories.OnTxnErr.IGNORE)
.snapshots(snapshotName).list();
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]