mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 13:09:00 +00:00
(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:
parent
2b8ab97ec1
commit
90a2d4ae38
@ -142,8 +142,10 @@ public class PrioDocIdsTransformer implements LongArrayTransformations.LongIOTra
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
writeBuffer.flip();
|
||||
int written = writeChannel.write(writeBuffer, writeOffsetB);
|
||||
writeOffsetB += written;
|
||||
while (writeBuffer.hasRemaining()) {
|
||||
int written = writeChannel.write(writeBuffer, writeOffsetB);
|
||||
writeOffsetB += written;
|
||||
}
|
||||
writeBuffer.clear();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user