Fix core of table scan iter

This commit is contained in:
obdev
2022-11-15 07:08:07 +00:00
committed by wangzelin.wzl
parent 00bd416ba8
commit 5048204f42
3 changed files with 10 additions and 18 deletions

View File

@ -250,9 +250,9 @@ int ObExprToOutfileRow::print_field(char *buf, const int64_t buf_len, int64_t &p
auto escape_func = auto escape_func =
[buf, buf_len, &pos, need_enclose, &out_info] (ObString &code_point, int32_t wchar) -> int { [buf, buf_len, &pos, need_enclose, &out_info] (ObString &code_point, int32_t wchar) -> int {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (wchar == '\0') { if (wchar == '\0') {
OZ(out_info.escape_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_)); OZ(out_info.escape_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_));
OZ(print_wchar_to_buf(buf, buf_len, pos, '0', out_info.print_params_.cs_type_)); OZ(print_wchar_to_buf(buf, buf_len, pos, '0', out_info.print_params_.cs_type_));
} else if (wchar == out_info.wchar_enclose_ || wchar == out_info.wchar_escape_) { } else if (wchar == out_info.wchar_enclose_ || wchar == out_info.wchar_escape_) {
OZ(out_info.escape_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_)); OZ(out_info.escape_.print_plain_str_literal(buf, buf_len, pos, out_info.print_params_));
OZ(copy_string_to_buf(buf, buf_len, pos, code_point)); OZ(copy_string_to_buf(buf, buf_len, pos, code_point));

View File

@ -730,17 +730,16 @@ int ObLSTabletService::table_scan(ObTableScanIterator &iter, ObTableScanParam &p
} else if (OB_FAIL(get_tablet_with_timeout(param.tablet_id_, data_tablet, param.timeout_))) { } else if (OB_FAIL(get_tablet_with_timeout(param.tablet_id_, data_tablet, param.timeout_))) {
LOG_WARN("failed to check and get tablet", K(ret), K(param)); LOG_WARN("failed to check and get tablet", K(ret), K(param));
} else if (OB_FAIL(inner_table_scan(data_tablet, iter, param))) { } else if (OB_FAIL(inner_table_scan(data_tablet, iter, param))) {
LOG_WARN("failed to do table scan", K(ret), K(param)); LOG_WARN("failed to do table scan", K(ret), KP(&iter), K(param));
} else { } else {
result = &iter;
}
if (OB_SUCC(ret)) {
bool is_same = false; bool is_same = false;
allow_to_read_mgr_.check_read_info_same(read_info, is_same); allow_to_read_mgr_.check_read_info_same(read_info, is_same);
if (!is_same) { if (!is_same) {
ret = OB_REPLICA_NOT_READABLE; ret = OB_REPLICA_NOT_READABLE;
LOG_WARN("ls is not allow to read", K(ret), KPC(ls_)); LOG_WARN("ls is not allow to read", K(ret), KPC(ls_), KP(&iter));
} else {
// result should be assigned at the last
result = &iter;
} }
} }
NG_TRACE(S_table_scan_end); NG_TRACE(S_table_scan_end);

View File

@ -271,18 +271,11 @@ int ObAccessService::table_rescan(
ret = OB_NOT_SUPPORTED; ret = OB_NOT_SUPPORTED;
LOG_WARN("only table scan iter can be rescan", K(ret), K(result->get_type())); LOG_WARN("only table scan iter can be rescan", K(ret), K(result->get_type()));
} else if (!param.need_switch_param_) { } else if (!param.need_switch_param_) {
if (ObNewRowIterator::ObTableScanIterator == result->get_type() && if (OB_FAIL(static_cast<ObTableScanIterator*>(result)->rescan(param))) {
OB_FAIL(static_cast<ObTableScanIterator*>(result)->rescan(param))) {
LOG_WARN("rescan ObTableScanIterator failed", K(ret), K(result), K(vparam)); LOG_WARN("rescan ObTableScanIterator failed", K(ret), K(result), K(vparam));
} }
} else { } else {
ObTableScanIterator *iter = nullptr; ObTableScanIterator *iter = static_cast<ObTableScanIterator*>(result);
if (ObNewRowIterator::ObTableScanIterator == result->get_type()) {
iter = static_cast<ObTableScanIterator*>(result);
} else {
ret = OB_ERR_UNEXPECTED;
STORAGE_LOG(WARN, "Unexpected table iter type", K(ret), K(result->get_type()));
}
const share::ObLSID &ls_id = vparam.ls_id_; const share::ObLSID &ls_id = vparam.ls_id_;
const common::ObTabletID &data_tablet_id = vparam.tablet_id_; const common::ObTabletID &data_tablet_id = vparam.tablet_id_;
ObLS *ls = nullptr; ObLS *ls = nullptr;