apurtell commented on a change in pull request #2261:
URL: https://github.com/apache/hbase/pull/2261#discussion_r471672318



##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AdminOverAsyncAdmin.java
##########
@@ -1057,4 +1057,9 @@ public void updateRSGroupConfig(String groupName, 
Map<String, String> configurat
       throws IOException {
     get(admin.updateRSGroupConfig(groupName, configuration));
   }
+
+  @Override
+  public List<BalancerDecisionRecords> getBalancerDecisions() throws 
IOException {

Review comment:
       This would mean you'd have to go back and modify any admin API related 
to the slow log, which is fine, and desirable (if you accept the premise of 
this feedback)

##########
File path: hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
##########
@@ -2458,4 +2458,11 @@ boolean snapshotCleanupSwitch(final boolean on, final 
boolean synchronous)
    */
   void updateRSGroupConfig(String groupName, Map<String, String> 
configuration) throws IOException;
 
+  /**
+   * Retrieve recent balancer decision factors with region plans from HMaster 
in-memory ringbuffer
+   *
+   * @return list of balancer decision records
+   * @throws IOException if a remote or network exception occurs
+   */
+  List<BalancerDecisionRecords> getBalancerDecisions() throws IOException;

Review comment:
       Just call this BalancerDecision ? Of course it's a record, or an item, 
or an element (choose your term for individual item in a collection) so that 
just adds letters for no clearer meaning.

##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/BalancerDecisionRecords.java
##########
@@ -0,0 +1,147 @@
+/*
+ *
+ * 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.client;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.hadoop.hbase.util.GsonUtil;
+import org.apache.hbase.thirdparty.com.google.gson.Gson;
+import org.apache.hbase.thirdparty.com.google.gson.JsonSerializer;
+import org.apache.yetus.audience.InterfaceAudience;
+import java.util.List;
+
+/**
+ * History of balancer decisions taken for region movements.
+ */
[email protected]
+final public class BalancerDecisionRecords {
+
+  private final String initialFunctionCosts;
+  private final String finalFunctionCosts;
+  private final double initTotalCost;
+  private final double computedTotalCost;
+  private final long computedSteps;
+  private final List<String> regionPlans;
+
+  // used to convert object to pretty printed format
+  // used by toJsonPrettyPrint()
+  private static final Gson GSON = GsonUtil.createGson()
+    .setPrettyPrinting()
+    .registerTypeAdapter(OnlineLogRecord.class, 
(JsonSerializer<OnlineLogRecord>)
+      (slowLogPayload, type, jsonSerializationContext) -> {

Review comment:
       Since this is being used for more than just the slowlog, this parameter 
_slowLogPayload_ should be renamed. (First question that comes to mind is what 
does slow log have to do with the balancer). Call it _logPayload_?

##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AdminOverAsyncAdmin.java
##########
@@ -1057,4 +1057,9 @@ public void updateRSGroupConfig(String groupName, 
Map<String, String> configurat
       throws IOException {
     get(admin.updateRSGroupConfig(groupName, configuration));
   }
+
+  @Override
+  public List<BalancerDecisionRecords> getBalancerDecisions() throws 
IOException {

Review comment:
       Something to consider: Rather than adding new API for every ringbuffer 
backed type, since the ringbuffers are named, can we just have one API that 
retrieves records from a buffer specified by name? 
   
   E.g.
   
   public List<LogEntry> getLogEntries(String name)
   
   Then, LogEntry is a generic type capable of accepting any protobuf encoding. 
Then, we derive new types from LogEntry such as BalancerDecision. Have a static 
method in RingEntry for instantiating the subclasses based on what type is 
communicated by the protobuf. 
   
   If _LogEntry_ is too generic a name, consider _RingEntry_. (I'm not the best 
at naming, maybe someone else has a better idea...)
   
   It is a lot easier to add or remove specialized classes as these things 
evolve than add or remove methods from public/stable admin APIs. 

##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/BalancerDecisionRecords.java
##########
@@ -0,0 +1,147 @@
+/*
+ *
+ * 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.client;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.hadoop.hbase.util.GsonUtil;
+import org.apache.hbase.thirdparty.com.google.gson.Gson;
+import org.apache.hbase.thirdparty.com.google.gson.JsonSerializer;
+import org.apache.yetus.audience.InterfaceAudience;
+import java.util.List;
+
+/**
+ * History of balancer decisions taken for region movements.
+ */
[email protected]
+final public class BalancerDecisionRecords {

Review comment:
       Just BalancerDecision? 'Records' doesn't add any meaning. 




----------------------------------------------------------------
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.

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


Reply via email to