Skip to content

MINOR: Follow-up KAFKA-20696#22676

Open
frankvicky wants to merge 4 commits into
apache:trunkfrom
frankvicky:KAFKA-20696-follow-up
Open

MINOR: Follow-up KAFKA-20696#22676
frankvicky wants to merge 4 commits into
apache:trunkfrom
frankvicky:KAFKA-20696-follow-up

Conversation

@frankvicky

@frankvicky frankvicky commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Deal the comments of #22622

  • OffsetMetadataManager.allOffsetsExpiredgroupHasNoOffsets.
    Per-topic / per-partition expiration check was O(topics × partitions)
    per group. Since the regular offset-expiration cycle already tombstones
    expired offsets, this stage only needs the post-state — a single
    null-check on offsetsByGroup plus an openTransactions.contains
    (O(1)). Three cycles compose cleanly: offset expiration → topology
    cleanup → group tombstone. The now-unused snapshot overload
    OpenTransactions.contains(groupId, topic, partition, committedOffset)
    is removed.

  • Per-shard batching of the conditional clear write. All groups in
    one partition's eligibility read hash to the same __consumer_offsets
    partition, so the cycle now issues one scheduleWriteOperation per
    shard carrying every conditional clear for that shard — not one write
    per group. Added
    GroupCoordinatorShard.clearStoredDescriptionTopologyEpochBatch(Map<String, Integer>) that folds per-group GMM results into one
    CoordinatorResult.

  • Restored inline comment on the pending-transactional-offset guard
    in cleanupExpiredOffsets — accidentally dropped during the
    helper-extract / inline round-trip.

Reviewers: Alieh Saeedi asaeedi@confluent.io

@github-actions github-actions Bot added triage PRs from the community group-coordinator labels Jun 25, 2026
@frankvicky frankvicky requested a review from lucasbru June 26, 2026 08:19
@frankvicky

Copy link
Copy Markdown
Contributor Author

Deal withs the new comments from #22622 (comment) after merge.

@aliehsaeedii aliehsaeedii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @frankvicky. I left some minor comments.

private CompletableFuture<Void> clearStoredDescriptionTopologyEpochBatchAsync(
Map<String, Integer> expectedStoredEpochByGroupId
) {
TopicPartition tp = topicPartitionFor(expectedStoredEpochByGroupId.keySet().iterator().next());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The batch's target partition is derived from keySet().iterator().next(), which throws NoSuchElementException on an empty map. It's safe today because the only caller guards with if (toClear.isEmpty()), but that coupling is implicit. Consider an early if (expectedStoredEpochByGroupId.isEmpty()) return CompletableFuture.completedFuture(null); here so the method is self-protecting and doesn't depend on the caller's guard staying in place.

if (throwable != null) {
log.warn("Failed to clear StoredDescriptionTopologyEpoch for group {}; the next cleanup cycle will retry.",
groupId, throwable);
log.warn("Failed to clear StoredDescriptionTopologyEpoch for {} group(s) on partition {}; the next cleanup cycle will retry.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The batched failure log now reports size() + partition instead of the individual groupId, so a failed write no longer tells you which groups didn't get cleared. Given the next-cycle retry guarantee this is acceptable, but logging the group ids (here or at debug) would make a stuck group easier to diagnose.

@github-actions github-actions Bot removed the triage PRs from the community label Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants