Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lihongda1002
oceanbase
提交
30c702d3
O
oceanbase
项目概览
lihongda1002
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
30c702d3
编写于
11月 07, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
11月 07, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix duplicated system table name problem
上级
8d2d0ef5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
16 deletion
+37
-16
src/share/schema/ob_schema_getter_guard.cpp
src/share/schema/ob_schema_getter_guard.cpp
+1
-0
src/share/schema/ob_schema_mgr.cpp
src/share/schema/ob_schema_mgr.cpp
+34
-14
src/share/schema/ob_schema_struct.cpp
src/share/schema/ob_schema_struct.cpp
+2
-2
未找到文件。
src/share/schema/ob_schema_getter_guard.cpp
浏览文件 @
30c702d3
...
...
@@ -1530,6 +1530,7 @@ int ObSchemaGetterGuard::get_table_id(uint64_t tenant_id,
}
}
else
{
if
(
TEMP_TABLE_TYPE
==
check_type
&&
!
is_inner_table
(
simple_table
->
get_table_id
())
&&
false
==
simple_table
->
is_tmp_table
())
{
// temporary table is not finded.
LOG_TRACE
(
"request for temporary table but non-temporary table returned"
,
K
(
session_id_
),
K
(
session_id
),
K
(
check_type
));
...
...
src/share/schema/ob_schema_mgr.cpp
浏览文件 @
30c702d3
...
...
@@ -3408,35 +3408,31 @@ int ObSchemaMgr::get_table_schema(
const
ObSimpleTableSchemaV2
*&
table_schema
)
const
{
int
ret
=
OB_SUCCESS
;
bool
is_system_table
=
false
;
table_schema
=
NULL
;
if
(
!
check_inner_stat
())
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"not init"
,
K
(
ret
));
LOG_WARN
(
"not init"
,
K
R
(
ret
));
}
else
if
(
OB_INVALID_ID
==
tenant_id
||
OB_INVALID_ID
==
database_id
||
table_name
.
empty
())
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid argument"
,
K
(
ret
),
K
(
tenant_id
),
K
(
database_id
),
K
(
table_name
));
}
else
if
(
OB_FAIL
(
ObSysTableChecker
::
is_sys_table_name
(
tenant_id
,
database_id
,
table_name
,
is_system_table
)))
{
LOG_WARN
(
"fail to check if table is system table"
,
K
(
ret
),
K
(
tenant_id
),
K
(
database_id
),
K
(
table_name
));
LOG_WARN
(
"invalid argument"
,
KR
(
ret
),
K
(
tenant_id
),
K
(
database_id
),
K
(
table_name
));
}
else
if
(
OB_INVALID_TENANT_ID
!=
tenant_id_
&&
OB_SYS_TENANT_ID
!=
tenant_id_
&&
tenant_id_
!=
tenant_id
)
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"tenant_id not matched"
,
K
(
ret
),
K
(
tenant_id
),
K_
(
tenant_id
));
LOG_WARN
(
"tenant_id not matched"
,
K
R
(
ret
),
K
(
tenant_id
),
K_
(
tenant_id
));
}
else
{
ObSimpleTableSchemaV2
*
tmp_schema
=
NULL
;
ObNameCaseMode
mode
=
OB_NAME_CASE_INVALID
;
if
(
OB_SYS_TENANT_ID
==
tenant_id_
||
is_system_table
)
{
// Scenarios for special handling of user tenant system tables
if
(
is_sys_tenant
(
tenant_id
))
{
mode
=
OB_ORIGIN_AND_INSENSITIVE
;
}
else
if
(
OB_FAIL
(
get_tenant_name_case_mode
(
tenant_id
,
mode
)))
{
LOG_WARN
(
"fail to get_tenant_name_case_mode"
,
K
(
tenant_id
),
K
(
ret
));
LOG_WARN
(
"fail to get_tenant_name_case_mode"
,
K
(
tenant_id
),
K
R
(
ret
));
}
else
if
(
OB_NAME_CASE_INVALID
==
mode
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"invalid case mode"
,
K
(
ret
),
K
(
mode
));
LOG_WARN
(
"invalid case mode"
,
K
R
(
ret
),
K
(
mode
));
}
if
(
OB_SUCC
(
ret
))
{
const
ObTableSchemaHashWrapper
table_name_wrapper
(
tenant_id
,
database_id
,
session_id
,
mode
,
table_name
);
...
...
@@ -3444,24 +3440,48 @@ int ObSchemaMgr::get_table_schema(
if
(
OB_SUCCESS
==
hash_ret
)
{
if
(
OB_ISNULL
(
tmp_schema
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"NULL ptr"
,
K
(
ret
),
K
(
tmp_schema
));
LOG_WARN
(
"NULL ptr"
,
K
R
(
ret
),
K
(
table_name_wrapper
));
}
else
{
table_schema
=
tmp_schema
;
}
}
else
if
(
OB_HASH_NOT_EXIST
==
hash_ret
&&
0
!=
session_id
&&
OB_INVALID_ID
!=
session_id
)
{
// If session_id != 0, the search just now is based on the possible match of the temporary table.
// If it is not found, then it will be searched according to session_id = 0, which is the normal table.
const
ObTableSchemaHashWrapper
table_name_wrapper
2
(
tenant_id
,
database_id
,
0
,
mode
,
table_name
);
hash_ret
=
table_name_map_
.
get_refactored
(
table_name_wrapper
2
,
tmp_schema
);
const
ObTableSchemaHashWrapper
table_name_wrapper
1
(
tenant_id
,
database_id
,
0
,
mode
,
table_name
);
hash_ret
=
table_name_map_
.
get_refactored
(
table_name_wrapper
1
,
tmp_schema
);
if
(
OB_SUCCESS
==
hash_ret
)
{
if
(
OB_ISNULL
(
tmp_schema
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"NULL ptr"
,
K
(
ret
),
K
(
tmp_schema
));
LOG_WARN
(
"NULL ptr"
,
K
R
(
ret
),
K
(
table_name_wrapper1
));
}
else
{
table_schema
=
tmp_schema
;
}
}
}
// restrict creating duplicate table with existed inner table
if
(
OB_SUCC
(
ret
)
&&
OB_ISNULL
(
table_schema
))
{
bool
is_system_table
=
false
;
if
(
OB_FAIL
(
ObSysTableChecker
::
is_sys_table_name
(
tenant_id
,
database_id
,
table_name
,
is_system_table
)))
{
LOG_WARN
(
"fail to check if table is system table"
,
KR
(
ret
),
K
(
tenant_id
),
K
(
database_id
),
K
(
table_name
));
}
else
if
(
is_system_table
)
{
// Inner table's ObTableSchemaHashWrapper is stored with OB_ORIGIN_AND_INSENSITIVE. Actually,
// 1. For inner table in mysql database, comparision is insensitive.
// 2. For inner table in oracle database, comparision is sensitive.
const
ObTableSchemaHashWrapper
table_name_wrapper2
(
tenant_id
,
database_id
,
0
,
OB_ORIGIN_AND_INSENSITIVE
,
table_name
);
hash_ret
=
table_name_map_
.
get_refactored
(
table_name_wrapper2
,
tmp_schema
);
if
(
OB_SUCCESS
==
hash_ret
)
{
if
(
OB_ISNULL
(
tmp_schema
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"NULL ptr"
,
KR
(
ret
),
K
(
table_name_wrapper2
));
}
else
{
table_schema
=
tmp_schema
;
}
}
}
else
{
// not system table
}
}
}
}
...
...
src/share/schema/ob_schema_struct.cpp
浏览文件 @
30c702d3
...
...
@@ -219,7 +219,7 @@ int ObSysTableChecker::init_sys_table_name_map()
}
else
if
(
OB_FAIL
(
sys_table_name_map_
.
set_refactored
(
key
,
value
)))
{
LOG_WARN
(
"fail to set table name array"
,
K
(
ret
),
K
(
key
),
K
(
table
));
}
else
{
LOG_INFO
(
"set tenant space table name"
,
K
(
key
),
K
(
table
));
LOG_INFO
(
"set tenant space table name"
,
K
(
key
),
K
(
table
)
,
"strlen"
,
table_name
.
length
()
);
}
}
else
if
(
OB_SUCCESS
==
ret
)
{
if
(
OB_ISNULL
(
value
))
{
...
...
@@ -323,7 +323,7 @@ int ObSysTableChecker::check_sys_table_name(
is_system_table
=
(
value
->
at
(
i
)
==
table
);
}
}
LOG_TRACE
(
"check sys table name"
,
K
(
ret
),
K
(
key
),
K
(
table
));
LOG_TRACE
(
"check sys table name"
,
K
(
ret
),
K
(
key
),
K
(
table
)
,
"strlen"
,
table_name
.
length
()
);
}
return
ret
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录