Skip to content

Unit testable IndicesClusterStateService#17270

Merged
ywelsch merged 1 commit intoelastic:masterfrom
ywelsch:enhance/testable-icss
Jun 10, 2016
Merged

Unit testable IndicesClusterStateService#17270
ywelsch merged 1 commit intoelastic:masterfrom
ywelsch:enhance/testable-icss

Conversation

@ywelsch
Copy link
Copy Markdown
Contributor

@ywelsch ywelsch commented Mar 23, 2016

This PR makes IndicesClusterState unit-testable. Testability of ICSS is achieved by introducing interfaces for IndicesService, IndexService and IndexShard. These interfaces extract all relevant methods used by ICSS (which do not deal directly with store). This gives the possibility to easily mock all the store behavior away in the tests (and cuts down on dependencies). It also helps to better understand what the actual interface is between the different components.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment is stale now (no longer package private).

@ywelsch ywelsch force-pushed the enhance/testable-icss branch from 8ac5491 to 45c0b6f Compare June 6, 2016 08:26
@ywelsch
Copy link
Copy Markdown
Contributor Author

ywelsch commented Jun 6, 2016

@bleskes @s1monw I've updated the PR according to our discussions.

@ywelsch ywelsch force-pushed the enhance/testable-icss branch 2 times, most recently from ae80607 to f71f7de Compare June 6, 2016 13:54
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/to list of/to the list of/

@s1monw
Copy link
Copy Markdown
Contributor

s1monw commented Jun 8, 2016

@ywelsch this looks AWESOME! I really like it. I think we should get it in ASAP! I left some bikeshedding while I looked at the structure, I wasn't sure if you wanna go over it again before we do a more detailed review! IMO the tests by itself justify pushing this soon :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wondering if we need recoveryState.isPeerRecovery() to simplify these lines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've switched the flow here to switch / case so that it's apparent that we cover all cases.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think requiresIndexMappingRefresh is very misleading - it should be called updateMapping as it does update the mapping (and returns a boolean for refreshes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we make this an impl detail on AllocatedIndex#updateMetaData and let it return if we need to refresh the mapping?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

++. PS - We shouldn't optimize for refresh mapping as it's going away.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We currently call updateIndexMapping explicitly when we create an index (the mapping is not updated as part of index creation, that's a whole different rabbit hole to investigate) but don't call updateMetaData on the newly created index as meta data is properly initialized by createIndex. This means that I cannot just fold updateMetaData and updateMapping together. I would prefer not to address this point in this PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure. This one is more than good enough :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. >non-issue v5.0.0-alpha4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants