Skip to content

Fix/materialized view#151

Merged
lfbrehm merged 6 commits intomainfrom
fix/materialized_view
Mar 26, 2024
Merged

Fix/materialized view#151
lfbrehm merged 6 commits intomainfrom
fix/materialized_view

Conversation

@lfbrehm
Copy link
Copy Markdown
Member

@lfbrehm lfbrehm commented Mar 26, 2024

Implements a retry logic for get_object database 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_object queries are called.

@lfbrehm lfbrehm requested a review from das-Abroxas March 26, 2024 08:57
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 32.00000% with 34 lines in your changes are missing coverage. Please review.

Project coverage is 30.63%. Comparing base (bd37417) to head (014c88a).
Report is 952 commits behind head on main.

Files Patch % Lines
components/server/src/database/dsls/object_dsl.rs 32.00% 34 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

das-Abroxas
das-Abroxas previously approved these changes Mar 26, 2024
Copy link
Copy Markdown
Contributor

@das-Abroxas das-Abroxas left a comment

Choose a reason for hiding this comment

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

Thanks for the good work. Another problem fixed 💪

Comment thread components/server/.env Outdated
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"))
Copy link
Copy Markdown
Contributor

@das-Abroxas das-Abroxas Mar 26, 2024

Choose a reason for hiding this comment

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

We should package the re-try functionality into a reusable form in the foreseeable future, such as a macro or some kind of decorator.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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>
@lfbrehm lfbrehm merged commit 7861bc2 into main Mar 26, 2024
@lfbrehm lfbrehm deleted the fix/materialized_view branch March 26, 2024 13:28
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.

2 participants