FrankChen021 commented on code in PR #20267:
URL: https://github.com/apache/druid/pull/20267#discussion_r3989505479
##########
server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java:
##########
@@ -1116,8 +1117,13 @@ private DataSegment loadPartial(DataSegment dataSegment)
throws SegmentLoadingEx
final Set<String> selected = Set.copyOf(
wrapper.getSelectedBundleNames(dataSegment,
mapper.getSegmentFileMetadata())
);
+ // Snapshot the rule this call is about to replace, then pin the
UNION of it and the new selection for the
+ // duration of the attempt.
final String priorFingerprint = metadata.getRuleFingerprint();
- metadata.applyRule(wrapper.getFingerprint(), selected);
+ final Set<String> priorSelection =
metadata.getRuleSelectedBundleNames();
+ final Set<String> attemptSelection = new HashSet<>(priorSelection);
+ attemptSelection.addAll(selected);
+ metadata.applyRule(wrapper.getFingerprint(), attemptSelection);
Review Comment:
[P1] Restore the info file when a rule swap fails
`loadPartial` rewrites the segment info file before this in-memory rule swap
and `realizeRuleOrRestorePrior` have completed. On an existing serving replica,
an eager bundle failure now restores the prior rule in memory and throws, so
the handler keeps the old announcement, but the info file still contains the
new fingerprint/delegate/selection. If the historical restarts before a retry
succeeds, bootstrap trusts that file and re-applies the failed rule; another
capacity or deep-storage failure then makes `loadSegmentOnBootstrap` call
`cacheManager.drop`, deleting the last good replica, while a successful
bootstrap silently changes the durable rule ahead of coordinator state. Write
the new info file only after realization commits, or atomically restore the
prior info file on every failed reload path (including mount/selection
failures), and add a restart-after-failed-reload test.
--
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]