(index) Fix partial buffer writing in PrioDocIdsTransformer

Ensure all data is written to writeChannel by looping until the buffer is fully drained. This prevents potential data loss during the close operation and maintains data integrity.
This commit is contained in:
Viktor Lofgren 2024-09-29 17:53:40 +02:00
parent 2b8ab97ec1
commit 90a2d4ae38

View File

@ -142,8 +142,10 @@ public class PrioDocIdsTransformer implements LongArrayTransformations.LongIOTra
@Override
public void close() throws IOException {
writeBuffer.flip();
while (writeBuffer.hasRemaining()) {
int written = writeChannel.write(writeBuffer, writeOffsetB);
writeOffsetB += written;
}
writeBuffer.clear();
}
}