fix encoding when rows exceeds uint16_MAX
This commit is contained in:
		| @ -576,7 +576,7 @@ int ObMicroBlockEncoder::build_block(char *&buf, int64_t &size) | |||||||
|       if (OB_FAIL(set_row_data_pos(fix_data_size))) { |       if (OB_FAIL(set_row_data_pos(fix_data_size))) { | ||||||
|         LOG_WARN("set row data position failed", K(ret)); |         LOG_WARN("set row data position failed", K(ret)); | ||||||
|       } else { |       } else { | ||||||
|         header_->var_column_count_ = static_cast<int16_t>(var_data_encoders_.count()); |         header_->var_column_count_ = static_cast<uint16_t>(var_data_encoders_.count()); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @ -613,7 +613,7 @@ int ObMicroBlockEncoder::build_block(char *&buf, int64_t &size) | |||||||
|  |  | ||||||
|     // <5> fill header |     // <5> fill header | ||||||
|     if (OB_SUCC(ret)) { |     if (OB_SUCC(ret)) { | ||||||
|       header_->row_count_ = static_cast<int16_t>(datum_rows_.count()); |       header_->row_count_ = static_cast<uint32_t>(datum_rows_.count()); | ||||||
|       header_->encoding_has_out_row_column_ = has_out_row_column_; |       header_->encoding_has_out_row_column_ = has_out_row_column_; | ||||||
|  |  | ||||||
|       const int64_t header_size = header_->header_size_; |       const int64_t header_size = header_->header_size_; | ||||||
|  | |||||||
| @ -38,7 +38,8 @@ public: | |||||||
|   static const int64_t DEFAULT_ESTIMATE_REAL_SIZE_PCT = 150; |   static const int64_t DEFAULT_ESTIMATE_REAL_SIZE_PCT = 150; | ||||||
|  |  | ||||||
|   // maximum row count is restricted to 4 bytes in MicroBlockHeader |   // 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 |   // Unlike ObMicroBlockWriter, ObMicroBlockEncoder internally uses ObRowWriter and ObIColumnEncoder | ||||||
|   // to form row and column data. Both ObRowWriter and ObIColumnEncoder check buffer capacity by |   // 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. |   // calling ObBufferWriter::advance_zero. If buffer size is not enough, they return failure. | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 obdev
					obdev