-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display function compatibility with OB 3.x (#538)
* obdiag display support 3.x * update1112 * update1113 * test_1113 * update_test * Display function compatibility with OB 3.x
- Loading branch information
Showing
15 changed files
with
462 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ on: | |
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
info_en: "[database data_size]" | ||
info_cn: "[查看库占用磁盘大小]" | ||
command: obdiag display scene run --scene=observer.database_datasize --env tenant_id=1006 --env database_name=test | ||
task: | ||
- version: "[4.0.0.0, *]" | ||
steps: | ||
- type: sql | ||
sql: "select tenant_id,tenant_name,DATABASE_NAME,sum(data_size_in_GB) as data_size_in_GB from | ||
(SELECT /*+ query_timeout(30000000) */ a.TENANT_ID, c.tenant_name, a.DATABASE_NAME, a.TABLE_NAME, a.TABLE_ID, | ||
SUM(CASE WHEN b.nested_offset = 0 THEN IFNULL(b.data_block_count + b.index_block_count + b.linked_block_count, 0) * 2 * 1024 * 1024 ELSE IFNULL(b.size, 0) END ) /1024.0 /1024/1024 AS data_size_in_GB | ||
FROM oceanbase.CDB_OB_TABLE_LOCATIONS a INNER JOIN oceanbase.__all_virtual_table_mgr b ON a.svr_ip = b.svr_ip | ||
AND a.svr_port = b.svr_port AND a.tenant_id = b.tenant_id AND a.LS_ID = b.LS_ID AND a.TABLET_ID = b.TABLET_ID | ||
inner join oceanbase.__all_tenant c on a.tenant_id=c.tenant_id WHERE a.role = 'LEADER' | ||
AND c.tenant_id = {tenant_id} AND b.table_type >= 10 AND b.size > 0 AND a.TABLE_NAME NOT REGEXP '^__' | ||
and a.database_name='{database_name}' GROUP BY a.TABLE_ID) group by database_name;" | ||
global: true | ||
- version: "[3.0.0.0, 4.0.0.0]" | ||
steps: | ||
- type: sql | ||
sql: "select a.tenant_id, b.database_name,SUM(a.data_size) / 1024 / 1024 / 1024 AS data_size_G, | ||
SUM(a.required_size) / 1024 / 1024 / 1024 AS required_size_G from | ||
oceanbase.__all_virtual_meta_table a inner join | ||
(select a.* from | ||
oceanbase.gv$table a | ||
inner join | ||
oceanbase.gv$database b | ||
on a.database_id=b.database_id | ||
where b.tenant_id={tenant_id} and b.database_name='{database_name}')b | ||
on a.table_id=b.table_id | ||
where a.role = 1 | ||
group by a.tenant_id, b.database_name;" | ||
global: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
info_en: "[plan]" | ||
info_cn: "[查看sql的执行计划]" | ||
command: obdiag display scene run --scene=observer.plan --env db_connect='-h127.0.0.1 -P2881 -utest@test -p****** -Dtest' --env sqlid=test | ||
command: obdiag display scene run --scene=observer.plan --env tenant_name=test --env sqlid=test | ||
|
||
task: | ||
- version: "[4.0.0.0, *]" | ||
steps: | ||
- type: sql | ||
sql: "SELECT * FROM oceanbase.V$OB_PLAN_CACHE_PLAN_STAT where sql_id = '{sqlid}';" | ||
global: true | ||
sql: "SELECT a.* FROM oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT a left join oceanbase.__all_tenant b on a.tenant_id=b.tenant_id where b.tenant_name='{tenant_name}' and a.sql_id = '{sqlid}';" | ||
global: true | ||
- version: "[3.0.0.0, 4.0.0.0]" | ||
steps: | ||
- type: sql | ||
sql: "SELECT a.* FROM oceanbase.GV$plan_cache_plan_stat a left join oceanbase.__all_tenant b on a.tenant_id=b.tenant_id where b.tenant_name='{tenant_name}' and a.sql_id = '{sqlid}';" | ||
global: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
info_en: "[processlist]" | ||
info_cn: "[查看processlist]" | ||
command: obdiag display scene run --scene=observer.processlist --env db_connect='-h127.0.0.1 -P2881 -utest@test -p****** -Dtest' | ||
command: obdiag display scene run --scene=observer.processlist --env tenant_name=test | ||
task: | ||
- version: "[4.0.0.0, *]" | ||
steps: | ||
- type: sql | ||
sql: "select * from oceanbase.gv$ob_processlist;" | ||
sql: "select * from oceanbase.gv$ob_processlist where tenant='{tenant_name}';" | ||
global: true | ||
- version: "[3.0.0.0, 4.0.0.0]" | ||
steps: | ||
- type: sql | ||
sql: "select * from oceanbase.__all_virtual_processlist where tenant='{tenant_name}';" | ||
global: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
info_en: "[table data_size]" | ||
info_cn: "[查看表占用磁盘大小]" | ||
command: obdiag display scene run --scene=observer.table_datasize --env tenant_id=1006 --env database_name=test --env table_name=ttt2 | ||
task: | ||
- version: "[4.0.0.0, *]" | ||
steps: | ||
- type: sql | ||
sql: "SELECT /*+ query_timeout(30000000) */ a.TENANT_ID, c.tenant_name, a.DATABASE_NAME, a.TABLE_NAME, a.TABLE_ID, | ||
SUM(CASE WHEN b.nested_offset = 0 THEN IFNULL(b.data_block_count + b.index_block_count + b.linked_block_count, 0) * 2 * 1024 * 1024 ELSE IFNULL(b.size, 0) END ) / 1024.0 / 1024 / 1024 AS data_size_in_GB | ||
FROM oceanbase.CDB_OB_TABLE_LOCATIONS a INNER JOIN oceanbase.__all_virtual_table_mgr b ON a.svr_ip = b.svr_ip AND a.svr_port = b.svr_port AND a.tenant_id = b.tenant_id AND a.LS_ID = b.LS_ID AND a.TABLET_ID = b.TABLET_ID | ||
inner join oceanbase.__all_tenant c on a.tenant_id=c.tenant_id | ||
WHERE a.role = 'LEADER' AND c.tenant_id = {tenant_id} | ||
AND b.table_type >= 10 AND b.size > 0 | ||
AND a.TABLE_NAME NOT REGEXP '^__' | ||
and a.database_name='{database_name}' | ||
and a.TABLE_NAME='{table_name}' GROUP BY a.TABLE_ID;" | ||
global: true | ||
|
||
- version: "[3.0.0.0, 4.0.0.0]" | ||
steps: | ||
- type: sql | ||
sql: "SELECT | ||
a.tenant_id, | ||
b.table_name, | ||
SUM(a.data_size) / 1024 / 1024 / 1024 AS data_size_G, | ||
SUM(a.required_size) / 1024 / 1024 / 1024 AS required_size_G | ||
FROM | ||
oceanbase.__all_virtual_meta_table a | ||
JOIN | ||
(select a.* from | ||
oceanbase.gv$table a | ||
inner join | ||
oceanbase.gv$database b | ||
on a.database_id=b.database_id | ||
where b.tenant_id={tenant_id} and b.database_name='{database_name}' and a.table_name='{table_name}') b | ||
ON | ||
a.table_id = b.table_id | ||
WHERE | ||
a.role = 1 | ||
group by a.tenant_id, b.table_name;" | ||
global: true | ||
|
||
|
Oops, something went wrong.