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

Retry on wait_for_metada_version timeout #38521

Merged
merged 2 commits into from
Feb 9, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,29 @@ public static void getIndexMetadata(Client client, Index index, long mappingVers
}
client.admin().cluster().state(request, ActionListener.wrap(
response -> {
if (response.getState() == null) {
if (response.getState() == null) { // timeout on wait_for_metadata_version
assert metadataVersion > 0 : metadataVersion;
throw new IllegalStateException("timeout to get cluster state with" +
" metadata version [" + metadataVersion + "], mapping version [" + mappingVersion + "]");
if (timeoutSupplier.get().nanos() < 0) {
listener.onFailure(new IllegalStateException("timeout to get cluster state with" +
" metadata version [" + metadataVersion + "], mapping version [" + mappingVersion + "]"));
} else {
getIndexMetadata(client, index, mappingVersion, metadataVersion, timeoutSupplier, listener);
}
} else {
final MetaData metaData = response.getState().metaData();
final IndexMetaData indexMetaData = metaData.getIndexSafe(index);
if (indexMetaData.getMappingVersion() >= mappingVersion) {
listener.onResponse(indexMetaData);
return;
}
if (timeoutSupplier.get().nanos() < 0) {
listener.onFailure(new IllegalStateException(
"timeout to get cluster state with mapping version [" + mappingVersion + "]"));
} else {
// ask for the next version.
getIndexMetadata(client, index, mappingVersion, metaData.version() + 1, timeoutSupplier, listener);
}
}
final MetaData metaData = response.getState().metaData();
final IndexMetaData indexMetaData = metaData.getIndexSafe(index);
if (indexMetaData.getMappingVersion() >= mappingVersion) {
listener.onResponse(indexMetaData);
return;
}
if (timeoutSupplier.get().nanos() < 0) {
throw new IllegalStateException("timeout to get cluster state with mapping version [" + mappingVersion + "]");
}
// ask for the next version.
getIndexMetadata(client, index, mappingVersion, metaData.version() + 1, timeoutSupplier, listener);
},
listener::onFailure
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ public void testAddNewReplicasOnFollower() throws Exception {
pauseFollow("follower-index");
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37807")
public void testReadRequestsReturnLatestMappingVersion() throws Exception {
InternalTestCluster leaderCluster = getLeaderCluster();
Settings nodeAttributes = Settings.builder().put("node.attr.box", "large").build();
Expand Down