Skip to content

Commit

Permalink
Improved logging around remote cluster state (opensearch-project#10892)
Browse files Browse the repository at this point in the history
* Improved logging around remote cluster state

Signed-off-by: Dhwanil Patel <[email protected]>
  • Loading branch information
dhwanilpatel authored Oct 26, 2023
1 parent fe8b2d5 commit d1c94b5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,8 @@ public ClusterMetadataManifest writeFullMetadata(ClusterState clusterState, Stri
allUploadedIndexMetadata.size()
);
} else {
// todo change to debug
logger.info(
"writing cluster state took [{}ms]; " + "wrote full state with [{}] indices",
"writing cluster state took [{}ms]; " + "wrote full state with [{}] indices and global metadata",
durationMillis,
allUploadedIndexMetadata.size()
);
Expand Down Expand Up @@ -285,6 +284,7 @@ public ClusterMetadataManifest writeIncrementalMetadata(
if (updateGlobalMetadata || previousManifest.getGlobalMetadataFileName() == null) {
globalMetadataFile = writeGlobalMetadata(clusterState);
} else {
logger.debug("Global metadata has not updated in cluster state, skipping upload of it");
globalMetadataFile = previousManifest.getGlobalMetadataFileName();
}

Expand All @@ -305,7 +305,7 @@ public ClusterMetadataManifest writeIncrementalMetadata(
for (final IndexMetadata indexMetadata : clusterState.metadata().indices().values()) {
final Long previousVersion = previousStateIndexMetadataVersionByName.get(indexMetadata.getIndex().getName());
if (previousVersion == null || indexMetadata.getVersion() != previousVersion) {
logger.trace(
logger.debug(
"updating metadata for [{}], changing version from [{}] to [{}]",
indexMetadata.getIndex(),
previousVersion,
Expand Down Expand Up @@ -342,18 +342,22 @@ public ClusterMetadataManifest writeIncrementalMetadata(
if (durationMillis >= slowWriteLoggingThreshold.getMillis()) {
logger.warn(
"writing cluster state took [{}ms] which is above the warn threshold of [{}]; "
+ "wrote metadata for [{}] indices and skipped [{}] unchanged indices",
+ "wrote metadata for [{}] indices and skipped [{}] unchanged indices, global metadata updated : [{}]",
durationMillis,
slowWriteLoggingThreshold,
numIndicesUpdated,
numIndicesUnchanged
numIndicesUnchanged,
updateGlobalMetadata
);
} else {
logger.trace(
"writing cluster state took [{}ms]; " + "wrote metadata for [{}] indices and skipped [{}] unchanged indices",
logger.info(
"writing cluster state for version [{}] took [{}ms]; "
+ "wrote metadata for [{}] indices and skipped [{}] unchanged indices, global metadata updated : [{}]",
manifest.getStateVersion(),
durationMillis,
numIndicesUpdated,
numIndicesUnchanged
numIndicesUnchanged,
updateGlobalMetadata
);
}
return manifest;
Expand Down Expand Up @@ -605,6 +609,11 @@ private void writeMetadataManifest(String clusterName, String clusterUUID, Clust
blobStoreRepository.getCompressor(),
FORMAT_PARAMS
);
logger.debug(
"Metadata manifest file [{}] written during [{}] phase. ",
fileName,
uploadManifest.isCommitted() ? "commit" : "publish"
);
}

private String fetchPreviousClusterUUID(String clusterName, String clusterUUID) {
Expand Down Expand Up @@ -912,6 +921,7 @@ private List<String> createClusterChain(final Map<String, ClusterMetadataManifes
// Getting the previous cluster UUID of a cluster UUID from the clusterUUID Graph
currentUUID = clusterUUIDGraph.get(currentUUID);
}
logger.info("Known UUIDs found in remote store : [{}]", validChain);
return validChain;
}

Expand Down Expand Up @@ -1231,7 +1241,7 @@ private void deleteClusterMetadata(
});

if (staleManifestPaths.isEmpty()) {
logger.info("No stale Remote Cluster Metadata files found");
logger.debug("No stale Remote Cluster Metadata files found");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public RemoteRestoreResult restore(
if (currentState.metadata().clusterUUID().equals(restoreClusterUUID)) {
throw new IllegalArgumentException("clusterUUID to restore from should be different from current cluster UUID");
}
logger.info("Restoring cluster state from remote store from cluster UUID : [{}]", restoreClusterUUID);
remoteMetadata = remoteClusterStateService.getLatestMetadata(currentState.getClusterName().value(), restoreClusterUUID);
remoteMetadata.getIndices().values().forEach(indexMetadata -> {
indexMetadataMap.put(indexMetadata.getIndex().getName(), new Tuple<>(true, indexMetadata));
Expand Down

0 comments on commit d1c94b5

Please sign in to comment.