Fix file handle leak in Lucene99ScalarQuantizedVectorsWriter. (#12739)

If `mergeQuantizedByteVectorValues` fails with an exception, the temp output
never gets closed. This was found by the test that throws random exceptions.
This commit is contained in:
Adrien Grand 2023-10-31 11:35:05 +01:00 committed by GitHub
parent 85f5d3bb0b
commit 361f0a4524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -260,7 +260,7 @@ public final class Lucene99ScalarQuantizedVectorsWriter implements Accountable {
quantizationDataInput)));
} finally {
if (success == false) {
IOUtils.closeWhileHandlingException(quantizationDataInput);
IOUtils.closeWhileHandlingException(tempQuantizedVectorData, quantizationDataInput);
IOUtils.deleteFilesIgnoringExceptions(
segmentWriteState.directory, tempQuantizedVectorData.getName());
}