You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ps...@apache.org on 2018/04/23 09:06:16 UTC

hbase git commit: HBASE-20427 thrift.jsp displays "Framed transport" incorrectly

Repository: hbase
Updated Branches:
  refs/heads/master 193359ffd -> e73ba582f


HBASE-20427 thrift.jsp displays "Framed transport" incorrectly

Signed-off-by: Sean Busbey <bu...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e73ba582
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e73ba582
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e73ba582

Branch: refs/heads/master
Commit: e73ba582f23e7ac512665bac2539af53bd3cb47c
Parents: 193359f
Author: Balazs Meszaros <ba...@cloudera.com>
Authored: Mon Apr 16 16:33:48 2018 +0200
Committer: Peter Somogyi <ps...@apache.org>
Committed: Mon Apr 23 11:05:53 2018 +0200

----------------------------------------------------------------------
 .../hadoop/hbase/thrift/ThriftServerRunner.java | 24 ++++++++++++++------
 .../resources/hbase-webapps/thrift/thrift.jsp   | 11 +++++----
 2 files changed, 23 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/e73ba582/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
index 28ba28a..1db9256 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
@@ -139,6 +139,7 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.hbase.thirdparty.com.google.common.base.Joiner;
+import org.apache.hbase.thirdparty.com.google.common.base.Splitter;
 import org.apache.hbase.thirdparty.com.google.common.base.Throwables;
 import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
 import org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine;
@@ -224,7 +225,7 @@ public class ThriftServerRunner implements Runnable {
   private final JvmPauseMonitor pauseMonitor;
 
   /** An enum of server implementation selections */
-  enum ImplType {
+  public enum ImplType {
     HS_HA("hsha", true, THsHaServer.class, true),
     NONBLOCKING("nonblocking", true, TNonblockingServer.class, true),
     THREAD_POOL("threadpool", false, TBoundedThreadPoolServer.class, true),
@@ -238,7 +239,7 @@ public class ThriftServerRunner implements Runnable {
     final Class<? extends TServer> serverClass;
     final boolean canSpecifyBindIP;
 
-    ImplType(String option, boolean isAlwaysFramed,
+    private ImplType(String option, boolean isAlwaysFramed,
         Class<? extends TServer> serverClass, boolean canSpecifyBindIP) {
       this.option = option;
       this.isAlwaysFramed = isAlwaysFramed;
@@ -255,7 +256,15 @@ public class ThriftServerRunner implements Runnable {
       return "-" + option;
     }
 
-    String getDescription() {
+    public String getOption() {
+      return option;
+    }
+
+    public boolean isAlwaysFramed() {
+      return isAlwaysFramed;
+    }
+
+    public String getDescription() {
       StringBuilder sb = new StringBuilder("Use the " +
           serverClass.getSimpleName());
       if (isAlwaysFramed) {
@@ -275,7 +284,7 @@ public class ThriftServerRunner implements Runnable {
       return group;
     }
 
-    static ImplType getServerImpl(Configuration conf) {
+    public static ImplType getServerImpl(Configuration conf) {
       String confType = conf.get(SERVER_TYPE_CONF_KEY, THREAD_POOL.option);
       for (ImplType t : values()) {
         if (confType.equals(t.option)) {
@@ -1979,13 +1988,14 @@ public class ThriftServerRunner implements Runnable {
 
   public static void registerFilters(Configuration conf) {
     String[] filters = conf.getStrings("hbase.thrift.filters");
+    Splitter splitter = Splitter.on(':');
     if(filters != null) {
       for(String filterClass: filters) {
-        String[] filterPart = filterClass.split(":");
-        if(filterPart.length != 2) {
+        List<String> filterPart = splitter.splitToList(filterClass);
+        if(filterPart.size() != 2) {
           LOG.warn("Invalid filter specification " + filterClass + " - skipping");
         } else {
-          ParseFilter.registerFilter(filterPart[0], filterPart[1]);
+          ParseFilter.registerFilter(filterPart.get(0), filterPart.get(1));
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/e73ba582/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp
index 579d0f7..eb329fe 100644
--- a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp
+++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp
@@ -20,6 +20,7 @@
 <%@ page contentType="text/html;charset=UTF-8"
   import="org.apache.hadoop.conf.Configuration"
   import="org.apache.hadoop.hbase.HBaseConfiguration"
+  import="org.apache.hadoop.hbase.thrift.ThriftServerRunner.ImplType"
   import="org.apache.hadoop.hbase.util.VersionInfo"
   import="java.util.Date"
 %>
@@ -29,9 +30,10 @@ Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf
 long startcode = conf.getLong("startcode", System.currentTimeMillis());
 String listenPort = conf.get("hbase.regionserver.thrift.port", "9090");
 String serverInfo = listenPort + "," + String.valueOf(startcode);
-String implType = conf.get("hbase.regionserver.thrift.server.type", "threadpool");
+ImplType implType = ImplType.getServerImpl(conf);
+String framed = implType.isAlwaysFramed()
+    ? "true" : conf.get("hbase.regionserver.thrift.framed", "false");
 String compact = conf.get("hbase.regionserver.thrift.compact", "false");
-String framed = conf.get("hbase.regionserver.thrift.framed", "false");
 %>
 <!DOCTYPE html>
 <?xml version="1.0" encoding="UTF-8" ?>
@@ -69,9 +71,8 @@ String framed = conf.get("hbase.regionserver.thrift.framed", "false");
                 <% } %>
             </ul>
           </div><!--/.nav-collapse -->
-        </div>
       </div>
-    </div>
+  </div>
 
 <div class="container-fluid content">
     <div class="row inner_header">
@@ -106,7 +107,7 @@ String framed = conf.get("hbase.regionserver.thrift.framed", "false");
         </tr>
         <tr>
             <td>Thrift Impl Type</td>
-            <td><%= implType %></td>
+            <td><%= implType.getOption() %></td>
             <td>Thrift RPC engine implementation type chosen by this Thrift server</td>
         </tr>
         <tr>