This is an automated email from the ASF dual-hosted git repository.

zhangchen 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 494b54a5a56 [enhancement](trash) support skip trash, update trash 
default expire time (#37170) (#37409)
494b54a5a56 is described below

commit 494b54a5a56a3db17940a486db54ede17907b756
Author: zhannngchen <[email protected]>
AuthorDate: Mon Jul 8 15:33:02 2024 +0800

    [enhancement](trash) support skip trash, update trash default expire time 
(#37170) (#37409)
    
    cherry-pick #37170
---
 be/src/common/config.cpp | 2 +-
 be/src/olap/data_dir.cpp | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index cbae3ee896b..11e2635047b 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -312,7 +312,7 @@ DEFINE_mInt32(garbage_sweep_batch_size, "100");
 DEFINE_mInt32(snapshot_expire_time_sec, "172800");
 // It is only a recommended value. When the disk space is insufficient,
 // the file storage period under trash dose not have to comply with this 
parameter.
-DEFINE_mInt32(trash_file_expire_time_sec, "259200");
+DEFINE_mInt32(trash_file_expire_time_sec, "86400");
 // minimum file descriptor number
 // modify them upon necessity
 DEFINE_Int32(min_file_descriptor_number, "60000");
diff --git a/be/src/olap/data_dir.cpp b/be/src/olap/data_dir.cpp
index 37dd76c848c..98bc721c048 100644
--- a/be/src/olap/data_dir.cpp
+++ b/be/src/olap/data_dir.cpp
@@ -927,8 +927,14 @@ void DataDir::disks_compaction_num_increment(int64_t 
delta) {
 }
 
 Status DataDir::move_to_trash(const std::string& tablet_path) {
-    Status res = Status::OK();
+    if (config::trash_file_expire_time_sec <= 0) {
+        LOG(INFO) << "delete tablet dir " << tablet_path
+                  << " directly due to trash_file_expire_time_sec is 0";
+        
RETURN_IF_ERROR(io::global_local_filesystem()->delete_directory(tablet_path));
+        return delete_tablet_parent_path_if_empty(tablet_path);
+    }
 
+    Status res = Status::OK();
     // 1. get timestamp string
     string time_str;
     if ((res = gen_timestamp_string(&time_str)) != Status::OK()) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to