fix bug of data compress in direct load

This commit is contained in:
coolfishchen
2023-07-13 06:18:05 +00:00
committed by ob-robot
parent 58764f7d2a
commit 945d494df8
2 changed files with 6 additions and 3 deletions

View File

@ -171,7 +171,7 @@ int ObDirectLoadDataBlockDecoder<Header>::prepare_data_block(char *buf, int64_t
if (OB_UNLIKELY(common::ObCompressorType::NONE_COMPRESSOR == compressor_type_)) {
ret = common::OB_ERR_UNEXPECTED;
STORAGE_LOG(WARN, "unexpected compressor type", KR(ret));
} else if (OB_FAIL(compressor_->decompress(buf + pos_, buf_size - pos_,
} else if (OB_FAIL(compressor_->decompress(buf + pos_, header_.occupy_size_ - pos_,
decompress_buf_ + pos_,
decompress_buf_size_ - pos_, decompress_size))) {
STORAGE_LOG(WARN, "fail to decompress", KR(ret));

View File

@ -186,9 +186,12 @@ int ObDirectLoadDataBlockEncoder<Header>::build_data_block(char *&buf, int64_t &
int64_t pos = 0;
header_.data_size_ = pos_;
header_.occupy_size_ = buf_size;
header_.checksum_ = ob_crc64_sse42(0, buf + header_size_, pos_ - header_size_);
if (OB_FAIL(header_.serialize(buf, buf_size, pos))) {
header_.checksum_ = ob_crc64_sse42(0, buf + header_size_, header_.occupy_size_ - header_size_);
if (OB_FAIL(header_.serialize(buf, header_size_, pos))) {
STORAGE_LOG(WARN, "fail to serialize header", KR(ret));
} else if (header_size_ != pos) {
ret = OB_ERR_UNEXPECTED;
STORAGE_LOG(WARN, "header_size must be equal pos", KR(ret), K(header_size_), K(pos));
}
}
}