[CP] Fix parallel create conflict problem
This commit is contained in:
1
deps/oblib/src/rpc/obrpc/ob_rpc_proxy.h
vendored
1
deps/oblib/src/rpc/obrpc/ob_rpc_proxy.h
vendored
@ -130,6 +130,7 @@ public:
|
|||||||
void destroy() { init_ = false; }
|
void destroy() { init_ = false; }
|
||||||
bool is_inited() const { return init_; }
|
bool is_inited() const { return init_; }
|
||||||
void set_timeout(int64_t timeout) { timeout_ = timeout; }
|
void set_timeout(int64_t timeout) { timeout_ = timeout; }
|
||||||
|
int64_t get_timeout() const { return timeout_; }
|
||||||
void set_trace_time(const bool is_trace_time) { is_trace_time_ = is_trace_time; }
|
void set_trace_time(const bool is_trace_time) { is_trace_time_ = is_trace_time; }
|
||||||
void set_ratelimit(const bool do_ratelimit) { do_ratelimit_ = do_ratelimit; }
|
void set_ratelimit(const bool do_ratelimit) { do_ratelimit_ = do_ratelimit; }
|
||||||
void set_bg_flow(const int8_t is_bg_flow) { is_bg_flow_ = is_bg_flow;}
|
void set_bg_flow(const int8_t is_bg_flow) { is_bg_flow_ = is_bg_flow;}
|
||||||
|
|||||||
@ -935,6 +935,12 @@ int ObCreateTableHelper::check_and_set_parent_table_id_()
|
|||||||
K(parent_database_id), K(parent_table_name));
|
K(parent_database_id), K(parent_table_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (foreign_key_arg.is_parent_table_mock_) {
|
||||||
|
ret = OB_ERR_PARALLEL_DDL_CONFLICT;
|
||||||
|
LOG_WARN("parenet table already exist, should retry",
|
||||||
|
KR(ret), K_(tenant_id), K(parent_table_id), K(foreign_key_arg));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// parent_table_id will be OB_INVALID_ID in the following cases:
|
// parent_table_id will be OB_INVALID_ID in the following cases:
|
||||||
// 1. foreign key is self reference.
|
// 1. foreign key is self reference.
|
||||||
|
|||||||
@ -563,6 +563,7 @@ class ObString;
|
|||||||
ACT(BEFORE_GET_CONFIG_VERSION_AND_TRANSFER_SCN,)\
|
ACT(BEFORE_GET_CONFIG_VERSION_AND_TRANSFER_SCN,)\
|
||||||
ACT(LS_GC_BEFORE_OFFLINE,)\
|
ACT(LS_GC_BEFORE_OFFLINE,)\
|
||||||
ACT(BEFORE_FETCH_SIMPLE_TABLES,)\
|
ACT(BEFORE_FETCH_SIMPLE_TABLES,)\
|
||||||
|
ACT(BEFORE_SEND_PARALLEL_CREATE_TABLE,)\
|
||||||
ACT(BEFORE_DROP_TENANT,)\
|
ACT(BEFORE_DROP_TENANT,)\
|
||||||
ACT(MAX_DEBUG_SYNC_POINT,)
|
ACT(MAX_DEBUG_SYNC_POINT,)
|
||||||
|
|
||||||
|
|||||||
@ -574,10 +574,11 @@ int ObCreateTableExecutor::execute(ObExecContext &ctx, ObCreateTableStmt &stmt)
|
|||||||
LOG_WARN("rpc proxy create table failed", KR(ret), "dst", common_rpc_proxy->get_server());
|
LOG_WARN("rpc proxy create table failed", KR(ret), "dst", common_rpc_proxy->get_server());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
DEBUG_SYNC(BEFORE_SEND_PARALLEL_CREATE_TABLE);
|
||||||
int64_t start_time = ObTimeUtility::current_time();
|
int64_t start_time = ObTimeUtility::current_time();
|
||||||
ObTimeoutCtx ctx;
|
ObTimeoutCtx ctx;
|
||||||
if (OB_FAIL(ObShareUtil::set_default_timeout_ctx(ctx, GCONF._ob_ddl_timeout))) {
|
if (OB_FAIL(ctx.set_timeout(common_rpc_proxy->get_timeout()))) {
|
||||||
LOG_WARN("fail to set timeout ctx", KR(ret));
|
LOG_WARN("fail to set timeout ctx", K(ret));
|
||||||
} else if (OB_FAIL(common_rpc_proxy->parallel_create_table(create_table_arg, res))) {
|
} else if (OB_FAIL(common_rpc_proxy->parallel_create_table(create_table_arg, res))) {
|
||||||
LOG_WARN("rpc proxy create table failed", KR(ret), "dst", common_rpc_proxy->get_server());
|
LOG_WARN("rpc proxy create table failed", KR(ret), "dst", common_rpc_proxy->get_server());
|
||||||
} else {
|
} else {
|
||||||
@ -2227,7 +2228,7 @@ int ObTruncateTableExecutor::execute(ObExecContext &ctx, ObTruncateTableStmt &st
|
|||||||
} else {
|
} else {
|
||||||
// new parallel truncate
|
// new parallel truncate
|
||||||
ObTimeoutCtx ctx;
|
ObTimeoutCtx ctx;
|
||||||
if (OB_FAIL(ObShareUtil::set_default_timeout_ctx(ctx, (static_cast<obrpc::ObRpcProxy*>(common_rpc_proxy))->timeout()))) {
|
if (OB_FAIL(ctx.set_timeout(common_rpc_proxy->get_timeout()))) {
|
||||||
LOG_WARN("fail to set timeout ctx", K(ret));
|
LOG_WARN("fail to set timeout ctx", K(ret));
|
||||||
} else {
|
} else {
|
||||||
int64_t start_time = ObTimeUtility::current_time();
|
int64_t start_time = ObTimeUtility::current_time();
|
||||||
|
|||||||
Reference in New Issue
Block a user