You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2021/02/04 09:19:44 UTC

[iotdb] branch ImproveFlush created (now e8e7bf9)

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

jackietien pushed a change to branch ImproveFlush
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at e8e7bf9  improve flush

This branch includes the following new commits:

     new e8e7bf9  improve flush

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: improve flush

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch ImproveFlush
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit e8e7bf90673d4acc9ce28f1f79ff3083af0250e3
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Thu Feb 4 17:13:00 2021 +0800

    improve flush
---
 .../main/java/org/apache/iotdb/tsfile/utils/PublicBAOS.java  |  5 +++++
 .../org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java | 12 +++---------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/PublicBAOS.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/PublicBAOS.java
index de4c985..085bcef 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/PublicBAOS.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/PublicBAOS.java
@@ -79,4 +79,9 @@ public class PublicBAOS extends ByteArrayOutputStream {
   public void reset() {
     count = 0;
   }
+
+  @Override
+  public int size() {
+    return count;
+  }
 }
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
index a1968c8..0b92c6f 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/chunk/ChunkWriterImpl.java
@@ -52,11 +52,6 @@ public class ChunkWriterImpl implements IChunkWriter {
    */
   private PublicBAOS pageBuffer;
 
-  /**
-   * current chunk data size, i.e the size of pageBuffer
-   */
-  private int chunkDataSize;
-
   private int numOfPages;
 
   /**
@@ -356,7 +351,6 @@ public class ChunkWriterImpl implements IChunkWriter {
     if (pageWriter != null && pageWriter.getPointNumber() > 0) {
       writePageToPageBuffer();
     }
-    chunkDataSize = pageBuffer.size();
   }
   
   public void clearPageWriter() {
@@ -424,7 +418,7 @@ public class ChunkWriterImpl implements IChunkWriter {
 
     // start to write this column chunk
     writer.startFlushChunk(measurementSchema, compressor.getType(), measurementSchema.getType(),
-        measurementSchema.getEncodingType(), statistics, chunkDataSize, numOfPages);
+        measurementSchema.getEncodingType(), statistics, pageBuffer.size(), numOfPages);
 
     long dataOffset = writer.getPos();
 
@@ -432,10 +426,10 @@ public class ChunkWriterImpl implements IChunkWriter {
     writer.writeBytesToStream(pageBuffer);
 
     int dataSize = (int) (writer.getPos() - dataOffset);
-    if (dataSize != chunkDataSize) {
+    if (dataSize != pageBuffer.size()) {
       throw new IOException(
           "Bytes written is inconsistent with the size of data: " + dataSize + " !="
-              + " " + chunkDataSize);
+              + " " + pageBuffer.size());
     }
 
     writer.endCurrentChunk();