Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Obdiag gather tabledump cannot calculate the size of partitioned tables. #604

Closed
hlfox opened this issue Dec 6, 2024 · 1 comment

Comments

@hlfox
Copy link

hlfox commented Dec 6, 2024

Describe the bug

When calculating the size of a partitioned table, only the size of one of the partitions will be counted.

Environment

OceanBase Diagnostic Tool: 2.5.0

Fast reproduce steps

  1. create a partition table
    CREATE TABLE sbtest3 (
    id int(11) NOT NULL AUTO_INCREMENT,
    k int(11) NOT NULL DEFAULT '0',
    c char(120) NOT NULL DEFAULT '',
    pad char(60) NOT NULL DEFAULT '',
    PRIMARY KEY (id),
    KEY k_3 (k) BLOCK_SIZE 16384 LOCAL,
    KEY idx_c (c) BLOCK_SIZE 16384 LOCAL
    ) partition by hash(id) partitions 9;

  2. use the obdiag
    obdiag gather tabledump --user=root@my#hucq_421 --password='aaBB11@@' --database=test --table=sbtest3

  3. check the result
    obclient > select /*+read_consistency(weak) QUERY_TIMEOUT(60000000) */ t1.SVR_IP,t1.role,ifnull(t2.data_size,0) as total_data_size from (select SVR_IP,tenant_id, database_name, role, table_id, tablet_id from oceanbase.cdb_ob_table_locations) t1 left join (select tenant_id, tablet_id,data_size from oceanbase.cdb_ob_tablet_replicas) t2 on t1.tenant_id = t2.tenant_id and t1.tablet_id = t2.tablet_id where t1.tenant_id = '1004' and t1.table_id = '500133' order by total_data_size desc limit 1
    +--------------+----------+-------------------+
    | SVR_IP | role | total_data_size |
    +==============+==========+===================+
    | 10.186.57.73 | FOLLOWER | 8497805 |
    +--------------+----------+-------------------+

Expected behavior

In oceanbase.cdb_ob_tablet_replicas, each partition will have a row of records. Different partitions of the same table have the same table_id. If you want to count the size of the partitioned table, should be select sum(data_size) from oceanbase.cdb_ob_tablet_replicas group by table_id;

Actual behavior

No response

Additional context

No response

@Teingi
Copy link
Contributor

Teingi commented Dec 10, 2024

fixed: #613

@Teingi Teingi closed this as completed Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants