Skip to content

Commit

Permalink
Improve recovery plan trace logging (#93578)
Browse files Browse the repository at this point in the history
Distinguishes files that we plan to recover from a snapshot from those
coming from a peer, and clarifies that the overall `total_size` is not
the total size of `recovering_files`.
  • Loading branch information
DaveCTurner committed Feb 8, 2023
1 parent db17d38 commit 8a12c68
Showing 1 changed file with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -636,34 +636,47 @@ void recoverFilesFromSourceAndSnapshot(
for (StoreFileMetadata md : shardRecoveryPlan.getSourceFilesToRecover()) {
if (request.metadataSnapshot().fileMetadataMap().containsKey(md.name())) {
logger.trace(
"recovery [phase1]: recovering [{}], exists in local store, but is different: remote [{}], local [{}]",
"recovery [phase1]: recovering [{}] from peer, exists in local store but is different: remote [{}], local [{}]",
md.name(),
request.metadataSnapshot().fileMetadataMap().get(md.name()),
md
);
} else {
logger.trace("recovery [phase1]: recovering [{}], does not exist in remote", md.name());
logger.trace("recovery [phase1]: recovering [{}] from peer, does not exist in remote", md.name());
}
}

for (BlobStoreIndexShardSnapshot.FileInfo fileInfo : shardRecoveryPlan.getSnapshotFilesToRecover()) {
final StoreFileMetadata md = fileInfo.metadata();
if (request.metadataSnapshot().fileMetadataMap().containsKey(md.name())) {
logger.trace(
"recovery [phase1]: recovering [{}], exists in local store, but is different: remote [{}], local [{}]",
"recovery [phase1]: recovering [{}] from snapshot, exists in local store but is different: remote [{}], local [{}]",
md.name(),
request.metadataSnapshot().fileMetadataMap().get(md.name()),
md
);
} else {
logger.trace("recovery [phase1]: recovering [{}], does not exist in remote", md.name());
logger.trace("recovery [phase1]: recovering [{}] from snapshot, does not exist in remote", md.name());
}
}

logger.trace(
"recovery [phase1]: recovering_files [{}] with total_size [{}], reusing_files [{}] with total_size [{}]",
filesToRecoverNames.size(),
"""
recovery [phase1]: total_size[{}], \
recovering_files [{}] with total_size [{}] from peer, \
recovering_files [{}] with total_size [{}] from snapshot, \
reusing_files [{}] with total_size [{}]""",
ByteSizeValue.ofBytes(totalSize),
shardRecoveryPlan.getSourceFilesToRecover().size(),
ByteSizeValue.ofBytes(shardRecoveryPlan.getSourceFilesToRecover().stream().mapToLong(StoreFileMetadata::length).sum()),
shardRecoveryPlan.getSnapshotFilesToRecover().size(),
ByteSizeValue.ofBytes(
shardRecoveryPlan.getSnapshotFilesToRecover()
.getSnapshotFiles()
.stream()
.mapToLong(BlobStoreIndexShardSnapshot.FileInfo::length)
.sum()
),
phase1ExistingFileNames.size(),
ByteSizeValue.ofBytes(existingTotalSize)
);
Expand Down

0 comments on commit 8a12c68

Please sign in to comment.