From 51726a2d5e2d3f2f6ff620fcb52e457e822958ff Mon Sep 17 00:00:00 2001 From: gitccl Date: Wed, 26 Apr 2023 12:15:10 +0800 Subject: [PATCH] fix http triggerd compaction --- be/src/http/action/compaction_action.cpp | 6 +++--- be/src/olap/base_compaction.h | 2 -- be/src/olap/compaction.cpp | 1 + be/src/olap/cumulative_compaction.h | 2 -- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/be/src/http/action/compaction_action.cpp b/be/src/http/action/compaction_action.cpp index 1cfd27f2e939a4..852cd149a575c4 100644 --- a/be/src/http/action/compaction_action.cpp +++ b/be/src/http/action/compaction_action.cpp @@ -208,7 +208,7 @@ Status CompactionAction::_execute_compaction_callback(TabletSharedPtr tablet, res = Status::Error(); } else { StorageEngine::instance()->create_base_compaction(tablet, base_compaction); - Status res = base_compaction->prepare_compact(); + res = base_compaction->prepare_compact(); if (res.ok()) { tablet->set_base_compaction(base_compaction); need_reset = true; @@ -240,7 +240,7 @@ Status CompactionAction::_execute_compaction_callback(TabletSharedPtr tablet, bool need_reset = false; { std::unique_lock compaction_meta_lock(tablet->get_compaction_meta_lock()); - Status res = cumu_compaction->prepare_compact(); + res = cumu_compaction->prepare_compact(); if (res.ok()) { tablet->add_cumulative_compaction_unlocked(cumu_compaction); need_reset = true; @@ -255,7 +255,7 @@ Status CompactionAction::_execute_compaction_callback(TabletSharedPtr tablet, } if (!res) { - if (res.is()) { + if (res.is()) { // Ignore this error code. VLOG_NOTICE << "failed to init cumulative compaction due to no suitable version," << "tablet=" << tablet->full_name(); diff --git a/be/src/olap/base_compaction.h b/be/src/olap/base_compaction.h index ecee304449aef5..84fcdb86f8ec6c 100644 --- a/be/src/olap/base_compaction.h +++ b/be/src/olap/base_compaction.h @@ -43,8 +43,6 @@ class BaseCompaction : public Compaction { Status prepare_compact() override; Status execute_compact_impl() override; - std::vector get_input_rowsets() { return _input_rowsets; } - protected: Status pick_rowsets_to_compact() override; std::string compaction_name() const override { return "base compaction"; } diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp index fb153be3f53b6a..d66c26d3863038 100644 --- a/be/src/olap/compaction.cpp +++ b/be/src/olap/compaction.cpp @@ -262,6 +262,7 @@ bool Compaction::handle_ordered_data_compaction() { if (i <= input_size / 2) { return false; } else { + // TODO(ccl): other thread will read _input_rowsets, maybe add a lock _input_rowsets.resize(i); break; } diff --git a/be/src/olap/cumulative_compaction.h b/be/src/olap/cumulative_compaction.h index e2b1a4d038d65b..f16ce4d5620f7a 100644 --- a/be/src/olap/cumulative_compaction.h +++ b/be/src/olap/cumulative_compaction.h @@ -40,8 +40,6 @@ class CumulativeCompaction : public Compaction { Status prepare_compact() override; Status execute_compact_impl() override; - const std::vector& get_input_rowsets() { return _input_rowsets; } - protected: Status pick_rowsets_to_compact() override;