-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix(bridge/mqtt): respect client ID prefix #13216
fix(bridge/mqtt): respect client ID prefix #13216
Conversation
mk_clientid(WorkerId, {Prefix, ClientId}) when ?IS_NO_PREFIX(Prefix) -> | ||
%% When there is no prefix, try to keep the client ID length within 23 bytes | ||
emqx_bridge_mqtt_lib:bytes23(ClientId, WorkerId); | ||
mk_clientid(WorkerId, {Prefix, ClientId}) when size(Prefix) < 20 -> |
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.
Nit. Put 20
behind a -define
?
Change Details: | ||
- Without Prefix: Behavior remains unchanged; EMQX will hash the entire Client ID into a 23-byte space (when longer than 23 bytes). | ||
- With Prefix: | ||
- Prefix no more than 19 bytes: The prefix is preserved, and the remaining suffix is hashed into a 4-byte space. |
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.
It would be easier to understand if it is changed to:
Prefix no more than 19 bytes: The prefix is preserved, and the remaining suffix is hashed, the total length of the clientid is 23 bytes.
Since when the prefix is "org_", the clientid will be something like "org_de50546ff2da307d11d".
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.
tahnk you. fixed.
Fixes #13214, #13186, #13185 and EMQX-12525
Release version: v/e5.7.1
Summary
Introduced in 5.4.1 PR: #12236
The client ID shortener did not respect client ID prefix.
After this fix, client ID prefix will be kept:
PR Checklist
Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:
changes/(ce|ee)/(feat|perf|fix|breaking)-<PR-id>.en.md
filesChecklist for CI (.github/workflows) changes
changes/
dir for user-facing artifacts update