smjn commented on code in PR #19443:
URL: https://github.com/apache/kafka/pull/19443#discussion_r2047117734
##########
share-coordinator/src/main/java/org/apache/kafka/coordinator/share/ShareCoordinatorShard.java:
##########
@@ -574,6 +575,46 @@ public
CoordinatorResult<InitializeShareGroupStateResponseData, CoordinatorRecor
return new CoordinatorResult<>(List.of(record), responseData);
}
+ /**
+ * 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.
+ *
+ * @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 != 0 &&
coldSnapshottedPartitionsCount == shareStateMap.size()) {
Review Comment:
Incorporated
--
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]