yifan-c commented on a change in pull request #1311:
URL: https://github.com/apache/cassandra/pull/1311#discussion_r759907051
##########
File path:
src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java
##########
@@ -250,9 +302,11 @@ void processDiscardedSegment(CommitLogSegment segment)
{
// Add to flushed size before decrementing unflushed so we
don't have a window of false generosity
if (segment.getCDCState() == CDCState.CONTAINS)
- size += segment.onDiskSize();
+ sizeInProgress.getAndAdd(segment.onDiskSize());
+
+ // Subtract the (estimated) size of the segment from
processNewSegment.
if (segment.getCDCState() != CDCState.FORBIDDEN)
- size -= defaultSegmentSize();
+ sizeInProgress.getAndAdd(-defaultSegmentSize()); // todo:
the defaultSegmentSize can be altered
Review comment:
The reason to subtract `defaultSegmentSize` is to return the estimated
segment size it has aggressively counted at `processNewSegment`.
In `processDiscardedSegment`, it counts the actual `onDiskSize` for the
segment that `CONTAINS`. So it returns the estimated size. For the segment that
remains in `PERMITTED`, it gets deleted, so it also need to subtract/return.
I will update the comment to make it more clear.
--
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]