Code review comment: There will be a PR to implement the backlist strategy soon, comment will be made at that time.

Code under review:
private TOlapTableLocationParam createLocation(OlapTable table) throws UserException {
        TOlapTableLocationParam locationParam = new TOlapTableLocationParam();
        
        Multimap<Long, Long> allBePathsMap = HashMultimap.create();
        Map<Long, Long> bePrimaryMap = new HashMap<>();
        for (Long partitionId : partitionIds) {
            Partition partition = table.getPartition(partitionId);
            int quorum = table.getPartitionInfo().getQuorumNum(partition.getId());
            for (MaterializedIndex index : partition.getMaterializedIndices(IndexExtState.ALL)) {
                for (Tablet tablet : index.getTablets()) {
                    if (table.isLakeTable()) {
                        locationParam.addToTablets(new TTabletLocation(
                                tablet.getId(), Lists.newArrayList(((LakeTablet) tablet).getPrimaryBackendId())));
                    } else {
                        
                        
                        LocalTablet localTablet = (LocalTablet) tablet;
                        Multimap<Long, Long> bePathsMap =
                                localTablet.getNormalReplicaBackendPathMap(table.getClusterId());
                        if (bePathsMap.keySet().size() < quorum) {
                            throw new UserException(InternalErrorCode.REPLICA_FEW_ERR,
                                    "Tablet lost replicas. Check if any backend is down or not. tablet_id: "
                                            + tablet.getId() + ", backends: " +
                                            Joiner.on(",").join(localTablet.getBackends()));
                        }

                        List<Long> replicas = Lists.newArrayList(bePathsMap.keySet());
                        int lowUsageIndex = 0;
                        for (int i = 0; i < replicas.size(); i++) {
                            Long backendID = replicas.get(i);
                            if (!bePrimaryMap.containsKey(backendID)) {
                                bePrimaryMap.put(backendID, Long.valueOf(0));
                            }
                            if (bePrimaryMap.get(backendID) < bePrimaryMap.get(replicas.get(lowUsageIndex))) {
                                lowUsageIndex = i;
                            }
                        }
                        bePrimaryMap.put(replicas.get(lowUsageIndex), bePrimaryMap.get(replicas.get(lowUsageIndex)) + 1);
                        
                        Collections.swap(replicas, 0, lowUsageIndex);

                        locationParam
                                .addToTablets(
                                        new TTabletLocation(tablet.getId(), replicas));
                        allBePathsMap.putAll(bePathsMap);
                    }
                }
            }
        }

        
        
        Status st = GlobalStateMgr.getCurrentSystemInfo().checkExceedDiskCapacityLimit(allBePathsMap, true);
        if (!st.ok()) {
            throw new DdlException(st.getErrorMsg());
        }
        return locationParam;
    }

Line commented on: int lowUsageIndex = 0;

Revised code:
private TOlapTableLocationParam createLocation(OlapTable table) throws UserException {
        TOlapTableLocationParam locationParam = new TOlapTableLocationParam();
        
        Multimap<Long, Long> allBePathsMap = HashMultimap.create();
        Map<Long, Long> bePrimaryMap = new HashMap<>();
        for (Long partitionId : partitionIds) {
            Partition partition = table.getPartition(partitionId);
            int quorum = table.getPartitionInfo().getQuorumNum(partition.getId());
            for (MaterializedIndex index : partition.getMaterializedIndices(IndexExtState.ALL)) {
                for (Tablet tablet : index.getTablets()) {
                    if (table.isLakeTable()) {
                        locationParam.addToTablets(new TTabletLocation(
                                tablet.getId(), Lists.newArrayList(((LakeTablet) tablet).getPrimaryBackendId())));
                    } else {
                        
                        
                        LocalTablet localTablet = (LocalTablet) tablet;
                        Multimap<Long, Long> bePathsMap =
                                localTablet.getNormalReplicaBackendPathMap(table.getClusterId());
                        if (bePathsMap.keySet().size() < quorum) {
                            throw new UserException(InternalErrorCode.REPLICA_FEW_ERR,
                                    "Tablet lost replicas. Check if any backend is down or not. tablet_id: "
                                            + tablet.getId() + ", backends: " +
                                            Joiner.on(",").join(localTablet.getBackends()));
                        }

                        List<Long> replicas = Lists.newArrayList(bePathsMap.keySet());
                        int lowUsageIndex = 0;
                        for (int i = 0; i < replicas.size(); i++) {
                            Long backendID = replicas.get(i);
                            if (!bePrimaryMap.containsKey(backendID)) {
                                bePrimaryMap.put(backendID, Long.valueOf(0));
                            }
                            if (bePrimaryMap.get(backendID) < bePrimaryMap.get(replicas.get(lowUsageIndex))) {
                                lowUsageIndex = i;
                            }
                        }
                        bePrimaryMap.put(replicas.get(lowUsageIndex), bePrimaryMap.get(replicas.get(lowUsageIndex)) + 1);
                        
                        Collections.swap(replicas, 0, lowUsageIndex);

                        locationParam
                                .addToTablets(
                                        new TTabletLocation(tablet.getId(), replicas));
                        allBePathsMap.putAll(bePathsMap);
                    }
                }
            }
        }

        
        
        Status st = GlobalStateMgr.getCurrentSystemInfo().checkExceedDiskCapacityLimit(allBePathsMap, true);
        if (!st.ok()) {
            throw new DdlException(st.getErrorMsg());
        }
        return locationParam;
    }