@@ -388,6 +388,7 @@ Status retry_rpc(std::string_view op_name, const Request& req, Response* res,
388388 static_assert (std::is_base_of_v<::google::protobuf::Message, Request>);
389389 static_assert (std::is_base_of_v<::google::protobuf::Message, Response>);
390390
391+ // Applies only to the current file, and all req are non-const, but passed as const types.
391392 const_cast <Request&>(req).set_request_ip (BackendOptions::get_be_endpoint ());
392393
393394 int retry_times = 0 ;
@@ -944,6 +945,17 @@ Status CloudMetaMgr::sync_tablet_delete_bitmap(CloudTablet* tablet, int64_t old_
944945 DeleteBitmapPtr new_delete_bitmap = std::make_shared<DeleteBitmap>(tablet->tablet_id ());
945946 *delete_bitmap = *new_delete_bitmap;
946947 }
948+
949+ if (read_version == 2 && config::delete_bitmap_store_write_version == 1 ) {
950+ return Status::InternalError (
951+ " please set delete_bitmap_store_read_version to 1 or 3 because "
952+ " delete_bitmap_store_write_version is 1" );
953+ } else if (read_version == 1 && config::delete_bitmap_store_write_version == 2 ) {
954+ return Status::InternalError (
955+ " please set delete_bitmap_store_read_version to 2 or 3 because "
956+ " delete_bitmap_store_write_version is 2" );
957+ }
958+
947959 int64_t new_max_version = std::max (old_max_version, rs_metas.rbegin ()->end_version ());
948960 // When there are many delete bitmaps that need to be synchronized, it
949961 // may take a longer time, especially when loading the tablet for the
@@ -1637,6 +1649,7 @@ Status CloudMetaMgr::update_delete_bitmap(const CloudTablet& tablet, int64_t loc
16371649 if (next_visible_version > 0 ) {
16381650 req.set_next_visible_version (next_visible_version);
16391651 }
1652+ req.set_store_version (store_version);
16401653
16411654 bool write_v1 = store_version == 1 || store_version == 3 ;
16421655 bool write_v2 = store_version == 2 || store_version == 3 ;
@@ -1784,6 +1797,10 @@ Status CloudMetaMgr::cloud_update_delete_bitmap_without_lock(
17841797 const CloudTablet& tablet, DeleteBitmap* delete_bitmap,
17851798 std::map<std::string, int64_t >& rowset_to_versions, int64_t pre_rowset_agg_start_version,
17861799 int64_t pre_rowset_agg_end_version) {
1800+ if (config::delete_bitmap_store_write_version == 2 ) {
1801+ VLOG_DEBUG << " no need to agg delete bitmap v1 in ms because use v2" ;
1802+ return Status::OK ();
1803+ }
17871804 LOG (INFO) << " cloud_update_delete_bitmap_without_lock, tablet_id: " << tablet.tablet_id ()
17881805 << " , delete_bitmap size: " << delete_bitmap->delete_bitmap .size ();
17891806 UpdateDeleteBitmapRequest req;
@@ -1915,12 +1932,12 @@ void CloudMetaMgr::remove_delete_bitmap_update_lock(int64_t table_id, int64_t lo
19151932 }
19161933}
19171934
1918- void CloudMetaMgr::check_table_size_correctness (const RowsetMeta& rs_meta) {
1935+ void CloudMetaMgr::check_table_size_correctness (RowsetMeta& rs_meta) {
19191936 if (!config::enable_table_size_correctness_check) {
19201937 return ;
19211938 }
19221939 int64_t total_segment_size = get_segment_file_size (rs_meta);
1923- int64_t total_inverted_index_size = get_inverted_index_file_szie (rs_meta);
1940+ int64_t total_inverted_index_size = get_inverted_index_file_size (rs_meta);
19241941 if (rs_meta.data_disk_size () != total_segment_size ||
19251942 rs_meta.index_disk_size () != total_inverted_index_size ||
19261943 rs_meta.data_disk_size () + rs_meta.index_disk_size () != rs_meta.total_disk_size ()) {
@@ -1939,9 +1956,9 @@ void CloudMetaMgr::check_table_size_correctness(const RowsetMeta& rs_meta) {
19391956 }
19401957}
19411958
1942- int64_t CloudMetaMgr::get_segment_file_size (const RowsetMeta& rs_meta) {
1959+ int64_t CloudMetaMgr::get_segment_file_size (RowsetMeta& rs_meta) {
19431960 int64_t total_segment_size = 0 ;
1944- const auto fs = const_cast <RowsetMeta&>( rs_meta) .fs ();
1961+ const auto fs = rs_meta.fs ();
19451962 if (!fs) {
19461963 LOG (WARNING) << " get fs failed, resource_id={}" << rs_meta.resource_id ();
19471964 }
@@ -1966,9 +1983,9 @@ int64_t CloudMetaMgr::get_segment_file_size(const RowsetMeta& rs_meta) {
19661983 return total_segment_size;
19671984}
19681985
1969- int64_t CloudMetaMgr::get_inverted_index_file_szie ( const RowsetMeta& rs_meta) {
1986+ int64_t CloudMetaMgr::get_inverted_index_file_size ( RowsetMeta& rs_meta) {
19701987 int64_t total_inverted_index_size = 0 ;
1971- const auto fs = const_cast <RowsetMeta&>( rs_meta) .fs ();
1988+ const auto fs = rs_meta.fs ();
19721989 if (!fs) {
19731990 LOG (WARNING) << " get fs failed, resource_id={}" << rs_meta.resource_id ();
19741991 }
0 commit comments