Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}: {}",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

zkWriteTimeMs, isSnapshot ? "snapshot" : "delta", dualWriteCounts);
}

// Persist the offset of the metadata that was written to ZK
Expand Down