You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2021/04/27 15:26:49 UTC

[hbase] branch master updated: HBASE-25757 Addendum remove CandidateGenerator classes under hbase-server module

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 8856f61  HBASE-25757 Addendum remove CandidateGenerator classes under hbase-server module
8856f61 is described below

commit 8856f61986ca8bfd43fd7ef2bab6843479638958
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Tue Apr 27 23:24:16 2021 +0800

    HBASE-25757 Addendum remove CandidateGenerator classes under hbase-server module
---
 .../master/balancer/RandomCandidateGenerator.java  | 34 --------------
 .../RegionReplicaRackCandidateGenerator.java       | 54 ----------------------
 2 files changed, 88 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RandomCandidateGenerator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RandomCandidateGenerator.java
deleted file mode 100644
index c2cd998..0000000
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RandomCandidateGenerator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.master.balancer;
-
-import org.apache.yetus.audience.InterfaceAudience;
-
-@InterfaceAudience.Private
-class RandomCandidateGenerator extends CandidateGenerator {
-
-  @Override
-  BalanceAction generate(BalancerClusterState cluster) {
-    int thisServer = pickRandomServer(cluster);
-
-    // Pick the other server
-    int otherServer = pickOtherRandomServer(cluster, thisServer);
-
-    return pickRandomRegions(cluster, thisServer, otherServer);
-  }
-}
\ No newline at end of file
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionReplicaRackCandidateGenerator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionReplicaRackCandidateGenerator.java
deleted file mode 100644
index a67dc1d..0000000
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionReplicaRackCandidateGenerator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.master.balancer;
-
-import java.util.concurrent.ThreadLocalRandom;
-import org.apache.yetus.audience.InterfaceAudience;
-
-/**
- * Generates candidates which moves the replicas out of the rack for co-hosted region replicas in
- * the same rack
- */
-@InterfaceAudience.Private
-class RegionReplicaRackCandidateGenerator extends RegionReplicaCandidateGenerator {
-
-  @Override
-  BalanceAction generate(BalancerClusterState cluster) {
-    int rackIndex = pickRandomRack(cluster);
-    if (cluster.numRacks <= 1 || rackIndex == -1) {
-      return super.generate(cluster);
-    }
-
-    int regionIndex = selectCoHostedRegionPerGroup(cluster.primariesOfRegionsPerRack[rackIndex],
-      cluster.regionsPerRack[rackIndex], cluster.regionIndexToPrimaryIndex);
-
-    // if there are no pairs of region replicas co-hosted, default to random generator
-    if (regionIndex == -1) {
-      // default to randompicker
-      return randomGenerator.generate(cluster);
-    }
-
-    int serverIndex = cluster.regionIndexToServerIndex[regionIndex];
-    int toRackIndex = pickOtherRandomRack(cluster, rackIndex);
-
-    int rand = ThreadLocalRandom.current().nextInt(cluster.serversPerRack[toRackIndex].length);
-    int toServerIndex = cluster.serversPerRack[toRackIndex][rand];
-    int toRegionIndex = pickRandomRegion(cluster, toServerIndex, 0.9f);
-    return getAction(serverIndex, regionIndex, toServerIndex, toRegionIndex);
-  }
-}
\ No newline at end of file