-
Notifications
You must be signed in to change notification settings - Fork 93
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
Refactor log_event function and add retry logic #1660
Conversation
Some backoff would be useful. Apart from avoiding extra load when things go wrong it also helps reduce the chance of a retry hitting the same issue. Why not use https://github.com/man-group/ArcticDB/blob/dc6764fb5ef2d159f9f2e35bcf9c68493d94b140/cpp/arcticdb/util/exponential_backoff.hpp ? |
cpp/arcticdb/version/version_log.hpp
Outdated
SegmentInMemory seg{log_stream_descriptor(action)}; | ||
store->write_sync(KeyType::LOG, version_id, StreamId{action}, IndexValue{id}, IndexValue{id}, std::move(seg)); | ||
static const auto max_trial_config = ConfigsMap::instance()->get_int("Storage.MaxOpLogWriteRetries", 2); | ||
auto max_trials = max_trial_config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with James that it would be better to use the ExponentialBackoff that already exists, as this will retry very fast and possible encounter the same error.
We will attempt to retry the writing of the op log up to `Storage.MaxOpLogWriteRetries` times. This approach is similar to the one already used when [loading the ref key](https://github.com/man-group/ArcticDB/blob/66a5d19c4a2c3b2423b52a68f984ca8d9b52afce/cpp/arcticdb/version/version_map.hpp#L190) #### Reference Issues/PRs <!--Example: Fixes #1234. See also #3456.--> #### What does this implement or fix? #### Any other comments? #### Checklist <details> <summary> Checklist for code changes... </summary> - [ ] Have you updated the relevant docstrings, documentation and copyright notice? - [ ] Is this contribution tested against [all ArcticDB's features](../docs/mkdocs/docs/technical/contributing.md)? - [ ] Do all exceptions introduced raise appropriate [error messages](https://docs.arcticdb.io/error_messages/)? - [ ] Are API changes highlighted in the PR description? - [ ] Is the PR labelled as enhancement or bug so it appears in autogenerated release notes? </details> <!-- Thanks for contributing a Pull Request to ArcticDB! Please ensure you have taken a look at: - ArcticDB's Code of Conduct: https://github.com/man-group/ArcticDB/blob/master/CODE_OF_CONDUCT.md - ArcticDB's Contribution Licensing: https://github.com/man-group/ArcticDB/blob/master/docs/mkdocs/docs/technical/contributing.md#contribution-licensing --> (cherry picked from commit cb60722)
We will attempt to retry the writing of the op log up to `Storage.MaxOpLogWriteRetries` times. This approach is similar to the one already used when [loading the ref key](https://github.com/man-group/ArcticDB/blob/66a5d19c4a2c3b2423b52a68f984ca8d9b52afce/cpp/arcticdb/version/version_map.hpp#L190) #### Reference Issues/PRs <!--Example: Fixes #1234. See also #3456.--> #### What does this implement or fix? #### Any other comments? #### Checklist <details> <summary> Checklist for code changes... </summary> - [ ] Have you updated the relevant docstrings, documentation and copyright notice? - [ ] Is this contribution tested against [all ArcticDB's features](../docs/mkdocs/docs/technical/contributing.md)? - [ ] Do all exceptions introduced raise appropriate [error messages](https://docs.arcticdb.io/error_messages/)? - [ ] Are API changes highlighted in the PR description? - [ ] Is the PR labelled as enhancement or bug so it appears in autogenerated release notes? </details> <!-- Thanks for contributing a Pull Request to ArcticDB! Please ensure you have taken a look at: - ArcticDB's Code of Conduct: https://github.com/man-group/ArcticDB/blob/master/CODE_OF_CONDUCT.md - ArcticDB's Contribution Licensing: https://github.com/man-group/ArcticDB/blob/master/docs/mkdocs/docs/technical/contributing.md#contribution-licensing --> (cherry picked from commit cb60722) #### Reference Issues/PRs <!--Example: Fixes #1234. See also #3456.--> #### What does this implement or fix? #### Any other comments? #### Checklist <details> <summary> Checklist for code changes... </summary> - [ ] Have you updated the relevant docstrings, documentation and copyright notice? - [ ] Is this contribution tested against [all ArcticDB's features](../docs/mkdocs/docs/technical/contributing.md)? - [ ] Do all exceptions introduced raise appropriate [error messages](https://docs.arcticdb.io/error_messages/)? - [ ] Are API changes highlighted in the PR description? - [ ] Is the PR labelled as enhancement or bug so it appears in autogenerated release notes? </details> <!-- Thanks for contributing a Pull Request to ArcticDB! Please ensure you have taken a look at: - ArcticDB's Code of Conduct: https://github.com/man-group/ArcticDB/blob/master/CODE_OF_CONDUCT.md - ArcticDB's Contribution Licensing: https://github.com/man-group/ArcticDB/blob/master/docs/mkdocs/docs/technical/contributing.md#contribution-licensing --> --------- Co-authored-by: Phoebus Mak <61957902+phoebusm@users.noreply.github.com>
We will attempt to retry the writing of the op log up to
Storage.MaxOpLogWriteRetries
times.This approach is similar to the one already used when loading the ref key
Reference Issues/PRs
What does this implement or fix?
Any other comments?
Checklist
Checklist for code changes...