[Bug] Upper-case hex in cloud initial rowset id is mis-parsed by BE from_hex (lossy, non-unique RowsetId)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
まず be/src/util/uid_util.h と be/src/storage/rowset_id.cpp を読み、次に issue で言及されている from_hex() の呼び出し元を調べてください。大文字の解析ケースを再現し、UID または rowset ID の解析に関する既存の単体テストを確認してください。大文字の 16 進数が小文字と同じ値に解析され、無効な文字が安全に処理されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Search before asking
- I had searched in the issues and found no similar issues.
Version
4.1.4 (cloud mode). master is the same (351d9388d5):
- FE
fe/fe-core/src/main/java/org/apache/doris/cloud/datasource/CloudInternalCatalog.java:690-692builds the initial[0-1]rowset id withString.format("%016X", ...)(upper-case hex). - BE
be/src/util/uid_util.h:48-61from_hex()only handles0-9anda-f; any other character is mapped withc - 'a' + 10. - BE
be/src/storage/rowset_id.cpp:57-63RowsetId::init(std::string_view)parses the 48-char id withfrom_hex().
Description
In cloud mode the FE creates the empty [0-1] rowset of every new tablet with a V2 rowset id formatted as upper-case hex:
String rowsetIdV2Str = String.format("%016X", 2L << 56)
+ String.format("%016X", uuid.getMostSignificantBits())
+ String.format("%016X", uuid.getLeastSignificantBits());
The BE parses rowset ids with from_hex(), which treats every non-digit as lower-case:
if (i >= '0' && i <= '9') {
buf_val = i - '0';
} else {
buf_val = i - 'a' + 10; // 'A'..'F' -> -22..-17
}
val <<= 4;
val = val | buf_val; // a negative nibble sets all upper bits
For 'A'..'F' the nibble is negative, so val | buf_val sets every higher bit. Any UUID half that contains an upper-case letter parses to a value like 0xffffffffffffffea. The BE then shows these rowsets as, e.g.,
0200000000000000ffffffffffffffeafffffffffffffffe
Consequences:
- The parse is lossy: everything before the last letter in each 16-char half is lost, so
[0-1]rowset ids of different tablets can parse to the sameRowsetId. RowsetId::to_string()never round-trips to the id stored in the meta-service, so any code that compares the BE-side id string with the stored one sees a mismatch for these rowsets.- These ids look like version-hole rowsets in BE logs, which is confusing when diagnosing rowset reference counts.
The [0-1] rowset is empty (0 segments, 0 rows), so we have not seen data impact, but the ids are wrong and not unique.
Solution
Either side fixes it; both are one-liners:
- BE: make
from_hex()accept upper case, e.g.else if (i >= 'A' && i <= 'F') buf_val = i - 'A' + 10;(and ideally reject anything else instead of producing a negative nibble). - FE: format with
%016x(lower case), matching how the BE prints rowset ids.
Doing (1) keeps existing upper-case ids already stored in the meta-service parsing correctly.
How to Reproduce?
- Start a cloud-mode cluster, create any table.
- Look at the
[0-1]rowset id of a tablet on the BE (e.g. in BE logs or via the tablet meta HTTP API): it shows as0200000000000000ffff..., while the meta-service stores0200000000000000+ 32 upper-case hex chars. - Unit level:
RowsetId id; id.init("0200000000000000ABCDEF0123456789ABCDEF0123456789");givesmiandlowith all upper bits set (e.g.0xffffffef0123456789-style values truncated to 64 bits) instead of0xABCDEF0123456789.
Anything Else?
from_hex() is also used for UniqueId parsing; any other caller that can receive upper-case hex is affected the same way.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
- 主要言語
- Java
- スター
- 16.1k
- フォーク
- 4k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 669
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/doris のほかの issue
-
難易度 2/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
[Enhancement] Update documentation to build you own docker image対応中かも @NUAAwqy が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
4.1.4.1 Release Noteオープンrelease notes
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
[Bug] FE metric http_copy_into_query_err_total is registered under the upload error name対応中かも @manesioz が 27 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
apache/doris#68505 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
status: needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
JabRef/jabref#17546 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
hiero-ledger/hiero-sdk-java#3010 ·
メンテナーはふだん 1 日以内に返信
-
Optimize consumer version heatmap aggregation to avoid repeated scans対応中かも @praykaria31 が今日担当しました。 オープンtype/enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Apicurio/apicurio-registry#10662 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
a:false-positive
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
status: waiting-for-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
spring-projects/spring-boot#52347 ·
メンテナーはふだん 2 日以内に返信