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/09/29 09:45:58 UTC

[incubator-iotdb] branch dev_preallocate_data_file updated: fix buffer limit is unset

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

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


The following commit(s) were added to refs/heads/dev_preallocate_data_file by this push:
     new c23e8d2  fix buffer limit is unset
c23e8d2 is described below

commit c23e8d2453a5666e4bff616da6e7aefb86403b0a
Author: jt <jt...@163.com>
AuthorDate: Sun Sep 29 17:34:58 2019 +0800

    fix buffer limit is unset
---
 .../java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
index ca6b6b2..941cd7d 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
@@ -144,7 +144,9 @@ public class TsFileProcessor {
       // instead
       int preAllocateSize =
           (fileSizeThreshold > Integer.MAX_VALUE / 2) ? Integer.MAX_VALUE / 2 : (int) fileSizeThreshold;
-      fileChannel.write(ByteBuffer.allocate(preAllocateSize));
+      ByteBuffer emptyBuffer = ByteBuffer.allocate(preAllocateSize);
+      emptyBuffer.limit(emptyBuffer.capacity());
+      fileChannel.write(emptyBuffer);
       fileChannel.force(true);
     }
   }