Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ private static MemoryRecords convertRecords(MemoryRecords recordsToConvert, byte
ByteBuffer convertedRecordsBuffer;
try (TransferableChannel channel = toTransferableChannel(FileChannel.open(outputFile.toPath(), StandardOpenOption.READ, StandardOpenOption.WRITE))) {
int written = 0;
while (written < bytesToConvert) written += lazySend.writeTo(channel, written, bytesToConvert - written);
// Use bytesToConvert as remaining to avoid truncating batches when V1 is larger than V2 (e.g. zlib-ng)
while (written < bytesToConvert) written += lazySend.writeTo(channel, written, bytesToConvert);
try (FileRecords convertedRecords = FileRecords.open(outputFile, true, written, false)) {
convertedRecordsBuffer = ByteBuffer.allocate(convertedRecords.sizeInBytes());
convertedRecords.readInto(convertedRecordsBuffer, 0);
Expand Down