tarun11Mavani commented on code in PR #19577:
URL: https://github.com/apache/pinot/pull/19577#discussion_r4092253940
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/fwd/CLPForwardIndexCreatorV2.java:
##########
@@ -452,9 +452,13 @@ public void seal() {
@Override
public void close()
throws IOException {
+ try {
+ org.apache.pinot.common.utils.FileUtils.forceMappedBuffers(_fileBuffer);
+ } finally {
+ org.apache.pinot.common.utils.FileUtils.syncAndClose(_dataFile);
+ }
Review Comment:
This reordering drops a cleanup guarantee.
V2 used to delete the temp dir first, unconditionally:
```java
// before
FileUtils.deleteDirectory(_intermediateFilesDir);
_dataFile.close();
```
Now it runs last, behind `forceMappedBuffers` and `syncAndClose`. This PR
made both of those capable of throwing, so an `EIO`/`ENOSPC` during the final
sync orphans `<column>.raw_sv.forward_index.clp.tmp`.
V1 has the same exposure.
`VarLengthValueWriter.close()` already uses similar shape where finally can
be wrapped in a try or both `forceMappedBuffers` and `syncAndClose` can be
wrapped in a try.
```java
@Override
public void close()
throws IOException {
try {
try {
org.apache.pinot.common.utils.FileUtils.forceMappedBuffers(_fileBuffer);
} finally {
org.apache.pinot.common.utils.FileUtils.syncAndClose(_dataFile);
}
} finally {
// Delete all temp files
FileUtils.deleteQuietly(_intermediateFilesDir);
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]