J-HowHuang commented on code in PR #20367:
URL: https://github.com/apache/pinot/pull/20367#discussion_r4705991722
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/BaseTableDataManager.java:
##########
@@ -1359,14 +1359,34 @@ public void reloadSegment(String segmentName,
IndexLoadingConfig indexLoadingCon
SegmentDirectory segmentDirectory =
initSegmentDirectory(segmentName, zkMetadata.getCrc(),
indexLoadingConfig, zkMetadata);
// We should first try to reuse existing segment directory
- if (canReuseExistingDirectoryForReload(zkMetadata, segmentTier,
segmentDirectory, indexLoadingConfig)) {
+ SegmentDirectory reusableDirectory;
+ try {
+ reusableDirectory =
+ getReusableDirectoryForReload(zkMetadata, segmentTier,
segmentDirectory, indexLoadingConfig);
+ } catch (Exception e) {
+ closeSegmentDirectoryQuietly(segmentDirectory);
+ throw e;
+ }
+ if (reusableDirectory == segmentDirectory) {
_logger.info("Reloading segment: {} using existing segment
directory as no reprocessing needed",
segmentName);
// No reprocessing needed, reuse the same segment
ImmutableSegment segment =
ImmutableSegmentLoader.load(segmentDirectory, indexLoadingConfig);
addSegment(segment, zkMetadata);
return;
}
+ if (reusableDirectory != null) {
Review Comment:
I don't think it matters. `getReusableDirectoryForReload` should be the one
to decide which directory it wants to reuse, be it the dir with old crc or the
new crc. No need to control the flow at this place.
--
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]