From c5a4f06ec3448558a0f25fef5fb77efb93d905f2 Mon Sep 17 00:00:00 2001 From: Lijia Liu Date: Mon, 10 Nov 2025 18:54:56 +0800 Subject: [PATCH] [opt](cloud) optimize the logic of creating warmup job(#57752) Retrieve the tablet set only once when creating a warm up job Co-authored-by: liulijia --- .../org/apache/doris/cloud/CacheHotspotManager.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/cloud/CacheHotspotManager.java b/fe/fe-core/src/main/java/org/apache/doris/cloud/CacheHotspotManager.java index ed51961151e334..d849d11e8432f4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/cloud/CacheHotspotManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/CacheHotspotManager.java @@ -722,6 +722,12 @@ public Map> warmUpNewClusterByTable(long jobId, String dstClu Long warmUpTotalFileCache = 0L; LOG.info("Start warm up job {}, cluster {}, total cache size: {}", jobId, dstClusterName, totalFileCache); + List backends = getBackendsFromCluster(dstClusterName); + LOG.info("Got {} backends for cluster {}", backends.size(), dstClusterName); + Map> beToTabletIds = new HashMap<>(); + for (Backend backend : backends) { + beToTabletIds.put(backend.getId(), getTabletIdsFromBe(backend.getId())); + } for (Triple tableTriple : tables) { if (warmUpTotalFileCache > totalFileCache) { LOG.info("Warm up size {} exceeds total cache size {}, breaking loop", @@ -732,8 +738,7 @@ public Map> warmUpNewClusterByTable(long jobId, String dstClu List partitions = getPartitionsFromTriple(tableTriple); LOG.info("Got {} partitions for table {}.{}.{}", partitions.size(), tableTriple.getLeft(), tableTriple.getMiddle(), tableTriple.getRight()); - List backends = getBackendsFromCluster(dstClusterName); - LOG.info("Got {} backends for cluster {}", backends.size(), dstClusterName); + List warmUpPartitions = new ArrayList<>(); for (Partition partition : partitions) { Long partitionSize = partition.getDataSize(true); @@ -755,7 +760,7 @@ public Map> warmUpNewClusterByTable(long jobId, String dstClu LOG.info("Got {} tablets for table {}.{}.{}", tablets.size(), tableTriple.getLeft(), tableTriple.getMiddle(), tableTriple.getRight()); for (Backend backend : backends) { - Set beTabletIds = getTabletIdsFromBe(backend.getId()); + Set beTabletIds = beToTabletIds.get(backend.getId()); List warmUpTablets = new ArrayList<>(); for (Tablet tablet : tablets) { if (beTabletIds.contains(tablet.getId())) {