Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Ignore failures from renormalizing buckets in read-only index #118674

Merged
merged 12 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/118674.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 118674
summary: Ignore failures from renormalizing buckets in read-only index
area: Machine Learning
type: enhancement
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.index.IndexRequest;
Expand Down Expand Up @@ -102,7 +103,24 @@ public void executeRequest() {
try (ThreadContext.StoredContext ignore = client.threadPool().getThreadContext().stashWithOrigin(ML_ORIGIN)) {
BulkResponse addRecordsResponse = client.bulk(bulkRequest).actionGet();
if (addRecordsResponse.hasFailures()) {
logger.error("[{}] Bulk index of results has errors: {}", jobId, addRecordsResponse.buildFailureMessage());
// Implementation note: Ignore the failures from writing to the read-only index, as it comes
// from changing the index format version.
boolean hasNonReadOnlyFailures = false;
for (BulkItemResponse response : addRecordsResponse.getItems()) {
if (response.isFailed() == false) {
continue;
}
if (response.getFailureMessage().contains("index read-only")) {
valeriy42 marked this conversation as resolved.
Show resolved Hide resolved
// We expect this to happen when the old index is made read-only and being reindexed
logger.debug("[{}] Ignoring failure to write to read-only index: {}", jobId, response.getFailureMessage());
valeriy42 marked this conversation as resolved.
Show resolved Hide resolved
} else {
hasNonReadOnlyFailures = true;
break;
}
}
if (hasNonReadOnlyFailures) {
logger.error("[{}] Bulk index of results has errors: {}", jobId, addRecordsResponse.buildFailureMessage());
}
}
}

Expand Down