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
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plugin/storage/es/esRollover.py
Original file line number Diff line number Diff line change
Expand Up @@ -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



def create_aliases(client, alias_name, archive_index_name):
Expand Down