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

Check index uuid when merging incoming cluster state into the local one #9541

Closed
wants to merge 2 commits into from

Conversation

bleskes
Copy link
Contributor

@bleskes bleskes commented Feb 3, 2015

In big deployment ClusterState can be large. To make sure we keep reusing objects that were promoted to the Old Gen, ZenDiscovery has an optimization where it tries to reuse existing IndexMetaData object (containing among other things the mappings) from the current cluster state if they didn't change. The comparison currently uses the index name and the metadata version. This is however not enough and we should also check the index uuid. In extreme cases, where cluster state processing is slow and the index in question is deleted and recreated and these operations are batch processed together, we can use the wrong meta data if the version is also identical. This can happen if people create the index with all meta data predefined and no settings were changed.

Closes #9489

Note that this is done against the 1.4 branch as i want it to go there too.

…to local

In big deployment ClusterState can be large. To make sure we keep reusing objects that were promoted to the Old Gen, ZenDiscovery has an optimization where it tries to reuse existing IndexMetaData object (containing among other things the mappings) from the current cluster state if they didn't change. The comparison currently uses the index name and the metadata version. This is however not enough and we should also check the index uuid. In extreme cases, where cluster state processing is slow and the index in question is deleted and recreated and these operations are batch processed together, we can use the wrong meta data if the version is also identical. This can happen if people create the index with all meta data predefined and no settings were changed.

Closes elastic#9489
@bleskes bleskes added the review label Feb 3, 2015
@bleskes bleskes changed the title Discovery: check in index uuid when merging incoming cluster state into the local one Discovery: check index uuid when merging incoming cluster state into the local one Feb 3, 2015
@martijnvg martijnvg self-assigned this Feb 3, 2015
.put(DiscoveryModule.DISCOVERY_TYPE_KEY, "zen")
.build()).get();
assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes("2").get().isTimedOut());
prepareCreate("test").setSettings(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, cluster().numDataNodes() - 1).addMapping("type").get();
Copy link
Member

Choose a reason for hiding this comment

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

maybe use index.auto_expand_replicas instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah can do. Slightly fancier :)

@martijnvg
Copy link
Member

@bleskes Great catch! How did you figured this out? (test failure?) I left a couple of comments/questions, but this looks good to me.

@bleskes
Copy link
Contributor Author

bleskes commented Feb 3, 2015

@martijnvg thx. pushed another commit.

I was diagnosing a customer cluster and saw these kind of messages:

[2015-02-03 11:50:30,078][DEBUG][cluster.action.shard     ] [node_t1] [test][3] ignoring shard started, different index uuid, current IKfsCb3sT7WnfUcfpAcbxg, got [test][3], node[RBwFZ5K6TpuocqmI3dgHdw], [P], s[INITIALIZING], indexUUID [hABpEGPPQOuE_9UhwIa8Rg], reason [master [node_t1][8nttXu8AQb2r0wvtGO95VA][Boazs-Air.local][local[2]]{mode=local} marked shard as initializing, but shard state is [STARTED], mark shard as started]

@martijnvg
Copy link
Member

@bleskes LGTM!

@kimchy
Copy link
Member

kimchy commented Feb 3, 2015

LGTM

bleskes added a commit that referenced this pull request Feb 3, 2015
…local

In big deployment ClusterState can be large. To make sure we keep reusing objects that were promoted to the Old Gen, ZenDiscovery has an optimization where it tries to reuse existing IndexMetaData object (containing among other things the mappings) from the current cluster state if they didn't change. The comparison currently uses the index name and the metadata version. This is however not enough and we should also check the index uuid. In extreme cases, where cluster state processing is slow and the index in question is deleted and recreated and these operations are batch processed together, we can use the wrong meta data if the version is also identical. This can happen if people create the index with all meta data predefined and no settings were changed.

Closes #9489
Closes #9541
bleskes added a commit that referenced this pull request Feb 3, 2015
…local

In big deployment ClusterState can be large. To make sure we keep reusing objects that were promoted to the Old Gen, ZenDiscovery has an optimization where it tries to reuse existing IndexMetaData object (containing among other things the mappings) from the current cluster state if they didn't change. The comparison currently uses the index name and the metadata version. This is however not enough and we should also check the index uuid. In extreme cases, where cluster state processing is slow and the index in question is deleted and recreated and these operations are batch processed together, we can use the wrong meta data if the version is also identical. This can happen if people create the index with all meta data predefined and no settings were changed.

Closes #9489
Closes #9541
@bleskes bleskes closed this in 896e865 Feb 3, 2015
@bleskes bleskes deleted the index_create_uuid branch February 3, 2015 20:36
@clintongormley clintongormley added v1.4.3 v1.5.0 v2.0.0-beta1 >bug :Distributed/Discovery-Plugins Anything related to our integration plugins with EC2, GCP and Azure resiliency and removed review labels Feb 10, 2015
@clintongormley clintongormley changed the title Discovery: check index uuid when merging incoming cluster state into the local one Check index uuid when merging incoming cluster state into the local one Jun 7, 2015
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
…local

In big deployment ClusterState can be large. To make sure we keep reusing objects that were promoted to the Old Gen, ZenDiscovery has an optimization where it tries to reuse existing IndexMetaData object (containing among other things the mappings) from the current cluster state if they didn't change. The comparison currently uses the index name and the metadata version. This is however not enough and we should also check the index uuid. In extreme cases, where cluster state processing is slow and the index in question is deleted and recreated and these operations are batch processed together, we can use the wrong meta data if the version is also identical. This can happen if people create the index with all meta data predefined and no settings were changed.

Closes elastic#9489
Closes elastic#9541
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed/Discovery-Plugins Anything related to our integration plugins with EC2, GCP and Azure resiliency v1.4.3 v1.5.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants