Skip to content

Commit

Permalink
Don't Deduplicate RepositoryData Loading When Caching is Disabled (el…
Browse files Browse the repository at this point in the history
…astic#68126)

Deduplicating repository data loading when deactivating caching (which is effectively a test only
setting that allows us to change the repo data at a given generation in place).
In the corner case of the result deduplicator not removing the request from the `requests` map
quickly enough when we update the repository data in place this causes the old version to be loaded still,
thus breaking repo corruption tests.

Instead of complicating the tests, this commit just turns off deduplication if caching is off since
its always on in production anyway.

Closes elastic#67696
  • Loading branch information
original-brownbear committed Jan 29, 2021
1 parent 551beff commit 2ddf7a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ public void testHandlingMissingRootLevelSnapshotMetadata() throws Exception {
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/67696")
public void testMountCorruptedRepositoryData() throws Exception {
disableRepoConsistencyCheck("This test intentionally corrupts the repository contents");
Client client = client();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,10 @@ public void getRepositoryData(ActionListener<RepositoryData> listener) {
} else {
logger.trace("[{}] loading un-cached repository data with best known repository generation [{}]", metadata.name(),
latestKnownRepoGen);
if (bestEffortConsistency) {
// Don't deduplicate repo data loading if we don't have strong consistency guarantees between the repo and the cluster state
// Also, if we are not caching repository data (for tests) we assume that the contents of the repository data at a given
// generation may change
if (bestEffortConsistency || cacheRepositoryData == false) {
threadPool.generic().execute(ActionRunnable.wrap(listener, this::doGetRepositoryData));
} else {
repoDataDeduplicator.executeOnce(metadata, listener, (metadata, l) ->
Expand Down

0 comments on commit 2ddf7a6

Please sign in to comment.