Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
===========================================
- Coverage 44.90% 30.63% -14.27%
===========================================
Files 61 127 +66
Lines 7997 24139 +16142
===========================================
+ Hits 3591 7396 +3805
- Misses 4406 16743 +12337 ☔ View full report in Codecov by Sentry. |
das-Abroxas
previously approved these changes
Mar 26, 2024
Contributor
das-Abroxas
left a comment
There was a problem hiding this comment.
Thanks for the good work. Another problem fixed 💪
Comment on lines
+175
to
+201
| let mut backoff_counter: u64 = 0; | ||
|
|
||
| while backoff_counter <= *MAX_RETRIES { | ||
| match client.query_opt(&prepared, &[&id]).await { | ||
| Ok(query) => return Ok(query.map(|e| Object::from_row(&e))), | ||
| Err(err) => { | ||
| if let Some(sql_error) = err.code() { | ||
| match sql_error.code() { | ||
| // => 40001 Error from yugabyte matches to 25P02 | ||
| "25P02" => { | ||
| backoff_counter += 1; | ||
| tokio::time::sleep(Duration::from_millis( | ||
| *RETRY_TIMEOUT ^ backoff_counter, | ||
| )) | ||
| .await; | ||
| } | ||
| _code => { | ||
| return Err(anyhow!(err)); | ||
| } | ||
| } | ||
| } else { | ||
| return Err(anyhow!(err)); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Err(anyhow!("TODO")) |
Contributor
There was a problem hiding this comment.
We should package the re-try functionality into a reusable form in the foreseeable future, such as a macro or some kind of decorator.
Member
Author
There was a problem hiding this comment.
This is a good idea, especially if the retry logic is extended for more database calls
Co-authored-by: Jannis Hochmuth <jannis.hochmuth@computational.bio.uni-giessen.de>
das-Abroxas
approved these changes
Mar 26, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a retry logic for
get_objectdatabase queries. This is a fix proposed by yugabyte for catalog mismatch errors.The error occurs when a transaction completes, the materialized view is updated and then
get_objectqueries are called.