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

Make rollover init step idempotent #1964

Merged

Conversation

pavolloffay
Copy link
Member

@pavolloffay pavolloffay commented Dec 5, 2019

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@codecov
Copy link

codecov bot commented Dec 5, 2019

Codecov Report

Merging #1964 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1964   +/-   ##
=======================================
  Coverage   96.99%   96.99%           
=======================================
  Files         203      203           
  Lines       10061    10061           
=======================================
  Hits         9759     9759           
  Misses        264      264           
  Partials       38       38

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 730170d...3ff510c. Read the comment docs.

@@ -69,6 +69,10 @@ def main():

def perform_action(action, client, write_alias, read_alias, index_to_rollover, template_name):
if action == 'init':
if not is_alias_empty(client, read_alias) or not is_alias_empty(client, write_alias):
print("Alias {} or {} is not empty aborting init step".format(read_alias, write_alias))
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't instead the creation of the index be made conditional? If this script fails after creating a read alias but before write alias there's no way to fix the situation by rerunning it.

Copy link
Member Author

Choose a reason for hiding this comment

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

+1. I think that was the initial goal. I have reverted this and fixed catching the exception in the create index func

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@@ -112,8 +112,10 @@ def create_index(client, name):
try:
create.do_action()
except curator.exceptions.FailedExecution as e:
if "index_already_exists_exception" not in str(e) and "resource_already_exists_exception" not in str(e):
if ("index_already_exists_exception" or "resource_already_exists_exception") in str(e):
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't OR of two strings simply return the first one?

Copy link
Member Author

Choose a reason for hiding this comment

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

ohh this would not work. My python skills...

Actually str(e) never returns this string. There is a parameter ignore_existing=True I would use that instead. If the index exists it logs it.

Index jaeger-span-000001 already exists.

raise e
else:
print("Index {} already exists".format(name))
Copy link
Member

Choose a reason for hiding this comment

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

Aside from a log entry, how is it functionally different from before, when the exception was simply ignored?

Copy link
Member Author

Choose a reason for hiding this comment

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

This just logs that the index was not created because it already exists

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@pavolloffay
Copy link
Member Author

@yurishkuro could you please re-review?

@yurishkuro yurishkuro merged commit c1bc28d into jaegertracing:master Dec 5, 2019
@pavolloffay pavolloffay added this to the Release 1.16 milestone Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rollover fails to start on es cluster which was using rollover before
2 participants