[ISSUE #7142] Add command RocksDBConfigToJson to inspect rocksdb content#7180
[ISSUE #7142] Add command RocksDBConfigToJson to inspect rocksdb content#7180RongtongJin merged 2 commits intoapache:developapache/rocketmq:developfrom
RocksDBConfigToJson to inspect rocksdb content#7180Conversation
kvConfigToJson to inspect rocksdb contentkvConfigToJson to inspect rocksdb content
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| public class KvConfigToJsonCommand implements SubCommand { |
There was a problem hiding this comment.
How about renaming to RocksDBConfigToJsonCommand?
There was a problem hiding this comment.
Good! Let me take a look.
Signed-off-by: Ziy1-Tan <ajb4596984460@gmail.com>
kvConfigToJson to inspect rocksdb contentRocksDBConfigToJson to inspect rocksdb content
| @Override | ||
| public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) throws SubCommandException { | ||
| String path = commandLine.getOptionValue("path").trim(); | ||
| if (StringUtils.isEmpty(path) || !new File(path).exists()) { |
There was a problem hiding this comment.
support default path configuration?
There was a problem hiding this comment.
Metadata is stored in different paths, it may be more appropriate to specify the path.
| } | ||
| topicsJsonConfig.put("topicConfigTable", (JSONObject) JSONObject.toJSON(topicConfigTable)); | ||
| final String topicsJsonStr = JSONObject.toJSONString(topicsJsonConfig, true); | ||
| System.out.print(topicsJsonStr + "\n"); |
There was a problem hiding this comment.
The topic size is too large, causing Out Of Memory (OOM) errors.
You could use the stream approach to write to the file, instead of reusing the previous code.
There was a problem hiding this comment.
How about mqadmin rocksDBConfig -p /home/xxx/store/config/topics -t topics > topics.json?
|
|
||
| @Override | ||
| public String commandName() { | ||
| return "RocksDBConfigToJson"; |
There was a problem hiding this comment.
rocksDBConfigToJson, lowercase the first letter like any other command.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #7180 +/- ##
=============================================
- Coverage 42.52% 42.48% -0.05%
- Complexity 9357 9363 +6
=============================================
Files 1149 1150 +1
Lines 82043 82093 +50
Branches 10701 10706 +5
=============================================
- Hits 34889 34877 -12
- Misses 42792 42850 +58
- Partials 4362 4366 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Which Issue(s) This PR Fixes
Fixes #7142
Brief Description
mqadmin RocksDBConfigToJson -p /home/xxx/store/config/topics -t topicsmqadmin RocksDBConfigToJson -p /home/xxx/store/config/subscriptionGroups -t subscriptionGroupsHow Did You Test This Change?
TBD