You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ar...@apache.org on 2017/12/09 15:39:22 UTC

[1/5] drill git commit: DRILL-6000: Categorized graceful shutdown unit tests as SlowTests

Repository: drill
Updated Branches:
  refs/heads/master 54d3d2018 -> 0e5ad4e1b


DRILL-6000: Categorized graceful shutdown unit tests as SlowTests

closes #1056


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

Branch: refs/heads/master
Commit: ed089d7f28b28192f824a3d9a19d394539f93528
Parents: 54d3d20
Author: Timothy Farkas <ti...@apache.org>
Authored: Wed Nov 29 10:52:29 2017 -0800
Committer: Arina Ielchiieva <ar...@gmail.com>
Committed: Sat Dec 9 15:49:09 2017 +0200

----------------------------------------------------------------------
 .../test/java/org/apache/drill/test/TestGracefulShutdown.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/ed089d7f/exec/java-exec/src/test/java/org/apache/drill/test/TestGracefulShutdown.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/test/TestGracefulShutdown.java b/exec/java-exec/src/test/java/org/apache/drill/test/TestGracefulShutdown.java
index f69152e..c26be22 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/test/TestGracefulShutdown.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/test/TestGracefulShutdown.java
@@ -17,12 +17,15 @@
  */
 
 package org.apache.drill.test;
+import org.apache.drill.categories.SlowTest;
 import org.apache.drill.exec.ExecConstants;
 import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
 import org.apache.drill.exec.server.Drillbit;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -37,7 +40,7 @@ import java.io.BufferedWriter;
 
 
 
