@@ -98,11 +98,10 @@ void MergedIterator::Next(IteratorPtr iter, int iter_pos) {
9898
9999// base physics key, contain key of multi version.
100100std::string HalfSplitChecker::SplitKey (store::RegionPtr region, const pb::common::Range& range,
101- const std::vector<std::string>& cf_names, uint32_t & count) {
101+ const std::vector<std::string>& cf_names, uint32_t & count, int64_t & size ) {
102102 MergedIterator iter (raw_engine_, cf_names, range.end_key ());
103103 iter.Seek (range.start_key ());
104104
105- int64_t size = 0 ;
106105 int64_t chunk_size = 0 ;
107106 std::string prev_key;
108107 std::vector<std::string> keys;
@@ -136,11 +135,10 @@ std::string HalfSplitChecker::SplitKey(store::RegionPtr region, const pb::common
136135
137136// base physics key, contain key of multi version.
138137std::string SizeSplitChecker::SplitKey (store::RegionPtr region, const pb::common::Range& range,
139- const std::vector<std::string>& cf_names, uint32_t & count) {
138+ const std::vector<std::string>& cf_names, uint32_t & count, int64_t & size ) {
140139 MergedIterator iter (raw_engine_, cf_names, range.end_key ());
141140 iter.Seek (range.start_key ());
142141
143- int64_t size = 0 ;
144142 std::string prev_key;
145143 std::string split_key;
146144 bool is_split = false ;
@@ -168,11 +166,10 @@ std::string SizeSplitChecker::SplitKey(store::RegionPtr region, const pb::common
168166
169167// base logic key, ignore key of multi version.
170168std::string KeysSplitChecker::SplitKey (store::RegionPtr region, const pb::common::Range& range,
171- const std::vector<std::string>& cf_names, uint32_t & count) {
169+ const std::vector<std::string>& cf_names, uint32_t & count, int64_t & size ) {
172170 MergedIterator iter (raw_engine_, cf_names, range.end_key ());
173171 iter.Seek (range.start_key ());
174172
175- int64_t size = 0 ;
176173 int64_t split_key_count = 0 ;
177174 std::string prev_key;
178175 std::string split_key;
@@ -264,7 +261,8 @@ void SplitCheckTask::SplitCheck() {
264261 DINGO_LOG (INFO) << fmt::format (" [split.check][region({})] Will check SplitKey for raw_range{} cf_names({})" ,
265262 region_->Id (), Helper::RangeToString (plain_range), Helper::VectorToString (cf_names));
266263 uint32_t key_count = 0 ;
267- std::string encode_split_key = split_checker_->SplitKey (region_, encode_range, cf_names, key_count);
264+ int64_t size = 0 ;
265+ std::string encode_split_key = split_checker_->SplitKey (region_, encode_range, cf_names, key_count, size);
268266
269267 int64_t ts = 0 ;
270268 std::string plain_split_key;
@@ -273,9 +271,14 @@ void SplitCheckTask::SplitCheck() {
273271 }
274272
275273 // Update region key count metrics.
276- if (region_metrics_ != nullptr && key_count > 0 ) {
277- region_metrics_->SetKeyCount (key_count);
278- region_metrics_->SetNeedUpdateKeyCount (false );
274+ if (region_metrics_ != nullptr ) {
275+ if (key_count > 0 ) {
276+ region_metrics_->SetKeyCount (key_count);
277+ region_metrics_->SetNeedUpdateKeyCount (false );
278+ }
279+ if (size > 0 ) {
280+ region_metrics_->SetRegionSize (size);
281+ }
279282 }
280283
281284 bool need_split = true ;
0 commit comments