This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new cc7ab2b9fe0 [fix](inverted index)Delete tmp dirs when BE starts to
avoid tmp files left by last crash #35951 (#36190)
cc7ab2b9fe0 is described below
commit cc7ab2b9fe04877fdc6a5fa859ea6ce521e1a2d4
Author: qiye <[email protected]>
AuthorDate: Wed Jun 12 23:05:44 2024 +0800
[fix](inverted index)Delete tmp dirs when BE starts to avoid tmp files left
by last crash #35951 (#36190)
When BE crashes, there may be tmp files left in the tmp dir, so we
remove and rebuild the tmp dir every time we start BE to prevent rubbish
data from occupying the disk.
---
be/src/olap/rowset/segment_v2/inverted_index_writer.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/be/src/olap/rowset/segment_v2/inverted_index_writer.h
b/be/src/olap/rowset/segment_v2/inverted_index_writer.h
index 77873905af1..06bc960bc33 100644
--- a/be/src/olap/rowset/segment_v2/inverted_index_writer.h
+++ b/be/src/olap/rowset/segment_v2/inverted_index_writer.h
@@ -106,11 +106,9 @@ public:
Status init() {
for (auto& tmp_file_dir : _tmp_file_dirs) {
- bool exists = true;
-
RETURN_IF_ERROR(io::global_local_filesystem()->exists(tmp_file_dir, &exists));
- if (!exists) {
-
RETURN_IF_ERROR(io::global_local_filesystem()->create_directory(tmp_file_dir));
- }
+ // delete the tmp dir to avoid the tmp files left by last crash
+
RETURN_IF_ERROR(io::global_local_filesystem()->delete_directory(tmp_file_dir));
+
RETURN_IF_ERROR(io::global_local_filesystem()->create_directory(tmp_file_dir));
}
return Status::OK();
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]