-
+@Category({SlowTest.class})
 public class TestGracefulShutdown extends BaseTestQuery{
 
   @BeforeClass


[2/5] drill git commit: DRILL-5702: Jdbc Driver Class not found

Posted by ar...@apache.org.
DRILL-5702: Jdbc Driver Class not found

1. Setting "package.namespace.prefix" to "oadd." by default for all profiles. It can be overridden if necessary within any profile.
2. Removing duplicated and redundant excluding of commons-logging packages.

closes #1063


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

Branch: refs/heads/master
Commit: c7872dc00fd320133a7ce8b80c31a9a681fbd700
Parents: ed089d7
Author: Vitalii Diravka <vi...@gmail.com>
Authored: Wed Dec 6 17:31:10 2017 +0200
Committer: Arina Ielchiieva <ar...@gmail.com>
Committed: Sat Dec 9 15:49:24 2017 +0200

----------------------------------------------------------------------
 .../exec/rpc/security/SecurityConfiguration.java   |  5 ++---
 exec/jdbc-all/pom.xml                              | 17 +++++++----------
 pom.xml                                            |  8 --------
 3 files changed, 9 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/c7872dc0/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/security/SecurityConfiguration.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/security/SecurityConfiguration.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/security/SecurityConfiguration.java
index 275fd84..ca90332 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/security/SecurityConfiguration.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/security/SecurityConfiguration.java
@@ -54,14 +54,13 @@ public class SecurityConfiguration extends Configuration {
    * Update the GroupMapping class name to add namespace prefix retrieved from System Property. This is needed since
    * in drill-jdbc-all jar we are packaging hadoop dependencies under that namespace. This will help application
    * using this jar as driver to avoid conflict with it's own hadoop dependency if any. The property is needed only
-   * when Hadoop classes are relocated to different namespace which is done inside jdbc-all package. For normal build
-   * this property is not required as Hadoop classes will be used normally.
+   * when Hadoop classes are relocated to different namespace which is done inside jdbc-all package.
    */
   private void updateGroupMapping() {
     final String originalClassName = get(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING);
     final String profilePrefix = System.getProperty("drill.security.namespacePrefix");
 
-    if (!Strings.isNullOrEmpty(profilePrefix)) {
+    if (originalClassName != null && !Strings.isNullOrEmpty(profilePrefix) && !originalClassName.startsWith(profilePrefix)) {
       set(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING, profilePrefix + originalClassName);
     }
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/c7872dc0/exec/jdbc-all/pom.xml
----------------------------------------------------------------------
diff --git a/exec/jdbc-all/pom.xml b/exec/jdbc-all/pom.xml
index 68130e1..d0e9001 100644
--- a/exec/jdbc-all/pom.xml
+++ b/exec/jdbc-all/pom.xml
@@ -26,6 +26,12 @@
   <artifactId>drill-jdbc-all</artifactId>
   <name>JDBC JAR with all dependencies</name>
 
+  <!-- Since we are packaging hadoop dependencies under the namespace with "oadd." prefix by default,
+       "package.namespace.prefix" equals to "oadd.". It can be overridden if necessary within any profile -->
+  <properties>
+    <package.namespace.prefix>oadd.</package.namespace.prefix>
+  </properties>
+
   <dependencies>
 
     <dependency>
@@ -535,19 +541,10 @@
   </pluginRepositories>
 
   <profiles>
-    <profile>
-      <id>default</id>
-      <activation>
-        <activeByDefault>true</activeByDefault>
-      </activation>
-      <properties>
-        <package.namespace.prefix>oadd.</package.namespace.prefix>
-      </properties>
-    </profile>
       <profile>
         <id>mapr</id>
         <properties>
-          <package.namespace.prefix></package.namespace.prefix>
+          <package.namespace.prefix />
         </properties>
 
         <build>

http://git-wip-us.apache.org/repos/asf/drill/blob/c7872dc0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e3387e6..35a8826 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1918,10 +1918,6 @@
                 <groupId>commons-logging</groupId>
               </exclusion>
               <exclusion>
-                <artifactId>commons-logging</artifactId>
-                <groupId>commons-logging</groupId>
-              </exclusion>
-              <exclusion>
                 <artifactId>core</artifactId>
                 <groupId>org.eclipse.jdt</groupId>
               </exclusion>
@@ -2005,10 +2001,6 @@
                 <groupId>commons-logging</groupId>
               </exclusion>
               <exclusion>
-                <artifactId>commons-logging</artifactId>
-                <groupId>commons-logging</groupId>
-              </exclusion>
-              <exclusion>
                 <groupId>com.sun.jersey</groupId>
                 <artifactId>jersey-core</artifactId>
               </exclusion>


[5/5] drill git commit: DRILL-6019: Only admin should be able to access shutdown resources and information about process and admin users

Posted by ar...@apache.org.
DRILL-6019: Only admin should be able to access shutdown resources and information about process and admin users

1. Only admin should be able to access shutdown resources via REST API.
2. Modified ClusterInfo to show information about process and admin users only when user is logged in and is admin.
3. Added drillbits comparison based on thier adress and ports to check if drillbits are the same (DRILL-6006)

closes #1065


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

Branch: refs/heads/master
Commit: 0e5ad4e1b549f37eb878758409b5afda1deece9d
Parents: aa6666e
Author: Arina Ielchiieva <ar...@gmail.com>
Authored: Fri Dec 8 13:19:40 2017 +0200
Committer: Arina Ielchiieva <ar...@gmail.com>
Committed: Sat Dec 9 15:51:11 2017 +0200

----------------------------------------------------------------------
 .../drill/exec/server/rest/DrillRoot.java       | 117 ++++++++++++-------
 1 file changed, 73 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/0e5ad4e1/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
index 02f2731..ca6d748 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import javax.annotation.security.PermitAll;
+import javax.annotation.security.RolesAllowed;
 import javax.inject.Inject;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
@@ -31,6 +32,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.SecurityContext;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import com.fasterxml.jackson.annotation.JsonInclude;
 import com.google.common.base.Joiner;
 import com.google.common.base.Strings;
 import com.google.common.collect.Sets;
@@ -55,6 +57,8 @@ import org.glassfish.jersey.server.mvc.Viewable;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
 
+import static org.apache.drill.exec.server.rest.auth.DrillUserPrincipal.ADMIN_ROLE;
+
 @Path("/")
 @PermitAll
 public class DrillRoot {
@@ -69,10 +73,6 @@ public class DrillRoot {
   @Inject
   Drillbit drillbit;
 
-  public enum ShutdownMode {
-    forcefulShutdown, gracefulShutdown, quiescent
-  }
-
   @GET
   @Produces(MediaType.TEXT_HTML)
   public Viewable getClusterInfo() {
@@ -90,8 +90,7 @@ public class DrillRoot {
     for (DrillbitInfo drillbit : drillbits) {
       drillStatusMap.put(drillbit.getAddress() + "-" + drillbit.getUserPort(), drillbit.getState());
     }
-    Response response = setResponse(drillStatusMap);
-    return response;
+    return setResponse(drillStatusMap);
   }
 
   @SuppressWarnings("resource")
@@ -99,7 +98,6 @@ public class DrillRoot {
   @Path("/gracePeriod")
   @Produces(MediaType.APPLICATION_JSON)
   public Map<String, Integer> getGracePeriod() {
-
     final DrillConfig config = work.getContext().getConfig();
     final int gracePeriod = config.getInt(ExecConstants.GRACE_PERIOD);
     Map<String, Integer> gracePeriodMap = new HashMap<String, Integer>();
@@ -125,44 +123,42 @@ public class DrillRoot {
   @Path("/queriesCount")
   @Produces(MediaType.APPLICATION_JSON)
   public Response getRemainingQueries() {
-    Map<String, Integer> queriesInfo = new HashMap<String, Integer>();
-    queriesInfo = work.getRemainingQueries();
-    Response response = setResponse(queriesInfo);
-    return response;
+    Map<String, Integer> queriesInfo = work.getRemainingQueries();
+    return setResponse(queriesInfo);
   }
 
   @SuppressWarnings("resource")
   @POST
   @Path("/gracefulShutdown")
   @Produces(MediaType.APPLICATION_JSON)
+  @RolesAllowed(ADMIN_ROLE)
   public Response shutdownDrillbit() throws Exception {
     String resp = "Graceful Shutdown request is triggered";
     return shutdown(resp);
-
   }
 
   @SuppressWarnings("resource")
   @POST
   @Path("/shutdown")
   @Produces(MediaType.APPLICATION_JSON)
-  public Response ShutdownForcefully() throws Exception {
+  @RolesAllowed(ADMIN_ROLE)
+  public Response shutdownForcefully() throws Exception {
     drillbit.setForcefulShutdown(true);
     String resp = "Forceful shutdown request is triggered";
     return shutdown(resp);
-
   }
 
   @SuppressWarnings("resource")
   @POST
   @Path("/quiescent")
   @Produces(MediaType.APPLICATION_JSON)
+  @RolesAllowed(ADMIN_ROLE)
   public Response drillbitToQuiescentMode() throws Exception {
     drillbit.setQuiescentMode(true);
     String resp = "Request to put drillbit in Quiescent mode is triggered";
     return shutdown(resp);
   }
 
-
   @SuppressWarnings("resource")
   @GET
   @Path("/cluster.json")
@@ -180,36 +176,58 @@ public class DrillRoot {
             config.getBoolean(ExecConstants.USER_ENCRYPTION_SASL_ENABLED) ||
                     config .getBoolean(ExecConstants.USER_SSL_ENABLED);
     final boolean bitEncryptionEnabled = config.getBoolean(ExecConstants.BIT_ENCRYPTION_SASL_ENABLED);
-    // If the user is logged in and is admin user then show the admin user info
-    // For all other cases the user info need-not or should-not be displayed
+
     OptionManager optionManager = work.getContext().getOptionManager();
     final boolean isUserLoggedIn = AuthDynamicFeature.isUserLoggedIn(sc);
-    final String processUser = ImpersonationUtil.getProcessUserName();
-    final String processUserGroups = Joiner.on(", ").join(ImpersonationUtil.getProcessUserGroupNames());
-    String adminUsers = ExecConstants.ADMIN_USERS_VALIDATOR.getAdminUsers(optionManager);
-    String adminUserGroups = ExecConstants.ADMIN_USER_GROUPS_VALIDATOR.getAdminUserGroups(optionManager);
-
-    final boolean shouldShowAdminInfo = isUserLoggedIn &&
-            ((DrillUserPrincipal)sc.getUserPrincipal()).isAdminUser();
+    final boolean shouldShowAdminInfo = isUserLoggedIn && ((DrillUserPrincipal)sc.getUserPrincipal()).isAdminUser();
 
     for (DrillbitEndpoint endpoint : work.getContext().getAvailableBits()) {
       final DrillbitInfo drillbit = new DrillbitInfo(endpoint,
-              currentDrillbit.equals(endpoint),
+              isDrillbitsTheSame(currentDrillbit, endpoint),
               currentVersion.equals(endpoint.getVersion()));
       if (!drillbit.isVersionMatch()) {
         mismatchedVersions.add(drillbit.getVersion());
       }
       drillbits.add(drillbit);
     }
-    logger.debug("Admin info: user: "  + adminUsers +  " user group: " + adminUserGroups +
-            " userLoggedIn "  + isUserLoggedIn + " shouldShowAdminInfo: " + shouldShowAdminInfo );
+
+    // If the user is logged in and is admin user then show the admin user info
+    // For all other cases the user info need-not or should-not be displayed
+    if (shouldShowAdminInfo) {
+      final String processUser = ImpersonationUtil.getProcessUserName();
+      final String processUserGroups = Joiner.on(", ").join(ImpersonationUtil.getProcessUserGroupNames());
+      String adminUsers = ExecConstants.ADMIN_USERS_VALIDATOR.getAdminUsers(optionManager);
+      String adminUserGroups = ExecConstants.ADMIN_USER_GROUPS_VALIDATOR.getAdminUserGroups(optionManager);
+
+      logger.debug("Admin info: user: "  + adminUsers +  " user group: " + adminUserGroups +
+          " userLoggedIn "  + isUserLoggedIn + " shouldShowAdminInfo: " + shouldShowAdminInfo);
+
+      return new ClusterInfo(drillbits, currentVersion, mismatchedVersions,
+          userEncryptionEnabled, bitEncryptionEnabled, shouldShowAdminInfo,
+          QueueInfo.build(dbContext.getResourceManager()),
+          processUser, processUserGroups, adminUsers, adminUserGroups);
+    }
 
     return new ClusterInfo(drillbits, currentVersion, mismatchedVersions,
-            userEncryptionEnabled, bitEncryptionEnabled, processUser, processUserGroups, adminUsers,
-            adminUserGroups, shouldShowAdminInfo, QueueInfo.build(dbContext.getResourceManager()));
+        userEncryptionEnabled, bitEncryptionEnabled, shouldShowAdminInfo,
+        QueueInfo.build(dbContext.getResourceManager()));
+  }
+
+  /**
+   * Compares two drillbits based on their address and ports (control, data, user).
+   *
+   * @param endpoint1 first drillbit to compare
+   * @param endpoint2 second drillbit to compare
+   * @return true if drillbit are the same
+   */
+  private boolean isDrillbitsTheSame(DrillbitEndpoint endpoint1, DrillbitEndpoint endpoint2) {
+    return endpoint1.getAddress().equals(endpoint2.getAddress()) &&
+        endpoint1.getControlPort() == endpoint2.getControlPort() &&
+        endpoint1.getDataPort() == endpoint2.getDataPort() &&
+        endpoint1.getUserPort() == endpoint2.getUserPort();
   }
 
-  public Response setResponse(Map entity) {
+  private Response setResponse(Map entity) {
     return Response.ok()
             .entity(entity)
             .header("Access-Control-Allow-Origin", "*")
@@ -218,7 +236,7 @@ public class DrillRoot {
             .allow("OPTIONS").build();
   }
 
-  public Response shutdown(String resp) throws Exception {
+  private Response shutdown(String resp) throws Exception {
     Map<String, String> shutdownInfo = new HashMap<String, String>();
     new Thread(new Runnable() {
         public void run() {
@@ -230,11 +248,9 @@ public class DrillRoot {
         }
       }).start();
     shutdownInfo.put("response",resp);
-    Response response = setResponse(shutdownInfo);
-    return response;
+    return setResponse(shutdownInfo);
   }
 
-
 /**
  * Pretty-printing wrapper class around the ZK-based queue summary.
  */
@@ -317,29 +333,27 @@ public static class QueueInfo {
 }
 
 @XmlRootElement
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
 public static class ClusterInfo {
   private final Collection<DrillbitInfo> drillbits;
   private final String currentVersion;
   private final Collection<String> mismatchedVersions;
   private final boolean userEncryptionEnabled;
   private final boolean bitEncryptionEnabled;
-  private final String adminUsers;
-  private final String adminUserGroups;
-  private final String processUser;
-  private final String processUserGroups;
   private final boolean shouldShowAdminInfo;
   private final QueueInfo queueInfo;
 
+  private String adminUsers;
+  private String adminUserGroups;
+  private String processUser;
+  private String processUserGroups;
+
   @JsonCreator
   public ClusterInfo(Collection<DrillbitInfo> drillbits,
                      String currentVersion,
                      Collection<String> mismatchedVersions,
                      boolean userEncryption,
                      boolean bitEncryption,
-                     String processUser,
-                     String processUserGroups,
-                     String adminUsers,
-                     String adminUserGroups,
                      boolean shouldShowAdminInfo,
                      QueueInfo queueInfo) {
     this.drillbits = Sets.newTreeSet(drillbits);
@@ -347,12 +361,27 @@ public static class ClusterInfo {
     this.mismatchedVersions = Sets.newTreeSet(mismatchedVersions);
     this.userEncryptionEnabled = userEncryption;
     this.bitEncryptionEnabled = bitEncryption;
+    this.shouldShowAdminInfo = shouldShowAdminInfo;
+    this.queueInfo = queueInfo;
+  }
+
+  @JsonCreator
+  public ClusterInfo(Collection<DrillbitInfo> drillbits,
+                     String currentVersion,
+                     Collection<String> mismatchedVersions,
+                     boolean userEncryption,
+                     boolean bitEncryption,
+                     boolean shouldShowAdminInfo,
+                     QueueInfo queueInfo,
+                     String processUser,
+                     String processUserGroups,
+                     String adminUsers,
+                     String adminUserGroups) {
+    this(drillbits, currentVersion, mismatchedVersions, userEncryption, bitEncryption, shouldShowAdminInfo, queueInfo);
     this.processUser = processUser;
     this.processUserGroups = processUserGroups;
     this.adminUsers = adminUsers;
     this.adminUserGroups = adminUserGroups;
-    this.shouldShowAdminInfo = shouldShowAdminInfo;
-    this.queueInfo = queueInfo;
   }
 
   public Collection<DrillbitInfo> getDrillbits() {


[3/5] drill git commit: DRILL-6017: Fix for SHUTDOWN button being visible for non Admin users

Posted by ar...@apache.org.
DRILL-6017: Fix for SHUTDOWN button being visible for non Admin users

closes #1064


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

Branch: refs/heads/master
Commit: b34679579930f2643837e0c59dbe743b80b2f7e2
Parents: c7872dc
Author: karthik <km...@maprtech.com>
Authored: Thu Dec 7 09:43:24 2017 +0530
Committer: Arina Ielchiieva <ar...@gmail.com>
Committed: Sat Dec 9 15:50:33 2017 +0200

----------------------------------------------------------------------
 .../drill/exec/server/rest/DrillRoot.java       | 14 ++++----
 .../java-exec/src/main/resources/rest/index.ftl | 36 +++++++++++---------
 2 files changed, 27 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/b3467957/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
index da1d2fb..94e607c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
@@ -189,7 +189,7 @@ public class DrillRoot {
     String adminUsers = ExecConstants.ADMIN_USERS_VALIDATOR.getAdminUsers(optionManager);
     String adminUserGroups = ExecConstants.ADMIN_USER_GROUPS_VALIDATOR.getAdminUserGroups(optionManager);
 
-    final boolean shouldShowUserInfo = isUserLoggedIn &&
+    final boolean shouldShowAdminInfo = isUserLoggedIn &&
             ((DrillUserPrincipal)sc.getUserPrincipal()).isAdminUser();
 
     for (DrillbitEndpoint endpoint : work.getContext().getAvailableBits()) {
@@ -202,11 +202,11 @@ public class DrillRoot {
       drillbits.add(drillbit);
     }
     logger.debug("Admin info: user: "  + adminUsers +  " user group: " + adminUserGroups +
-            " userLoggedIn "  + isUserLoggedIn + " shouldShowUserInfo: " + shouldShowUserInfo );
+            " userLoggedIn "  + isUserLoggedIn + " shouldShowAdminInfo: " + shouldShowAdminInfo );
 
     return new ClusterInfo(drillbits, currentVersion, mismatchedVersions,
             userEncryptionEnabled, bitEncryptionEnabled, processUser, processUserGroups, adminUsers,
-            adminUserGroups, shouldShowUserInfo, QueueInfo.build(dbContext.getResourceManager()));
+            adminUserGroups, shouldShowAdminInfo, QueueInfo.build(dbContext.getResourceManager()));
   }
 
   public Response setResponse(Map entity) {
@@ -327,7 +327,7 @@ public static class ClusterInfo {
   private final String adminUserGroups;
   private final String processUser;
   private final String processUserGroups;
-  private final boolean shouldShowUserInfo;
+  private final boolean shouldShowAdminInfo;
   private final QueueInfo queueInfo;
 
   @JsonCreator
@@ -340,7 +340,7 @@ public static class ClusterInfo {
                      String processUserGroups,
                      String adminUsers,
                      String adminUserGroups,
-                     boolean shouldShowUserInfo,
+                     boolean shouldShowAdminInfo,
                      QueueInfo queueInfo) {
     this.drillbits = Sets.newTreeSet(drillbits);
     this.currentVersion = currentVersion;
@@ -351,7 +351,7 @@ public static class ClusterInfo {
     this.processUserGroups = processUserGroups;
     this.adminUsers = adminUsers;
     this.adminUserGroups = adminUserGroups;
-    this.shouldShowUserInfo = shouldShowUserInfo;
+    this.shouldShowAdminInfo = shouldShowAdminInfo;
     this.queueInfo = queueInfo;
   }
 
@@ -379,7 +379,7 @@ public static class ClusterInfo {
 
   public String getAdminUserGroups() { return adminUserGroups; }
 
-  public boolean shouldShowUserInfo() { return shouldShowUserInfo; }
+  public boolean shouldShowAdminInfo() { return shouldShowAdminInfo; }
 
   public QueueInfo queueInfo() { return queueInfo; }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/b3467957/exec/java-exec/src/main/resources/rest/index.ftl
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/resources/rest/index.ftl b/exec/java-exec/src/main/resources/rest/index.ftl
index 74425d6..18be7a9 100644
--- a/exec/java-exec/src/main/resources/rest/index.ftl
+++ b/exec/java-exec/src/main/resources/rest/index.ftl
@@ -79,9 +79,11 @@
                   </span>
                 </td>
                 <td id="status" >${drillbit.getState()}</td>
-                <td>
-                    <button type="button" id="shutdown" onClick="shutdown('${drillbit.getAddress()}',$(this));"> SHUTDOWN </button>
-                </td>
+                <#if model.shouldShowAdminInfo()>
+                  <td>
+                      <button type="button" id="shutdown" onClick="shutdown('${drillbit.getAddress()}',$(this));"> SHUTDOWN </button>
+                  </td>
+                </#if>
                 <td id="queriesCount">  </td>
               </tr>
               <#assign i = i + 1>
@@ -112,7 +114,7 @@
       </div>
   </div>
 
-   <#if model.shouldShowUserInfo()>
+   <#if model.shouldShowAdminInfo()>
        <div class="row">
             <div class="col-md-12">
               <h3>User Info </h3>
@@ -266,18 +268,20 @@
                               }
                         });
       }
-      function shutdown(address,button) {
-          url = "http://"+address+":"+portNum+"/gracefulShutdown";
-          var result = $.ajax({
-                type: 'POST',
-                url: url,
-                contentType : 'text/plain',
-                complete: function(data) {
-                    alert(data.responseJSON["response"]);
-                    button.prop('disabled',true).css('opacity',0.5);
-                }
-          });
-      }
+       <#if model.shouldShowAdminInfo()>
+          function shutdown(address,button) {
+              url = "http://"+address+":"+portNum+"/gracefulShutdown";
+              var result = $.ajax({
+                    type: 'POST',
+                    url: url,
+                    contentType : 'text/plain',
+                    complete: function(data) {
+                        alert(data.responseJSON["response"]);
+                        button.prop('disabled',true).css('opacity',0.5);
+                    }
+              });
+          }
+      </#if>
     </script>
 </#macro>
 


[4/5] drill git commit: DRILL-6007: Use default refresh timeout (10 seconds) if graceful shutdown timeout is set to 0.

Posted by ar...@apache.org.
DRILL-6007: Use default refresh timeout (10 seconds) if graceful shutdown timeout is set to 0.

closes #1062


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

Branch: refs/heads/master
Commit: aa6666e6700566719c00614a58ce5b861c79e2a5
Parents: b346795
Author: Arina Ielchiieva <ar...@gmail.com>
Authored: Tue Dec 5 19:13:09 2017 +0200
Committer: Arina Ielchiieva <ar...@gmail.com>
Committed: Sat Dec 9 15:50:56 2017 +0200

----------------------------------------------------------------------
 .../apache/drill/exec/client/DrillClient.java   |  2 +-
 .../drill/exec/server/rest/DrillRoot.java       |  2 +-
 .../java-exec/src/main/resources/rest/index.ftl | 27 ++++++++++----------
 3 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/aa6666e6/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java b/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java
index 248058f..71acfb1 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java
@@ -440,7 +440,7 @@ public class DrillClient implements Closeable, ConnectionThrottle {
 
   private void connect(DrillbitEndpoint endpoint) throws RpcException {
     client.connect(endpoint, properties, getUserCredentials());
-    logger.info("Foreman drillbit is" + endpoint.getAddress());
+    logger.info("Foreman drillbit is {}", endpoint.getAddress());
   }
 
   public BufferAllocator getAllocator() {

http://git-wip-us.apache.org/repos/asf/drill/blob/aa6666e6/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
index 94e607c..02f2731 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java
@@ -103,7 +103,7 @@ public class DrillRoot {
     final DrillConfig config = work.getContext().getConfig();
     final int gracePeriod = config.getInt(ExecConstants.GRACE_PERIOD);
     Map<String, Integer> gracePeriodMap = new HashMap<String, Integer>();
-    gracePeriodMap.put("graceperiod", gracePeriod);
+    gracePeriodMap.put("gracePeriod", gracePeriod);
     return gracePeriodMap;
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/aa6666e6/exec/java-exec/src/main/resources/rest/index.ftl
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/resources/rest/index.ftl b/exec/java-exec/src/main/resources/rest/index.ftl
index 18be7a9..6466701 100644
--- a/exec/java-exec/src/main/resources/rest/index.ftl
+++ b/exec/java-exec/src/main/resources/rest/index.ftl
@@ -187,11 +187,10 @@
       </div>
   </div>
    <script charset="utf-8">
-      var refreshTime = 2000;
+      var refreshTime = 10000;
       var refresh = getRefreshTime();
       var portNum = 0;
       var port = getPortNum();
-      console.log(portNum);
       var timeout;
       var size = $("#size").html();
 
@@ -208,19 +207,21 @@
       }
 
       function getRefreshTime() {
-          var refresh = $.ajax({
-                          type: 'GET',
-                          url: '/gracePeriod',
-                          dataType: "json",
-                          complete: function(data) {
-                                refreshTime = data.responseJSON["graceperiod"];
-                                refreshTime = refreshTime/3;
-                                timeout = setTimeout(reloadStatus,refreshTime );
-                                }
-                          });
+          $.ajax({
+              type: 'GET',
+              url: '/gracePeriod',
+              dataType: "json",
+              complete: function (data) {
+                  var gracePeriod = data.responseJSON["gracePeriod"];
+                  if (gracePeriod > 0) {
+                      refreshTime = gracePeriod / 3;
+                  }
+                  timeout = setTimeout(reloadStatus, refreshTime);
+              }
+          });
       }
+
       function reloadStatus () {
-          console.log(refreshTime);
           var result = $.ajax({
                       type: 'GET',
                       url: '/state',