[obkv] fix auto split with global index scan return 4377
This commit is contained in:
@ -335,15 +335,9 @@ int ObTableCtx::inner_init_common(const ObTabletID &arg_tablet_id,
|
||||
LOG_WARN("fail to get tenant schema", K(ret), K_(tenant_id));
|
||||
} else if (FALSE_IT(init_physical_plan_ctx(timeout_ts, tenant_schema_version_))) {
|
||||
LOG_WARN("fail to init physical plan ctx", K(ret));
|
||||
} else if (!arg_tablet_id.is_valid()) {
|
||||
if (is_scan_) { // 扫描场景使用table_schema上的tablet id,客户端已经做了路由分发
|
||||
if (simple_table_schema_->is_partitioned_table()) { // 不支持分区表
|
||||
// classify whether the request is valid will do in function 'init_scan'
|
||||
tablet_id = ObTabletID::INVALID_TABLET_ID;
|
||||
} else {
|
||||
tablet_id = simple_table_schema_->get_tablet_id();
|
||||
}
|
||||
} else { // dml场景使用rowkey计算出tablet id
|
||||
} else if (!arg_tablet_id.is_valid() && !is_scan_) {
|
||||
// for scan scene, we will process it in init_scan when tablet_id is invalid
|
||||
// because we need to know if use index and index_type
|
||||
if (!simple_table_schema_->is_partitioned_table()) {
|
||||
tablet_id = simple_table_schema_->get_tablet_id();
|
||||
} else {
|
||||
@ -354,7 +348,6 @@ int ObTableCtx::inner_init_common(const ObTabletID &arg_tablet_id,
|
||||
LOG_WARN("partitioned table should pass right tablet id from client", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (!is_scan_ && !ls_id_.is_valid() && OB_FAIL(GCTX.location_service_->get(tenant_id_,
|
||||
@ -934,15 +927,23 @@ int ObTableCtx::init_scan(const ObTableQuery &query,
|
||||
query.get_filter_string().length() > 0;
|
||||
limit_ = is_query_with_filter || is_ttl_table() ? -1 : query.get_limit(); // query with filter or ttl table can't pushdown limit
|
||||
offset_ = is_ttl_table() ? 0 : query.get_offset();
|
||||
// init is_index_scan_
|
||||
if (index_name.empty() || 0 == index_name.case_compare(ObIndexHint::PRIMARY_KEY)) { // scan with primary key
|
||||
index_table_id_ = ref_table_id_;
|
||||
if (!index_tablet_id_.is_valid()) {
|
||||
if (!tablet_id_.is_valid()) {
|
||||
if (simple_table_schema_->is_partitioned_table()) {
|
||||
// trigger client to refresh table entry
|
||||
// maybe drop a non-partitioned table and create a
|
||||
// partitioned table with same name
|
||||
ret = OB_SCHEMA_ERROR;
|
||||
LOG_WARN("partitioned table should pass right tablet id from client", K(ret));
|
||||
} else {
|
||||
tablet_id_ = simple_table_schema_->get_tablet_id();
|
||||
}
|
||||
}
|
||||
// init is_index_scan_
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (index_name.empty() || 0 == index_name.case_compare(ObIndexHint::PRIMARY_KEY)) { // scan with primary key
|
||||
index_table_id_ = ref_table_id_;
|
||||
if (!index_tablet_id_.is_valid()) {
|
||||
index_tablet_id_ = tablet_id_;
|
||||
}
|
||||
is_index_back_ = false;
|
||||
} else {
|
||||
|
@ -226,6 +226,7 @@ int ObTableApiModifyExecutor::calc_tablet_loc(ObExpr *calc_part_id_expr,
|
||||
ObDASTabletLoc *&tablet_loc)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
tablet_loc = nullptr;
|
||||
if (OB_NOT_NULL(calc_part_id_expr)) {
|
||||
ObObjectID partition_id = OB_INVALID_ID;
|
||||
ObTabletID tablet_id;
|
||||
@ -242,6 +243,20 @@ int ObTableApiModifyExecutor::calc_tablet_loc(ObExpr *calc_part_id_expr,
|
||||
LOG_WARN("fail to calc local tablet loc", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_ISNULL(tablet_loc)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tablet loc is NULL", K(ret), K(table_loc), KP(calc_part_id_expr));
|
||||
} else {
|
||||
transaction::ObTxReadSnapshot &snapshot = exec_ctx_.get_das_ctx().get_snapshot();
|
||||
bool is_ls_snapshot = snapshot.is_ls_snapshot();
|
||||
if (is_ls_snapshot) {
|
||||
if (tablet_loc->ls_id_ != snapshot.snapshot_lsid_) {
|
||||
ret = OB_SNAPSHOT_DISCARDED;
|
||||
LOG_WARN("snapshot_ls_id is not equal tablet_loc ls_id", K(snapshot.snapshot_lsid_), KPC(tablet_loc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -103,7 +103,8 @@ public:
|
||||
|| is_transaction_rpc_timeout_err(err)
|
||||
|| is_has_no_readable_replica_err(err)
|
||||
|| is_select_dup_follow_replic_err(err)
|
||||
|| is_trans_stmt_need_retry_error(err);
|
||||
|| is_trans_stmt_need_retry_error(err)
|
||||
|| is_snapshot_discarded_err(err);
|
||||
}
|
||||
|
||||
OB_INLINE static bool need_do_move_response(const int err, const obrpc::ObRpcPacket &rpc_pkt)
|
||||
|
Reference in New Issue
Block a user