[CP][BUGFIX] fix trim process single outrow lob

This commit is contained in:
skylhd
2024-03-15 11:45:43 +00:00
committed by ob-robot
parent eec6a7d098
commit 1dc1bc30e7
5 changed files with 134 additions and 34 deletions

View File

@ -560,6 +560,14 @@ int ObTextStringIter::get_next_block_inner(ObString &str)
COMMON_LOG(WARN,"Lob: falied to get first block.", K(ret));
}
} else {
// if put backward, we should compact buffer remain and move reserved part closed to the reading value
if (output_data.remain() > 0 && ctx_->is_backward_ && ctx_->reserved_byte_len_ > 0) {
// from :[0, output_data.length_][output_data.length_, output_data.buffer_size_][reserved_part]
// to :[0, output_data.length_][reserved_part]
MEMMOVE(output_data.ptr() + output_data.length(),
output_data.ptr() + output_data.length() + output_data.remain(),
ctx_->reserved_byte_len_);
}
ctx_->content_byte_len_ = ctx_->reserved_byte_len_ + output_data.length();
// ToDo: @gehao get directly from lob mngr ?
uint32 cur_out_len = static_cast<uint32_t>(ObCharset::strlen_char(cs_type_,
@ -569,7 +577,7 @@ int ObTextStringIter::get_next_block_inner(ObString &str)
ctx_->last_accessed_byte_len_ = ctx_->accessed_byte_len_;
ctx_->last_accessed_len_ = ctx_->accessed_len_;
ctx_->accessed_byte_len_ += output_data.length();
ctx_->accessed_len_ += cur_out_len;\
ctx_->accessed_len_ += cur_out_len;
ctx_->iter_count_++;
str.assign_ptr(ctx_->buff_, ctx_->content_byte_len_);
}
@ -658,7 +666,7 @@ void ObTextStringIter::set_reserved_byte_len(uint32_t reserved_byte_len)
void ObTextStringIter::reset_reserve_len()
{
if (is_valid_for_config()) {
if (is_valid_for_config(TEXTSTRING_ITER_NEXT)) {
ctx_->reserved_byte_len_ = 0;
ctx_->reserved_len_ = 0;
}