-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
[ISSUE #7142] Add command RocksDBConfigToJson
to inspect rocksdb content
#7180
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about renaming to RocksDBConfigToJsonCommand?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
support default path configuration?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rocksDBConfigToJson, lowercase the first letter like any other command.
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.
Fixed.
Codecov Report
@@ 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
... and 21 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Which Issue(s) This PR Fixes
Fixes #7142
Brief Description
mqadmin RocksDBConfigToJson -p /home/xxx/store/config/topics -t topics
mqadmin RocksDBConfigToJson -p /home/xxx/store/config/subscriptionGroups -t subscriptionGroups
How Did You Test This Change?
TBD