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

fix: table lock flaky test #16429

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/query/service/src/locks/lock_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,15 @@ impl LockManager {

loop {
// List all revisions and check if the current is the minimum.
let reply = catalog
let mut rev_list = catalog
.list_lock_revisions(list_table_lock_req.clone())
.await?;
let rev_list = reply.into_iter().map(|(x, _)| x).collect::<Vec<_>>();
.await?
.into_iter()
.map(|(x, _)| x)
.collect::<Vec<_>>();
// list_lock_revisions are returned in big-endian order,
// we need to sort them in ascending numeric order.
rev_list.sort();
let position = rev_list.iter().position(|x| *x == revision).ok_or_else(||
// If the current is not found in list, it means that the current has been expired.
ErrorCode::TableLockExpired(format!(
Expand Down
6 changes: 1 addition & 5 deletions src/query/service/src/sessions/query_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,11 +1371,7 @@ impl TableContext for QueryContext {
let tbl = catalog
.get_table(&self.get_tenant(), db_name, tbl_name)
.await?;
if tbl.engine() != "FUSE" || tbl.is_read_only() {
return Ok(None);
}

if tbl.is_temp() {
if tbl.engine() != "FUSE" || tbl.is_read_only() || tbl.is_temp() {
return Ok(None);
}

Expand Down
Loading