Skip to content

Commit

Permalink
Reduce unnecessary switches
Browse files Browse the repository at this point in the history
  • Loading branch information
LetLetMe committed Oct 16, 2024
1 parent bf0489a commit 7df9ef0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ private RemotingCommand checkRocksdbCqWriteProgress(ChannelHandlerContext ctx, R
HashMap<String, String> resultMap = new HashMap<>();
if (!defaultMessageStore.getMessageStoreConfig().isRocksdbCQDoubleWriteEnable()) {
resultMap.put("diffResult", "rocksdbCQWriteEnable is false, checkRocksdbCqWriteProgressCommand is invalid");
resultMap.put("checkStatus", "2");
resultMap.put("checkStatus", "1");
response.setBody(JSON.toJSONBytes(resultMap));
return response;
}
Expand All @@ -512,7 +512,7 @@ private RemotingCommand checkRocksdbCqWriteProgress(ChannelHandlerContext ctx, R

} catch (Exception e) {
LOGGER.error("CheckRocksdbCqWriteProgressCommand error", e);
resultMap.put("diffResult", e.getMessage());
resultMap.put("diffResult", e.getMessage() + Arrays.toString(e.getStackTrace()));
resultMap.put("checkStatus", "2");
response.setBody(JSON.toJSONBytes(resultMap));
}
Expand Down Expand Up @@ -548,8 +548,7 @@ private boolean processConsumeQueuesForTopic(ConcurrentMap<Integer, ConsumeQueue
topic, queueId, i, kvCqUnit != null ? kvCqUnit.getObject1() : "null", fileCqUnit != null ? fileCqUnit.getObject1() : "null"));
break;
}
Long earliestKcTime = kvCqUnit.getObject2();
if (earliestKcTime < checkStoreTime) {
if (kvCqUnit.getObject2() < checkStoreTime) {
continue;
}
if (!checkCqUnitEqual(kvCqUnit.getObject1(), fileCqUnit.getObject1())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
String brokerAddr = brokerData.getBrokerAddrs().get(0L);
CheckRocksdbCqWriteProgressResponseBody body = defaultMQAdminExt.checkRocksdbCqWriteProgress(brokerAddr, topic, checkStoreTime);
if (StringUtils.isNotBlank(topic)) {
System.out.print("checkStatus(0 -> ready, 1 -> notReady, 2 -> error): " + body.getCheckStatus() + " \n " + body.getDiffResult() + "\n");
System.out.print(brokerName + " checkStatus(0 -> ready, 1 -> notReady, 2 -> error): " + body.getCheckStatus() + " \n " + body.getDiffResult() + "\n");
} else {
System.out.print("checkStatus(0 -> ready, 1 -> notReady, 2 -> error): " + body.getCheckStatus() + " \n " +
brokerName + " \n" + body.getDiffResult() + "\n");
System.out.print(brokerName + " checkStatus(0 -> ready, 1 -> notReady, 2 -> error): " + body.getCheckStatus() + " \n " +
body.getDiffResult() + "\n");
}
}

Expand Down

0 comments on commit 7df9ef0

Please sign in to comment.