junrao commented on code in PR #14603:
URL: https://github.com/apache/kafka/pull/14603#discussion_r1374791457
##########
storage/src/main/java/org/apache/kafka/storage/internals/checkpoint/CleanShutdownFileHandler.java:
##########
@@ -85,17 +86,16 @@ void write(long brokerEpoch, int version) throws Exception {
}
}
- public long read() {
- long brokerEpoch = -1L;
+ @SuppressWarnings("unchecked")
+ public OptionalLong read() {
try {
String text =
Utils.readFileAsString(cleanShutdownFile.toPath().toString());
- Map<String, String> content = new ObjectMapper().readValue(text,
HashMap.class);
-
- brokerEpoch =
Long.parseLong(content.getOrDefault(Fields.BROKER_EPOCH.toString(), "-1L"));
+ Content content = Json.parseStringAs(text, Content.class);
+ return OptionalLong.of(content.brokerEpoch);
} catch (Exception e) {
- logger.warn("Fail to read the clean shutdown file in " +
cleanShutdownFile.toPath() + ":" + e);
+ logger.trace("Fail to read the clean shutdown file in " +
cleanShutdownFile.toPath() + ":" + e);
Review Comment:
This probably should be debug?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]