This is an automated email from the ASF dual-hosted git repository. xingtanzjr pushed a commit to branch ml_add_peer in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/ml_add_peer by this push: new 62e0cb0116 add more logs for taking snapshot 62e0cb0116 is described below commit 62e0cb0116abadc72e471cca50a00ae5ecf1ef33 Author: Jinrui.Zhang <xingtan...@gmail.com> AuthorDate: Tue Sep 6 16:22:46 2022 +0800 add more logs for taking snapshot --- .../iotdb/db/engine/snapshot/SnapshotTaker.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/org/apache/iotdb/db/engine/snapshot/SnapshotTaker.java b/server/src/main/java/org/apache/iotdb/db/engine/snapshot/SnapshotTaker.java index 626588cfe8..72c3326fc5 100644 --- a/server/src/main/java/org/apache/iotdb/db/engine/snapshot/SnapshotTaker.java +++ b/server/src/main/java/org/apache/iotdb/db/engine/snapshot/SnapshotTaker.java @@ -150,12 +150,12 @@ public class SnapshotTaker { // create hard link for tsfile, resource, mods createHardLink(snapshotTsFile, tsFile); createHardLink( - new File(snapshotTsFile.getCanonicalPath() + TsFileResource.RESOURCE_SUFFIX), - new File(tsFile.getCanonicalPath() + TsFileResource.RESOURCE_SUFFIX)); + new File(snapshotTsFile.getAbsolutePath() + TsFileResource.RESOURCE_SUFFIX), + new File(tsFile.getAbsolutePath() + TsFileResource.RESOURCE_SUFFIX)); if (resource.getModFile().exists()) { createHardLink( - new File(snapshotTsFile.getCanonicalPath() + ModificationFile.FILE_SUFFIX), - new File(tsFile.getCanonicalPath() + ModificationFile.FILE_SUFFIX)); + new File(snapshotTsFile.getAbsolutePath() + ModificationFile.FILE_SUFFIX), + new File(tsFile.getAbsolutePath() + ModificationFile.FILE_SUFFIX)); } } return true; @@ -166,7 +166,15 @@ public class SnapshotTaker { } private void createHardLink(File target, File source) throws IOException { - Files.createLink(target.toPath(), source.toPath()); + if (!target.getParentFile().exists()) { + LOGGER.error("Hard link target dir {} doesn't exist", target.getParentFile()); + } + if (!source.exists()) { + LOGGER.error("Hard link source file {} doesn't exist", source); + } + + Files.createLink(target.getAbsoluteFile().toPath(), source.getAbsoluteFile().toPath()); + LOGGER.info("Taking snapshot for {} to {}", source, target); snapshotLogger.logFile(source.getAbsolutePath(), target.getAbsolutePath()); } @@ -213,6 +221,7 @@ public class SnapshotTaker { } private void cleanUpWhenFail(String snapshotId) { + LOGGER.info("Cleaning up snapshot dir for {}", snapshotId); for (String dataDir : IoTDBDescriptor.getInstance().getConfig().getDataDirs()) { File dataDirForThisSnapshot = new File(dataDir + File.separator + "snapshot" + File.separator + snapshotId);