Skip to content

Commit e60f1ef

Browse files
authored
refactor(meta): sleep a second before removing dir when cleaning up sled during upgrade (#18018)
NFS may hold the resource for longer thus there might be an error such as: ``` Error: std::io::error::Error: std::io::error::Error: Device or resource busy (os error 16); when:(remove dir /var/lib/databend/raft/heap; when remove V003 raft-log store based on sled: '/var/lib/databend/raft') ```
1 parent 0a6673b commit e60f1ef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/meta/raft-store/src/ondisk/upgrade_to_v004.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ impl OnDisk {
229229

230230
drop_sled_db();
231231

232+
// Sleep a while to make sure the sled db is dropped and released in the underlying file system.
233+
// There is an issue without sleep:
234+
// Error: std::io::error::Error: std::io::error::Error: Device or resource busy (os error 16); when:(remove dir /var/lib/databend/raft/heap; when remove V003 raft-log store based on sled: '/var/lib/databend/raft')
235+
tokio::time::sleep(std::time::Duration::from_millis(1_000)).await;
236+
232237
//</_databend/meta_1/
233238
// ▸ df_meta/
234239
// ▸ heap/

0 commit comments

Comments
 (0)