diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java index 1f23a1d985..d76e9fdd05 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java @@ -23,7 +23,6 @@ import static org.apache.hadoop.hbase.TableName.META_TABLE_NAME; import static org.apache.hadoop.hbase.client.AsyncRegionLocatorHelper.canUpdateOnError; import static org.apache.hadoop.hbase.client.AsyncRegionLocatorHelper.createRegionLocations; import static org.apache.hadoop.hbase.client.AsyncRegionLocatorHelper.isGood; -import static org.apache.hadoop.hbase.client.AsyncRegionLocatorHelper.mergeRegionLocations; import static org.apache.hadoop.hbase.client.AsyncRegionLocatorHelper.removeRegionLocation; import static org.apache.hadoop.hbase.client.ConnectionUtils.createClosestRowAfter; import static org.apache.hadoop.hbase.client.ConnectionUtils.isEmptyStopRow; @@ -218,7 +217,7 @@ class AsyncNonMetaRegionLocator { if (loc1.getSeqNum() != loc2.getSeqNum()) { return false; } - if (Objects.equal(loc1.getServerName(), loc2.getServerName())) { + if (!Objects.equal(loc1.getServerName(), loc2.getServerName())) { return false; } } @@ -235,7 +234,7 @@ class AsyncNonMetaRegionLocator { if (oldLocs == null) { return true; } - RegionLocations mergedLocs = mergeRegionLocations(locs, oldLocs); + RegionLocations mergedLocs = oldLocs.mergeLocations(locs); if (isEqual(mergedLocs, oldLocs)) { // the merged one is the same with the old one, give up LOG.trace("Will not add {} to cache because the old value {} " + diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java index dd516ec42e..4dde1bbc89 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java @@ -129,20 +129,6 @@ final class AsyncRegionLocatorHelper { } } - /** - * Create a new {@link RegionLocations} which is the merging result for the given two - * {@link RegionLocations}. - *
- * All the {@link RegionLocations} in async locator related class are immutable because we want to - * access them concurrently, so here we need to create a new one, instead of calling - * {@link RegionLocations#mergeLocations(RegionLocations)} directly. - */ - static RegionLocations mergeRegionLocations(RegionLocations newLocs, RegionLocations oldLocs) { - RegionLocations locs = new RegionLocations(newLocs.getRegionLocations()); - locs.mergeLocations(oldLocs); - return locs; - } - static boolean isGood(RegionLocations locs, int replicaId) { if (locs == null) { return false; diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml index fff0a3aeef..4a48a9b406 100644 --- a/hbase-server/pom.xml +++ b/hbase-server/pom.xml @@ -18,6 +18,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +for test -->