changeset 734:51076ac31537

NcDataBlockWriter - bugfix (truncates existing file)
author Devel 1
date Mon, 04 Dec 2017 16:21:05 +0100
parents cc190cb53f4f
children 843e6848a49b
files stress-tester/src/main/java/com/passus/st/reader/nc/NcDataBlockWriter.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/NcDataBlockWriter.java	Mon Dec 04 14:18:21 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/reader/nc/NcDataBlockWriter.java	Mon Dec 04 16:21:05 2017 +0100
@@ -3,7 +3,6 @@
 import com.passus.commons.Assert;
 import com.passus.data.ByteBuff;
 import com.passus.data.ByteBuffDataSource;
-import com.passus.data.DataHelper;
 import com.passus.data.DataSource;
 import com.passus.st.emitter.SessionInfo;
 import com.passus.st.reader.DataBlockWriter;
@@ -56,7 +55,7 @@
     private long currentSegmentInfoPos = -1;
 
     private int currentSegmentSessionInfoBlocks = -1;
-    
+
     private int currentSegmentsPayloadBlocks = -1;
 
     private long currentSegmentSize = -1;
@@ -148,6 +147,7 @@
         try {
             StandardOpenOption createOption = allowOverwrite ? StandardOpenOption.CREATE : StandardOpenOption.CREATE_NEW;
             ch = FileChannel.open(path, StandardOpenOption.WRITE, createOption);
+            ch.truncate(0);
             writeHeader();
             openSegmentBlock();
             opened = true;