-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Tighten mapping syncing in ccr remote restore #38071
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 all commits
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 |
|---|---|---|
|
|
@@ -390,7 +390,6 @@ public void testIndividualActionsTimeout() throws Exception { | |
| assertAcked(followerClient().admin().cluster().updateSettings(settingsRequest).actionGet()); | ||
| } | ||
|
|
||
| @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37887") | ||
| public void testFollowerMappingIsUpdated() throws IOException { | ||
| String leaderClusterRepoName = CcrRepository.NAME_PREFIX + "leader_cluster"; | ||
| String leaderIndex = "index1"; | ||
|
|
@@ -413,16 +412,8 @@ public void testFollowerMappingIsUpdated() throws IOException { | |
| .renameReplacement(followerIndex).masterNodeTimeout(new TimeValue(1L, TimeUnit.HOURS)) | ||
| .indexSettings(settingsBuilder); | ||
|
|
||
| // TODO: Eventually when the file recovery work is complete, we should test updated mappings by | ||
| // indexing to the leader while the recovery is happening. However, into order to that test mappings | ||
| // are updated prior to that work, we index documents in the clear session callback. This will | ||
| // ensure a mapping change prior to the final mapping check on the follower side. | ||
| for (CcrRestoreSourceService restoreSourceService : getLeaderCluster().getDataNodeInstances(CcrRestoreSourceService.class)) { | ||
| restoreSourceService.addCloseSessionListener(s -> { | ||
| final String source = String.format(Locale.ROOT, "{\"k\":%d}", 1); | ||
| leaderClient().prepareIndex("index1", "doc", Long.toString(1)).setSource(source, XContentType.JSON).get(); | ||
| }); | ||
| } | ||
| final String source = String.format(Locale.ROOT, "{\"k\":%d}", 1); | ||
| leaderClient().prepareIndex("index1", "doc", Long.toString(1)).setSource(source, XContentType.JSON).get(); | ||
|
|
||
| PlainActionFuture<RestoreInfo> future = PlainActionFuture.newFuture(); | ||
| restoreService.restoreSnapshot(restoreRequest, waitForRestore(clusterService, future)); | ||
|
|
@@ -435,10 +426,6 @@ public void testFollowerMappingIsUpdated() throws IOException { | |
| clusterStateRequest.clear(); | ||
| clusterStateRequest.metaData(true); | ||
| clusterStateRequest.indices(followerIndex); | ||
| ClusterStateResponse clusterState = followerClient().admin().cluster().state(clusterStateRequest).actionGet(); | ||
| IndexMetaData followerIndexMetadata = clusterState.getState().metaData().index(followerIndex); | ||
| assertEquals(2, followerIndexMetadata.getMappingVersion()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why remove this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously we changed mapping twice in the leader: one before opening session and one after. These two events are propagated separately; then the mapping version on the follower is 2. Now, these two events happen before we open session, then the mapping version on the follower is 1 instead of 2. I think verifying the content of the mapping is good enough.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
|
|
||
| MappingMetaData mappingMetaData = followerClient().admin().indices().prepareGetMappings("index2").get().getMappings() | ||
| .get("index2").get("doc"); | ||
| assertThat(XContentMapValues.extractValue("properties.k.type", mappingMetaData.sourceAsMap()), equalTo("long")); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.