AntiTopQuark commented on code in PR #66191:
URL: https://github.com/apache/doris/pull/66191#discussion_r3868630482
##########
fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java:
##########
@@ -650,13 +661,33 @@ private void scheduleTablet(TabletSchedCtx tabletCtx,
AgentBatchTask batchTask)
tabletCtx.setVersionInfo(partition.getVisibleVersion(),
partition.getCommittedVersion());
tabletCtx.setSchemaHash(tbl.getSchemaHashByIndexId(idx.getId()));
tabletCtx.setStorageMedium(tbl.getPartitionInfo().getDataProperty(partition.getId()).getStorageMedium());
+ setBasePreferredDestPathIfNecessary(tabletCtx, partition, idx,
tablet, tabletHealth.status);
handleTabletByTypeAndStatus(tabletHealth.status, tabletCtx,
batchTask);
} finally {
tbl.writeUnlock();
}
}
+ private void setBasePreferredDestPathIfNecessary(TabletSchedCtx tabletCtx,
Partition partition,
+ MaterializedIndex idx, Tablet tablet, TabletStatus status) throws
SchedException {
+
tabletCtx.setBasePreferredDestPathHashByBackend(Collections.emptyMap());
+ if (idx.isRowBinlog() || idx.getId() !=
partition.getBaseIndex().getId()) {
+ return;
+ }
+ if (status != TabletStatus.REPLICA_MISSING && status !=
TabletStatus.REPLICA_RELOCATING) {
+ return;
+ }
+ Map<Long, Long> preferredDestPathHashByBackend;
+ try {
+ preferredDestPathHashByBackend = RowBinlogTabletLocality
+ .getPreferredBaseRepairPathByBackend(partition, tablet,
tabletCtx.getVisibleVersion());
+ } catch (IllegalStateException e) {
+ throw new SchedException(Status.UNRECOVERABLE, e.getMessage());
+ }
+
tabletCtx.setBasePreferredDestPathHashByBackend(preferredDestPathHashByBackend);
Review Comment:
Added `computeBasePreferredDestPathHashByBackend`, which computes the
preferred paths locally only when needed (only for the non-row-binlog base
index; otherwise it returns an empty map).
Inside `handleReplicaMissing`, the preferred paths are computed on the fly
at the point of use and passed directly as an argument to
`chooseBasePreferredDestPath`.
--
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]