Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
天地威能
oceanbase
提交
65cde46d
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 搜索 >>
提交
65cde46d
编写于
12月 02, 2022
作者:
O
obdev
提交者:
OB-robot
12月 02, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] [to #44090387] fix package body create
上级
dc28e0e5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
20 deletion
+44
-20
src/rootserver/ob_ddl_operator.cpp
src/rootserver/ob_ddl_operator.cpp
+21
-11
src/rootserver/ob_ddl_operator.h
src/rootserver/ob_ddl_operator.h
+2
-1
src/share/schema/ob_routine_sql_service.cpp
src/share/schema/ob_routine_sql_service.cpp
+1
-1
src/sql/resolver/ddl/ob_create_package_resolver.cpp
src/sql/resolver/ddl/ob_create_package_resolver.cpp
+19
-6
src/sql/resolver/ddl/ob_create_package_resolver.h
src/sql/resolver/ddl/ob_create_package_resolver.h
+1
-1
未找到文件。
src/rootserver/ob_ddl_operator.cpp
浏览文件 @
65cde46d
...
...
@@ -7977,20 +7977,23 @@ int ObDDLOperator::update_routine_info(ObRoutineInfo &routine_info,
int64_t
tenant_id
,
int64_t
parent_id
,
int64_t
owner_id
,
int64_t
database_id
)
int64_t
database_id
,
int64_t
routine_id
=
OB_INVALID_ID
)
{
int
ret
=
OB_SUCCESS
;
uint64_t
new_routine_id
=
OB_INVALID_ID
;
uint64_t
new_routine_id
=
routine_id
;
int64_t
new_schema_version
=
OB_INVALID_VERSION
;
ObSchemaService
*
schema_service
=
schema_service_
.
get_schema_service
();
lib
::
Worker
::
CompatMode
compat_mode
=
lib
::
Worker
::
CompatMode
::
INVALID
;
if
(
OB_ISNULL
(
schema_service
))
{
ret
=
OB_ERR_SYS
;
LOG_ERROR
(
"schema_service must not null"
,
K
(
ret
));
}
else
if
(
OB_SYS_TENANT_ID
==
tenant_id
}
else
if
(
OB_INVALID_ID
==
new_routine_id
&&
OB_SYS_TENANT_ID
==
tenant_id
&&
OB_FAIL
(
schema_service
->
fetch_new_sys_pl_object_id
(
tenant_id
,
new_routine_id
)))
{
LOG_WARN
(
"failed to fetch new_routine_id"
,
K
(
tenant_id
),
K
(
ret
));
}
else
if
(
OB_SYS_TENANT_ID
!=
tenant_id
LOG_WARN
(
"failed to fetch new_routine_id"
,
K
(
tenant_id
),
K
(
ret
));
}
else
if
(
OB_INVALID_ID
==
new_routine_id
&&
OB_SYS_TENANT_ID
!=
tenant_id
&&
OB_FAIL
(
schema_service
->
fetch_new_routine_id
(
tenant_id
,
new_routine_id
)))
{
LOG_WARN
(
"failed to fetch new_routine_id"
,
K
(
tenant_id
),
K
(
ret
));
}
else
if
(
OB_FAIL
(
schema_service_
.
gen_new_schema_version
(
tenant_id
,
new_schema_version
)))
{
...
...
@@ -8055,22 +8058,29 @@ int ObDDLOperator::create_package(const ObPackageInfo *old_package_info,
LOG_WARN
(
"insert package info failed"
,
K
(
new_package_info
),
K
(
ret
));
}
else
{
ARRAY_FOREACH
(
public_routine_infos
,
routine_idx
)
{
ObRoutineInfo
&
routine_info
=
public_routine_infos
.
at
(
routine_idx
);
if
(
new_package_info
.
is_package
())
{
ObRoutineInfo
&
routine_info
=
public_routine_infos
.
at
(
routine_idx
);
if
(
OB_FAIL
(
update_routine_info
(
routine_info
,
tenant_id
,
new_package_info
.
get_package_id
(),
new_package_info
.
get_owner_id
(),
new_package_info
.
get_database_id
())))
{
tenant_id
,
new_package_info
.
get_package_id
(),
new_package_info
.
get_owner_id
(),
new_package_info
.
get_database_id
(),
routine_info
.
get_routine_id
())))
{
LOG_WARN
(
"failed to update routine info"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
schema_service
->
get_routine_sql_service
().
create_routine
(
routine_info
,
&
trans
,
NULL
)))
{
LOG_WARN
(
"insert routine info failed"
,
K
(
routine_info
),
K
(
ret
));
}
}
else
if
(
OB_INVALID_ID
==
routine_info
.
get_routine_id
())
{
OZ
(
update_routine_info
(
routine_info
,
tenant_id
,
routine_info
.
get_package_id
(),
routine_info
.
get_owner_id
(),
routine_info
.
get_database_id
()));
OZ
(
schema_service
->
get_routine_sql_service
().
create_routine
(
routine_info
,
&
trans
,
NULL
));
}
else
{
// update routine route sql
int64_t
new_schema_version
=
OB_INVALID_VERSION
;
ObRoutineInfo
&
routine_info
=
public_routine_infos
.
at
(
routine_idx
);
OZ
(
schema_service_
.
gen_new_schema_version
(
tenant_id
,
new_schema_version
));
OX
(
routine_info
.
set_schema_version
(
new_schema_version
));
OZ
(
schema_service
->
get_routine_sql_service
().
update_routine
(
routine_info
,
&
trans
));
...
...
src/rootserver/ob_ddl_operator.h
浏览文件 @
65cde46d
...
...
@@ -1015,7 +1015,8 @@ private:
int64_t
tenant_id
,
int64_t
parent_id
,
int64_t
owner_id
,
int64_t
database_id
);
int64_t
database_id
,
int64_t
routine_id
);
private:
int
drop_fk_cascade
(
...
...
src/share/schema/ob_routine_sql_service.cpp
浏览文件 @
65cde46d
...
...
@@ -200,7 +200,7 @@ int ObRoutineSqlService::update_routine(ObRoutineInfo &routine_info,
{
int
ret
=
OB_SUCCESS
;
CK
(
OB_NOT_NULL
(
sql_client
));
CK
(
routine_info
.
is_valid
(
));
OV
(
routine_info
.
is_valid
(),
OB_ERR_UNEXPECTED
,
K
(
routine_info
));
OZ
(
add_routine
(
*
sql_client
,
routine_info
,
true
));
if
(
OB_SUCC
(
ret
))
{
ObSchemaOperation
opt
;
...
...
src/sql/resolver/ddl/ob_create_package_resolver.cpp
浏览文件 @
65cde46d
...
...
@@ -167,10 +167,9 @@ int ObCreatePackageResolver::resolve(const ParseNode &parse_tree)
}
else
{}
}
if
(
OB_SUCC
(
ret
)
&&
resolve_success
)
{
if
(
OB_FAIL
(
resolve_functions_spec
(
package_info
,
create_package_arg
.
public_routine_infos_
,
package_ast
.
get_routine_table
())))
{
LOG_WARN
(
"failed to resolve function spec"
,
K
(
ret
));
}
OZ
(
resolve_functions_spec
(
package_info
,
create_package_arg
.
public_routine_infos_
,
package_ast
.
get_routine_table
()));
}
if
(
OB_SUCC
(
ret
))
{
ObString
dep_attr
;
...
...
@@ -315,6 +314,8 @@ int ObCreatePackageResolver::resolve_functions_spec(const ObPackageInfo &package
//process basic info
routine_info
.
set_tenant_id
(
package_info
.
get_tenant_id
());
routine_info
.
set_owner_id
(
package_info
.
get_owner_id
());
routine_info
.
set_database_id
(
package_info
.
get_database_id
());
routine_info
.
set_package_id
(
package_info
.
get_package_id
());
routine_info
.
set_routine_type
(
routine_type
);
routine_info
.
set_subprogram_id
(
i
);
routine_info
.
set_exec_env
(
package_info
.
get_exec_env
());
...
...
@@ -563,13 +564,25 @@ int ObCreatePackageBodyResolver::resolve(const ParseNode &parse_tree)
const
ObPLRoutineTable
&
body_routine_table
=
package_body_ast
.
get_routine_table
();
ObRoutineInfo
routine_info
;
const
ObPLRoutineInfo
*
pl_routine_info
=
NULL
;
ObArray
<
const
ObRoutineInfo
*>
routine_infos
;
ObSEArray
<
const
ObRoutineInfo
*
,
2
>
routine_infos
;
ObSEArray
<
ObRoutineInfo
,
2
>
routine_spec_infos
;
uint64_t
database_id
=
OB_INVALID_ID
;
OZ
(
schema_checker_
->
get_schema_guard
()
->
get_database_id
(
session_info_
->
get_effective_tenant_id
(),
db_name
,
database_id
));
OZ
(
schema_checker_
->
get_schema_guard
()
->
get_routine_infos_in_package
(
session_info_
->
get_effective_tenant_id
(),
package_spec_info
->
get_package_id
(),
routine_infos
));
if
(
OB_SUCC
(
ret
)
&&
routine_infos
.
empty
()
&&
package_spec_ast
.
get_routine_table
().
get_count
()
>
1
)
{
OZ
(
ObCreatePackageResolver
::
resolve_functions_spec
(
*
package_spec_info
,
routine_spec_infos
,
package_spec_ast
.
get_routine_table
()));
CK
(
routine_spec_infos
.
count
()
>
0
);
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
routine_spec_infos
.
count
();
++
i
)
{
OZ
(
routine_infos
.
push_back
(
&
routine_spec_infos
.
at
(
i
)));
}
}
OZ
(
update_routine_route_sql
(
*
allocator_
,
*
session_info_
,
routine_list
,
spec_routine_table
,
body_routine_table
,
routine_infos
));
}
...
...
@@ -659,7 +672,7 @@ int ObCreatePackageBodyResolver::update_routine_route_sql(ObIAllocator &allocato
ObIArray
<
ObRoutineInfo
>
&
public_routine_list
,
const
ObPLRoutineTable
&
spec_routine_table
,
const
ObPLRoutineTable
&
body_routine_table
,
ObArray
<
const
ObRoutineInfo
*>
&
routine_infos
)
Ob
I
Array
<
const
ObRoutineInfo
*>
&
routine_infos
)
{
int
ret
=
OB_SUCCESS
;
const
ObPLRoutineInfo
*
pl_routine_info
=
NULL
;
...
...
src/sql/resolver/ddl/ob_create_package_resolver.h
浏览文件 @
65cde46d
...
...
@@ -58,7 +58,7 @@ public:
ObIArray
<
ObRoutineInfo
>
&
public_routine_list
,
const
pl
::
ObPLRoutineTable
&
spec_routine_table
,
const
pl
::
ObPLRoutineTable
&
body_routine_table
,
ObArray
<
const
ObRoutineInfo
*>
&
routine_infos
);
Ob
I
Array
<
const
ObRoutineInfo
*>
&
routine_infos
);
private:
DISALLOW_COPY_AND_ASSIGN
(
ObCreatePackageBodyResolver
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录