This is an automated email from the ASF dual-hosted git repository. hxd pushed a commit to branch fix_future_lost_when_flush_multitimes in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 633a01b2431977e4f3bd8776671b166ae140d669 Author: xiangdong huang <[email protected]> AuthorDate: Fri Apr 12 14:53:12 2019 +0800 fix the future instance is replaced when the flush frequency is high --- .../db/engine/bufferwrite/BufferWriteProcessor.java | 18 +++++++++--------- .../iotdb/db/engine/overflow/io/OverflowProcessor.java | 17 ++++++++--------- 2 files changed, 17 insertions(+), 18 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 e09feec..51c7907 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 @@ -332,16 +332,16 @@ public class BufferWriteProcessor extends Processor { } lastFlushTime = System.nanoTime(); // check value count + // waiting for the end of last flush operation. + try { + flushFuture.get(); + } catch (InterruptedException | ExecutionException e) { + LOGGER.error("Encounter an interrupt error when waitting for the flushing, " + + "the bufferwrite processor is {}.", + getProcessorName(), e); + Thread.currentThread().interrupt(); + } if (valueCount > 0) { - // waiting for the end of last flush operation. - try { - flushFuture.get(); - } catch (InterruptedException | ExecutionException e) { - LOGGER.error("Encounter an interrupt error when waitting for the flushing, " - + "the bufferwrite processor is {}.", - getProcessorName(), e); - Thread.currentThread().interrupt(); - } // update the lastUpdatetime, prepare for flush try { bufferwriteFlushAction.act(); 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 0debfe4..a3a4663 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 @@ -488,17 +488,16 @@ public class OverflowProcessor extends Processor { (thisFLushTime - lastFlushTime) / 1000); } lastFlushTime = System.currentTimeMillis(); - // value count + try { + flushFuture.get(); + } catch (InterruptedException | ExecutionException e) { + LOGGER.error("Encounter an interrupt error when waitting for the flushing, " + + "the bufferwrite processor is {}.", + getProcessorName(), e); + Thread.currentThread().interrupt(); + } if (valueCount > 0) { try { - flushFuture.get(); - } catch (InterruptedException | ExecutionException e) { - LOGGER.error("Encounter an interrupt error when waitting for the flushing, " - + "the bufferwrite processor is {}.", - getProcessorName(), e); - Thread.currentThread().interrupt(); - } - try { // backup newIntervalFile list and emptyIntervalFileNode overflowFlushAction.act(); } catch (Exception e) {
