maedhroz commented on code in PR #4380:
URL: https://github.com/apache/cassandra/pull/4380#discussion_r2408260371
##########
src/java/org/apache/cassandra/index/sai/disk/v1/SSTableIndexWriter.java:
##########
@@ -100,6 +100,18 @@ public void addRow(PrimaryKey key, Row row, long
sstableRowId) throws IOExceptio
}
}
+ @Override
+ public void onSSTableWriterSwitched(Stopwatch stopwatch) throws IOException
+ {
+ if (maybeAbort())
+ return;
+
+ boolean emptySegment = currentBuilder == null ||
currentBuilder.isEmpty();
+ logger.debug("Flushing index {} with {}buffered data on sstable writer
switched...", index.identifier().indexName, emptySegment ? "no " : "");
+ if (!emptySegment)
+ flushSegment();
Review Comment:
Note that we don't have to aggressively create a new builder here because
`addTerm()`, `complete()`, and `abort()` will all handle the `currentBuilder ==
null` case appropriately.
--
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]