npawar opened a new pull request, #9719:
URL: https://github.com/apache/pinot/pull/9719
Before this code change, if for some reason `segmentTarFile` already existed
on the server (at `indexDir/tableName_REALTIME/segmentName.tar.gz`), then we
would simply fail with FileAlreadyExistsException during
`SegmentFetcherFactory.fetchSegmentToLocal(uri, segmentTarFile);`
The file could already exist in the scenario where server gets restarted or
killed, before we get to the finally of this method, which is supposed to clean
up the file.
```
private void downloadSegmentFromDeepStore(String segmentName,
IndexLoadingConfig indexLoadingConfig, String uri) {
File segmentTarFile = new File(_indexDir, segmentName +
TarGzCompressionUtils.TAR_GZ_FILE_EXTENSION);
try {
SegmentFetcherFactory.fetchSegmentToLocal(uri, segmentTarFile);
_logger.info("Downloaded file from {} to {}; Length of downloaded
file: {}", uri, segmentTarFile,
segmentTarFile.length());
untarAndMoveSegment(segmentName, indexLoadingConfig, segmentTarFile);
} catch (Exception e) {
_logger.warn("Failed to download segment {} from deep store: ",
segmentName, e);
throw new RuntimeException(e);
} finally {
FileUtils.deleteQuietly(segmentTarFile);
}
}
```
Cleaning up the file explicitly before fetching to local.
--
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]