Skip to content

Commit e966efe

Browse files
committed
Reduce logging frequency for GCS per project clients
Log a message only when the client settings have actual changes. Relates: #131899
1 parent 7d2de6b commit e966efe

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

modules/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageService.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,19 +369,18 @@ public void applyClusterState(ClusterChangedEvent event) {
369369
.filter(entry -> entry.getValue().getCredential() != null)
370370
.collect(Collectors.toUnmodifiableMap(Map.Entry::getKey, Map.Entry::getValue));
371371

372-
if (allClientSettings.size() != clientSettings.size()) {
373-
logger.warn(
374-
"Project [{}] has [{}] GCS client settings, but [{}] is usable due to missing credentials for clients {}",
375-
project.id(),
376-
allClientSettings.size(),
377-
clientSettings.size(),
378-
Sets.difference(allClientSettings.keySet(), clientSettings.keySet())
379-
);
380-
}
381-
382372
// TODO: If performance is an issue, we may consider comparing just the relevant project secrets for new or updated clients
383373
// and avoid building the clientSettings
384374
if (newOrUpdated(project.id(), clientSettings)) {
375+
if (allClientSettings.size() != clientSettings.size()) {
376+
logger.warn(
377+
"Project [{}] has [{}] GCS client settings, but [{}] is usable due to missing credentials for clients {}",
378+
project.id(),
379+
allClientSettings.size(),
380+
clientSettings.size(),
381+
Sets.difference(allClientSettings.keySet(), clientSettings.keySet())
382+
);
383+
}
385384
updatedPerProjectClients.put(project.id(), new PerProjectClientsHolder(clientSettings));
386385
}
387386
}

0 commit comments

Comments
 (0)