geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (GEODE-3801) Utilize hard-links to copy files during backups
Date Mon, 23 Oct 2017 22:01:00 GMT


ASF GitHub Bot commented on GEODE-3801:

nreich commented on a change in pull request #963: GEODE-3801: Use hardlinks for backup oplog

 File path: geode-core/src/main/java/org/apache/geode/internal/cache/
 @@ -569,6 +570,28 @@ private void createBackupDir(File backupDir) throws IOException {
+  private void backupOplog(File targetDir, Oplog oplog) throws IOException {
+    File crfFile = oplog.getCrfFile();
+    backupFile(targetDir, crfFile);
+    File drfFile = oplog.getDrfFile();
+    backupFile(targetDir, drfFile);
+    oplog.finishKrf();
+    File krfFile = oplog.getKrfFile();
+    backupFile(targetDir, krfFile);
+  }
+  private void backupFile(File targetDir, File file) throws IOException {
+    if (file != null && file.exists())
+      try {
+        Files.createLink(targetDir.toPath().resolve(file.getName()), file.toPath());
 Review comment:
   The use of a hard link here is to replace the existing logic of making a copy of the original
file for the backup. Deletion of the original file cannot be allowed to result in loss of
that file in the backup location and thus a symbolic link cannot be used in this case. Hard
links can be used here in place of copying the file only because the Oplog files being copied
are guaranteed to be read-only.

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Utilize hard-links to copy files during backups
> -----------------------------------------------
>                 Key: GEODE-3801
>                 URL:
>             Project: Geode
>          Issue Type: Sub-task
>          Components: persistence
>            Reporter: Nick Reich
>            Assignee: Nick Reich
> Instead of copying files which are read-only during a backup, create a hard-link to the
file in the backup location. This prevents losing the file if the original location is deleted,
but does not require make a new copy of the file. If hard-links cannot be created, revert
to the existing copying mechanic.

This message was sent by Atlassian JIRA

View raw message