Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
obdeploy
提交
9398d0d6
O
obdeploy
项目概览
oceanbase
/
obdeploy
1 年多 前同步成功
通知
7
Star
73
Fork
132
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obdeploy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
9398d0d6
编写于
6月 29, 2022
作者:
F
frf12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v1.4.0
上级
fa4c735e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
11 deletion
+31
-11
_cmd.py
_cmd.py
+1
-1
plugins/tpcc/3.1.0/build.py
plugins/tpcc/3.1.0/build.py
+30
-10
未找到文件。
_cmd.py
浏览文件 @
9398d0d6
...
...
@@ -910,7 +910,7 @@ class TestMajorCommand(MajorCommand):
self
.
register_command
(
MySQLTestCommand
())
self
.
register_command
(
SysBenchCommand
())
self
.
register_command
(
TPCHCommand
())
#
self.register_command(TPCCCommand())
self
.
register_command
(
TPCCCommand
())
class
BenchMajorCommand
(
MajorCommand
):
...
...
plugins/tpcc/3.1.0/build.py
浏览文件 @
9398d0d6
...
...
@@ -42,6 +42,18 @@ def build(plugin_context, cursor, odp_cursor, *args, **kwargs):
def
local_execute_command
(
command
,
env
=
None
,
timeout
=
None
):
return
LocalClient
.
execute_command
(
command
,
env
,
timeout
,
stdio
)
def
execute
(
cursor
,
query
,
args
=
None
):
msg
=
query
%
tuple
(
args
)
if
args
is
not
None
else
query
stdio
.
verbose
(
'execute sql: %s'
%
msg
)
stdio
.
verbose
(
"query: %s. args: %s"
%
(
query
,
args
))
try
:
cursor
.
execute
(
query
,
args
)
return
cursor
.
fetchone
()
except
:
msg
=
'execute sql exception: %s'
%
msg
stdio
.
exception
(
msg
)
raise
Exception
(
msg
)
def
run_sql
(
sql_file
,
force
=
False
):
sql_cmd
=
"{obclient} -h{host} -P{port} -u{user}@{tenant} {password_arg} -A {db} {force_flag} < {sql_file}"
.
format
(
obclient
=
obclient_bin
,
host
=
host
,
port
=
port
,
user
=
user
,
tenant
=
tenant_name
,
...
...
@@ -130,22 +142,30 @@ def build(plugin_context, cursor, odp_cursor, *args, **kwargs):
stdio
.
exception
(
''
)
return
stdio
.
stop_loading
(
'succeed'
)
# drop old tables
bmsql_sql_path
=
kwargs
.
get
(
'bmsql_sql_path'
,
''
)
run_sql
(
sql_file
=
os
.
path
.
join
(
bmsql_sql_path
,
'tableDrops.sql'
),
force
=
True
)
retries
=
300
pending_free_count
=
-
1
while
pending_free_count
!=
0
and
retries
>
0
:
retries
-=
1
sql
=
'select pending_free_count from oceanbase.__all_virtual_macro_block_marker_status'
stdio
.
verbose
(
'execute sql: %s'
%
sql
)
cursor
.
execute
(
sql
)
ret
=
cursor
.
fetchone
()
stdio
.
verbose
(
'sql result: %s'
%
ret
)
pending_free_count
=
ret
.
get
(
'pending_free_count'
,
0
)
if
ret
else
0
merge_version
=
execute
(
cursor
,
"select value from oceanbase.__all_zone where name='frozen_version'"
)[
'value'
]
stdio
.
start_loading
(
'Merge'
)
execute
(
cursor
,
'alter system major freeze'
)
sql
=
"select value from oceanbase.__all_zone where name='frozen_version' and value != %s"
%
merge_version
while
True
:
if
execute
(
cursor
,
sql
):
break
time
.
sleep
(
1
)
while
True
:
if
not
execute
(
cursor
,
"""select * from oceanbase.__all_zone
where name='last_merged_version'
and value != (select value from oceanbase.__all_zone where name='frozen_version' limit 1)
and zone in (select zone from oceanbase.__all_zone where name='status' and info = 'ACTIVE')
"""
):
break
time
.
sleep
(
5
)
stdio
.
stop_loading
(
'succeed'
)
# create new tables
if
not
run_sql
(
sql_file
=
os
.
path
.
join
(
bmsql_sql_path
,
'tableCreates.sql'
)):
stdio
.
error
(
'create tables failed'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录