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

Remove dangling indices settings, always import it #10016

Merged
merged 1 commit into from Mar 8, 2015

Conversation

kimchy
Copy link
Member

@kimchy kimchy commented Mar 6, 2015

Remove the settings around dangling indices, such as no import and timeout for deletion, we always want to import dangling indices for safety, and we should not allow to change the behavior. This also cleans up the code quite a bit.

}
for (String danglingIndex : danglingIndices) {
if (newMetaData.hasIndex(danglingIndex)) {
logger.debug("[{}] no longer dangling (created), removing", danglingIndex);
Copy link
Member

Choose a reason for hiding this comment

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

I think while we're changing this, it would be nice to change this from "removing" to "removing from dangling index set", otherwise it is kind of confusing about whether data is actually being deleted (which it's not)

Copy link
Member Author

Choose a reason for hiding this comment

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

make sense, will address

@kimchy
Copy link
Member Author

kimchy commented Mar 6, 2015

@dakrone addressed your comments

logger.info("[{}] dangling index, exists on local file system, but not in cluster metadata, auto import to cluster state", indexName);
danglingIndices.add(indexName);
} else {
logger.debug("[{}] dangling index directory detected, but no state found");
Copy link
Member

Choose a reason for hiding this comment

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

Missing the indexName argument to the debug log here

@dakrone
Copy link
Member

dakrone commented Mar 6, 2015

Left one comment about a missing argument, other than that LGTM

@s1monw
Copy link
Contributor

s1monw commented Mar 6, 2015

i like the simplifications here. Yet, I think we need to work on how these huge methods are structured and tested. In other classes I already started to add simple package private methods that are individually tested in unittests reducing the size of the loops dramatically. I think we have to break things up into small chunks when we do these kind of refactorings and add real unittests. It's pretty simple to do IMO such that the main look really only processes the end result and loops over the dangeling indices. Can you please simplify, test and document that would be awesome.

@kimchy
Copy link
Member Author

kimchy commented Mar 7, 2015

@s1monw I was thinking about refactoring it, was thinking of doing it as a next step to keep the change smaller. I updated the pull request with refactoring out the handling of dangling indices into its own class, and it has specific tests for it. Needed to refactor out also the persistence logic of meta state as well.

* Iterates over the existing marked dangled indices, and returns the outstanding ones that
* need to be allocated.
*/
IndexMetaData[] outstandingDanglingIndicesToProcess() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just return a List here?

@s1monw
Copy link
Contributor

s1monw commented Mar 8, 2015

left some comments

@kimchy
Copy link
Member Author

kimchy commented Mar 8, 2015

@s1monw applied comments, and did another round of simplifications

return;
}
try {
allocateDangledIndices.allocateDangled(danglingIndices.values().toArray(new IndexMetaData[danglingIndices.size()]), new LocalAllocateDangledIndices.Listener() {
Copy link
Contributor

Choose a reason for hiding this comment

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

while we are at it - any chance we can just pass danglingIndices.values() to this?

@s1monw
Copy link
Contributor

s1monw commented Mar 8, 2015

left one comment - LGTM

@s1monw
Copy link
Contributor

s1monw commented Mar 8, 2015

thanks for doing this!

Remove the settings around dangling indices, such as no import and timeout for deletion, we always want to import dangling indices for safety, and we should not allow to change the behavior. This also cleans up the code quite a bit.
closes elastic#10016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants