muralibasani commented on code in PR #23750:
URL: https://github.com/apache/kafka/pull/23750#discussion_r4657523690
##########
share-coordinator/src/main/java/org/apache/kafka/coordinator/share/ShareCoordinatorShard.java:
##########
@@ -586,24 +582,28 @@ public
CoordinatorResult<InitializeShareGroupStateResponseData, CoordinatorRecor
/**
* Iterates over the soft state to determine the share partitions whose
last snapshot is
* older than the allowed time interval. The candidate share partitions
are force snapshotted.
+ * <p>
+ * Skipped if all share partitions are cold snapshotted with no pending
share updates.
*
* @return A result containing snapshot records, if any, and a void
response.
*/
public CoordinatorResult<Void, CoordinatorRecord> snapshotColdPartitions()
{
- long coldSnapshottedPartitionsCount = shareStateMap.values().stream()
- .filter(shareGroupOffset -> shareGroupOffset.createTimestamp() -
shareGroupOffset.writeTimestamp() != 0)
- .count();
-
- // If all share partitions are snapshotted, it means that
- // system is quiet and cold snapshotting will not help much.
- if (coldSnapshottedPartitionsCount == shareStateMap.size()) {
- log.debug("All share snapshot records already cold snapshotted,
skipping.");
+ boolean allPartitionsQuiet = shareStateMap.entrySet().stream()
+ .allMatch(entry -> entry.getValue().createTimestamp() !=
entry.getValue().writeTimestamp() &&
+ snapshotUpdateCount.getOrDefault(entry.getKey(), 0) == 0);
Review Comment:
Yes, updated. Thank youl.
--
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]