You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/10/10 00:33:26 UTC

[doris] branch master updated: [compaction](http_action) enable be run manual compaction concurrently (#13219)

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

yiguolei 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 3dc4dc6d43 [compaction](http_action) enable be run manual compaction concurrently (#13219)
3dc4dc6d43 is described below

commit 3dc4dc6d433c8659a0776bd4a1b0715443846c1c
Author: yixiutt <10...@users.noreply.github.com>
AuthorDate: Mon Oct 10 08:33:18 2022 +0800

    [compaction](http_action) enable be run manual compaction concurrently (#13219)
    
    In some case, we need to run manual compaction via http interface
    concurrently, so we remove the mutex and tablet's compaction lock
    is enough to prevent concurrent compaction in tablet.
    
    Co-authored-by: yixiutt <yi...@selectdb.com>
---
 be/src/http/action/compaction_action.cpp | 19 +------------------
 be/src/http/action/compaction_action.h   |  5 -----
 2 files changed, 1 insertion(+), 23 deletions(-)

diff --git a/be/src/http/action/compaction_action.cpp b/be/src/http/action/compaction_action.cpp
index 30eedcef1f..101e193797 100644
--- a/be/src/http/action/compaction_action.cpp
+++ b/be/src/http/action/compaction_action.cpp
@@ -38,9 +38,6 @@ namespace doris {
 
 const static std::string HEADER_JSON = "application/json";
 
-bool CompactionAction::_is_compaction_running = false;
-std::mutex CompactionAction::_compaction_running_mutex;
-
 Status CompactionAction::_check_param(HttpRequest* req, uint64_t* tablet_id) {
     std::string req_tablet_id = req->param(TABLET_ID_KEY);
     if (req_tablet_id == "") {
@@ -94,18 +91,7 @@ Status CompactionAction::_handle_run_compaction(HttpRequest* req, std::string* j
         return _execute_compaction_callback(tablet, compaction_type);
     });
     std::future<Status> future_obj = task.get_future();
-
-    {
-        // 3.1 check is there compaction running
-        std::lock_guard<std::mutex> lock(_compaction_running_mutex);
-        if (_is_compaction_running) {
-            return Status::TooManyTasks("Manual compaction task is running");
-        } else {
-            // 3.2 execute the compaction task and set compaction task running
-            _is_compaction_running = true;
-            std::thread(std::move(task)).detach();
-        }
-    }
+    std::thread(std::move(task)).detach();
 
     // 4. wait for result for 2 seconds by async
     std::future_status status = future_obj.wait_for(std::chrono::seconds(2));
@@ -235,9 +221,6 @@ Status CompactionAction::_execute_compaction_callback(TabletSharedPtr tablet,
         }
     }
 
-    std::lock_guard<std::mutex> lock(_compaction_running_mutex);
-    _is_compaction_running = false;
-
     timer.stop();
     LOG(INFO) << "Manual compaction task finish, status=" << res
               << ", compaction_use_time=" << timer.elapsed_time() / 1000000 << "ms";
diff --git a/be/src/http/action/compaction_action.h b/be/src/http/action/compaction_action.h
index 6782cc7f94..b265948759 100644
--- a/be/src/http/action/compaction_action.h
+++ b/be/src/http/action/compaction_action.h
@@ -63,11 +63,6 @@ private:
 
 private:
     CompactionActionType _type;
-
-    /// running check mutex
-    static std::mutex _compaction_running_mutex;
-    /// whether there is manual compaction running
-    static bool _is_compaction_running;
 };
 
 } // end namespace doris


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org