Skip to content

Commit 7a90774

Browse files
committed
refactor: reduce history table semaphore acquire attempts
1 parent 401d89d commit 7a90774

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/query/service/src/history_tables/global_history_log.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ impl GlobalHistoryLog {
167167
Ok(acquired_lock) => {
168168
if acquired_lock {
169169
consecutive_error = 0;
170+
} else {
171+
// If the lock is acquired by another node, this node will wait for
172+
// a relative longer time (15s to 20s) before retrying.
173+
// This is to avoid frequent acquire attempts
174+
sleep(Duration::from_secs(15 + random::<u64>() % 5)).await;
170175
}
171176
}
172177
Err(e) => {

0 commit comments

Comments
 (0)