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

[CCR] Added more validation to follow index api. #31068

Merged
merged 4 commits into from
Jun 15, 2018

Conversation

martijnvg
Copy link
Member

Relates to #30086

@martijnvg martijnvg added review :Distributed Indexing/CCR Issues around the Cross Cluster State Replication features labels Jun 4, 2018
@martijnvg martijnvg requested a review from jasontedor June 4, 2018 12:57
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

}
Map<String, Object> leaderMapping = getMapping(leaderIndex);
Map<String, Object> followerMapping = getMapping(followIndex);
if (leaderMapping.equals(followerMapping) == false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI - for future work - they should be mergeable (i.e. leader into follower) not necessarily identical.

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense. The shard follow tasks also add the missing fields in the case they are missing at startup.

Copy link
Member Author

Choose a reason for hiding this comment

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

done here: 284e2ddd6f2c6da0d0255d6a8d45d8cd6e9ebddf

throw new IllegalArgumentException("the leader and follower mappings must be identical");
}
Map<String, Settings> leaderAnalysisSettings = leaderIndex.getSettings().getGroups("index.analysis");
Map<String, Settings> followerAnalysisSettings = followIndex.getSettings().getGroups("index.analysis");
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should flip this and only while list things that can be different (like number of replicas, allocation filtering etc.). Thoughts?

Copy link
Member Author

@martijnvg martijnvg Jun 4, 2018

Choose a reason for hiding this comment

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

This does seem safer, however almost all settings are allowed to be different so the whitelist is going to be very large then.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is indeed what I wasn't sure about. I did a very brief random sample of IndexSetting and I'm not sure we need to white list so many settings when compared to all the settings that are in there?

Copy link
Member Author

Choose a reason for hiding this comment

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

So you mean that we only whitelist a few settings (like refresh_rate) while we could whitelist more settings (like translog settings) but since there are not commonly used we just not allow it?

Copy link
Contributor

Choose a reason for hiding this comment

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

to be clear - by not whitelisting them it doesn't mean people can't change them - it means they need to be same at both source and target. I think things like refresh rate and and translog settings are ok in that regard?

Copy link
Member Author

Choose a reason for hiding this comment

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

to be clear - by not whitelisting them it doesn't mean people can't change them - it means they need to be same at both source and target.

Yes.

I think things like refresh rate and and translog settings are ok in that regard?

What settings do you think are likely to be different in leader and follower index?

Copy link
Member Author

Choose a reason for hiding this comment

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

@bleskes I've added a whitelist of allowed settings that may be different: 38f2cf188cfd119bd178d8d1bceff5957f30dec0

@martijnvg martijnvg force-pushed the ccr_more_more_validation branch from ac47a9b to 284e2dd Compare June 5, 2018 10:57
@martijnvg martijnvg force-pushed the ccr_more_more_validation branch from 38f2cf1 to 9e57d12 Compare June 12, 2018 13:02
Copy link
Contributor

@bleskes bleskes left a comment

Choose a reason for hiding this comment

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

LGTM. Left some minor comments.

try {
start(request, null, leaderIndexMetadata, followIndexMetadata, listener);
} catch (IOException e) {
listener.onFailure(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

add a return method here just in case? I don't like this construct but can't think of how to improve it (all other options I see suck too)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it is really needed, because this were the if code block ends and below it is an else code block and that is it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I know it's not needed now but it's a bug waiting to happen when someone adds a line below.

Copy link
Member Author

Choose a reason for hiding this comment

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

got it 👍

validate (leaderIndexMetadata ,followIndexMetadata , request);
ActionListener<Response> handler) throws IOException {
MapperService mapperService = followIndexMetadata != null ? indicesService.createIndexMapperService(followIndexMetadata) : null;
validate(request, leaderIndexMetadata, followIndexMetadata, mapperService);
Copy link
Contributor

Choose a reason for hiding this comment

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

can you fix the indentation here?

assertThat(e.getMessage(),
equalTo("leader index primary shards [5] does not match with the number of shards of the follow index [4]"));
}
{
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a comment to each of these that indicates what you're testing? that way you don't need to squint at the setting and figure out what's different.

@martijnvg martijnvg force-pushed the ccr_more_more_validation branch from 9e57d12 to 8f6ac19 Compare June 13, 2018 10:06
@martijnvg
Copy link
Member Author

retest this please

1 similar comment
@martijnvg
Copy link
Member Author

retest this please

@martijnvg martijnvg force-pushed the ccr_more_more_validation branch from 8f6ac19 to 892e175 Compare June 14, 2018 18:04
@martijnvg martijnvg merged commit cc824eb into elastic:ccr Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/CCR Issues around the Cross Cluster State Replication features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants