Caideyipi commented on code in PR #14594:
URL: https://github.com/apache/iotdb/pull/14594#discussion_r1899880011
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/SimpleProgressIndexAssigner.java:
##########
@@ -86,15 +89,19 @@ private void parseRebootTimes() {
try {
String content = FileUtils.readFileToString(file,
StandardCharsets.UTF_8);
rebootTimes = Integer.parseInt(content);
- } catch (IOException e) {
+ } catch (Exception e) {
LOGGER.error("Cannot parse reboot times from file {}",
file.getAbsolutePath(), e);
- rebootTimes = 0;
+ rebootTimes = (int) (System.currentTimeMillis() / 1000);
}
}
private void recordRebootTimes() throws IOException {
File file = SystemFileFactory.INSTANCE.getFile(PIPE_SYSTEM_DIR +
REBOOT_TIMES_FILE_NAME);
- FileUtils.writeStringToFile(file, String.valueOf(rebootTimes + 1),
StandardCharsets.UTF_8);
+ try (FileOutputStream fos = new FileOutputStream(file, false);
+ FileChannel channel = fos.getChannel()) {
+ channel.write(ByteBuffer.wrap(String.valueOf(rebootTimes +
1).getBytes()));
Review Comment:
.getBytes(TSFileConfig.STRING_CHARSET)
--
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]