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

[Test] Account for auto-repairing for shard gen file #112778

Merged
merged 6 commits into from
Sep 12, 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
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ tests:
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
method: test {yaml=reference/cluster/stats/line_1450}
issue: https://github.com/elastic/elasticsearch/issues/112732
- class: org.elasticsearch.repositories.blobstore.testkit.integrity.RepositoryVerifyIntegrityIT
method: testCorruption
issue: https://github.com/elastic/elasticsearch/issues/112769
- class: org.elasticsearch.repositories.blobstore.testkit.integrity.RepositoryVerifyIntegrityIT
method: testTransportException
issue: https://github.com/elastic/elasticsearch/issues/112779
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,20 @@ public void testCorruption() throws IOException {
? equalTo(testContext.indexNames().size())
: lessThan(testContext.indexNames().size())
);
assertThat(anomalies, not(empty()));
// Missing shard generation file is automatically repaired based on the shard snapshot files.
// See also BlobStoreRepository#buildBlobStoreIndexShardSnapshots
assertThat(anomalies, corruptedFileType == RepositoryFileType.SHARD_GENERATION ? empty() : not(empty()));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we can add a flag to make buildBlobStoreIndexShardSnapshots not repair missing shard gen file so that the verification can fail. I am not sure whether it is necessary since this would return warnings to users for something we already have a workaround, i.e. no action is required on the user side. In addition, the warning message about the repairing is logged in this case and I think that is all we need for this type of issue.

assertThat(responseObjectPath.evaluate("results.total_anomalies"), greaterThanOrEqualTo(anomalies.size()));
assertEquals("fail", responseObjectPath.evaluate("results.result"));
assertEquals(
corruptedFileType == RepositoryFileType.SHARD_GENERATION ? "pass" : "fail",
responseObjectPath.evaluate("results.result")
);

// remove permitted/expected anomalies to verify that no unexpected ones were seen
switch (corruptedFileType) {
case SNAPSHOT_INFO -> anomalies.remove("failed to load snapshot info");
case GLOBAL_METADATA -> anomalies.remove("failed to load global metadata");
case INDEX_METADATA -> anomalies.remove("failed to load index metadata");
case SHARD_GENERATION -> anomalies.remove("failed to load shard generation");
case SHARD_SNAPSHOT_INFO -> anomalies.remove("failed to load shard snapshot");
case SHARD_DATA -> {
anomalies.remove("missing blob");
Expand Down