Skip to content

Commit 304b7fb

Browse files
authored
[ML] Improve log message for model snapshot update (#134541) (#134904)
Since the 9.0 upgrade, we have introduced a solution by setting large .ml-anomalies to read only during the upgrade assistant. However, there is an edge case that will cause the obsolete model snapshot to fail to upgrade. Step to reproduce: setup a 7.17 cluster create and start an anomaly detection job upgrade to 8.18 or 8.19 go to upgrade assistant change .ml-anomalies-shared to read only then try upgrade obsolete model snapshot Observed: upgrade model snapshot will fail. This PR extends the warning message explaining the steps to resolve the issue. (cherry picked from commit c47522c) # Conflicts: # server/src/main/java/org/elasticsearch/common/ReferenceDocs.java # server/src/main/resources/org/elasticsearch/common/reference-docs-links.txt
1 parent a3b532a commit 304b7fb

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

server/src/main/java/org/elasticsearch/common/ReferenceDocs.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public enum ReferenceDocs {
8484
ALLOCATION_EXPLAIN_MAX_RETRY,
8585
SECURE_SETTINGS,
8686
CLUSTER_SHARD_LIMIT,
87+
DELETE_INDEX_BLOCK,
8788
// this comment keeps the ';' on the next line so every entry above has a trailing ',' which makes the diff for adding new links cleaner
8889
;
8990

server/src/main/resources/org/elasticsearch/common/reference-docs-links.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ CIRCUIT_BREAKER_ERRORS troubleshoot/ela
4545
ALLOCATION_EXPLAIN_NO_COPIES troubleshoot/elasticsearch/diagnose-unassigned-shards#no-shard-copy
4646
ALLOCATION_EXPLAIN_MAX_RETRY troubleshoot/elasticsearch/diagnose-unassigned-shards#maximum-retries-exceeded
4747
SECURE_SETTINGS deploy-manage/security/secure-settings
48-
CLUSTER_SHARD_LIMIT reference/elasticsearch/configuration-reference/miscellaneous-cluster-settings#cluster-shard-limit
48+
CLUSTER_SHARD_LIMIT reference/elasticsearch/configuration-reference/miscellaneous-cluster-settings#cluster-shard-limit
49+
DELETE_INDEX_BLOCK api/doc/elasticsearch/operation/operation-indices-remove-block

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/JobModelSnapshotUpgrader.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.elasticsearch.action.support.WriteRequest;
1818
import org.elasticsearch.client.internal.Client;
1919
import org.elasticsearch.common.CheckedSupplier;
20+
import org.elasticsearch.common.ReferenceDocs;
2021
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
2122
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
2223
import org.elasticsearch.common.util.concurrent.ThreadContext;
@@ -196,15 +197,21 @@ private void deleteOlderSnapshotDoc(SearchResponse searchResponse, Consumer<Exce
196197
);
197198
}
198199
}, e -> {
199-
logger.warn(
200-
() -> format(
200+
logger.warn(() -> {
201+
String baseMessage = format(
201202
"[%s] [%s] failed to delete old snapshot [%s] result document",
202203
jobId,
203204
snapshotId,
204205
ModelSizeStats.RESULT_TYPE_FIELD.getPreferredName()
205-
),
206-
e
207-
);
206+
);
207+
if (e instanceof org.elasticsearch.cluster.block.ClusterBlockException) {
208+
return baseMessage
209+
+ ". Remove the write block from the results index to delete the model snapshot. See "
210+
+ ReferenceDocs.DELETE_INDEX_BLOCK
211+
+ " for details.";
212+
}
213+
return baseMessage;
214+
}, e);
208215
}), () -> runAfter.accept(null)));
209216
}
210217

0 commit comments

Comments
 (0)