Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
e93afdc7
O
oceanbase
项目概览
Metz
/
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看板
提交
e93afdc7
编写于
8月 24, 2021
作者:
Z
zs0
提交者:
wangzelin.wzl
8月 24, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
check before auto migrate unit
上级
d011a522
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
20 deletion
+28
-20
src/rootserver/ob_server_balancer.cpp
src/rootserver/ob_server_balancer.cpp
+19
-8
src/rootserver/ob_server_balancer.h
src/rootserver/ob_server_balancer.h
+2
-2
src/rootserver/ob_unit_manager.cpp
src/rootserver/ob_unit_manager.cpp
+5
-8
src/rootserver/ob_unit_manager.h
src/rootserver/ob_unit_manager.h
+2
-2
未找到文件。
src/rootserver/ob_server_balancer.cpp
浏览文件 @
e93afdc7
...
...
@@ -203,7 +203,8 @@ int ObServerBalancer::distribute_pool_for_standalone_sys_unit(
}
}
else
if
(
OB_FAIL
(
get_unit_resource_reservation
(
unit
->
unit_id_
,
migrate_server
,
in_migrate_unit_stat
)))
{
LOG_WARN
(
"fail to get unit resource reservation"
,
K
(
ret
),
K
(
unit
),
K
(
migrate_server
));
}
else
if
(
OB_FAIL
(
try_migrate_unit
(
unit
->
unit_id_
,
unit_stat
,
in_migrate_unit_stat
,
migrate_server
)))
{
}
else
if
(
OB_FAIL
(
try_migrate_unit
(
unit
->
unit_id_
,
pool
.
tenant_id_
,
unit_stat
,
in_migrate_unit_stat
,
migrate_server
)))
{
LOG_WARN
(
"fail to migrate unit"
,
K
(
ret
),
K
(
unit
),
K
(
unit_stat
),
K
(
in_migrate_unit_stat
));
}
}
...
...
@@ -319,8 +320,8 @@ int ObServerBalancer::distribute_for_unit_intersect()
}
else
if
(
OB_FAIL
(
get_unit_resource_reservation
(
unit
.
unit_
.
unit_id_
,
migrate_server
,
in_migrate_unit_stat
)))
{
LOG_WARN
(
"fail to get unit resource reservation"
,
K
(
ret
),
K
(
unit
),
K
(
migrate_server
));
}
else
if
(
OB_FAIL
(
try_migrate_unit
(
unit
.
unit_
.
unit_id_
,
unit_stat
,
in_migrate_unit_stat
,
migrate_server
)))
{
}
else
if
(
OB_FAIL
(
try_migrate_unit
(
unit
.
unit_
.
unit_id_
,
tenant_id
,
unit_stat
,
in_migrate_unit_stat
,
migrate_server
)))
{
LOG_WARN
(
"fail to migrate unit"
,
K
(
ret
),
K
(
unit
),
K
(
unit_stat
),
K
(
in_migrate_unit_stat
));
}
}
...
...
@@ -575,7 +576,11 @@ int ObServerBalancer::distribute_for_permanent_offline_or_delete(
ObArray
<
ObUnitStat
>
in_migrate_unit_stat
;
if
(
OB_FAIL
(
get_unit_resource_reservation
(
unit_info
.
unit_
.
unit_id_
,
migrate_server
,
in_migrate_unit_stat
)))
{
LOG_WARN
(
"get_unit_resource_reservation failed"
,
K
(
unit_info
),
K
(
ret
));
}
else
if
(
OB_FAIL
(
try_migrate_unit
(
unit_info
.
unit_
.
unit_id_
,
unit_stat
,
in_migrate_unit_stat
,
migrate_server
)))
{
}
else
if
(
OB_FAIL
(
try_migrate_unit
(
unit_info
.
unit_
.
unit_id_
,
unit_info
.
pool_
.
tenant_id_
,
unit_stat
,
in_migrate_unit_stat
,
migrate_server
)))
{
LOG_WARN
(
"fail to try migrate unit"
,
"unit"
,
unit_info
.
unit_
,
K
(
migrate_server
),
K
(
ret
));
}
else
{
LOG_INFO
(
"migrate unit success"
,
K
(
unit_info
),
K
(
status
),
"dest_server"
,
migrate_server
);
...
...
@@ -649,7 +654,11 @@ int ObServerBalancer::distribute_for_migrate_in_blocked(const ObUnitInfo& unit_i
K
(
ret
));
}
else
if
(
OB_FAIL
(
get_unit_resource_reservation
(
unit_info
.
unit_
.
unit_id_
,
new_server
,
in_migrate_unit_stat
)))
{
LOG_WARN
(
"get_unit_resource_reservation failed"
,
K
(
unit_info
),
K
(
ret
));
}
else
if
(
OB_FAIL
(
try_migrate_unit
(
unit_info
.
unit_
.
unit_id_
,
unit_stat
,
in_migrate_unit_stat
,
new_server
)))
{
}
else
if
(
OB_FAIL
(
try_migrate_unit
(
unit_info
.
unit_
.
unit_id_
,
unit_info
.
pool_
.
tenant_id_
,
unit_stat
,
in_migrate_unit_stat
,
new_server
)))
{
LOG_WARN
(
"fail to try migrate unit "
,
"unit"
,
unit_info
.
unit_
,
K
(
new_server
),
K
(
ret
));
}
}
...
...
@@ -699,15 +708,15 @@ int ObServerBalancer::get_unit_resource_reservation(
return
ret
;
}
int
ObServerBalancer
::
try_migrate_unit
(
const
uint64_t
unit_id
,
const
ObUnitStat
&
unit_stat
,
const
ObIArray
<
ObUnitStat
>
&
migrating_unit_stat
,
const
ObAddr
&
dst
)
int
ObServerBalancer
::
try_migrate_unit
(
const
uint64_t
unit_id
,
const
uint64_t
tenant_id
,
const
ObUnitStat
&
unit_stat
,
const
ObIArray
<
ObUnitStat
>
&
migrating_unit_stat
,
const
ObAddr
&
dst
)
{
int
ret
=
OB_SUCCESS
;
if
(
!
inited_
)
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"server balancer not init"
,
K_
(
inited
),
K
(
ret
));
}
else
{
ret
=
unit_mgr_
->
try_migrate_unit
(
unit_id
,
unit_stat
,
migrating_unit_stat
,
dst
);
ret
=
unit_mgr_
->
try_migrate_unit
(
unit_id
,
tenant_id
,
unit_stat
,
migrating_unit_stat
,
dst
);
unit_migrated_
=
true
;
}
return
ret
;
...
...
@@ -3222,6 +3231,7 @@ int ObServerBalancer::do_migrate_unit_task(const common::ObIArray<UnitMigrateSta
in_migrate_unit_stat
)))
{
LOG_WARN
(
"fail to get unit resource reservation"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
try_migrate_unit
(
unit_migrate_stat
.
unit_load_
.
unit_
->
unit_id_
,
unit_migrate_stat
.
unit_load_
.
pool_
->
tenant_id_
,
unit_stat
,
in_migrate_unit_stat
,
unit_migrate_stat
.
arranged_pos_
)))
{
...
...
@@ -3279,6 +3289,7 @@ int ObServerBalancer::do_migrate_unit_task(const common::ObIArray<UnitMigrateSta
in_migrate_unit_stat
)))
{
LOG_WARN
(
"fail to get unit resource reservation"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
try_migrate_unit
(
unit_migrate_stat
->
unit_load_
.
unit_
->
unit_id_
,
unit_migrate_stat
->
unit_load_
.
pool_
->
tenant_id_
,
unit_stat
,
in_migrate_unit_stat
,
unit_migrate_stat
->
arranged_pos_
)))
{
...
...
src/rootserver/ob_server_balancer.h
浏览文件 @
e93afdc7
...
...
@@ -272,8 +272,8 @@ private:
int
get_unit_resource_reservation
(
uint64_t
unit_id
,
const
common
::
ObAddr
&
new_server
,
common
::
ObIArray
<
share
::
ObUnitStat
>&
in_migrate_unit_stat
);
int
try_migrate_unit
(
const
uint64_t
unit_id
,
const
share
::
ObUnitStat
&
unit_stat
,
const
common
::
ObIArray
<
share
::
ObUnitStat
>
&
migrating_unit_stat
,
const
common
::
ObAddr
&
dst
);
int
try_migrate_unit
(
const
uint64_t
unit_id
,
const
uint64_t
tenant_id
,
const
share
::
ObUnitStat
&
unit_stat
,
const
common
::
ObIArray
<
share
::
ObUnitStat
>
&
migrating_unit_stat
,
const
common
::
ObAddr
&
dst
);
int
try_cancel_migrate_unit
(
const
share
::
ObUnit
&
unit
,
bool
&
is_canceled
);
...
...
src/rootserver/ob_unit_manager.cpp
浏览文件 @
e93afdc7
...
...
@@ -8187,8 +8187,8 @@ int ObUnitManager::check_can_migrate_in(const ObAddr& server, bool& can_migrate_
return
ret
;
}
int
ObUnitManager
::
try_migrate_unit
(
const
uint64_t
unit_id
,
const
ObUnitStat
&
unit_stat
,
const
ObIArray
<
ObUnitStat
>
&
migrating_unit_stat
,
const
ObAddr
&
dst
,
const
bool
is_manual
)
int
ObUnitManager
::
try_migrate_unit
(
const
uint64_t
unit_id
,
const
uint64_t
tenant_id
,
const
ObUnitStat
&
unit_stat
,
const
ObIArray
<
ObUnitStat
>
&
migrating_unit_stat
,
const
ObAddr
&
dst
,
const
bool
is_manual
)
{
int
ret
=
OB_SUCCESS
;
ObServerStatus
server_status
;
...
...
@@ -8237,13 +8237,10 @@ int ObUnitManager::try_migrate_unit(const uint64_t unit_id, const ObUnitStat& un
if
(
OB_SUCC
(
ret
))
{
bool
can_migrate
=
false
;
share
::
ObUnitInfo
unit_info
;
if
(
OB_FAIL
(
get_unit_info_by_id
(
unit_id
,
unit_info
)))
{
LOG_WARN
(
"fail to get unit info by id"
,
KR
(
ret
),
K
(
unit_id
));
}
else
if
(
OB_FAIL
(
check_unit_can_migrate
(
unit_info
.
pool_
.
tenant_id_
,
can_migrate
)))
{
LOG_WARN
(
"fail to check unit can migrate"
,
KR
(
ret
),
K
(
unit_info
),
K
(
can_migrate
));
if
(
OB_FAIL
(
check_unit_can_migrate
(
tenant_id
,
can_migrate
)))
{
LOG_WARN
(
"fail to check unit can migrate"
,
KR
(
ret
),
K
(
tenant_id
),
K
(
can_migrate
));
}
else
if
(
!
can_migrate
)
{
LOG_INFO
(
"can't migrate unit, don't need auto migrate unit"
,
K
(
unit_info
));
LOG_INFO
(
"can't migrate unit, don't need auto migrate unit"
,
K
(
tenant_id
));
}
else
if
(
OB_FAIL
(
migrate_unit
(
unit_id
,
dst
,
is_manual
)))
{
LOG_WARN
(
"fail migrate unit"
,
K
(
unit_id
),
K
(
dst
),
K
(
ret
));
}
...
...
src/rootserver/ob_unit_manager.h
浏览文件 @
e93afdc7
...
...
@@ -411,8 +411,8 @@ protected:
// check whether the target unit space is sufficient,
// if it is insufficient, do not migrate,
// and return OB_OP_NOT_ALLOW
int
try_migrate_unit
(
const
uint64_t
unit_id
,
const
share
::
ObUnitStat
&
unit_stat
,
const
common
::
ObIArray
<
share
::
ObUnitStat
>
&
migrating_unit_stat
,
const
common
::
ObAddr
&
dst
,
int
try_migrate_unit
(
const
uint64_t
unit_id
,
const
uint64_t
tenant_id
,
const
share
::
ObUnitStat
&
unit_stat
,
const
common
::
ObIArray
<
share
::
ObUnitStat
>
&
migrating_unit_stat
,
const
common
::
ObAddr
&
dst
,
const
bool
is_manual
=
false
);
int
get_zone_units
(
const
common
::
ObArray
<
share
::
ObResourcePool
*>&
pools
,
common
::
ObArray
<
ZoneUnit
>&
zone_units
)
const
;
virtual
int
end_migrate_unit
(
const
uint64_t
unit_id
,
const
EndMigrateOp
end_migrate_op
=
COMMIT
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录