@Test public void flushForTest() throws IOException { writer.flushAllChunkGroups(); closeFile(); readNothing(); }
public boolean flushAllChunkGroups() throws IOException { if (recordCount > 0) { for (Map.Entry<String, IChunkGroupWriter> entry : groupWriters.entrySet()) { long pos = fileWriter.getPos(); String deviceId = entry.getKey(); IChunkGroupWriter groupWriter = entry.getValue(); fileWriter.startChunkGroup(deviceId); long dataSize = groupWriter.flushToFileWriter(fileWriter); if (fileWriter.getPos() - pos != dataSize) { throw new IOException( String.format( "Flushed data size is inconsistent with computation! Estimated: %d, Actual: %d", dataSize, fileWriter.getPos() - pos)); } fileWriter.endChunkGroup(); } reset(); } return false; }
TsFileWriter implements AutoCloseable { public boolean flushAllChunkGroups() throws IOException { if (recordCount > 0) { for (Map.Entry<String, IChunkGroupWriter> entry : groupWriters.entrySet()) { long pos = fileWriter.getPos(); String deviceId = entry.getKey(); IChunkGroupWriter groupWriter = entry.getValue(); fileWriter.startChunkGroup(deviceId); long dataSize = groupWriter.flushToFileWriter(fileWriter); if (fileWriter.getPos() - pos != dataSize) { throw new IOException( String.format( "Flushed data size is inconsistent with computation! Estimated: %d, Actual: %d", dataSize, fileWriter.getPos() - pos)); } fileWriter.endChunkGroup(); } reset(); } return false; } }
TsFileWriter implements AutoCloseable { public boolean flushAllChunkGroups() throws IOException { if (recordCount > 0) { for (Map.Entry<String, IChunkGroupWriter> entry : groupWriters.entrySet()) { long pos = fileWriter.getPos(); String deviceId = entry.getKey(); IChunkGroupWriter groupWriter = entry.getValue(); fileWriter.startChunkGroup(deviceId); long dataSize = groupWriter.flushToFileWriter(fileWriter); if (fileWriter.getPos() - pos != dataSize) { throw new IOException( String.format( "Flushed data size is inconsistent with computation! Estimated: %d, Actual: %d", dataSize, fileWriter.getPos() - pos)); } fileWriter.endChunkGroup(); } reset(); } return false; } TsFileWriter(File file);  TsFileWriter(TsFileIOWriter fileWriter);  TsFileWriter(File file, Schema schema);  TsFileWriter(TsFileOutput output, Schema schema);  TsFileWriter(File file, Schema schema, TSFileConfig conf); protected  TsFileWriter(TsFileIOWriter fileWriter, Schema schema, TSFileConfig conf); }
TsFileWriter implements AutoCloseable { public boolean flushAllChunkGroups() throws IOException { if (recordCount > 0) { for (Map.Entry<String, IChunkGroupWriter> entry : groupWriters.entrySet()) { long pos = fileWriter.getPos(); String deviceId = entry.getKey(); IChunkGroupWriter groupWriter = entry.getValue(); fileWriter.startChunkGroup(deviceId); long dataSize = groupWriter.flushToFileWriter(fileWriter); if (fileWriter.getPos() - pos != dataSize) { throw new IOException( String.format( "Flushed data size is inconsistent with computation! Estimated: %d, Actual: %d", dataSize, fileWriter.getPos() - pos)); } fileWriter.endChunkGroup(); } reset(); } return false; } TsFileWriter(File file);  TsFileWriter(TsFileIOWriter fileWriter);  TsFileWriter(File file, Schema schema);  TsFileWriter(TsFileOutput output, Schema schema);  TsFileWriter(File file, Schema schema, TSFileConfig conf); protected  TsFileWriter(TsFileIOWriter fileWriter, Schema schema, TSFileConfig conf); void registerDeviceTemplate(String templateName, Map<String, MeasurementSchema> template); void registerDevice(String deviceId, String templateName); void registerTimeseries(Path path, MeasurementSchema measurementSchema); boolean write(TSRecord record); boolean write(Tablet tablet); boolean flushAllChunkGroups(); @Override void close(); TsFileIOWriter getIOWriter(); void writeVersion(long versionPair); }
TsFileWriter implements AutoCloseable { public boolean flushAllChunkGroups() throws IOException { if (recordCount > 0) { for (Map.Entry<String, IChunkGroupWriter> entry : groupWriters.entrySet()) { long pos = fileWriter.getPos(); String deviceId = entry.getKey(); IChunkGroupWriter groupWriter = entry.getValue(); fileWriter.startChunkGroup(deviceId); long dataSize = groupWriter.flushToFileWriter(fileWriter); if (fileWriter.getPos() - pos != dataSize) { throw new IOException( String.format( "Flushed data size is inconsistent with computation! Estimated: %d, Actual: %d", dataSize, fileWriter.getPos() - pos)); } fileWriter.endChunkGroup(); } reset(); } return false; } TsFileWriter(File file);  TsFileWriter(TsFileIOWriter fileWriter);  TsFileWriter(File file, Schema schema);  TsFileWriter(TsFileOutput output, Schema schema);  TsFileWriter(File file, Schema schema, TSFileConfig conf); protected  TsFileWriter(TsFileIOWriter fileWriter, Schema schema, TSFileConfig conf); void registerDeviceTemplate(String templateName, Map<String, MeasurementSchema> template); void registerDevice(String deviceId, String templateName); void registerTimeseries(Path path, MeasurementSchema measurementSchema); boolean write(TSRecord record); boolean write(Tablet tablet); boolean flushAllChunkGroups(); @Override void close(); TsFileIOWriter getIOWriter(); void writeVersion(long versionPair);  }