diff --git a/src/storage/blocksstable/encoding/ob_micro_block_encoder.cpp b/src/storage/blocksstable/encoding/ob_micro_block_encoder.cpp index 6660898132..a4afca3836 100644 --- a/src/storage/blocksstable/encoding/ob_micro_block_encoder.cpp +++ b/src/storage/blocksstable/encoding/ob_micro_block_encoder.cpp @@ -576,7 +576,7 @@ int ObMicroBlockEncoder::build_block(char *&buf, int64_t &size) if (OB_FAIL(set_row_data_pos(fix_data_size))) { LOG_WARN("set row data position failed", K(ret)); } else { - header_->var_column_count_ = static_cast(var_data_encoders_.count()); + header_->var_column_count_ = static_cast(var_data_encoders_.count()); } } @@ -613,7 +613,7 @@ int ObMicroBlockEncoder::build_block(char *&buf, int64_t &size) // <5> fill header if (OB_SUCC(ret)) { - header_->row_count_ = static_cast(datum_rows_.count()); + header_->row_count_ = static_cast(datum_rows_.count()); header_->encoding_has_out_row_column_ = has_out_row_column_; const int64_t header_size = header_->header_size_; diff --git a/src/storage/blocksstable/encoding/ob_micro_block_encoder.h b/src/storage/blocksstable/encoding/ob_micro_block_encoder.h index 2ee28e1ec2..f34712b116 100644 --- a/src/storage/blocksstable/encoding/ob_micro_block_encoder.h +++ b/src/storage/blocksstable/encoding/ob_micro_block_encoder.h @@ -38,7 +38,8 @@ public: static const int64_t DEFAULT_ESTIMATE_REAL_SIZE_PCT = 150; // maximum row count is restricted to 4 bytes in MicroBlockHeader - static const int64_t MAX_MICRO_BLOCK_ROW_CNT = UINT32_MAX; + // But all_col_datums_ is restricted to 64K, so we limit maximum row count to uint16_max + static const int64_t MAX_MICRO_BLOCK_ROW_CNT = UINT16_MAX; // Unlike ObMicroBlockWriter, ObMicroBlockEncoder internally uses ObRowWriter and ObIColumnEncoder // to form row and column data. Both ObRowWriter and ObIColumnEncoder check buffer capacity by // calling ObBufferWriter::advance_zero. If buffer size is not enough, they return failure.