-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Enhancement] show persistent index disk cost in be_tablets #35615
Conversation
// INDEX_DISK | ||
fill_column_with_slot<TYPE_BIGINT>(column.get(), (void*)&info.index_disk_usage); | ||
break; | ||
} | ||
default: | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most risky bug in this code is:
Incorrect memory size definition for TYPE_VARCHAR
columns in the _s_columns[]
array initialization.
You can modify the code like this:
@@ -34,7 +34,7 @@ SchemaScanner::ColumnDesc SchemaBeTabletsScanner::_s_columns[] = {
{"INDEX_MEM", TYPE_BIGINT, sizeof(int64_t), false}, {"CREATE_TIME", TYPE_BIGINT, sizeof(int64_t), false},
// SIZE_VARCHAR has been changed from sizeof(StringValue) to an appropriate fixed buffer size or variable length handling mechanism
{"STATE", TYPE_VARCHAR, appropriate_buffer_size, false}, {"TYPE", TYPE_VARCHAR, appropriate_buffer_size, false},
{"DATA_DIR", TYPE_VARCHAR, appropriate_buffer_size, false}, {"SHARD_ID", TYPE_BIGINT, sizeof(int64_t), false},
- {"SCHEMA_HASH", TYPE_BIGINT, sizeof(int64_t), false},
+ {"SCHEMA_HASH", TYPE_BIGINT, sizeof(int64_t), false}, {"INDEX_DISK", TYPE_BIGINT, sizeof(int64_t), false},
};
Remember to replace appropriate_buffer_size
with the actual fixed size or dynamic size handling logic based on the real use case and data requirements.
Explanation:
The TYPE_VARCHAR
likely expects a string value and therefore needs a correct buffer length to accommodate the string data. The sizeof(StringValue)
here might not reflect the actual size needed for the VARCHAR data depending on how StringValue
is defined. In common scenarios, VARCHAR types either specify a maximum length or are accompanied by dynamic sizing logic in the system to handle variable-length strings appropriately.
07153c2
to
5422d17
Compare
Signed-off-by: luohaha <[email protected]>
5422d17
to
fe9626d
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs 0.0% Coverage The version of Java (11.0.21) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. |
[FE Incremental Coverage Report]✅ pass : 1 / 1 (100.00%) file detail
|
[BE Incremental Coverage Report]❌ fail : 0 / 14 (00.00%) file detail
|
@Mergifyio backport branch-3.2 |
@Mergifyio backport branch-3.1 |
✅ Backports have been created
|
✅ Backports have been created
|
We can't get the persistent index disk usage from system table now. Add each tablet's persistent index disk usage `INDEX_DISK` to `be_tablets`. ``` mysql> select * from be_tablets where tablet_id = 10121\G *************************** 1. row *************************** BE_ID: 10004 TABLE_ID: 10119 PARTITION_ID: 10118 TABLET_ID: 10121 NUM_VERSION: 4 MAX_VERSION: 6 MIN_VERSION: 4 NUM_ROWSET: 1 NUM_ROW: 5 DATA_SIZE: 710 INDEX_MEM: 119 CREATE_TIME: 1700701817 STATE: RUNNING TYPE: PRIMARY DATA_DIR: /home/disk5/luoyixin/starrocks-4/starrocks/output/be/storage SHARD_ID: 48 SCHEMA_HASH: 1872891624 INDEX_DISK: 152 1 row in set (0.02 sec) ``` (cherry picked from commit 956f397)
We can't get the persistent index disk usage from system table now. Add each tablet's persistent index disk usage `INDEX_DISK` to `be_tablets`. ``` mysql> select * from be_tablets where tablet_id = 10121\G *************************** 1. row *************************** BE_ID: 10004 TABLE_ID: 10119 PARTITION_ID: 10118 TABLET_ID: 10121 NUM_VERSION: 4 MAX_VERSION: 6 MIN_VERSION: 4 NUM_ROWSET: 1 NUM_ROW: 5 DATA_SIZE: 710 INDEX_MEM: 119 CREATE_TIME: 1700701817 STATE: RUNNING TYPE: PRIMARY DATA_DIR: /home/disk5/luoyixin/starrocks-4/starrocks/output/be/storage SHARD_ID: 48 SCHEMA_HASH: 1872891624 INDEX_DISK: 152 1 row in set (0.02 sec) ``` (cherry picked from commit 956f397) # Conflicts: # be/src/storage/tablet_updates.cpp # fe/fe-core/src/test/resources/sql/scheduler/schema_scan.sql
…35615) (#36022) Co-authored-by: Yixin Luo <[email protected]>
…s#35615) We can't get the persistent index disk usage from system table now. Add each tablet's persistent index disk usage `INDEX_DISK` to `be_tablets`. ``` mysql> select * from be_tablets where tablet_id = 10121\G *************************** 1. row *************************** BE_ID: 10004 TABLE_ID: 10119 PARTITION_ID: 10118 TABLET_ID: 10121 NUM_VERSION: 4 MAX_VERSION: 6 MIN_VERSION: 4 NUM_ROWSET: 1 NUM_ROW: 5 DATA_SIZE: 710 INDEX_MEM: 119 CREATE_TIME: 1700701817 STATE: RUNNING TYPE: PRIMARY DATA_DIR: /home/disk5/luoyixin/starrocks-4/starrocks/output/be/storage SHARD_ID: 48 SCHEMA_HASH: 1872891624 INDEX_DISK: 152 1 row in set (0.02 sec) ```
…s#35615) We can't get the persistent index disk usage from system table now. Add each tablet's persistent index disk usage `INDEX_DISK` to `be_tablets`. ``` mysql> select * from be_tablets where tablet_id = 10121\G *************************** 1. row *************************** BE_ID: 10004 TABLE_ID: 10119 PARTITION_ID: 10118 TABLET_ID: 10121 NUM_VERSION: 4 MAX_VERSION: 6 MIN_VERSION: 4 NUM_ROWSET: 1 NUM_ROW: 5 DATA_SIZE: 710 INDEX_MEM: 119 CREATE_TIME: 1700701817 STATE: RUNNING TYPE: PRIMARY DATA_DIR: /home/disk5/luoyixin/starrocks-4/starrocks/output/be/storage SHARD_ID: 48 SCHEMA_HASH: 1872891624 INDEX_DISK: 152 1 row in set (0.02 sec) ```
…s#35615) We can't get the persistent index disk usage from system table now. Add each tablet's persistent index disk usage `INDEX_DISK` to `be_tablets`. ``` mysql> select * from be_tablets where tablet_id = 10121\G *************************** 1. row *************************** BE_ID: 10004 TABLE_ID: 10119 PARTITION_ID: 10118 TABLET_ID: 10121 NUM_VERSION: 4 MAX_VERSION: 6 MIN_VERSION: 4 NUM_ROWSET: 1 NUM_ROW: 5 DATA_SIZE: 710 INDEX_MEM: 119 CREATE_TIME: 1700701817 STATE: RUNNING TYPE: PRIMARY DATA_DIR: /home/disk5/luoyixin/starrocks-4/starrocks/output/be/storage SHARD_ID: 48 SCHEMA_HASH: 1872891624 INDEX_DISK: 152 1 row in set (0.02 sec) ```
…35615) (#36280) Signed-off-by: luohaha <[email protected]>
Why I'm doing:
We can't get the persistent index disk usage from system table now.
What I'm doing:
Add each tablet's persistent index disk usage
INDEX_DISK
tobe_tablets
.What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: