[BUGFIX] fix lob bugs
This commit is contained in:
@ -528,7 +528,20 @@ int ObQueryDriver::process_lob_locator_results(ObObj& value,
|
|||||||
ObLobLocatorV2 loc(value.get_string(), value.has_lob_header());
|
ObLobLocatorV2 loc(value.get_string(), value.has_lob_header());
|
||||||
if (loc.is_lob_locator_v1()) {// do nothing, lob locator version 1
|
if (loc.is_lob_locator_v1()) {// do nothing, lob locator version 1
|
||||||
} else if (loc.is_valid()) { // lob locator v2
|
} else if (loc.is_valid()) { // lob locator v2
|
||||||
if (!loc.has_extern()) {
|
if (!loc.has_lob_header()) {
|
||||||
|
ObString data = value.get_string();
|
||||||
|
ObTextStringResult new_tmp_lob(value.get_type(), true, allocator);
|
||||||
|
if (OB_FAIL(new_tmp_lob.init(data.length()))) {
|
||||||
|
LOG_WARN("fail to init text string result", K(ret), K(new_tmp_lob), K(data.length()));
|
||||||
|
} else if (OB_FAIL(new_tmp_lob.append(data))) {
|
||||||
|
LOG_WARN("fail to append data", K(ret), K(new_tmp_lob), K(data.length()));
|
||||||
|
} else {
|
||||||
|
ObString res;
|
||||||
|
new_tmp_lob.get_result_buffer(res);
|
||||||
|
value.set_lob_value(value.get_type(), res.ptr(), res.length());
|
||||||
|
value.set_has_lob_header(); // must has lob header
|
||||||
|
}
|
||||||
|
} else if (!loc.has_extern()) {
|
||||||
// currently all temp lobs have extern field in oracle mode
|
// currently all temp lobs have extern field in oracle mode
|
||||||
// or the lob locator header cannot compatable with clients for 4.0
|
// or the lob locator header cannot compatable with clients for 4.0
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
@ -704,6 +717,8 @@ int ObQueryDriver::convert_text_value_charset(ObObj& value,
|
|||||||
// do nothing
|
// do nothing
|
||||||
} else if (OB_FAIL(lob.get_inrow_data(inrow_data))) {
|
} else if (OB_FAIL(lob.get_inrow_data(inrow_data))) {
|
||||||
LOG_WARN("fail to get inrow data", K(ret), K(lob));
|
LOG_WARN("fail to get inrow data", K(ret), K(lob));
|
||||||
|
} else if (inrow_data.length() == 0) {
|
||||||
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
int64_t lob_data_byte_len = inrow_data.length();
|
int64_t lob_data_byte_len = inrow_data.length();
|
||||||
int64_t offset_len = reinterpret_cast<uint64_t>(inrow_data.ptr()) - reinterpret_cast<uint64_t>(lob.ptr_);
|
int64_t offset_len = reinterpret_cast<uint64_t>(inrow_data.ptr()) - reinterpret_cast<uint64_t>(lob.ptr_);
|
||||||
|
|||||||
@ -1019,7 +1019,7 @@ int ObTextStringResult::calc_buffer_len(int64_t res_len)
|
|||||||
res_len += sizeof(ObLobCommon);
|
res_len += sizeof(ObLobCommon);
|
||||||
buff_len_ = ObLobLocatorV2::calc_locator_full_len(extern_flags, 0, static_cast<uint32_t>(res_len), false);
|
buff_len_ = ObLobLocatorV2::calc_locator_full_len(extern_flags, 0, static_cast<uint32_t>(res_len), false);
|
||||||
} else {
|
} else {
|
||||||
ret = OB_SIZE_OVERFLOW;
|
ret = OB_NOT_SUPPORTED;
|
||||||
LOG_WARN("Lob: out row temp lob not implemented, not support length bigger than 512M",
|
LOG_WARN("Lob: out row temp lob not implemented, not support length bigger than 512M",
|
||||||
K(ret), K(this), K(pos_), K(buff_len_), K(res_len));
|
K(ret), K(this), K(pos_), K(buff_len_), K(res_len));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -340,6 +340,8 @@ int ObExprOutputPack::convert_text_value_charset(common::ObObj& value,
|
|||||||
// do nothing
|
// do nothing
|
||||||
} else if (OB_FAIL(lob.get_inrow_data(inrow_data))) {
|
} else if (OB_FAIL(lob.get_inrow_data(inrow_data))) {
|
||||||
LOG_WARN("fail to get inrow data", K(ret), K(lob));
|
LOG_WARN("fail to get inrow data", K(ret), K(lob));
|
||||||
|
} else if (inrow_data.length() == 0) {
|
||||||
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
int64_t lob_data_byte_len = inrow_data.length();
|
int64_t lob_data_byte_len = inrow_data.length();
|
||||||
int64_t offset_len = reinterpret_cast<uint64_t>(inrow_data.ptr()) - reinterpret_cast<uint64_t>(lob.ptr_);
|
int64_t offset_len = reinterpret_cast<uint64_t>(inrow_data.ptr()) - reinterpret_cast<uint64_t>(lob.ptr_);
|
||||||
@ -494,12 +496,24 @@ int ObExprOutputPack::process_lob_locator_results(common::ObObj& value,
|
|||||||
ObLobLocatorV2 loc(value.get_string(), value.has_lob_header());
|
ObLobLocatorV2 loc(value.get_string(), value.has_lob_header());
|
||||||
if (loc.is_lob_locator_v1()) { // do nothing, lob locator version 1
|
if (loc.is_lob_locator_v1()) { // do nothing, lob locator version 1
|
||||||
} else if (loc.is_valid()) { // lob locator v2
|
} else if (loc.is_valid()) { // lob locator v2
|
||||||
if (!loc.has_extern()) { // if has header but without extern header
|
if (!loc.has_lob_header()) { // consider 4.0 will return no lob header obj
|
||||||
|
ObString data = value.get_string();
|
||||||
|
ObTextStringResult new_tmp_lob(value.get_type(), true, &alloc);
|
||||||
|
if (OB_FAIL(new_tmp_lob.init(data.length()))) {
|
||||||
|
LOG_WARN("fail to init text string result", K(ret), K(new_tmp_lob), K(data.length()));
|
||||||
|
} else if (OB_FAIL(new_tmp_lob.append(data))) {
|
||||||
|
LOG_WARN("fail to append data", K(ret), K(new_tmp_lob), K(data.length()));
|
||||||
|
} else {
|
||||||
|
ObString res;
|
||||||
|
new_tmp_lob.get_result_buffer(res);
|
||||||
|
value.set_lob_value(value.get_type(), res.ptr(), res.length());
|
||||||
|
value.set_has_lob_header(); // must has lob header
|
||||||
|
}
|
||||||
|
} else if (!loc.has_extern()) { // if has header but without extern header
|
||||||
// mock loc v2 with extern ? currently all temp lobs have extern field in oracle mode
|
// mock loc v2 with extern ? currently all temp lobs have extern field in oracle mode
|
||||||
// should not come here
|
// should not come here
|
||||||
OB_ASSERT(0);
|
OB_ASSERT(0);
|
||||||
}
|
} else if (!is_support_outrow_locator_v2 && !loc.has_inrow_data()) {
|
||||||
if (!is_support_outrow_locator_v2 && !loc.has_inrow_data()) {
|
|
||||||
if (OB_FAIL(ObTextStringIter::append_outrow_lob_fulldata(value, &my_session, alloc))) {
|
if (OB_FAIL(ObTextStringIter::append_outrow_lob_fulldata(value, &my_session, alloc))) {
|
||||||
LOG_WARN("Lob: convert lob to outrow failed", K(value), K(GET_MIN_CLUSTER_VERSION()));
|
LOG_WARN("Lob: convert lob to outrow failed", K(value), K(GET_MIN_CLUSTER_VERSION()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -420,7 +420,8 @@ int ObLobManager::is_remote(ObLobAccessParam& param, bool& is_remote, common::Ob
|
|||||||
} else {
|
} else {
|
||||||
is_remote = (dst_addr != self_addr);
|
is_remote = (dst_addr != self_addr);
|
||||||
if (param.from_rpc_ == true && is_remote) {
|
if (param.from_rpc_ == true && is_remote) {
|
||||||
LOG_WARN("call from rpc, but remote again", K(dst_addr), K(self_addr));
|
ret = OB_NOT_MASTER;
|
||||||
|
LOG_WARN("call from rpc, but remote again", K(ret), K(dst_addr), K(self_addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user