chia7712 commented on code in PR #14792:
URL: https://github.com/apache/kafka/pull/14792#discussion_r1511576151
##########
metadata/src/main/java/org/apache/kafka/metadata/migration/KRaftMigrationDriver.java:
##########
@@ -518,21 +518,27 @@ public void run() throws Exception {
Map<String, Integer> dualWriteCounts = new TreeMap<>();
long startTime = time.nanoseconds();
+ final long zkWriteTimeMs;
if (isSnapshot) {
zkMetadataWriter.handleSnapshot(image,
countingOperationConsumer(
dualWriteCounts,
KRaftMigrationDriver.this::applyMigrationOperation));
-
controllerMetrics.updateZkWriteSnapshotTimeMs(NANOSECONDS.toMillis(time.nanoseconds()
- startTime));
+ zkWriteTimeMs = NANOSECONDS.toMillis(time.nanoseconds() -
startTime);
+ controllerMetrics.updateZkWriteSnapshotTimeMs(zkWriteTimeMs);
} else {
if (zkMetadataWriter.handleDelta(prevImage, image, delta,
countingOperationConsumer(
dualWriteCounts,
KRaftMigrationDriver.this::applyMigrationOperation))) {
// Only record delta write time if we changed something.
Otherwise, no-op records will skew timings.
-
controllerMetrics.updateZkWriteDeltaTimeMs(NANOSECONDS.toMillis(time.nanoseconds()
- startTime));
+ zkWriteTimeMs = NANOSECONDS.toMillis(time.nanoseconds() -
startTime);
+ controllerMetrics.updateZkWriteDeltaTimeMs(zkWriteTimeMs);
+ } else {
+ zkWriteTimeMs = 0;
}
}
if (dualWriteCounts.isEmpty()) {
log.trace("Did not make any ZK writes when handling KRaft {}",
isSnapshot ? "snapshot" : "delta");
} else {
- log.debug("Made the following ZK writes when handling KRaft
{}: {}", isSnapshot ? "snapshot" : "delta", dualWriteCounts);
+ log.debug("Made the following ZK writes in {} ms when handling
KRaft {}: {}",
Review Comment:
Should we add same change for full snapshot sync ?
https://github.com/apache/kafka/blob/trunk/metadata/src/main/java/org/apache/kafka/metadata/migration/KRaftMigrationDriver.java#L762
--
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]