fix: avoid duplicated apikey from data import #11798
Merged
+182
−29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes EMQX-11209
Mnesia uses the first field of the record as the key to identify a record.
In this case:
Table
emqx_app
's key isname
, and it is randomly generated and has no association withapi_key
.So when exporting/importing on two different clusters, there will be two records in mnesia with the same
api_key
but differentname
, which will cause acase_caluse
when node restart after importing.Summary
🤖 Generated by Copilot at 3fb7df6
This pull request improves the management API key feature by refactoring the creation and authentication logic, adding app key support for the tests, and documenting the dashboard API key function. It affects the files
emqx_mgmt_auth.erl
,emqx_common_test_http.erl
, andemqx_mgmt_api_api_keys.erl
.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)-<PR-id>.en.md
filesChecklist for CI (.github/workflows) changes
changes/
dir for user-facing artifacts update