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/05/31 02:09:07 UTC
[incubator-iotdb] 01/01: fix missing wal log node after recovery
This is an automated email from the ASF dual-hosted git repository.
jiangtian pushed a commit to branch fix_missing_wal_node
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 68844b2439c521927f8a3634ed9a1effdb24ea28
Author: 江天 <jt...@163.com>
AuthorDate: Fri May 31 10:07:12 2019 +0800
fix missing wal log node after recovery
---
.../engine/bufferwrite/BufferWriteProcessor.java | 24 ++++++++++++----------
.../iotdb/db/engine/filenode/FileNodeManager.java | 12 +++++++++--
.../db/engine/overflow/io/OverflowProcessor.java | 18 ++++++++--------
3 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java
index 1809cfb..a8e1e58 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java
@@ -29,7 +29,6 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantLock;
-import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBConstant;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.engine.Processor;
@@ -109,15 +108,10 @@ public class BufferWriteProcessor extends Processor {
filenodeFlushAction = parameters.get(FileNodeConstants.FILENODE_PROCESSOR_FLUSH_ACTION);
reopen(fileName);
- if (IoTDBDescriptor.getInstance().getConfig().isEnableWal()) {
- try {
- logNode = MultiFileLogNodeManager.getInstance().getNode(
- processorName + IoTDBConstant.BUFFERWRITE_LOG_NODE_SUFFIX,
- getBufferwriteRestoreFilePath(),
- FileNodeManager.getInstance().getRestoreFilePath(processorName));
- } catch (IOException e) {
- throw new BufferWriteProcessorException(e);
- }
+ try {
+ getLogNode();
+ } catch (IOException e) {
+ throw new BufferWriteProcessorException(e);
}
this.versionController = versionController;
@@ -495,7 +489,15 @@ public class BufferWriteProcessor extends Processor {
writer.setNewResource(isNewProcessor);
}
- public WriteLogNode getLogNode() {
+ public WriteLogNode getLogNode() throws IOException {
+ if (logNode == null) {
+ if (IoTDBDescriptor.getInstance().getConfig().isEnableWal()) {
+ logNode = MultiFileLogNodeManager.getInstance().getNode(
+ processorName + IoTDBConstant.BUFFERWRITE_LOG_NODE_SUFFIX,
+ getBufferwriteRestoreFilePath(),
+ FileNodeManager.getInstance().getRestoreFilePath(processorName));
+ }
+ }
return logNode;
}
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
index 516abdc..656ece6 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
@@ -372,7 +372,11 @@ public class FileNodeManager implements IStatistic, IService {
throw new FileNodeManagerException(e);
}
// write wal
- writeLog(tsRecord, isMonitor, overflowProcessor.getLogNode());
+ try {
+ writeLog(tsRecord, isMonitor, overflowProcessor.getLogNode());
+ } catch (IOException e) {
+ throw new FileNodeManagerException(e);
+ }
// write overflow data
try {
overflowProcessor.insert(tsRecord);
@@ -418,7 +422,11 @@ public class FileNodeManager implements IStatistic, IService {
}
}
// write wal
- writeLog(tsRecord, isMonitor, bufferWriteProcessor.getLogNode());
+ try {
+ writeLog(tsRecord, isMonitor, bufferWriteProcessor.getLogNode());
+ } catch (IOException e) {
+ throw new FileNodeManagerException(e);
+ }
// Write data
long prevStartTime = fileNodeProcessor.getIntervalFileNodeStartTime(deviceId);
long prevUpdateTime = fileNodeProcessor.getLastUpdateTime(deviceId);
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessor.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessor.java
index 9905c46..c031181 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessor.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessor.java
@@ -117,13 +117,7 @@ public class OverflowProcessor extends Processor {
.get(FileNodeConstants.FILENODE_PROCESSOR_FLUSH_ACTION);
reopen();
-
- if (IoTDBDescriptor.getInstance().getConfig().isEnableWal()) {
- logNode = MultiFileLogNodeManager.getInstance().getNode(
- processorName + IoTDBConstant.OVERFLOW_LOG_NODE_SUFFIX,
- getOverflowRestoreFile(),
- FileNodeManager.getInstance().getRestoreFilePath(processorName));
- }
+ getLogNode();
}
public void reopen() throws IOException {
@@ -690,7 +684,15 @@ public class OverflowProcessor extends Processor {
}
}
- public WriteLogNode getLogNode() {
+ public WriteLogNode getLogNode() throws IOException {
+ if (logNode == null) {
+ if (IoTDBDescriptor.getInstance().getConfig().isEnableWal()) {
+ logNode = MultiFileLogNodeManager.getInstance().getNode(
+ processorName + IoTDBConstant.OVERFLOW_LOG_NODE_SUFFIX,
+ getOverflowRestoreFile(),
+ FileNodeManager.getInstance().getRestoreFilePath(processorName));
+ }
+ }
return logNode;
}