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 snapshot status before delete index #36

Merged
merged 6 commits into from
Apr 21, 2017
Merged

Conversation

sakama
Copy link
Contributor

@sakama sakama commented Apr 19, 2017

Fix to solve #35

@sakama sakama requested a review from muga April 19, 2017 07:58
Copy link
Contributor

@muga muga left a comment

Choose a reason for hiding this comment

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

Thank you. I put several comments and questions on the PR. Please check them and fix if needed.

@@ -48,6 +48,7 @@
// @see https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java#L108
private final long maxIndexNameBytes = 255;
private final List<Character> inalidIndexCharaters = Arrays.asList('\\', '/', '*', '?', '"', '<', '>', '|', '#', ' ', ',');
private final long maxSnapshotWaitingTime = 1800;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the unit of this variable? Where does 1800 come from?

Copy link
Contributor Author

@sakama sakama Apr 20, 2017

Choose a reason for hiding this comment

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

I changed a little a80c72a
I don't have enough confident about this value.
It should depends on Es server's specs and repository types(S3/Local FileSystem, HDFS...).
I don't think HDFS isn't a majority, though...
Then to make configurable is one idea.

As one of the guideline, Elastic Cloud takes snapshot at every 30 minutes to S3 repository.

Copy link
Contributor

@muga muga Apr 20, 2017

Choose a reason for hiding this comment

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

30 mins sounds reasonable for me. Can I ask you that it's good idea to parameterize this field as config option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make this as config option 0454b99 and updated README 85c797e

sendRequest(indexName, HttpMethod.DELETE, task, retryHelper);
log.info("Deleted Index [{}]", indexName);
}
}

private void getSnapshotStatusUntilDone(PluginTask task, Jetty92RetryHelper retryHelper)
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: "wait" is better name of this method. Because someone've taken snapshots. Instead, the plugin waits the snapshots completed. How about this?

Copy link
Contributor Author

@sakama sakama Apr 20, 2017

Choose a reason for hiding this comment

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

I changed to "waitSnapshot" 9290e7f
How about this?

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks good to me.

}
execCount++;
totalWaitingTime += 1000 * execCount;
if (totalWaitingTime > maxSnapshotWaitingTime) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that this retry logic doesn't work. Because totalWaitingTime becomes 2000 after a loop body is executed first time. And please explain why you think that you don't take RetryExecutor provided by Embulk.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I changed logic a80c72a

And please explain why you think that you don't take RetryExecutor provided by Embulk.

I thought RetryExecutor is too heavy for this purpose.
I just need exponential backoff mechanism but doesn't need exception handling or some others.

isSnapshotProgressing calls sendRequest and it uses RetryExecutor

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Can I ask you to put several comment about it within the source code? And please file new ticket for Embulk's RetryExecutor improvement:)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comment in the code 61601d7 and will create Issue later.

@muga
Copy link
Contributor

muga commented Apr 20, 2017

@sakama thank you for fixing. It looks good to me. but, please check my comments and fix them if needed.

@muga
Copy link
Contributor

muga commented Apr 21, 2017

@sakama thank you!

@sakama sakama merged commit 076aaff into master Apr 21, 2017
@sakama sakama deleted the check-snapshot-status branch April 21, 2017 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants