Skip to content

Commit

Permalink
Change noisy logs on SegRep and remote store paths to trace level (#9323
Browse files Browse the repository at this point in the history
)

Signed-off-by: Marc Handalian <handalm@amazon.com>
(cherry picked from commit 64be0ab)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Aug 15, 2023
1 parent 44cc408 commit dc5e7c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions server/src/main/java/org/opensearch/index/shard/IndexShard.java
Original file line number Diff line number Diff line change
Expand Up @@ -1633,20 +1633,20 @@ public Tuple<GatedCloseable<SegmentInfos>, ReplicationCheckpoint> getLatestSegme
*/
public boolean isSegmentReplicationAllowed() {
if (indexSettings.isSegRepEnabled() == false) {
logger.warn("Attempting to perform segment replication when it is not enabled on the index");
logger.trace("Attempting to perform segment replication when it is not enabled on the index");
return false;
}
if (getReplicationTracker().isPrimaryMode()) {
logger.warn("Shard is in primary mode and cannot perform segment replication as a replica.");
logger.trace("Shard is in primary mode and cannot perform segment replication as a replica.");

Check warning on line 1640 in server/src/main/java/org/opensearch/index/shard/IndexShard.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/index/shard/IndexShard.java#L1640

Added line #L1640 was not covered by tests
return false;
}
if (this.routingEntry().primary()) {
logger.warn("Shard routing is marked primary thus cannot perform segment replication as replica");
logger.trace("Shard routing is marked primary thus cannot perform segment replication as replica");

Check warning on line 1644 in server/src/main/java/org/opensearch/index/shard/IndexShard.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/index/shard/IndexShard.java#L1644

Added line #L1644 was not covered by tests
return false;
}
if (state().equals(IndexShardState.STARTED) == false
&& (state() == IndexShardState.POST_RECOVERY && shardRouting.state() == ShardRoutingState.INITIALIZING) == false) {
logger.warn(
logger.trace(
() -> new ParameterizedMessage(
"Shard is not started or recovering {} {} and cannot perform segment replication as a replica",
state(),
Expand All @@ -1656,7 +1656,7 @@ public boolean isSegmentReplicationAllowed() {
return false;
}
if (getReplicationEngine().isEmpty()) {
logger.warn(
logger.trace(

Check warning on line 1659 in server/src/main/java/org/opensearch/index/shard/IndexShard.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/index/shard/IndexShard.java#L1659

Added line #L1659 was not covered by tests
() -> new ParameterizedMessage(
"Shard does not have the correct engine type to perform segment replication {}.",
getEngine().getClass()
Expand Down Expand Up @@ -4811,8 +4811,8 @@ private String copySegmentFiles(
}
}
} finally {
logger.info("Downloaded segments here: {}", downloadedSegments);
logger.info("Skipped download for segments here: {}", skippedSegments);
logger.trace("Downloaded segments here: {}", downloadedSegments);
logger.trace("Skipped download for segments here: {}", skippedSegments);
}
return segmentNFile;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private boolean shouldSync(boolean didRefresh) {

private boolean syncSegments() {
if (indexShard.getReplicationTracker().isPrimaryMode() == false || indexShard.state() == IndexShardState.CLOSED) {
logger.info(
logger.trace(
"Skipped syncing segments with primaryMode={} indexShardState={}",
indexShard.getReplicationTracker().isPrimaryMode(),
indexShard.state()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public RemoteSegmentMetadata readLatestMetadataFile() throws IOException {
logger.trace("Reading latest Metadata file {}", latestMetadataFile);
remoteSegmentMetadata = readMetadataFile(latestMetadataFile);
} else {
logger.info("No metadata file found, this can happen for new index with no data uploaded to remote segment store");
logger.trace("No metadata file found, this can happen for new index with no data uploaded to remote segment store");
}

return remoteSegmentMetadata;
Expand Down Expand Up @@ -786,7 +786,7 @@ public void deleteStaleSegments(int lastNMetadataFilesToKeep) throws IOException
Integer.MAX_VALUE
);
if (sortedMetadataFileList.size() <= lastNMetadataFilesToKeep) {
logger.info(
logger.trace(
"Number of commits in remote segment store={}, lastNMetadataFilesToKeep={}",
sortedMetadataFileList.size(),
lastNMetadataFilesToKeep
Expand Down Expand Up @@ -849,7 +849,7 @@ public void deleteStaleSegments(int lastNMetadataFilesToKeep) throws IOException
}
});
if (deletionSuccessful.get()) {
logger.info("Deleting stale metadata file {} from remote segment store", metadataFile);
logger.trace("Deleting stale metadata file {} from remote segment store", metadataFile);
remoteMetadataDirectory.deleteFile(metadataFile);
}
}
Expand Down

0 comments on commit dc5e7c0

Please sign in to comment.