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

Fixed lambda_function to prevent errors during simultaneous deployments #48

Closed

Conversation

saimedhi
Copy link

Description

Fixed lambda_function to prevent errors during simultaneous deployments

Issues Resolved

closes #46

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

alias_status = os_client.indices.update_aliases(
{
"actions": [
{"remove": {"index": old_index, "alias": INDEX_ALIAS}},
Copy link
Author

@saimedhi saimedhi Mar 30, 2023

Choose a reason for hiding this comment

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

Previously, we tried to remove old index. This will cause issues with parallel deployments. When we try to remove old index, it may have already been deleted by another parallel thread. So, here ideal solution will be to remove all the indices that are present and add new index. By this we can always have number of indices for a index alias as one or zero(at initial state).

Copy link
Collaborator

@AMoo-Miki AMoo-Miki left a comment

Choose a reason for hiding this comment

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

The information in these indices come from various sources. When parallel requests land, we do want both of them. The current code recognizes that it has lost the reference to the old index and decides to fail rather that have invalid data. By not removing the old ones, this PR would only mask the failure but result in invalid data.

What we need is for the process to recognize that there is another one running and wait for its completion before it continues.

@saimedhi saimedhi closed this Aug 23, 2023
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.

[BUG] Errors during simultaneous deployments due to search index race condition
3 participants