Skip to content

Commit

Permalink
fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyass committed Sep 10, 2024
1 parent c558b45 commit 34f7dec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
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

0 comments on commit 34f7dec

Please sign in to comment.