-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-16106: revert classic state transitions if deletion fails #16511
base: trunk
Are you sure you want to change the base?
Conversation
866ce8b
to
b73af9c
Compare
@@ -575,18 +581,32 @@ public CoordinatorResult<OffsetDeleteResponseData, CoordinatorRecord> deleteOffs | |||
public CoordinatorResult<Void, CoordinatorRecord> cleanupGroupMetadata() { | |||
long startMs = time.milliseconds(); | |||
List<CoordinatorRecord> records = new ArrayList<>(); | |||
AtomicInteger deletedClassicGroupCount = new AtomicInteger(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, is the AtomicInteger
used to match the following forEach loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you mean by using it to conform to the lambda expression, yes
|
||
when(groupMetadataManager.groupIds()).thenReturn(mkSet("group-id", "other-group-id")); | ||
when(offsetMetadataManager.cleanupExpiredOffsets(eq("group-id"), eq(new ArrayList<>()))).thenReturn(true); | ||
when(groupMetadataManager.maybeDeleteGroup(eq("group-id"), eq(new ArrayList<>()))).thenReturn(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add something to the record list and assert it's non null later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test above, testCleanupGroupMetadata (https://github.com/apache/kafka/pull/16511/files/b73af9c786d4ad29259d0bfeb7c16db3324eff4b#diff-3a0b9cad0253e0f6d4665efd0d6f7efd5bd5dd96d3ba31005cab06fa728aad8fR990)
tests that the records we add are reflected. would this be sufficient?
An expire-group-metadata operation generates tombstone records, updates the groups state and decrements group size counters, then performs a write to the log. If there is a __consumer_offsets partition reassignment, for instance, this operation fails. The groups state is reverted to an earlier snapshot but classic group size counters are not. This begins an inconsistency between the metrics and the actual groups size. This applies to all unsuccessful write operations that alter the classic group state.
However, some operations that alter the classic group state does not produce records. This means that we cannot rely on timeline data structures as we do for consumer group states.
Committer Checklist (excluded from commit message)