You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ea...@apache.org on 2019/06/17 02:04:45 UTC
[incubator-iotdb] branch feature_async_close_tsfile updated: fix
overflow
This is an automated email from the ASF dual-hosted git repository.
east pushed a commit to branch feature_async_close_tsfile
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/feature_async_close_tsfile by this push:
new f23bddf fix overflow
f23bddf is described below
commit f23bddf7954a80b15a91a013d47e40f4bee592a2
Author: mdf369 <95...@qq.com>
AuthorDate: Mon Jun 17 10:04:29 2019 +0800
fix overflow
---
.../apache/iotdb/db/engine/overflow/io/OverflowProcessor.java | 9 +++++++--
.../iotdb/db/engine/overflow/io/OverflowProcessorTest.java | 2 +-
.../apache/iotdb/db/engine/overflow/io/OverflowTestUtils.java | 2 ++
3 files changed, 10 insertions(+), 3 deletions(-)
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 7a0f1f7..3171b4c 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
@@ -57,6 +57,7 @@ import org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
import org.apache.iotdb.db.engine.version.VersionController;
import org.apache.iotdb.db.exception.OverflowProcessorException;
import org.apache.iotdb.db.exception.ProcessorException;
+import org.apache.iotdb.db.monitor.collector.MemTableWriteTimeCost;
import org.apache.iotdb.db.qp.constant.DatetimeUtils;
import org.apache.iotdb.db.query.context.QueryContext;
import org.apache.iotdb.db.query.control.FileReaderManager;
@@ -227,6 +228,7 @@ public class OverflowProcessor extends Processor {
* insert one time-series record
*/
public void insert(TSRecord tsRecord) throws IOException {
+ MemTableWriteTimeCost.getInstance().init();
try {
checkOpen();
} catch (OverflowProcessorException e) {
@@ -397,10 +399,13 @@ public class OverflowProcessor extends Processor {
queryFlushLock.lock();
try {
if (!overflowFlushMemTables.isEmpty() && isFlush()) {
- for (IMemTable memTable : overflowFlushMemTables) {
- memSeriesLazyMerger.addMemSeries(memTable.query(deviceId, measurementId, dataType, props));
+ for (int i = overflowFlushMemTables.size() - 1; i >= 0; i--) {
+ memSeriesLazyMerger.addMemSeries(
+ overflowFlushMemTables.get(i).query(deviceId, measurementId, dataType, props));
}
}
+ memSeriesLazyMerger
+ .addMemSeries(workSupport.query(deviceId, measurementId, dataType, props));
// memSeriesLazyMerger has handled the props,
// so we do not need to handle it again in the following readOnlyMemChunk
return new ReadOnlyMemChunk(dataType, memSeriesLazyMerger, Collections.emptyMap());
diff --git a/iotdb/src/test/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessorTest.java b/iotdb/src/test/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessorTest.java
index 4b4cdf9..128d8b2 100644
--- a/iotdb/src/test/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessorTest.java
+++ b/iotdb/src/test/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessorTest.java
@@ -106,7 +106,7 @@ public class OverflowProcessorTest {
.query(OverflowTestUtils.deviceId1, OverflowTestUtils.measurementId1,
OverflowTestUtils.dataType1, Collections.emptyMap(), context);
assertEquals(OverflowTestUtils.dataType1, overflowSeriesDataSource.getDataType());
- Assert.assertEquals(false, overflowSeriesDataSource.getReadableMemChunk().isEmpty());
+ assertEquals(false, overflowSeriesDataSource.getReadableMemChunk().isEmpty());
assertEquals(1, overflowSeriesDataSource.getOverflowInsertFileList().size());
Iterator<TimeValuePair> iterator = overflowSeriesDataSource.getReadableMemChunk().getIterator();
for (int i = 1; i <= 3; i++) {
diff --git a/iotdb/src/test/java/org/apache/iotdb/db/engine/overflow/io/OverflowTestUtils.java b/iotdb/src/test/java/org/apache/iotdb/db/engine/overflow/io/OverflowTestUtils.java
index 5b40870..50395d9 100644
--- a/iotdb/src/test/java/org/apache/iotdb/db/engine/overflow/io/OverflowTestUtils.java
+++ b/iotdb/src/test/java/org/apache/iotdb/db/engine/overflow/io/OverflowTestUtils.java
@@ -19,6 +19,7 @@
package org.apache.iotdb.db.engine.overflow.io;
import java.io.IOException;
+import org.apache.iotdb.db.monitor.collector.MemTableWriteTimeCost;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
import org.apache.iotdb.tsfile.write.record.TSRecord;
@@ -48,6 +49,7 @@ public class OverflowTestUtils {
}
public static void produceInsertData(OverflowMemtable support) {
+ MemTableWriteTimeCost.getInstance().init();
support.insert(getData(deviceId1, measurementId1, dataType1, String.valueOf(1), 1));
support.insert(getData(deviceId1, measurementId1, dataType1, String.valueOf(3), 3));
support.insert(getData(deviceId1, measurementId1, dataType1, String.valueOf(2), 2));