Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
天地威能
oceanbase
提交
d52570f1
O
oceanbase
项目概览
天地威能
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d52570f1
编写于
12月 05, 2022
作者:
H
Hongqin-Li
提交者:
OB-robot
12月 05, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix infinite retry when table dropped to recyclebin
上级
a7b14cd4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
16 deletion
+45
-16
src/rootserver/ddl_task/ob_constraint_task.cpp
src/rootserver/ddl_task/ob_constraint_task.cpp
+8
-1
src/rootserver/ddl_task/ob_ddl_task.cpp
src/rootserver/ddl_task/ob_ddl_task.cpp
+8
-15
src/share/ob_ddl_common.cpp
src/share/ob_ddl_common.cpp
+24
-0
src/share/ob_ddl_common.h
src/share/ob_ddl_common.h
+5
-0
未找到文件。
src/rootserver/ddl_task/ob_constraint_task.cpp
浏览文件 @
d52570f1
...
...
@@ -212,6 +212,7 @@ int ObForeignKeyConstraintValidationTask::check_fk_by_send_sql() const
// for example: data_table_id will be parent_table_id when altering non-ref column type of parent table.
// https://work.aone.alibaba-inc.com/issue/38544828
const
ObTableSchema
*
data_table_schema
=
nullptr
;
const
ObDatabaseSchema
*
data_database_schema
=
nullptr
;
const
ObTableSchema
*
child_table_schema
=
nullptr
;
const
ObDatabaseSchema
*
child_database_schema
=
nullptr
;
const
ObTableSchema
*
parent_table_schema
=
nullptr
;
...
...
@@ -221,9 +222,15 @@ int ObForeignKeyConstraintValidationTask::check_fk_by_send_sql() const
LOG_WARN
(
"get tenant schema guard failed"
,
K
(
ret
),
K
(
tenant_id_
));
}
else
if
(
OB_FAIL
(
schema_guard
.
get_table_schema
(
tenant_id_
,
data_table_id_
,
data_table_schema
)))
{
LOG_WARN
(
"get table schema failed"
,
K
(
ret
),
K
(
tenant_id_
),
K
(
data_table_id_
));
}
else
if
(
OB_ISNULL
(
data_table_schema
))
{
}
else
if
(
OB_ISNULL
(
data_table_schema
)
||
data_table_schema
->
is_in_recyclebin
()
)
{
ret
=
OB_TABLE_NOT_EXIST
;
LOG_WARN
(
"table schema not exist"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
schema_guard
.
get_database_schema
(
tenant_id_
,
data_table_schema
->
get_database_id
(),
data_database_schema
)))
{
LOG_WARN
(
"failed to get database schema"
,
K
(
ret
));
}
else
if
(
OB_ISNULL
(
data_database_schema
)
||
data_database_schema
->
is_in_recyclebin
())
{
// ob drop database to recyclebin won't drop its tables to recyclebin, but will drop fk of its tables directly.
ret
=
OB_TABLE_NOT_EXIST
;
LOG_WARN
(
"database schema not exist"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
get_foreign_key_info
(
data_table_schema
,
fk_info
)))
{
LOG_WARN
(
"get foreign key info failed"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
schema_guard
.
get_table_schema
(
tenant_id_
,
fk_info
.
parent_table_id_
,
parent_table_schema
)))
{
...
...
src/rootserver/ddl_task/ob_ddl_task.cpp
浏览文件 @
d52570f1
...
...
@@ -652,6 +652,8 @@ bool ObDDLTask::is_replica_build_need_retry(
const
ObTableSchema
*
table_schema
=
nullptr
;
if
(
OB_FAIL
(
ObMultiVersionSchemaService
::
get_instance
().
get_tenant_schema_guard
(
tenant_id_
,
schema_guard
)))
{
LOG_WARN
(
"get tenant schema guard failed"
,
K
(
ret
),
K_
(
tenant_id
));
}
else
if
(
OB_FAIL
(
ObDDLUtil
::
check_table_exist
(
tenant_id_
,
object_id_
,
schema_guard
)))
{
LOG_WARN
(
"failed to check table exist"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
schema_guard
.
get_table_schema
(
tenant_id_
,
object_id_
,
table_schema
)))
{
LOG_WARN
(
"get table schema failed"
,
K
(
ret
),
K
(
tenant_id_
),
K
(
object_id_
));
}
else
if
(
OB_ISNULL
(
table_schema
))
{
...
...
@@ -668,24 +670,15 @@ bool ObDDLTask::is_replica_build_need_retry(
if
(
target_object_id_
!=
fk_infos
.
at
(
i
).
foreign_key_id_
)
{
}
else
{
found
=
true
;
if
(
OB_FAIL
(
schema_guard
.
check_table_exist
(
tenant_id_
,
fk_infos
.
at
(
i
).
parent_table_id_
,
is_table_exist
)))
{
LOG_WARN
(
"check schema exist failed"
,
K
(
ret
),
K
(
tenant_id_
),
K
(
fk_infos
.
at
(
i
)));
}
else
if
(
!
is_table_exist
)
{
ret
=
OB_TABLE_NOT_EXIST
;
LOG_INFO
(
"table schema not exist"
,
K
(
ret
),
K
(
tenant_id_
),
K
(
object_id_
),
K
(
fk_infos
.
at
(
i
)));
}
else
if
(
OB_FAIL
(
schema_guard
.
check_table_exist
(
tenant_id_
,
fk_infos
.
at
(
i
).
child_table_id_
,
is_table_exist
)))
{
LOG_WARN
(
"check schema exist failed"
,
K
(
ret
),
K
(
tenant_id_
),
K
(
fk_infos
.
at
(
i
)));
}
else
if
(
!
is_table_exist
)
{
ret
=
OB_TABLE_NOT_EXIST
;
LOG_INFO
(
"table schema not exist"
,
K
(
ret
),
K
(
tenant_id_
),
K
(
object_id_
),
K
(
fk_infos
.
at
(
i
)));
if
(
OB_FAIL
(
ObDDLUtil
::
check_table_exist
(
tenant_id_
,
fk_infos
.
at
(
i
).
parent_table_id_
,
schema_guard
)))
{
LOG_WARN
(
"failed to check table exist"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObDDLUtil
::
check_table_exist
(
tenant_id_
,
fk_infos
.
at
(
i
).
child_table_id_
,
schema_guard
)))
{
LOG_WARN
(
"failed to check table exist"
,
K
(
ret
));
}
}
}
}
else
if
(
OB_FAIL
(
schema_guard
.
check_table_exist
(
tenant_id_
,
target_object_id_
,
is_table_exist
)))
{
LOG_WARN
(
"check table exist failed"
,
K
(
ret
),
K
(
tenant_id_
),
K
(
target_object_id_
));
}
else
if
(
!
is_table_exist
)
{
ret
=
OB_TABLE_NOT_EXIST
;
LOG_WARN
(
"not exist"
,
K
(
ret
),
K
(
tenant_id_
),
K
(
target_object_id_
));
}
else
if
(
OB_FAIL
(
ObDDLUtil
::
check_table_exist
(
tenant_id_
,
target_object_id_
,
schema_guard
)))
{
LOG_WARN
(
"failed to check table exist"
,
K
(
ret
));
}
}
}
else
{
...
...
src/share/ob_ddl_common.cpp
浏览文件 @
d52570f1
...
...
@@ -875,6 +875,30 @@ int ObDDLUtil::get_sys_ls_leader_addr(
return
ret
;
}
int
ObDDLUtil
::
check_table_exist
(
const
uint64_t
tenant_id
,
const
uint64_t
table_id
,
ObSchemaGetterGuard
&
schema_guard
)
{
int
ret
=
OB_SUCCESS
;
const
ObTableSchema
*
table_schema
=
nullptr
;
const
ObDatabaseSchema
*
database_schema
=
nullptr
;
uint64_t
database_id
=
OB_INVALID_ID
;
if
(
OB_FAIL
(
schema_guard
.
get_table_schema
(
tenant_id
,
table_id
,
table_schema
)))
{
LOG_WARN
(
"failed to get table schema"
,
K
(
ret
));
}
else
if
(
OB_ISNULL
(
table_schema
)
||
table_schema
->
is_in_recyclebin
())
{
ret
=
OB_TABLE_NOT_EXIST
;
LOG_WARN
(
"table not exist"
,
K
(
ret
),
K
(
tenant_id
),
K
(
table_id
),
K
(
table_schema
));
}
else
if
(
OB_FALSE_IT
(
database_id
=
table_schema
->
get_database_id
()))
{
}
else
if
(
OB_FAIL
(
schema_guard
.
get_database_schema
(
tenant_id
,
database_id
,
database_schema
)))
{
LOG_WARN
(
"failed to get database schema"
,
K
(
ret
),
K
(
tenant_id
),
K
(
table_id
),
K
(
database_id
));
}
else
if
(
OB_ISNULL
(
database_schema
)
||
database_schema
->
is_in_recyclebin
())
{
ret
=
OB_TABLE_NOT_EXIST
;
LOG_WARN
(
"database not exist"
,
K
(
ret
),
K
(
tenant_id
),
K
(
table_id
),
K
(
database_id
),
K
(
database_schema
));
}
return
ret
;
}
/****************** ObCheckTabletDataComplementOp *************/
int
ObCheckTabletDataComplementOp
::
check_task_inner_sql_session_status
(
...
...
src/share/ob_ddl_common.h
浏览文件 @
d52570f1
...
...
@@ -300,6 +300,11 @@ public:
const
common
::
ObTabletID
&
tablet_id
,
ObLSLocation
&
location
);
static
int
check_table_exist
(
const
uint64_t
tenant_id
,
const
uint64_t
table_id
,
share
::
schema
::
ObSchemaGetterGuard
&
schema_guard
);
private:
static
int
generate_column_name_str
(
const
common
::
ObIArray
<
ObColumnNameInfo
>
&
column_names
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录