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

Bug fix delete by query #271

Merged
merged 2 commits into from
Apr 9, 2024
Merged

Conversation

miiu96
Copy link
Contributor

@miiu96 miiu96 commented Apr 9, 2024

  • Get write index in in case of delete_by_query operation

@miiu96 miiu96 self-assigned this Apr 9, 2024
// Iterate over the map and find the write index
var writeIndex string
for index, details := range indexData {
if len(indexData) == 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not this if before the for loop and return 0, nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because I don't know the key from the map


for _, indexAlias := range details.Aliases {
if indexAlias.IsWriteIndex {
writeIndex = index
Copy link
Contributor

Choose a reason for hiding this comment

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

return index, nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

refactored

}
}
if writeIndex != "" {
break
Copy link
Contributor

Choose a reason for hiding this comment

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

return writeIndex, nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

refactored

break
}
}
return writeIndex, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

with the above suggestions, perhaps return some error here, meaning the index was not found

Copy link
Contributor Author

Choose a reason for hiding this comment

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

refactored

"delegators" : { }
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

missing new line

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

}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

missing new line

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

bogdan-rosianu
bogdan-rosianu previously approved these changes Apr 9, 2024
@miiu96 miiu96 merged commit f891ec5 into master Apr 9, 2024
8 checks passed
@miiu96 miiu96 deleted the get-write-index-for-delete-by-query branch April 9, 2024 12:38
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.

3 participants