lukasz-antoniak commented on code in PR #179:
URL:
https://github.com/apache/cassandra-analytics/pull/179#discussion_r2916175511
##########
cassandra-analytics-cdc/src/test/java/org/apache/cassandra/cdc/LocalCommitLog.java:
##########
@@ -67,7 +70,21 @@ public long length()
public boolean completed()
{
// for CDC Cassandra writes COMPLETED in the final line of the
CommitLog-7-*_cdc.idx index file.
- return maxOffset() >= 67108818;
+ List<String> lines = readIdxFile();
+ return lines.size() >= 2 &&
lines.get(1).trim().equalsIgnoreCase("COMPLETED");
+ }
+
+ private List<String> readIdxFile()
+ {
+ Path idxPath = path.resolveSibling(name.replace(".log", "_cdc.idx"));
+ try
+ {
+ return Files.exists(idxPath) ? Files.readAllLines(idxPath) :
List.of();
+ }
+ catch (IOException e)
+ {
+ return List.of();
Review Comment:
I would propagate a runtime exception, so that it is not silently ignored in
case of failure?
--
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]