-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](load) resolve UBSan error when printing unique IDs #52042
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
Conversation
This commit fixes an Undefined Behavior Sanitizer error triggered when printing PUniqueId directly to an ostream. Among the three types of unique IDs, `UniqueId`, `PUniqueId` (protobuf), and `TUniqueId` (thrift), only `UniqueId` has an overloaded `operator<<`. Attempting to stream the other two types leads to undefined behavior, making the current approach error-prone. Introduces a unified `print_id()` function for safely printing all unique ID types (UniqueId, PUniqueId, TUniqueId). It is recommended to use `print_id()` instead of streaming directly.
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
1 similar comment
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
TPC-H: Total hot run time: 34378 ms |
TPC-DS: Total hot run time: 186554 ms |
ClickBench: Total hot run time: 29.2 s |
### What problem does this PR solve? This commit fixes an Undefined Behavior Sanitizer error triggered when printing `PUniqueId` directly to an ostream. Among the three types of unique IDs, `UniqueId`, `PUniqueId` (protobuf), and `TUniqueId` (thrift), only `UniqueId` has an overloaded `operator<<()`. Attempting to stream the other two types leads to undefined behavior, making the current approach error-prone. Introduces a unified `print_id()` function for safely printing all unique ID types (`UniqueId`, `PUniqueId`, `TUniqueId`). It is recommended to use `print_id()` instead of streaming directly.
### What problem does this PR solve? This commit fixes an Undefined Behavior Sanitizer error triggered when printing `PUniqueId` directly to an ostream. Among the three types of unique IDs, `UniqueId`, `PUniqueId` (protobuf), and `TUniqueId` (thrift), only `UniqueId` has an overloaded `operator<<()`. Attempting to stream the other two types leads to undefined behavior, making the current approach error-prone. Introduces a unified `print_id()` function for safely printing all unique ID types (`UniqueId`, `PUniqueId`, `TUniqueId`). It is recommended to use `print_id()` instead of streaming directly.
### What problem does this PR solve? Followup #52042 Modifying `hdr.load_id()` is unsafe and may cause undefined behavior. Also passing load_id by reference in constructors.
### What problem does this PR solve? Followup #52042 Modifying `hdr.load_id()` is unsafe and may cause undefined behavior. Also passing load_id by reference in constructors.
### What problem does this PR solve? Followup #52042 Modifying `hdr.load_id()` is unsafe and may cause undefined behavior. Also passing load_id by reference in constructors.
Followup apache#52042 Modifying `hdr.load_id()` is unsafe and may cause undefined behavior. Also passing load_id by reference in constructors.
…pache#52042 (apache#52261) Cherry-picked from apache#52042 Co-authored-by: Kaijie Chen <chenkaijie@selectdb.com>
What problem does this PR solve?
This commit fixes an Undefined Behavior Sanitizer error triggered when printing
PUniqueIddirectly to an ostream.Among the three types of unique IDs,
UniqueId,PUniqueId(protobuf), andTUniqueId(thrift),only
UniqueIdhas an overloadedoperator<<().Attempting to stream the other two types leads to undefined behavior, making the current approach error-prone.
Introduces a unified
print_id()function for safely printing all unique ID types (UniqueId,PUniqueId,TUniqueId).It is recommended to use
print_id()instead of streaming directly.Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)