Skip to content

Commit

Permalink
6
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukang-Lian committed Aug 16, 2023
1 parent 4af438f commit ef4d4b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 10 additions & 5 deletions be/src/http/action/compaction_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ CompactionAction::CompactionAction(CompactionActionType ctype, ExecEnv* exec_env
TPrivilegeHier::type hier, TPrivilegeType::type ptype)
: HttpHandlerWithAuth(exec_env, hier, ptype), _type(ctype) {}
Status CompactionAction::_check_param(HttpRequest* req, uint64_t* tablet_id, uint64_t* table_id) {
// req tablet id and table id, we have to set only one of them.
std::string req_tablet_id = req->param(TABLET_ID_KEY);
std::string req_table_id = req->param(TABLE_ID_KEY);
if (req_tablet_id == "") {
if (req_table_id == "") {
return Status::OK();
// both tablet id and table id are empty, return error.
return Status::InternalError(
"tablet id and table id can not be empty at the same time!");
} else {
try {
*table_id = std::stoull(req_table_id);
Expand All @@ -75,7 +78,8 @@ Status CompactionAction::_check_param(HttpRequest* req, uint64_t* tablet_id, uin
}
return Status::OK();
} else {
return Status::OK();
// both tablet id and table id are not empty, return err.
return Status::InternalError("tablet id and table id can not be set at the same time!");
}
}
}
Expand All @@ -97,7 +101,7 @@ Status CompactionAction::_handle_show_compaction(HttpRequest* req, std::string*

Status CompactionAction::_handle_run_compaction(HttpRequest* req, std::string* json_result) {
// 1. param check
// check req_tablet_id is not empty
// check req_tablet_id or req_table_id is not empty and can not be set together.
uint64_t tablet_id = 0;
uint64_t table_id = 0;
RETURN_NOT_OK_STATUS_WITH_WARN(_check_param(req, &tablet_id, &table_id), "check param failed");
Expand Down Expand Up @@ -149,8 +153,9 @@ Status CompactionAction::_handle_run_compaction(HttpRequest* req, std::string* j
}
LOG(INFO) << "Manual compaction task is successfully triggered";
*json_result =
"{\"status\": \"Success\", \"msg\": \"compaction task is successfully "
"triggered.\"}";
"{\"status\": \"Success\", \"msg\": \"compaction task is successfully triggered. Table "
"id: " +
std::to_string(table_id) + ". Tablet id: " + std::to_string(tablet_id) + "\"}";
return Status::OK();
}

Expand Down
2 changes: 0 additions & 2 deletions be/src/olap/tablet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,6 @@ Status Tablet::prepare_compaction_and_calculate_permits(CompactionType compactio
}
compaction_rowsets = _base_compaction->get_input_rowsets();
} else {
// TODO: full compaction code
DCHECK_EQ(compaction_type, CompactionType::FULL_COMPACTION);
MonotonicStopWatch watch;
watch.start();
Expand Down Expand Up @@ -1879,7 +1878,6 @@ void Tablet::execute_compaction(CompactionType compaction_type) {
}
set_last_base_compaction_failure_time(0);
} else {
// TODO: full compaction code
DCHECK_EQ(compaction_type, CompactionType::FULL_COMPACTION);
MonotonicStopWatch watch;
watch.start();
Expand Down

0 comments on commit ef4d4b1

Please sign in to comment.