MINOR: Don't print cleaning group metadata log if empty (#19080)

The new group coordinator prints the following line at fixed interval
even if no groups were deleted:

```
Generated 0 tombstone records while cleaning up group metadata in 0 milliseconds. (org.apache.kafka.coordinator.group.GroupCoordinatorShard)
```

The time component has some value in its own but it may be better to not
print if when there are not records in order to reduce the spam in the
logs.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
David Jacot 2025-03-03 18:10:17 +01:00 committed by GitHub
parent a6c53d0c37
commit 29115d5931
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -753,8 +753,11 @@ public class GroupCoordinatorShard implements CoordinatorShard<CoordinatorRecord
} }
}); });
if (!records.isEmpty()) {
log.info("Generated {} tombstone records while cleaning up group metadata in {} milliseconds.", log.info("Generated {} tombstone records while cleaning up group metadata in {} milliseconds.",
records.size(), time.milliseconds() - startMs); records.size(), time.milliseconds() - startMs);
}
// Reschedule the next cycle. // Reschedule the next cycle.
scheduleGroupMetadataExpiration(); scheduleGroupMetadataExpiration();
return new CoordinatorResult<>(records, false); return new CoordinatorResult<>(records, false);