Skip to content

Commit

Permalink
[enhancement](trash) support skip trash, update trash default expire …
Browse files Browse the repository at this point in the history
…time (apache#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: apache/doris-website#817
  • Loading branch information
zhannngchen committed Jul 8, 2024
1 parent 97e4025 commit cfb8809
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 7 additions & 1 deletion be/src/olap/data_dir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit cfb8809

Please sign in to comment.