Verify shards index UUID when fetching started shards #10200

Merged
merged 1 commit into from Mar 23, 2015

Projects

None yet

3 participants

@s1monw
Contributor
s1monw commented Mar 21, 2015

Today we simply fetch the shards metadata without verifying the
index UUID the shard belongs to. We recently added this UUID
to the shard state metadata. This commit adds verification
to the shard metadata fetching to prevent bringing shards
back into an index it doesn't belong to due to name collisions.

@s1monw
Contributor
s1monw commented Mar 23, 2015

@bleskes wanna take a look

@bleskes bleskes and 1 other commented on an outdated diff Mar 23, 2015
...h/gateway/TransportNodesListGatewayStartedShards.java
@@ -59,8 +62,8 @@ public TransportNodesListGatewayStartedShards(Settings settings, ClusterName clu
this.nodeEnv = env;
}
- public ActionFuture<NodesGatewayStartedShards> list(ShardId shardId, String[] nodesIds, @Nullable TimeValue timeout) {
- return execute(new Request(shardId, nodesIds).timeout(timeout));
+ public ActionFuture<NodesGatewayStartedShards> list(ShardId shardId, String indexUUID, String[] nodesIds, @Nullable TimeValue timeout) {
+ return execute(new Request(shardId, indexUUID, Arrays.asList(nodesIds)).timeout(timeout));
@bleskes
bleskes Mar 23, 2015 Member

I think the nodes can stay as an array. The constructor just converts to an array again.

@s1monw
s1monw Mar 23, 2015 Contributor

yeah so I did this since I didn't want the String, String... signature.. kind of confusing

@bleskes
bleskes Mar 23, 2015 Member

agreed, but what's wrong with Request(ShardId shardId, String[] nodesIds) ?

@s1monw
s1monw Mar 23, 2015 Contributor

true :) will fix

@bleskes
Member
bleskes commented Mar 23, 2015

Left one minor comment. LGTM otherwise.

@s1monw
Contributor
s1monw commented Mar 23, 2015

pushed a new commit

@s1monw s1monw [ALLOCATION] Verify shards index UUID when fetching started shards
Today we simply fetch the shards metadata without verifying the
index UUID the shard belongs to. We recently added this UUID
to the shard state metadata. This commit adds verification
to the shard metadata fetching to prevent bringing shards
back into an index it doesn't belong to due to name collisions.
cae2707
@bleskes
Member
bleskes commented Mar 23, 2015

LGTMx2

@s1monw s1monw merged commit cae2707 into elastic:master Mar 23, 2015

1 check passed

CLA Commit author is a member of Elasticsearch
Details
@clintongormley clintongormley changed the title from [ALLOCATION] Verify shards index UUID when fetching started shards to Verify shards index UUID when fetching started shards Jun 8, 2015
@clintongormley clintongormley removed the review label Aug 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment