You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2019/01/22 01:50:26 UTC

[incubator-iotdb] branch delete_dev4 updated: add roll back in wal recovery

This is an automated email from the ASF dual-hosted git repository.

jiangtian pushed a commit to branch delete_dev4
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/delete_dev4 by this push:
     new e8690d6  add roll back in wal recovery
e8690d6 is described below

commit e8690d6edae860bd314be355906505fa2421ee3c
Author: 江天 <jt...@163.com>
AuthorDate: Tue Jan 22 09:49:45 2019 +0800

    add roll back in wal recovery
---
 .../db/engine/filenode/FileNodeProcessor.java      | 29 ++++++++++++++++------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
index 1ac6e42..d79c01b 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
@@ -2068,13 +2068,22 @@ public class FileNodeProcessor extends Processor implements IStatistic {
    * Similar to delete(), but only deletes data in BufferWrite.
    * Only used by WAL recovery.
    */
-  public void deleteBufferWrite(String deviceId, String measurementId, long timestamp) throws IOException {
+  public void deleteBufferWrite(String deviceId, String measurementId, long timestamp)
+          throws IOException {
     String fullPath = deviceId +
             IoTDBConstant.PATH_SEPARATOR + measurementId;
     long version = versionController.nextVersion();
     Deletion deletion = new Deletion(fullPath, version, timestamp);
 
-    deleteBufferWriteFiles(deviceId, deletion, updatedModFiles);
+    List<ModificationFile> updatedModFiles = new ArrayList<>();
+    try {
+      deleteBufferWriteFiles(deviceId, deletion, updatedModFiles);
+    } catch (IOException e) {
+      for (ModificationFile modificationFile : updatedModFiles) {
+        modificationFile.abort();
+      }
+      throw e;
+    }
     if (bufferWriteProcessor != null) {
       bufferWriteProcessor.delete(deviceId, measurementId, timestamp);
     }
@@ -2084,13 +2093,19 @@ public class FileNodeProcessor extends Processor implements IStatistic {
    * Similar to delete(), but only deletes data in Overflow.
    * Only used by WAL recovery.
    */
-  public void deleteOverflow(String deviceId, String measurementId, long timestamp) throws IOException {
-    String fullPath = deviceId +
-            IoTDBConstant.PATH_SEPARATOR + measurementId;
+  public void deleteOverflow(String deviceId, String measurementId, long timestamp)
+          throws IOException {
     long version = versionController.nextVersion();
-    Deletion deletion = new Deletion(fullPath, version, timestamp);
 
     OverflowProcessor overflowProcessor = getOverflowProcessor(getProcessorName());
-    overflowProcessor.delete(deviceId, measurementId, timestamp, version, updatedModFiles);
+    List<ModificationFile> updatedModFiles = new ArrayList<>();
+    try {
+      overflowProcessor.delete(deviceId, measurementId, timestamp, version, updatedModFiles);
+    } catch (IOException e) {
+      for (ModificationFile modificationFile : updatedModFiles) {
+        modificationFile.abort();
+      }
+      throw e;
+    }
   }
 }
\ No newline at end of file