forked from oceanbase/obdiag
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
93 additions
and
36 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
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
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
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 | ||
|
||
|
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