yifan-c commented on code in PR #1770:
URL: https://github.com/apache/cassandra/pull/1770#discussion_r940513909
##########
src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java:
##########
@@ -190,14 +189,20 @@ public CommitLogSegment.Allocation allocate(Mutation
mutation, int size) throws
return alloc;
}
- // Non-blocking mode has just recently been enabled for CDC.
- // The segment is still marked as FORBIDDEN. It should be set to PERMITTED.
- private void ensureSegmentPermittedIfNotBlockWrites(CommitLogSegment
segment)
+ // Permit a forbidden segment under the following conditions.
+ // - Non-blocking mode has just recently been enabled for CDC.
+ // - The CDC total space has droppped below the limit (e.g. CDC consumer
cleans up).
+ private void permitSegmentMaybe(CommitLogSegment segment)
{
- if (!DatabaseDescriptor.getCDCBlockWrites() && segment.getCDCState()
== CDCState.FORBIDDEN)
+ if (segment.getCDCState() != CDCState.FORBIDDEN)
+ return;
+
+ if (!DatabaseDescriptor.getCDCBlockWrites()
+ || cdcSizeTracker.sizeInProgress.get() <
DatabaseDescriptor.getCDCTotalSpace())
Review Comment:
No. If the the state is FORBIDDEN, we do not create a link. The link is
created only when the state is NOT FORBIDDEN (i.e. PERMITTED/CONTAINS).
The current implementation is that a hardlink is created for all new
segments, regardless of the state. Since each FORBIDDEN segment has a change to
revert back to PERMITTED, this handling is easy but at the cost of slightly
over-counting (the size of one file).
I think, and as you mentioned, it likely not a big problem.
--
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]