Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
deardeng committed Jul 24, 2024
1 parent 9d60e57 commit 62c7415
Show file tree
Hide file tree
Showing 59 changed files with 104 additions and 238 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public AlterLightSchemaChangeInfo callForColumnsInfo()
Map<Long, Future<PFetchColIdsResponse>> beIdToRespFuture = new HashMap<>();
try {
for (Long beId : beIdToRequest.keySet()) {
final Backend backend = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster().get(beId);
final Backend backend = Env.getCurrentSystemInfo().getAllBackendsByAllCluster().get(beId);
final TNetworkAddress address =
new TNetworkAddress(Objects.requireNonNull(backend).getHost(), backend.getBrpcPort());
final Future<PFetchColIdsResponse> responseFuture = BackendServiceProxy.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private static void checkDecommissionWithReplicaAllocation(List<Backend> decommi
Map<Tag, Integer> tagAvailBackendNums = Maps.newHashMap();
List<Backend> bes;
try {
bes = Env.getCurrentSystemInfo().getBackendsByCurrentCluster();
bes = Env.getCurrentSystemInfo().getBackendsByCurrentCluster().values().asList();
} catch (UserException e) {
LOG.warn("Failed to get current cluster backend by current cluster.", e);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class AdminCancelRebalanceDiskStmt extends DdlStmt {
private List<Backend> backends = Lists.newArrayList();

public AdminCancelRebalanceDiskStmt(List<String> backends) throws UserException {
ImmutableMap<Long, Backend> backendsInfo = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();
ImmutableMap<Long, Backend> backendsInfo = Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
Map<String, Long> backendsID = new HashMap<String, Long>();
for (Backend backend : backendsInfo.values()) {
backendsID.put(NetUtils.getHostPortInAccessibleFormat(backend.getHost(), backend.getHeartbeatPort()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class AdminCleanTrashStmt extends DdlStmt {
private List<Backend> backends = Lists.newArrayList();

public AdminCleanTrashStmt(List<String> backends) throws UserException {
ImmutableMap<Long, Backend> backendsInfo = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();
ImmutableMap<Long, Backend> backendsInfo = Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
Map<String, Long> backendsID = new HashMap<String, Long>();
for (Backend backend : backendsInfo.values()) {
backendsID.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class AdminRebalanceDiskStmt extends DdlStmt {
public AdminRebalanceDiskStmt(List<String> backends) {
ImmutableMap<Long, Backend> backendsInfo;
try {
backendsInfo = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();
backendsInfo = Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
} catch (AnalysisException e) {
LOG.warn("failed to get backends,", e);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ShowTrashDiskStmt extends ShowStmt {
private Backend backend;

public ShowTrashDiskStmt(String backendQuery) throws AnalysisException {
ImmutableMap<Long, Backend> backendsInfo = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();
ImmutableMap<Long, Backend> backendsInfo = Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
for (Backend backend : backendsInfo.values()) {
String backendStr = NetUtils.getHostPortInAccessibleFormat(backend.getHost(), backend.getHeartbeatPort());
if (backendQuery.equals(backendStr)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ShowTrashStmt extends ShowStmt {
private List<Backend> backends = Lists.newArrayList();

public ShowTrashStmt() throws AnalysisException {
ImmutableMap<Long, Backend> backendsInfo = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();
ImmutableMap<Long, Backend> backendsInfo = Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
for (Backend backend : backendsInfo.values()) {
this.backends.add(backend);
}
Expand Down
2 changes: 1 addition & 1 deletion fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -6155,7 +6155,7 @@ public void cleanTrash(AdminCleanTrashStmt stmt) {
}

public void cleanUDFCacheTask(DropFunctionStmt stmt) throws UserException {
ImmutableMap<Long, Backend> backendsInfo = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();
ImmutableMap<Long, Backend> backendsInfo = Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
String functionSignature = stmt.signatureString();
AgentBatchTask batchTask = new AgentBatchTask();
for (Backend backend : backendsInfo.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ public void createHdfsVault(StorageVault vault) throws DdlException {
private void alterSyncVaultTask() {
List<Backend> bes;
try {
bes = systemInfoService.getBackendsByCurrentCluster();
// get system all backends
bes = systemInfoService.getAllBackendsByAllCluster().values().asList();
} catch (UserException e) {
LOG.warn("failed to get current cluster backends: {}", e);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public TabletStatMgr() {
protected void runAfterCatalogReady() {
ImmutableMap<Long, Backend> backends;
try {
backends = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();
backends = Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
} catch (AnalysisException e) {
LOG.warn("can't get backends info", e);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public Rebalancer getRebalancer() {
private boolean updateWorkingSlots() {
ImmutableMap<Long, Backend> backends;
try {
backends = infoService.getBackendsWithIdByCurrentCluster();
backends = infoService.getAllBackendsByAllCluster();
} catch (AnalysisException e) {
LOG.warn("failed to get backends with current cluster", e);
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public int getMinPipelineExecutorSize() {
}

@Override
public List<Backend> getBackendsByCurrentCluster() throws AnalysisException {
public ImmutableMap<Long, Backend> getBackendsByCurrentCluster() throws AnalysisException {
ConnectContext ctx = ConnectContext.get();
if (ctx == null) {
throw new AnalysisException("connect context is null");
Expand All @@ -380,12 +380,7 @@ public List<Backend> getBackendsByCurrentCluster() throws AnalysisException {
throw new AnalysisException("cluster name is empty");
}

return getBackendsByClusterName(cluster);
}

@Override
public ImmutableMap<Long, Backend> getBackendsWithIdByCurrentCluster() throws AnalysisException {
List<Backend> backends = getBackendsByCurrentCluster();
List<Backend> backends = getBackendsByClusterName(cluster);
Map<Long, Backend> idToBackend = Maps.newHashMap();
for (Backend be : backends) {
idToBackend.put(be.getId(), be);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public ReplicasProcNode(long tabletId, List<Replica> replicas) {

@Override
public ProcResult fetchResult() throws AnalysisException {
ImmutableMap<Long, Backend> backendMap = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();
ImmutableMap<Long, Backend> backendMap = Env.getCurrentSystemInfo().getAllBackendsByAllCluster();

BaseProcResult result = new BaseProcResult();
result.setNames(TITLE_NAMES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public List<List<Comparable>> fetchComparableResult(long version, long backendId
throws AnalysisException {
Preconditions.checkNotNull(table);
Preconditions.checkNotNull(index);
ImmutableMap<Long, Backend> backendMap = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();
ImmutableMap<Long, Backend> backendMap = Env.getCurrentSystemInfo().getAllBackendsByAllCluster();

List<List<Comparable>> tabletInfos = new ArrayList<List<Comparable>>();
Map<Long, String> pathHashToRoot = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class TrashProcDir implements ProcDirInterface {
public TrashProcDir() {
ImmutableMap<Long, Backend> backendsInfo;
try {
backendsInfo = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();
backendsInfo = Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
} catch (AnalysisException e) {
LOG.warn("Can't get backends info", e);
return;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected void runAfterCatalogReady() {
// step 2: publish topic info to all be
Collection<Backend> nodesToPublish;
try {
nodesToPublish = clusterInfoService.getAllBackendsWithIdByAllCluster().values();
nodesToPublish = clusterInfoService.getAllBackendsByAllCluster().values();
} catch (Exception e) {
LOG.warn("get backends failed", e);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static int getBENum() {
SystemInfoService infoService = Env.getCurrentSystemInfo();
ImmutableMap<Long, Backend> backends;
try {
backends = infoService.getBackendsWithIdByCurrentCluster();
backends = infoService.getAllBackendsByAllCluster();
} catch (AnalysisException e) {
logger.warn("failed to get backends with current cluster", e);
return 0;
Expand All @@ -59,7 +59,7 @@ private static int getBucketsNumByBEDisks() {
SystemInfoService infoService = Env.getCurrentSystemInfo();
ImmutableMap<Long, Backend> backends;
try {
backends = infoService.getBackendsWithIdByCurrentCluster();
backends = infoService.getAllBackendsByAllCluster();
} catch (AnalysisException e) {
logger.warn("failed to get backends with current cluster", e);
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ public void init(List<String> preLocations) throws UserException {
}

public void init(BeSelectionPolicy policy) throws UserException {
backends.addAll(policy.getCandidateBackends(Env.getCurrentSystemInfo().getBackendsByCurrentCluster()));
backends.addAll(policy.getCandidateBackends(Env.getCurrentSystemInfo()
.getBackendsByCurrentCluster().values().asList()));
if (backends.isEmpty()) {
throw new UserException("No available backends, "
+ "in cloud maybe this cluster has been dropped, please `use @otherClusterName` switch it");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public void createScanRangeLocations() throws UserException {

TScanRangeLocation location = new TScanRangeLocation();
long backendId = ConnectContext.get().getBackendId();
Backend backend = Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster().get(backendId);
Backend backend = Env.getCurrentSystemInfo().getBackendsByCurrentCluster().get(backendId);
location.setBackendId(backendId);
location.setServer(new TNetworkAddress(backend.getHost(), backend.getBePort()));
curLocations.addToLocations(location);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ private void testFeToJdbcConnection() throws DdlException {
private void testBeToJdbcConnection() throws DdlException {
Backend aliveBe = null;
try {
for (Backend be : Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster().values()) {
for (Backend be : Env.getCurrentSystemInfo().getAllBackendsByAllCluster().values()) {
if (be.isAlive()) {
aliveBe = be;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ public Object operateBackend(HttpServletRequest request, HttpServletResponse res
} else if ("DROP".equals(action)) {
currentSystemInfo.dropBackends(hostInfos);
} else if ("DECOMMISSION".equals(action)) {
ImmutableMap<Long, Backend> backendsInCluster = currentSystemInfo.getBackendsWithIdByCurrentCluster();
ImmutableMap<Long, Backend> backendsInCluster = currentSystemInfo.getAllBackendsByAllCluster();
backendsInCluster.forEach((k, v) -> {
hostInfos.stream()
.filter(h -> v.getHost().equals(h.getHost()) && v.getHeartbeatPort() == h.getPort())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private long getDiskOccupancy(SystemInfoService infoService) {
long diskOccupancy = 0;
List<Backend> backends;
try {
backends = infoService.getBackendsByCurrentCluster();
backends = infoService.getAllBackendsByAllCluster().values().asList();
} catch (UserException e) {
LOG.warn("failed to get backends by current cluster", e);
return 0;
Expand All @@ -98,7 +98,7 @@ private long getRemainDisk(SystemInfoService infoService) {
long remainDisk = 0;
List<Backend> backends;
try {
backends = infoService.getBackendsByCurrentCluster();
backends = infoService.getAllBackendsByAllCluster().values().asList();
} catch (UserException e) {
LOG.warn("failed to get backends by current cluster", e);
return 0;
Expand Down
Loading

0 comments on commit 62c7415

Please sign in to comment.