-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Ensure changes requests return the latest mapping version #37633
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
Changes from 6 commits
ba0df59
4c26292
7565875
64aa5a3
e19d242
9c4a595
14c0642
249a612
68efd37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,13 +112,24 @@ protected AllocatedPersistentTask createTask(long id, String type, String action | |
| scheduler, System::nanoTime) { | ||
|
|
||
| @Override | ||
| protected void innerUpdateMapping(LongConsumer handler, Consumer<Exception> errorHandler) { | ||
| protected void innerUpdateMapping(long minRequiredMappingVersion, long minRequiredMetadataVersion, | ||
| LongConsumer handler, Consumer<Exception> errorHandler) { | ||
| Index leaderIndex = params.getLeaderShardId().getIndex(); | ||
| Index followIndex = params.getFollowShardId().getIndex(); | ||
|
|
||
| ClusterStateRequest clusterStateRequest = CcrRequests.metaDataRequest(leaderIndex.getName()); | ||
| if (minRequiredMetadataVersion > 0) { | ||
| clusterStateRequest.waitForMetaDataVersion(minRequiredMetadataVersion) | ||
| .waitForTimeout(TimeValue.timeValueNanos(Long.MAX_VALUE)); | ||
dnhatn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| CheckedConsumer<ClusterStateResponse, Exception> onResponse = clusterStateResponse -> { | ||
| IndexMetaData indexMetaData = clusterStateResponse.getState().metaData().getIndexSafe(leaderIndex); | ||
| // this may return an outdated version if we did not have wait_for_metadata_version. | ||
| if (indexMetaData.getMappingVersion() < minRequiredMappingVersion) { | ||
|
||
| assert minRequiredMetadataVersion == 0 : minRequiredMappingVersion; | ||
| innerUpdateMapping(minRequiredMappingVersion, minRequiredMetadataVersion, handler, errorHandler); | ||
| return; | ||
| } | ||
| if (indexMetaData.getMappings().isEmpty()) { | ||
| assert indexMetaData.getMappingVersion() == 1; | ||
| handler.accept(indexMetaData.getMappingVersion()); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.