JeetKunDoug commented on code in PR #150:
URL:
https://github.com/apache/cassandra-analytics/pull/150#discussion_r2492465752
##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/DirectStreamSession.java:
##########
@@ -85,12 +85,17 @@ protected void onSSTablesProduced(Set<SSTableDescriptor>
sstables)
// 3. send the sstables to all replicas
// 4. remove the sstables once sent
Map<Path, Digest> fileDigests =
sstableWriter.prepareSStablesToSend(writerContext, sstables);
- recordStreamedFiles(fileDigests.keySet());
- fileDigests.keySet()
- .stream()
- .filter(p ->
p.getFileName().toString().endsWith(FileType.DATA.getFileSuffix()))
- .forEach(this::sendSStableToReplicas);
- LOGGER.info("[{}]: Sent SSTables. sstables={}", sessionID,
sstableWriter.sstableCount());
+ // retain only the SSTable data components
+ Set<Path> newSSTables = fileDigests.keySet()
Review Comment:
Why are we collecting these back into a Set? Given `fileDigests` is already
a Map<Path, Digest>, we shouldn't need to collect these again, we could just
use the "AtomicInteger in the foreach" trick to count them right (given that's
the only thing we're using the set for?)
```java
AtomicInteger sstableCount = new AtomicInteger();
fileDigests.keySet()
.stream()
.filter(p ->
p.getFileName().toString().endsWith(FileType.DATA.getFileSuffix()))
.forEach(p -> {
sstableCount.incrementAndGet();
sendSStableToReplicas(p);
});
LOGGER.info("[{}]: Sent newly produced SSTables.
sstables={}", sessionID, sstableCount.get());```
--
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]