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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 08aea68544b [chore](check) Add code check for some mow code (#45183)
08aea68544b is described below

commit 08aea68544b139436e08a2ec6f415378ab92b882
Author: huanghaibin <huanghai...@selectdb.com>
AuthorDate: Wed Dec 11 22:24:13 2024 +0800

    [chore](check) Add code check for some mow code (#45183)
    
    pick pr:
    https://github.com/apache/doris/pull/44439
    https://github.com/apache/doris/pull/45134
---
 be/src/cloud/cloud_cumulative_compaction.cpp       |  8 +++--
 be/src/cloud/cloud_cumulative_compaction.h         |  2 ++
 .../cloud/cloud_cumulative_compaction_policy.cpp   | 12 ++++----
 be/src/cloud/cloud_cumulative_compaction_policy.h  |  8 +++--
 be/src/cloud/cloud_delete_bitmap_action.cpp        |  2 ++
 be/src/cloud/cloud_delete_bitmap_action.h          |  2 ++
 .../cloud/cloud_engine_calc_delete_bitmap_task.cpp |  2 ++
 be/src/cloud/cloud_meta_mgr.cpp                    |  8 +++--
 be/src/cloud/cloud_meta_mgr.h                      |  2 ++
 be/src/cloud/cloud_storage_engine.cpp              | 34 ++++++++++++----------
 be/src/cloud/cloud_tablet.cpp                      | 11 ++++---
 be/src/cloud/cloud_tablet.h                        |  2 +-
 be/src/cloud/config.cpp                            |  2 ++
 be/src/cloud/config.h                              |  2 ++
 be/src/common/compile_check_begin.h                | 31 ++++++++++++++++++++
 be/src/common/compile_check_end.h                  | 23 +++++++++++++++
 be/src/olap/base_tablet.cpp                        |  4 +--
 be/src/olap/base_tablet.h                          |  2 +-
 be/src/olap/rowset/beta_rowset_writer.cpp          | 14 +++++----
 be/src/olap/rowset/beta_rowset_writer.h            |  4 +--
 be/src/olap/tablet_meta.cpp                        |  9 ++++--
 be/src/olap/tablet_meta.h                          |  8 +++--
 be/src/service/http_service.cpp                    |  2 ++
 be/src/util/hash_util.hpp                          |  2 +-
 24 files changed, 145 insertions(+), 51 deletions(-)

diff --git a/be/src/cloud/cloud_cumulative_compaction.cpp 
b/be/src/cloud/cloud_cumulative_compaction.cpp
index 990588ec739..6e610c395e8 100644
--- a/be/src/cloud/cloud_cumulative_compaction.cpp
+++ b/be/src/cloud/cloud_cumulative_compaction.cpp
@@ -33,6 +33,7 @@
 #include "util/uuid_generator.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 using namespace ErrorCode;
 
 bvar::Adder<uint64_t> cumu_output_size("cumu_compaction", "output_size");
@@ -490,8 +491,10 @@ Status 
CloudCumulativeCompaction::pick_rowsets_to_compact() {
     }
 
     int64_t max_score = config::cumulative_compaction_max_deltas;
-    auto process_memory_usage = 
doris::GlobalMemoryArbitrator::process_memory_usage();
-    bool memory_usage_high = process_memory_usage > MemInfo::soft_mem_limit() 
* 0.8;
+    double process_memory_usage =
+            
static_cast<double>(doris::GlobalMemoryArbitrator::process_memory_usage());
+    bool memory_usage_high =
+            process_memory_usage > 
static_cast<double>(MemInfo::soft_mem_limit()) * 0.8;
     if 
(cloud_tablet()->last_compaction_status.is<ErrorCode::MEM_LIMIT_EXCEEDED>() ||
         memory_usage_high) {
         max_score = std::max(config::cumulative_compaction_max_deltas /
@@ -621,4 +624,5 @@ void CloudCumulativeCompaction::do_lease() {
     }
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/cloud/cloud_cumulative_compaction.h 
b/be/src/cloud/cloud_cumulative_compaction.h
index 1159dcb59ce..87fc0b62c9c 100644
--- a/be/src/cloud/cloud_cumulative_compaction.h
+++ b/be/src/cloud/cloud_cumulative_compaction.h
@@ -24,6 +24,7 @@
 #include "olap/compaction.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 
 class CloudCumulativeCompaction : public CloudCompactionMixin {
 public:
@@ -60,4 +61,5 @@ private:
     Version _last_delete_version {-1, -1};
 };
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/cloud/cloud_cumulative_compaction_policy.cpp 
b/be/src/cloud/cloud_cumulative_compaction_policy.cpp
index 5a9879387b2..6445b47fc59 100644
--- a/be/src/cloud/cloud_cumulative_compaction_policy.cpp
+++ b/be/src/cloud/cloud_cumulative_compaction_policy.cpp
@@ -31,6 +31,7 @@
 #include "olap/tablet_meta.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 
 
CloudSizeBasedCumulativeCompactionPolicy::CloudSizeBasedCumulativeCompactionPolicy(
         int64_t promotion_size, double promotion_ratio, int64_t 
promotion_min_size,
@@ -48,7 +49,7 @@ int64_t 
CloudSizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size
     return (int64_t)1 << (sizeof(size) * 8 - 1 - __builtin_clzl(size));
 }
 
-int32_t CloudSizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
+int64_t CloudSizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
         CloudTablet* tablet, const std::vector<RowsetSharedPtr>& 
candidate_rowsets,
         const int64_t max_compaction_score, const int64_t min_compaction_score,
         std::vector<RowsetSharedPtr>* input_rowsets, Version* 
last_delete_version,
@@ -114,8 +115,8 @@ int32_t 
CloudSizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
     size_t new_compaction_score = *compaction_score;
     while (rs_begin != input_rowsets->end()) {
         auto& rs_meta = (*rs_begin)->rowset_meta();
-        int current_level = _level_size(rs_meta->total_disk_size());
-        int remain_level = _level_size(total_size - 
rs_meta->total_disk_size());
+        int64_t current_level = _level_size(rs_meta->total_disk_size());
+        int64_t remain_level = _level_size(total_size - 
rs_meta->total_disk_size());
         // if current level less then remain level, input rowsets contain 
current rowset
         // and process return; otherwise, input rowsets do not contain current 
rowset.
         if (current_level <= remain_level) {
@@ -185,7 +186,7 @@ int32_t 
CloudSizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
 }
 
 int64_t 
CloudSizeBasedCumulativeCompactionPolicy::cloud_promotion_size(CloudTablet* t) 
const {
-    int64_t promotion_size = int64_t(t->base_size() * _promotion_ratio);
+    int64_t promotion_size = int64_t(static_cast<double>(t->base_size()) * 
_promotion_ratio);
     // promotion_size is between _size_based_promotion_size and 
_size_based_promotion_min_size
     return promotion_size > _promotion_size       ? _promotion_size
            : promotion_size < _promotion_min_size ? _promotion_min_size
@@ -215,7 +216,7 @@ int64_t 
CloudSizeBasedCumulativeCompactionPolicy::new_cumulative_point(
                    : last_cumulative_point;
 }
 
-int32_t CloudTimeSeriesCumulativeCompactionPolicy::pick_input_rowsets(
+int64_t CloudTimeSeriesCumulativeCompactionPolicy::pick_input_rowsets(
         CloudTablet* tablet, const std::vector<RowsetSharedPtr>& 
candidate_rowsets,
         const int64_t max_compaction_score, const int64_t min_compaction_score,
         std::vector<RowsetSharedPtr>* input_rowsets, Version* 
last_delete_version,
@@ -377,4 +378,5 @@ int64_t 
CloudTimeSeriesCumulativeCompactionPolicy::new_cumulative_point(
     return output_rowset->end_version() + 1;
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/cloud/cloud_cumulative_compaction_policy.h 
b/be/src/cloud/cloud_cumulative_compaction_policy.h
index c142a8a6d3d..93737285472 100644
--- a/be/src/cloud/cloud_cumulative_compaction_policy.h
+++ b/be/src/cloud/cloud_cumulative_compaction_policy.h
@@ -30,6 +30,7 @@
 #include "olap/rowset/rowset_meta.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 
 class Tablet;
 struct Version;
@@ -44,7 +45,7 @@ public:
 
     virtual int64_t new_compaction_level(const std::vector<RowsetSharedPtr>& 
input_rowsets) = 0;
 
-    virtual int32_t pick_input_rowsets(CloudTablet* tablet,
+    virtual int64_t pick_input_rowsets(CloudTablet* tablet,
                                        const std::vector<RowsetSharedPtr>& 
candidate_rowsets,
                                        const int64_t max_compaction_score,
                                        const int64_t min_compaction_score,
@@ -71,7 +72,7 @@ public:
         return 0;
     }
 
-    int32_t pick_input_rowsets(CloudTablet* tablet,
+    int64_t pick_input_rowsets(CloudTablet* tablet,
                                const std::vector<RowsetSharedPtr>& 
candidate_rowsets,
                                const int64_t max_compaction_score,
                                const int64_t min_compaction_score,
@@ -106,7 +107,7 @@ public:
 
     int64_t new_compaction_level(const std::vector<RowsetSharedPtr>& 
input_rowsets) override;
 
-    int32_t pick_input_rowsets(CloudTablet* tablet,
+    int64_t pick_input_rowsets(CloudTablet* tablet,
                                const std::vector<RowsetSharedPtr>& 
candidate_rowsets,
                                const int64_t max_compaction_score,
                                const int64_t min_compaction_score,
@@ -115,4 +116,5 @@ public:
                                bool allow_delete = false) override;
 };
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/cloud/cloud_delete_bitmap_action.cpp 
b/be/src/cloud/cloud_delete_bitmap_action.cpp
index 86cc535e1bc..3d834bfe7b3 100644
--- a/be/src/cloud/cloud_delete_bitmap_action.cpp
+++ b/be/src/cloud/cloud_delete_bitmap_action.cpp
@@ -50,6 +50,7 @@
 #include "util/stopwatch.hpp"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 using namespace ErrorCode;
 
 namespace {
@@ -177,4 +178,5 @@ void CloudDeleteBitmapAction::handle(HttpRequest* req) {
     }
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris
\ No newline at end of file
diff --git a/be/src/cloud/cloud_delete_bitmap_action.h 
b/be/src/cloud/cloud_delete_bitmap_action.h
index 35739a7373e..ce507ee9991 100644
--- a/be/src/cloud/cloud_delete_bitmap_action.h
+++ b/be/src/cloud/cloud_delete_bitmap_action.h
@@ -27,6 +27,7 @@
 #include "olap/tablet.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 class HttpRequest;
 
 class ExecEnv;
@@ -52,4 +53,5 @@ private:
     CloudStorageEngine& _engine;
     DeleteBitmapActionType _delete_bitmap_action_type;
 };
+#include "common/compile_check_end.h"
 } // namespace doris
\ No newline at end of file
diff --git a/be/src/cloud/cloud_engine_calc_delete_bitmap_task.cpp 
b/be/src/cloud/cloud_engine_calc_delete_bitmap_task.cpp
index 594eeab3a5e..83f19881b72 100644
--- a/be/src/cloud/cloud_engine_calc_delete_bitmap_task.cpp
+++ b/be/src/cloud/cloud_engine_calc_delete_bitmap_task.cpp
@@ -34,6 +34,7 @@
 #include "runtime/memory/mem_tracker_limiter.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 
 CloudEngineCalcDeleteBitmapTask::CloudEngineCalcDeleteBitmapTask(
         CloudStorageEngine& engine, const TCalcDeleteBitmapRequest& 
cal_delete_bitmap_req,
@@ -253,4 +254,5 @@ Status CloudTabletCalcDeleteBitmapTask::handle() const {
     return status;
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/cloud/cloud_meta_mgr.cpp b/be/src/cloud/cloud_meta_mgr.cpp
index bf32450b886..6659164d4f7 100644
--- a/be/src/cloud/cloud_meta_mgr.cpp
+++ b/be/src/cloud/cloud_meta_mgr.cpp
@@ -64,6 +64,7 @@
 #include "util/thrift_rpc_helper.h"
 
 namespace doris::cloud {
+#include "common/compile_check_begin.h"
 using namespace ErrorCode;
 
 Status bthread_fork_join(const std::vector<std::function<Status()>>& tasks, 
int concurrency) {
@@ -717,7 +718,7 @@ Status CloudMetaMgr::sync_tablet_delete_bitmap(CloudTablet* 
tablet, int64_t old_
                 
"rowset_ids.size={},segment_ids.size={},vers.size={},delete_bitmaps.size={}",
                 rowset_ids.size(), segment_ids.size(), vers.size(), 
delete_bitmaps.size());
     }
-    for (size_t i = 0; i < rowset_ids.size(); i++) {
+    for (int i = 0; i < rowset_ids.size(); i++) {
         RowsetId rst_id;
         rst_id.init(rowset_ids[i]);
         delete_bitmap->merge(
@@ -757,10 +758,10 @@ Status CloudMetaMgr::prepare_rowset(const RowsetMeta& 
rs_meta,
     Status st = retry_rpc("prepare rowset", req, &resp, 
&MetaService_Stub::prepare_rowset);
     if (!st.ok() && resp.status().code() == MetaServiceCode::ALREADY_EXISTED) {
         if (existed_rs_meta != nullptr && resp.has_existed_rowset_meta()) {
-            RowsetMetaPB doris_rs_meta =
+            RowsetMetaPB doris_rs_meta_tmp =
                     
cloud_rowset_meta_to_doris(std::move(*resp.mutable_existed_rowset_meta()));
             *existed_rs_meta = std::make_shared<RowsetMeta>();
-            (*existed_rs_meta)->init_from_pb(doris_rs_meta);
+            (*existed_rs_meta)->init_from_pb(doris_rs_meta_tmp);
         }
         return Status::AlreadyExist("failed to prepare rowset: {}", 
resp.status().msg());
     }
@@ -1286,4 +1287,5 @@ int64_t CloudMetaMgr::get_inverted_index_file_szie(const 
RowsetMeta& rs_meta) {
     return total_inverted_index_size;
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris::cloud
diff --git a/be/src/cloud/cloud_meta_mgr.h b/be/src/cloud/cloud_meta_mgr.h
index c49b036ad90..913ef59489a 100644
--- a/be/src/cloud/cloud_meta_mgr.h
+++ b/be/src/cloud/cloud_meta_mgr.h
@@ -27,6 +27,7 @@
 #include "util/s3_util.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 
 class DeleteBitmap;
 class StreamLoadContext;
@@ -124,4 +125,5 @@ private:
 };
 
 } // namespace cloud
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/cloud/cloud_storage_engine.cpp 
b/be/src/cloud/cloud_storage_engine.cpp
index 5d7b445917a..a49809bd59c 100644
--- a/be/src/cloud/cloud_storage_engine.cpp
+++ b/be/src/cloud/cloud_storage_engine.cpp
@@ -52,6 +52,7 @@
 #include "util/parse_util.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 
 using namespace std::literals;
 
@@ -166,7 +167,8 @@ Status CloudStorageEngine::open() {
 
     _memtable_flush_executor = std::make_unique<MemTableFlushExecutor>();
     // Use file cache disks number
-    
_memtable_flush_executor->init(io::FileCacheFactory::instance()->get_cache_instance_size());
+    _memtable_flush_executor->init(
+            
static_cast<int32_t>(io::FileCacheFactory::instance()->get_cache_instance_size()));
 
     _calc_delete_bitmap_executor = 
std::make_unique<CalcDeleteBitmapExecutor>();
     _calc_delete_bitmap_executor->init();
@@ -308,7 +310,7 @@ void 
CloudStorageEngine::_check_file_cache_ttl_block_valid() {
         for (const auto& rowset : rowsets) {
             int64_t ttl_seconds = tablet->tablet_meta()->ttl_seconds();
             if (rowset->newest_write_timestamp() + ttl_seconds <= 
UnixSeconds()) continue;
-            for (int64_t seg_id = 0; seg_id < rowset->num_segments(); 
seg_id++) {
+            for (uint32_t seg_id = 0; seg_id < rowset->num_segments(); 
seg_id++) {
                 auto hash = 
Segment::file_cache_key(rowset->rowset_id().to_string(), seg_id);
                 auto* file_cache = 
io::FileCacheFactory::instance()->get_by_path(hash);
                 file_cache->update_ttl_atime(hash);
@@ -337,11 +339,11 @@ void CloudStorageEngine::sync_storage_vault() {
 
     for (auto& [id, vault_info, path_format] : vault_infos) {
         auto fs = get_filesystem(id);
-        auto st = (fs == nullptr)
-                          ? std::visit(VaultCreateFSVisitor {id, path_format}, 
vault_info)
-                          : std::visit(RefreshFSVaultVisitor {id, 
std::move(fs), path_format},
-                                       vault_info);
-        if (!st.ok()) [[unlikely]] {
+        auto status = (fs == nullptr)
+                              ? std::visit(VaultCreateFSVisitor {id, 
path_format}, vault_info)
+                              : std::visit(RefreshFSVaultVisitor {id, 
std::move(fs), path_format},
+                                           vault_info);
+        if (!status.ok()) [[unlikely]] {
             LOG(WARNING) << vault_process_error(id, vault_info, std::move(st));
         }
     }
@@ -491,13 +493,13 @@ void 
CloudStorageEngine::_compaction_tasks_producer_callback() {
             /// If it is not cleaned up, the reference count of the tablet 
will always be greater than 1,
             /// thus cannot be collected by the garbage collector. 
(TabletManager::start_trash_sweep)
             for (const auto& tablet : tablets_compaction) {
-                Status st = submit_compaction_task(tablet, compaction_type);
-                if (st.ok()) continue;
-                if ((!st.is<ErrorCode::BE_NO_SUITABLE_VERSION>() &&
-                     !st.is<ErrorCode::CUMULATIVE_NO_SUITABLE_VERSION>()) ||
+                Status status = submit_compaction_task(tablet, 
compaction_type);
+                if (status.ok()) continue;
+                if ((!status.is<ErrorCode::BE_NO_SUITABLE_VERSION>() &&
+                     !status.is<ErrorCode::CUMULATIVE_NO_SUITABLE_VERSION>()) 
||
                     VLOG_DEBUG_IS_ON) {
                     LOG(WARNING) << "failed to submit compaction task for 
tablet: "
-                                 << tablet->tablet_id() << ", err: " << st;
+                                 << tablet->tablet_id() << ", err: " << status;
                 }
             }
             interval = config::generate_compaction_tasks_interval_ms;
@@ -531,7 +533,8 @@ std::vector<CloudTabletSPtr> 
CloudStorageEngine::_generate_cloud_compaction_task
     int num_cumu =
             std::accumulate(submitted_cumu_compactions.begin(), 
submitted_cumu_compactions.end(), 0,
                             [](int a, auto& b) { return a + b.second.size(); 
});
-    int num_base = submitted_base_compactions.size() + 
submitted_full_compactions.size();
+    int num_base =
+            static_cast<int>(submitted_base_compactions.size() + 
submitted_full_compactions.size());
     int n = thread_per_disk - num_cumu - num_base;
     if (compaction_type == CompactionType::BASE_COMPACTION) {
         // We need to reserve at least one thread for cumulative compaction,
@@ -809,7 +812,7 @@ Status 
CloudStorageEngine::get_compaction_status_json(std::string* result) {
     // cumu
     std::string_view cumu = "CumulativeCompaction";
     rapidjson::Value cumu_key;
-    cumu_key.SetString(cumu.data(), cumu.length(), root.GetAllocator());
+    cumu_key.SetString(cumu.data(), static_cast<uint32_t>(cumu.length()), 
root.GetAllocator());
     rapidjson::Document cumu_arr;
     cumu_arr.SetArray();
     for (auto& [tablet_id, v] : _submitted_cumu_compactions) {
@@ -821,7 +824,7 @@ Status 
CloudStorageEngine::get_compaction_status_json(std::string* result) {
     // base
     std::string_view base = "BaseCompaction";
     rapidjson::Value base_key;
-    base_key.SetString(base.data(), base.length(), root.GetAllocator());
+    base_key.SetString(base.data(), static_cast<uint32_t>(base.length()), 
root.GetAllocator());
     rapidjson::Document base_arr;
     base_arr.SetArray();
     for (auto& [tablet_id, _] : _submitted_base_compactions) {
@@ -844,4 +847,5 @@ std::shared_ptr<CloudCumulativeCompactionPolicy> 
CloudStorageEngine::cumu_compac
     return _cumulative_compaction_policies.at(compaction_policy);
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/cloud/cloud_tablet.cpp b/be/src/cloud/cloud_tablet.cpp
index 628e3771bf7..fe9494ef149 100644
--- a/be/src/cloud/cloud_tablet.cpp
+++ b/be/src/cloud/cloud_tablet.cpp
@@ -50,6 +50,7 @@
 #include "vec/common/schema_util.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 using namespace ErrorCode;
 
 static constexpr int COMPACTION_DELETE_BITMAP_LOCK_ID = -1;
@@ -381,7 +382,7 @@ void CloudTablet::delete_rowsets(const 
std::vector<RowsetSharedPtr>& to_delete,
     _tablet_meta->modify_rs_metas({}, rs_metas, false);
 }
 
-int CloudTablet::delete_expired_stale_rowsets() {
+uint64_t CloudTablet::delete_expired_stale_rowsets() {
     std::vector<RowsetSharedPtr> expired_rowsets;
     int64_t expired_stale_sweep_endtime =
             ::time(nullptr) - config::tablet_rowset_stale_sweep_time_sec;
@@ -540,7 +541,7 @@ Result<std::unique_ptr<RowsetWriter>> 
CloudTablet::create_transient_rowset_write
 
     return RowsetFactory::create_rowset_writer(_engine, context, false)
             .transform([&](auto&& writer) {
-                writer->set_segment_start_id(rowset.num_segments());
+                
writer->set_segment_start_id(static_cast<int32_t>(rowset.num_segments()));
                 return writer;
             });
 }
@@ -618,7 +619,8 @@ void CloudTablet::get_compaction_status(std::string* 
json_result) {
         }
         rapidjson::Value value;
         std::string version_str = rowset->get_rowset_info_str();
-        value.SetString(version_str.c_str(), version_str.length(), 
versions_arr.GetAllocator());
+        value.SetString(version_str.c_str(), 
static_cast<uint32_t>(version_str.length()),
+                        versions_arr.GetAllocator());
         versions_arr.PushBack(value, versions_arr.GetAllocator());
         last_version = ver.second;
     }
@@ -631,7 +633,7 @@ void CloudTablet::get_compaction_status(std::string* 
json_result) {
     for (auto& rowset : stale_rowsets) {
         rapidjson::Value value;
         std::string version_str = rowset->get_rowset_info_str();
-        value.SetString(version_str.c_str(), version_str.length(),
+        value.SetString(version_str.c_str(), 
static_cast<uint32_t>(version_str.length()),
                         stale_versions_arr.GetAllocator());
         stale_versions_arr.PushBack(value, stale_versions_arr.GetAllocator());
     }
@@ -920,4 +922,5 @@ void CloudTablet::build_tablet_report_info(TTabletInfo* 
tablet_info) {
     // but it may be used in the future.
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/cloud/cloud_tablet.h b/be/src/cloud/cloud_tablet.h
index 3433c357322..458964bac2c 100644
--- a/be/src/cloud/cloud_tablet.h
+++ b/be/src/cloud/cloud_tablet.h
@@ -92,7 +92,7 @@ public:
     void clear_cache() override;
 
     // Return number of deleted stale rowsets
-    int delete_expired_stale_rowsets();
+    uint64_t delete_expired_stale_rowsets();
 
     bool has_stale_rowsets() const { return !_stale_rs_version_map.empty(); }
 
diff --git a/be/src/cloud/config.cpp b/be/src/cloud/config.cpp
index 2d7be6b4971..feb81d0a074 100644
--- a/be/src/cloud/config.cpp
+++ b/be/src/cloud/config.cpp
@@ -20,6 +20,7 @@
 #include "common/status.h"
 
 namespace doris::config {
+#include "common/compile_check_begin.h"
 
 DEFINE_String(deploy_mode, "");
 DEFINE_mString(cloud_unique_id, "");
@@ -76,4 +77,5 @@ DEFINE_mInt32(tablet_txn_info_min_expired_seconds, "120");
 DEFINE_mBool(enable_use_cloud_unique_id_from_fe, "true");
 
 DEFINE_mBool(enable_cloud_tablet_report, "false");
+#include "common/compile_check_end.h"
 } // namespace doris::config
diff --git a/be/src/cloud/config.h b/be/src/cloud/config.h
index b345e635592..a8a7c0c48ec 100644
--- a/be/src/cloud/config.h
+++ b/be/src/cloud/config.h
@@ -20,6 +20,7 @@
 #include "common/config.h"
 
 namespace doris::config {
+#include "common/compile_check_begin.h"
 
 DECLARE_String(deploy_mode);
 // deprecated do not configure directly
@@ -110,4 +111,5 @@ DECLARE_mBool(enable_use_cloud_unique_id_from_fe);
 
 DECLARE_Bool(enable_cloud_tablet_report);
 
+#include "common/compile_check_end.h"
 } // namespace doris::config
diff --git a/be/src/common/compile_check_begin.h 
b/be/src/common/compile_check_begin.h
new file mode 100644
index 00000000000..4d860d39d1c
--- /dev/null
+++ b/be/src/common/compile_check_begin.h
@@ -0,0 +1,31 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifdef COMPILE_CHECK
+#error The handling of compile_check_begin.h and compile_check_end.h is not 
done correctly.
+#endif
+
+#define COMPILE_CHECK
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic error "-Wconversion"
+#pragma clang diagnostic error "-Wshadow"
+#pragma clang diagnostic ignored "-Wsign-conversion"
+#pragma clang diagnostic ignored "-Wfloat-conversion"
+#endif
+
+//#include "common/compile_check_begin.h"
diff --git a/be/src/common/compile_check_end.h 
b/be/src/common/compile_check_end.h
new file mode 100644
index 00000000000..40df41b6bdf
--- /dev/null
+++ b/be/src/common/compile_check_end.h
@@ -0,0 +1,23 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+#undef COMPILE_CHECK
+
+// #include "common/compile_check_end.h"
diff --git a/be/src/olap/base_tablet.cpp b/be/src/olap/base_tablet.cpp
index 0cb918448c4..d4360f7da96 100644
--- a/be/src/olap/base_tablet.cpp
+++ b/be/src/olap/base_tablet.cpp
@@ -1547,8 +1547,8 @@ std::vector<RowsetSharedPtr> 
BaseTablet::get_snapshot_rowset(bool include_stale_
 
 void BaseTablet::calc_consecutive_empty_rowsets(
         std::vector<RowsetSharedPtr>* empty_rowsets,
-        const std::vector<RowsetSharedPtr>& candidate_rowsets, int limit) {
-    int len = candidate_rowsets.size();
+        const std::vector<RowsetSharedPtr>& candidate_rowsets, int64_t limit) {
+    int len = static_cast<int>(candidate_rowsets.size());
     for (int i = 0; i < len - 1; ++i) {
         auto rowset = candidate_rowsets[i];
         auto next_rowset = candidate_rowsets[i + 1];
diff --git a/be/src/olap/base_tablet.h b/be/src/olap/base_tablet.h
index f8f2869136f..7e5ecfe9612 100644
--- a/be/src/olap/base_tablet.h
+++ b/be/src/olap/base_tablet.h
@@ -263,7 +263,7 @@ public:
     // Find the first consecutive empty rowsets. output->size() >= limit
     void calc_consecutive_empty_rowsets(std::vector<RowsetSharedPtr>* 
empty_rowsets,
                                         const std::vector<RowsetSharedPtr>& 
candidate_rowsets,
-                                        int limit);
+                                        int64_t limit);
 
     // Return the merged schema of all rowsets
     virtual TabletSchemaSPtr merged_tablet_schema() const {
diff --git a/be/src/olap/rowset/beta_rowset_writer.cpp 
b/be/src/olap/rowset/beta_rowset_writer.cpp
index 3f5bf0bd578..f04c765908c 100644
--- a/be/src/olap/rowset/beta_rowset_writer.cpp
+++ b/be/src/olap/rowset/beta_rowset_writer.cpp
@@ -60,6 +60,7 @@
 #include "vec/data_types/data_type_factory.hpp"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 using namespace ErrorCode;
 
 namespace {
@@ -475,15 +476,15 @@ Status 
BetaRowsetWriter::_rename_compacted_segments(int64_t begin, int64_t end)
     return Status::OK();
 }
 
-void BetaRowsetWriter::_clear_statistics_for_deleting_segments_unsafe(uint64_t 
begin,
-                                                                      uint64_t 
end) {
+void BetaRowsetWriter::_clear_statistics_for_deleting_segments_unsafe(uint32_t 
begin,
+                                                                      uint32_t 
end) {
     VLOG_DEBUG << "_segid_statistics_map clear record segid range from:" << 
begin << " to:" << end;
-    for (int i = begin; i <= end; ++i) {
+    for (uint32_t i = begin; i <= end; ++i) {
         _segid_statistics_map.erase(i);
     }
 }
 
-Status BetaRowsetWriter::_rename_compacted_segment_plain(uint64_t seg_id) {
+Status BetaRowsetWriter::_rename_compacted_segment_plain(uint32_t seg_id) {
     if (seg_id == _num_segcompacted) {
         ++_num_segcompacted;
         return Status::OK();
@@ -653,7 +654,7 @@ Status BaseBetaRowsetWriter::add_rowset(RowsetSharedPtr 
rowset) {
     _num_rows_written += rowset->num_rows();
     _total_data_size += rowset->rowset_meta()->data_disk_size();
     _total_index_size += rowset->rowset_meta()->index_disk_size();
-    _num_segment += rowset->num_segments();
+    _num_segment += static_cast<int32_t>(rowset->num_segments());
     // append key_bounds to current rowset
     
RETURN_IF_ERROR(rowset->get_segments_key_bounds(&_segments_encoded_key_bounds));
 
@@ -1043,7 +1044,7 @@ Status BaseBetaRowsetWriter::add_segment(uint32_t 
segment_id, const SegmentStati
         if (segment_id >= _segment_num_rows.size()) {
             _segment_num_rows.resize(segment_id + 1);
         }
-        _segment_num_rows[segid_offset] = segstat.row_num;
+        _segment_num_rows[segid_offset] = 
static_cast<uint32_t>(segstat.row_num);
     }
     VLOG_DEBUG << "_segid_statistics_map add new record. segment_id:" << 
segment_id
                << " row_num:" << segstat.row_num << " data_size:" << 
segstat.data_size
@@ -1111,4 +1112,5 @@ Status 
BetaRowsetWriter::flush_segment_writer_for_segcompaction(
     return Status::OK();
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/olap/rowset/beta_rowset_writer.h 
b/be/src/olap/rowset/beta_rowset_writer.h
index cfdc212359a..760224b055d 100644
--- a/be/src/olap/rowset/beta_rowset_writer.h
+++ b/be/src/olap/rowset/beta_rowset_writer.h
@@ -298,9 +298,9 @@ private:
     Status _load_noncompacted_segment(segment_v2::SegmentSharedPtr& segment, 
int32_t segment_id);
     Status 
_find_longest_consecutive_small_segment(SegCompactionCandidatesSharedPtr& 
segments);
     Status _rename_compacted_segments(int64_t begin, int64_t end);
-    Status _rename_compacted_segment_plain(uint64_t seg_id);
+    Status _rename_compacted_segment_plain(uint32_t seg_id);
     Status _rename_compacted_indices(int64_t begin, int64_t end, uint64_t 
seg_id);
-    void _clear_statistics_for_deleting_segments_unsafe(uint64_t begin, 
uint64_t end);
+    void _clear_statistics_for_deleting_segments_unsafe(uint32_t begin, 
uint32_t end);
 
     StorageEngine& _engine;
 
diff --git a/be/src/olap/tablet_meta.cpp b/be/src/olap/tablet_meta.cpp
index cb95c4fb6e0..a8dd0e56273 100644
--- a/be/src/olap/tablet_meta.cpp
+++ b/be/src/olap/tablet_meta.cpp
@@ -57,6 +57,7 @@ using std::unordered_map;
 using std::vector;
 
 namespace doris {
+#include "common/compile_check_begin.h"
 using namespace ErrorCode;
 
 TabletMetaSharedPtr TabletMeta::create(
@@ -106,7 +107,7 @@ TabletMeta::TabletMeta()
           _delete_bitmap(new DeleteBitmap(_tablet_id)) {}
 
 TabletMeta::TabletMeta(int64_t table_id, int64_t partition_id, int64_t 
tablet_id,
-                       int64_t replica_id, int32_t schema_hash, uint64_t 
shard_id,
+                       int64_t replica_id, int32_t schema_hash, int32_t 
shard_id,
                        const TTabletSchema& tablet_schema, uint32_t 
next_unique_id,
                        const std::unordered_map<uint32_t, uint32_t>& 
col_ordinal_to_unique_id,
                        TabletUid tablet_uid, TTabletType::type tabletType,
@@ -567,7 +568,8 @@ void TabletMeta::serialize(string* meta_binary) {
 
 Status TabletMeta::deserialize(std::string_view meta_binary) {
     TabletMetaPB tablet_meta_pb;
-    bool parsed = tablet_meta_pb.ParseFromArray(meta_binary.data(), 
meta_binary.size());
+    bool parsed = tablet_meta_pb.ParseFromArray(meta_binary.data(),
+                                                
static_cast<int32_t>(meta_binary.size()));
     if (!parsed) {
         return Status::Error<INIT_FAILED>("parse tablet meta failed");
     }
@@ -660,7 +662,7 @@ void TabletMeta::init_from_pb(const TabletMetaPB& 
tablet_meta_pb) {
         int seg_maps_size = 
tablet_meta_pb.delete_bitmap().segment_delete_bitmaps_size();
         CHECK(rst_ids_size == seg_ids_size && seg_ids_size == seg_maps_size &&
               seg_maps_size == versions_size);
-        for (size_t i = 0; i < rst_ids_size; ++i) {
+        for (int i = 0; i < rst_ids_size; ++i) {
             RowsetId rst_id;
             rst_id.init(tablet_meta_pb.delete_bitmap().rowset_ids(i));
             auto seg_id = tablet_meta_pb.delete_bitmap().segment_ids(i);
@@ -1308,4 +1310,5 @@ std::string tablet_state_name(TabletState state) {
     }
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/olap/tablet_meta.h b/be/src/olap/tablet_meta.h
index 3a5999c6124..9f47ef4913c 100644
--- a/be/src/olap/tablet_meta.h
+++ b/be/src/olap/tablet_meta.h
@@ -50,6 +50,7 @@
 #include "util/uid_util.h"
 
 namespace json2pb {
+#include "common/compile_check_begin.h"
 struct Pb2JsonOptions;
 } // namespace json2pb
 
@@ -99,7 +100,7 @@ public:
 
     TabletMeta();
     TabletMeta(int64_t table_id, int64_t partition_id, int64_t tablet_id, 
int64_t replica_id,
-               int32_t schema_hash, uint64_t shard_id, const TTabletSchema& 
tablet_schema,
+               int32_t schema_hash, int32_t shard_id, const TTabletSchema& 
tablet_schema,
                uint32_t next_unique_id,
                const std::unordered_map<uint32_t, uint32_t>& 
col_ordinal_to_unique_id,
                TabletUid tablet_uid, TTabletType::type tabletType,
@@ -155,7 +156,7 @@ public:
     int64_t replica_id() const;
     void set_replica_id(int64_t replica_id) { _replica_id = replica_id; }
     int32_t schema_hash() const;
-    int16_t shard_id() const;
+    int32_t shard_id() const;
     void set_shard_id(int32_t shard_id);
     int64_t creation_time() const;
     void set_creation_time(int64_t creation_time);
@@ -614,7 +615,7 @@ inline int32_t TabletMeta::schema_hash() const {
     return _schema_hash;
 }
 
-inline int16_t TabletMeta::shard_id() const {
+inline int32_t TabletMeta::shard_id() const {
     return _shard_id;
 }
 
@@ -778,4 +779,5 @@ std::string tablet_state_name(TabletState state);
 bool operator==(const TabletMeta& a, const TabletMeta& b);
 bool operator!=(const TabletMeta& a, const TabletMeta& b);
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/service/http_service.cpp b/be/src/service/http_service.cpp
index 0ee484ec886..151f95179c9 100644
--- a/be/src/service/http_service.cpp
+++ b/be/src/service/http_service.cpp
@@ -80,6 +80,7 @@
 #include "util/doris_metrics.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 namespace {
 std::shared_ptr<bufferevent_rate_limit_group> get_rate_limit_group(event_base* 
event_base) {
     auto rate_limit = config::download_binlog_rate_limit_kbs;
@@ -466,4 +467,5 @@ int HttpService::get_real_port() const {
     return _ev_http_server->get_real_port();
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/util/hash_util.hpp b/be/src/util/hash_util.hpp
index dc70b1c9f9c..fcd4db5bead 100644
--- a/be/src/util/hash_util.hpp
+++ b/be/src/util/hash_util.hpp
@@ -305,7 +305,7 @@ public:
 #endif
     }
 
-    static uint64_t hash64(const void* data, int32_t bytes, uint64_t seed) {
+    static uint64_t hash64(const void* data, uint64_t bytes, uint64_t seed) {
 #ifdef _SSE4_2_
         if (LIKELY(CpuInfo::is_supported(CpuInfo::SSE4_2))) {
             return crc_hash64(data, bytes, seed);


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


Reply via email to