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

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 4453bfd1838 [enhancement](trash) support skip trash, update trash 
default expire time (#37170)
4453bfd1838 is described below

commit 4453bfd183848ce593f3412835c7acd8cb1c2a3e
Author: zhannngchen <[email protected]>
AuthorDate: Wed Jul 3 22:48:26 2024 +0800

    [enhancement](trash) support skip trash, update trash default expire time 
(#37170)
    
    ## Proposed changes
    
    Issue Number: close #xxx
    
    1. if user set `trash_file_expire_time_sec` to 0, skip trash directly
    2. update trash_file_expire_time_sec default value from 3 days to 1 day
    
    docs PR: https://github.com/apache/doris-website/pull/817
---
 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 37a239e6f79..b6ac089f84b 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -322,7 +322,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 fed3ccb2b84..640c1aa4f81 100644
--- a/be/src/olap/data_dir.cpp
+++ b/be/src/olap/data_dir.cpp
@@ -906,8 +906,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