rmdmattingly commented on code in PR #6651:
URL: https://github.com/apache/hbase/pull/6651#discussion_r1960617917


##########
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/replicas/ReplicaKey.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.replicas;
+
+import java.util.Arrays;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.util.Pair;
+import org.apache.yetus.audience.InterfaceAudience;
+
[email protected]
+public final class ReplicaKey {
+  private final Pair<ByteArrayWrapper, ByteArrayWrapper> startAndStopKeys;
+
+  public ReplicaKey(RegionInfo regionInfo) {
+    this.startAndStopKeys = new Pair<>(new 
ByteArrayWrapper(regionInfo.getStartKey()),
+      new ByteArrayWrapper(regionInfo.getEndKey()));
+  }
+
+  @Override
+  public boolean equals(Object o) {

Review Comment:
   I'm open to trying this out and keeping it if the extra object allocation 
doesn't slow us down. But this is a pretty hot path in balancer plan generation
   
   But all in all, this a pretty simple equals impl in a hot path, so if it 
does degrade perf at all, I'd be incentivized to keep this the way it is. Same 
for hashcode and in the byte array wrapper



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to