[Bug] The static-topic commands ignore -mf/--mapFile and silently recompute the mapping instead
Maintainer thường phản hồi trong vòng 1 ngày
@iloveeyjafjalla đang làm issue này rồi.
Từ ngày 12/10/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with UpdateStaticTopicSubCommand and RemappingStaticTopicSubCommand, focusing on buildCommandlineOptions, execute, and executeFromFile; compare the registered map-file option with the key read by each command. Trace how required options are checked for file and recompute modes, then inspect the force argument passed to updateTopicConfigMappingAll. Done means both commands apply the supplied mapping, file mode accepts its documented options, and updateStaticTopic honors -fr; linked PR #11382 is already open.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Before Creating the Bug Report
- I found a bug, not just asking a question, which should be created in GitHub Discussions.
- I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.
- I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
Runtime platform environment
OS: any (mqadmin, tools module)
RocketMQ version
branch: develop
Git commit id: 9ea2ccdc2b41445aee5e177e14e501d606f5a1ed (verified against this base; the files are unchanged on develop@b76420599)
JDK Version
Compiler: Temurin 1.8.0_504 (target 1.8, same as CI)
Describe the Bug
The map-file mode of the two static-topic commands is unreachable, and the documented invocation silently does something else.
Both commands register the option under the key mf and then read a different key:
// UpdateStaticTopicSubCommand / RemappingStaticTopicSubCommand, buildCommandlineOptions
opt = new Option("mf", "mapFile", true, "The mapping data file name");
...
// execute(...)
if (commandLine.hasOption("f")) { // "f" is registered nowhere
executeFromFile(commandLine, options, rpcHook);
return;
}
...
// executeFromFile(...)
String mapFileName = commandLine.getOptionValue('f').trim(); // null -> NPE if ever reached
So mqadmin updateStaticTopic -t T -b brokerA -qn 8 -mf plan.json parses (the help text advertises
-mf,--mapFile <arg>), never reads plan.json, and takes the recompute path instead — the command rewrites the static
topic mapping computed from the cluster's current state rather than applying the mapping the operator supplied. The only
way to reach the file mode is to pass -f, which the parser rejects with Unrecognized option: -f.
In addition, the file mode cannot even be invoked the way it is meant to be, because the parser demands options that mode
does not use:
OptionGroup("-b", "-c")issetRequired(true);UpdateStaticTopicSubCommandalso marks-qn/--totalQueueNumrequired;
so mqadmin updateStaticTopic -t T -mf plan.json (the target brokers and the queue count come from the file) fails to
parse; ServerUtil.parseCmdLine then prints the help and calls System.exit(1). Both recompute paths already validate
these options themselves (if (!hasOption("b") && !hasOption("c") || !hasOption("qn")) { printCommandLineHelp(...); return; }).
Finally, once the file mode is reachable, UpdateStaticTopicSubCommand ignores -fr/--forceReplace:
force is parsed and then MQAdminUtils.updateTopicConfigMappingAll(..., false) is called with a literal.
Steps to Reproduce
mqadmin updateStaticTopic -t T -b brokerA -qn 8 -mf plan.jsonwith a plan file whose mapping differs from the current
cluster state → the file is not read; a recomputed mapping is written instead.mqadmin updateStaticTopic -t T -mf plan.json→Missing required option, help, exit code 1.mqadmin remappingStaticTopic -t T -mf plan.json→ same as 2 (-b|-crequired).
Expected behavior
The documented -mf/--mapFile invocation reads the mapping from the named file and applies it (honoring -fr), and the
from-file mode does not require the target brokers or the queue count, which the file carries.
Actual behavior
The map file is ignored and the mapping is recomputed; without -b|-c (and -qn) the invocation does not even parse; -fr
is discarded in updateStaticTopic.
Additional context
Fix: read the option key the commands register, stop requiring -b|-c|-qn in the from-file mode (the recompute mode still
validates them), and pass the parsed force through.
- Ngôn ngữ chính
- Java
- Star
- 22.7k
- Fork
- 12k
- Merge trung bình
- 3 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/rocketmq
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configurationCó thể đã có người làm @amalsaidov đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
CompressionType.of fails under the Turkish localeCó thể đã có người làm @sharanggupta đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[rocketmq-client-python] TransactionMQProducer allocates an unused producer during initializationĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] notifyMasterOnline aborts the long-polling wake-up with a NullPointerException when an arrival drains a bucket firstCó thể đã có người làm @iloveeyjafjalla đã nhận 29 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/rocketmq#11441 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Enhancement] FilterFactory duplicate-registration and unregister semantics lack testsCó thể đã có người làm @chennaji9 đã nhận 34 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
apache/rocketmq#11340 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/rocketmq
Issue tương tự
-
bug emitter:client:csharp
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/typespec#12572 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-area-label
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
area/ai area/backend component/zeebe kind/task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
spAnser/reacharound#38 ·