This is an automated email from the ASF dual-hosted git repository. hellostephen 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 342a9fb2d4e [fix](compile)fix compile check warning (#53557) 342a9fb2d4e is described below commit 342a9fb2d4e5c890f593bab285ffa714abe76d60 Author: koarz <li...@selectdb.com> AuthorDate: Sat Jul 26 22:49:14 2025 +0800 [fix](compile)fix compile check warning (#53557) --- be/src/olap/rowset/segment_v2/column_reader.cpp | 11 +++++---- be/src/olap/rowset/segment_v2/zone_map_index.cpp | 4 ++- be/src/olap/rowset/segment_v2/zone_map_index.h | 5 ++-- be/src/olap/snapshot_manager.cpp | 19 ++++++++------- be/src/olap/storage_engine.cpp | 31 ++++++++++++++---------- be/src/util/network_util.cpp | 9 ++++--- 6 files changed, 46 insertions(+), 33 deletions(-) diff --git a/be/src/olap/rowset/segment_v2/column_reader.cpp b/be/src/olap/rowset/segment_v2/column_reader.cpp index 2a6cdcf60a5..02b5ba0fee4 100644 --- a/be/src/olap/rowset/segment_v2/column_reader.cpp +++ b/be/src/olap/rowset/segment_v2/column_reader.cpp @@ -522,12 +522,12 @@ Status ColumnReader::_get_filtered_pages( FieldType type = _type_info->type(); const std::vector<ZoneMapPB>& zone_maps = _zone_map_index->page_zone_maps(); - int32_t page_size = _zone_map_index->num_pages(); + size_t page_size = _zone_map_index->num_pages(); std::unique_ptr<WrapperField> min_value(WrapperField::create_by_type(type, _meta_length)); std::unique_ptr<WrapperField> max_value(WrapperField::create_by_type(type, _meta_length)); - for (int32_t i = 0; i < page_size; ++i) { + for (size_t i = 0; i < page_size; ++i) { if (zone_maps[i].pass_all()) { - page_indexes->push_back(i); + page_indexes->push_back(cast_set<uint32_t>(i)); } else { RETURN_IF_ERROR(_parse_zone_map(zone_maps[i], min_value.get(), max_value.get())); if (_zone_map_match_condition(zone_maps[i], min_value.get(), max_value.get(), @@ -545,14 +545,15 @@ Status ColumnReader::_get_filtered_pages( } } if (should_read) { - page_indexes->push_back(i); + page_indexes->push_back(cast_set<uint32_t>(i)); } } } } VLOG(1) << "total-pages: " << page_size << " not-filtered-pages: " << page_indexes->size() << " filtered-percent:" - << 1.0 - (static_cast<double>(page_indexes->size()) / (page_size * 1.0)); + << 1.0 - (static_cast<double>(page_indexes->size()) / + (static_cast<double>(page_size) * 1.0)); return Status::OK(); } diff --git a/be/src/olap/rowset/segment_v2/zone_map_index.cpp b/be/src/olap/rowset/segment_v2/zone_map_index.cpp index 452b5567106..22b981351c2 100644 --- a/be/src/olap/rowset/segment_v2/zone_map_index.cpp +++ b/be/src/olap/rowset/segment_v2/zone_map_index.cpp @@ -37,6 +37,7 @@ #include "vec/data_types/data_type.h" namespace doris { +#include "common/compile_check_begin.h" struct uint24_t; namespace segment_v2 { @@ -172,7 +173,7 @@ Status ZoneMapIndexReader::_load(bool use_page_cache, bool kept_in_memory, DCHECK(num_to_read == num_read); if (!_page_zone_maps[i].ParseFromArray(column->get_data_at(0).data, - column->get_data_at(0).size)) { + cast_set<int>(column->get_data_at(0).size))) { return Status::Corruption("Failed to parse zone map"); } _pb_meta_size += _page_zone_maps[i].ByteSizeLong(); @@ -231,4 +232,5 @@ Status ZoneMapIndexWriter::create(Field* field, std::unique_ptr<ZoneMapIndexWrit } } } // namespace segment_v2 +#include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/olap/rowset/segment_v2/zone_map_index.h b/be/src/olap/rowset/segment_v2/zone_map_index.h index 04cae12975c..c9445aa2d77 100644 --- a/be/src/olap/rowset/segment_v2/zone_map_index.h +++ b/be/src/olap/rowset/segment_v2/zone_map_index.h @@ -34,7 +34,7 @@ #include "vec/common/arena.h" namespace doris { - +#include "common/compile_check_begin.h" namespace io { class FileWriter; } // namespace io @@ -159,7 +159,7 @@ public: const std::vector<ZoneMapPB>& page_zone_maps() const { return _page_zone_maps; } - int32_t num_pages() const { return _page_zone_maps.size(); } + size_t num_pages() const { return _page_zone_maps.size(); } private: Status _load(bool use_page_cache, bool kept_in_memory, std::unique_ptr<IndexedColumnMetaPB>, @@ -177,4 +177,5 @@ private: }; } // namespace segment_v2 +#include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/olap/snapshot_manager.cpp b/be/src/olap/snapshot_manager.cpp index a59ed36bb82..5a6ff80d36c 100644 --- a/be/src/olap/snapshot_manager.cpp +++ b/be/src/olap/snapshot_manager.cpp @@ -65,6 +65,7 @@ using std::stringstream; using std::vector; namespace doris { +#include "common/compile_check_begin.h" using namespace ErrorCode; LocalSnapshotLockGuard LocalSnapshotLock::acquire(const std::string& path) { @@ -282,7 +283,7 @@ Result<std::vector<PendingRowsetGuard>> SnapshotManager::convert_rowset_ids( const auto& cloned_del_bitmap_pb = cloned_tablet_meta_pb.delete_bitmap(); DeleteBitmapPB* new_del_bitmap_pb = new_tablet_meta_pb.mutable_delete_bitmap(); int rst_ids_size = cloned_del_bitmap_pb.rowset_ids_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(cloned_del_bitmap_pb.rowset_ids(i)); // It should not happen, if we can't convert some rowid in delete bitmap, the @@ -302,7 +303,7 @@ Status SnapshotManager::_rename_rowset_id(const RowsetMetaPB& rs_meta_pb, const std::string& new_tablet_path, TabletSchemaSPtr tablet_schema, const RowsetId& rowset_id, RowsetMetaPB* new_rs_meta_pb) { - Status res = Status::OK(); + Status st = Status::OK(); RowsetMetaSharedPtr rowset_meta(new RowsetMeta()); rowset_meta->init_from_pb(rs_meta_pb); RowsetSharedPtr org_rowset; @@ -330,11 +331,11 @@ Status SnapshotManager::_rename_rowset_id(const RowsetMetaPB& rs_meta_pb, auto rs_writer = DORIS_TRY(RowsetFactory::create_rowset_writer(_engine, context, false)); - res = rs_writer->add_rowset(org_rowset); - if (!res.ok()) { + st = rs_writer->add_rowset(org_rowset); + if (!st.ok()) { LOG(WARNING) << "failed to add rowset " << " id = " << org_rowset->rowset_id() << " to rowset " << rowset_id; - return res; + return st; } RowsetSharedPtr new_rowset; RETURN_NOT_OK_STATUS_WITH_WARN(rs_writer->build(new_rowset), @@ -783,9 +784,9 @@ Status SnapshotManager::_create_snapshot_files(const TabletSharedPtr& ref_tablet LOG(WARNING) << "fail to make snapshot, try to delete the snapshot path. path=" << snapshot_id_path.c_str(); - bool exists = true; - RETURN_IF_ERROR(io::global_local_filesystem()->exists(snapshot_id_path, &exists)); - if (exists) { + bool exist = true; + RETURN_IF_ERROR(io::global_local_filesystem()->exists(snapshot_id_path, &exist)); + if (exist) { VLOG_NOTICE << "remove snapshot path. [path=" << snapshot_id_path << "]"; RETURN_IF_ERROR(io::global_local_filesystem()->delete_directory(snapshot_id_path)); } @@ -795,5 +796,5 @@ Status SnapshotManager::_create_snapshot_files(const TabletSharedPtr& ref_tablet return res; } - +#include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/olap/storage_engine.cpp b/be/src/olap/storage_engine.cpp index a7eed1f84ff..39ca846a42b 100644 --- a/be/src/olap/storage_engine.cpp +++ b/be/src/olap/storage_engine.cpp @@ -93,6 +93,7 @@ using std::stringstream; using std::vector; namespace doris { +#include "common/compile_check_begin.h" using namespace ErrorCode; extern void get_round_robin_stores(int64_t curr_index, const std::vector<DirInfo>& dir_infos, std::vector<DataDir*>& stores); @@ -110,8 +111,8 @@ BaseStorageEngine::BaseStorageEngine(Type type, const UniqueId& backend_uid) : _type(type), _rowset_id_generator(std::make_unique<UniqueRowsetIdGenerator>(backend_uid)), _stop_background_threads_latch(1) { - _memory_limitation_bytes_for_schema_change = - static_cast<int64_t>(MemInfo::soft_mem_limit() * config::schema_change_mem_limit_frac); + _memory_limitation_bytes_for_schema_change = static_cast<int64_t>( + static_cast<double>(MemInfo::soft_mem_limit()) * config::schema_change_mem_limit_frac); _tablet_max_delete_bitmap_score_metrics = std::make_shared<bvar::Status<size_t>>("tablet_max", "delete_bitmap_score", 0); _tablet_max_base_rowset_delete_bitmap_score_metrics = std::make_shared<bvar::Status<size_t>>( @@ -164,21 +165,22 @@ void CompactionSubmitRegistry::jsonfy_compaction_status(std::string* result) { auto add_node = [&root](const std::string& name, const Registry& registry) { rapidjson::Value key; - key.SetString(name.c_str(), name.length(), root.GetAllocator()); + key.SetString(name.c_str(), cast_set<uint32_t>(name.length()), root.GetAllocator()); rapidjson::Document path_obj; path_obj.SetObject(); for (const auto& it : registry) { const auto& dir = it.first->path(); rapidjson::Value path_key; - path_key.SetString(dir.c_str(), dir.length(), root.GetAllocator()); + path_key.SetString(dir.c_str(), cast_set<uint32_t>(dir.length()), root.GetAllocator()); rapidjson::Document arr; arr.SetArray(); for (const auto& tablet : it.second) { - rapidjson::Value key; + rapidjson::Value temp_key; auto key_str = std::to_string(tablet->tablet_id()); - key.SetString(key_str.c_str(), key_str.length(), root.GetAllocator()); + temp_key.SetString(key_str.c_str(), cast_set<uint32_t>(key_str.length()), + root.GetAllocator()); arr.PushBack(key, root.GetAllocator()); } path_obj.AddMember(path_key, arr, root.GetAllocator()); @@ -241,7 +243,7 @@ static Status load_data_dirs(const std::vector<DataDir*>& data_dirs) { int num_threads = config::load_data_dirs_threads; if (num_threads <= 0) { - num_threads = data_dirs.size(); + num_threads = cast_set<int>(data_dirs.size()); } auto st = ThreadPoolBuilder("load_data_dir") @@ -296,7 +298,7 @@ Status StorageEngine::_open() { auto dirs = get_stores(); RETURN_IF_ERROR(load_data_dirs(dirs)); - _disk_num = dirs.size(); + _disk_num = cast_set<int>(dirs.size()); _memtable_flush_executor = std::make_unique<MemTableFlushExecutor>(); _memtable_flush_executor->init(_disk_num); @@ -354,7 +356,8 @@ void StorageEngine::_update_storage_medium_type_count() { } } - _available_storage_medium_type_count = available_storage_medium_types.size(); + _available_storage_medium_type_count = + cast_set<uint32_t>(available_storage_medium_types.size()); } Status StorageEngine::_judge_and_update_effective_cluster_id(int32_t cluster_id) { @@ -640,7 +643,7 @@ void get_round_robin_stores(int64_t curr_index, const std::vector<DirInfo>& dir_ // data dirs [i, end) have the same tablet size, round robin range [i, end) size_t count = end - i; for (size_t k = 0; k < count; k++) { - size_t index = i + (k + curr_index) % count; + size_t index = i + ((k + curr_index) % count); stores.push_back(dir_infos[index].data_dir); } i = end; @@ -844,7 +847,8 @@ Status StorageEngine::start_trash_sweep(double* usage, bool ignore_guard) { continue; } - double curr_usage = (double)(info.disk_capacity - info.available) / info.disk_capacity; + double curr_usage = + (double)(info.disk_capacity - info.available) / (double)info.disk_capacity; tmp_usage = std::max(tmp_usage, curr_usage); Status curr_res = Status::OK(); @@ -992,7 +996,8 @@ void StorageEngine::_clean_unused_binlog_metas() { bool need_check) -> bool { if (need_check) { BinlogMetaEntryPB binlog_meta_pb; - if (UNLIKELY(!binlog_meta_pb.ParseFromArray(value.data(), value.size()))) { + if (UNLIKELY(!binlog_meta_pb.ParseFromArray(value.data(), + cast_set<int>(value.size())))) { LOG(WARNING) << "parse rowset meta string failed for binlog meta key: " << key; } else if (_tablet_manager->get_tablet(binlog_meta_pb.tablet_id()) == nullptr) { LOG(INFO) << "failed to find tablet " << binlog_meta_pb.tablet_id() @@ -1746,5 +1751,5 @@ void CreateTabletRRIdxCache::set_index(const std::string& key, int next_idx) { auto* lru_handle = insert(key, value, 1, sizeof(int), CachePriority::NORMAL); release(lru_handle); } - +#include "common/compile_check_end.h" } // namespace doris diff --git a/be/src/util/network_util.cpp b/be/src/util/network_util.cpp index 3d93c2e183f..a76c94f13e0 100644 --- a/be/src/util/network_util.cpp +++ b/be/src/util/network_util.cpp @@ -34,8 +34,11 @@ #include <unistd.h> #include <chrono> +#include <cstdint> #include <sstream> +#include "common/cast_set.h" + #ifdef __APPLE__ #ifndef HOST_NAME_MAX #define HOST_NAME_MAX MAXHOSTNAMELEN @@ -43,7 +46,7 @@ #endif namespace doris { - +#include "common/compile_check_begin.h" InetAddress::InetAddress(std::string ip, sa_family_t family, bool is_loopback) : _ip_addr(ip), _family(family), _is_loopback(is_loopback) {} @@ -113,7 +116,7 @@ bool parse_endpoint(const std::string& endpoint, std::string* host, uint16_t* po return false; } *host = endpoint.substr(i, p - i); - *port = value; + *port = cast_set<uint16_t>(value); return true; } @@ -291,5 +294,5 @@ std::string get_brpc_http_url(const std::string& host, int port) { return fmt::format("http://{}:{}", host, port); } } - +#include "common/compile_check_end.h" } // namespace doris --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org