sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ak...@apache.org
Subject sentry git commit: SENTRY-1642 Integrate Sentry build with Error Prone (Alex Kolbasov, reviewed by: Lei Xu)
Date Mon, 06 Mar 2017 18:21:13 GMT
Repository: sentry
Updated Branches:
  refs/heads/sentry-ha-redesign aecf3f281 -> af5c004b6


SENTRY-1642 Integrate Sentry build with Error Prone (Alex Kolbasov, reviewed by: Lei Xu)


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

Branch: refs/heads/sentry-ha-redesign
Commit: af5c004b6f7925be291dae95e8ba592d651aa1f8
Parents: aecf3f2
Author: Alexander Kolbasov <akolb@cloudera.com>
Authored: Sun Mar 5 21:23:47 2017 -0800
Committer: Alexander Kolbasov <akolb@cloudera.com>
Committed: Sun Mar 5 21:23:47 2017 -0800

----------------------------------------------------------------------
 pom.xml                                         | 23 ++++++++++++++++++++
 .../binding/hive/HiveAuthzBindingHook.java      |  2 +-
 .../db/service/thrift/SentryMetrics.java        |  1 +
 .../service/thrift/LeaderStatusMonitor.java     |  2 --
 .../e2e/hive/TestPrivilegesAtFunctionScope.java |  2 +-
 .../tests/e2e/hive/PrivilegeResultSet.java      |  2 +-
 .../e2e/hive/TestPrivilegesAtFunctionScope.java | 13 +++++------
 .../sentry/tests/e2e/solr/TestRealTimeGet.java  |  2 +-
 8 files changed, 33 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/af5c004b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bdee67f..4859212 100644
--- a/pom.xml
+++ b/pom.xml
@@ -756,7 +756,30 @@ limitations under the License.
           <configuration>
             <source>${maven.compile.source}</source>
             <target>${maven.compile.target}</target>
+            <!-- Enable errorprone compiler - see
+                 http://errorprone.info
+            -->
+            <compilerId>javac-with-errorprone</compilerId>
+            <forceJavacCompilerUse>true</forceJavacCompilerUse>
           </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.codehaus.plexus</groupId>
+              <artifactId>plexus-compiler-javac-errorprone</artifactId>
+              <version>2.8</version>
+            </dependency>
+            <!-- override plexus-compiler-javac-errorprone's dependency on
+                 Error Prone version 2.05.
+                 NOTE: We can only use version 2.05 - subsequent versions
+                       use Java 8. Once Sentry build switches to Java 8, we
+                       can update this to a newer version.
+            -->
+            <dependency>
+              <groupId>com.google.errorprone</groupId>
+              <artifactId>error_prone_core</artifactId>
+              <version>2.0.5</version>
+            </dependency>
+          </dependencies>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>

http://git-wip-us.apache.org/repos/asf/sentry/blob/af5c004b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
index c7afe1b..095cd65 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
@@ -126,7 +126,7 @@ public class HiveAuthzBindingHook extends HiveAuthzBindingHookBase {
             setSerdeURI(serdeClassName);
           }
         }
-
+      /* FALLTHROUGH */
       case HiveParser.TOK_CREATEVIEW:
         /*
          * Compiler doesn't create read/write entities for create table.

http://git-wip-us.apache.org/repos/asf/sentry/blob/af5c004b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
index a359a04..6ed2c78 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
@@ -188,6 +188,7 @@ public final class SentryMetrics {
                 .convertDurationsTo(TimeUnit.MILLISECONDS)
                 .build();
         logReporter.start(reportInterval, TimeUnit.SECONDS);
+        break;
       default:
         LOGGER.warn("Invalid metrics reporter " + reporter);
         break;

http://git-wip-us.apache.org/repos/asf/sentry/blob/af5c004b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/LeaderStatusMonitor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/LeaderStatusMonitor.java
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/LeaderStatusMonitor.java
index d1999b2..1d79bd1 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/LeaderStatusMonitor.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/LeaderStatusMonitor.java
@@ -25,7 +25,6 @@ import org.apache.curator.framework.recipes.leader.LeaderSelectorListenerAdapter
 import org.apache.hadoop.conf.Configuration;
 import org.apache.sentry.provider.db.service.persistent.HAContext;
 
-import javax.annotation.concurrent.GuardedBy;
 import javax.annotation.concurrent.ThreadSafe;
 import java.lang.management.ManagementFactory;
 import java.lang.management.RuntimeMXBean;
@@ -108,7 +107,6 @@ final class LeaderStatusMonitor
   /** Condition variable used to synchronize voluntary leadership release */
   private final Condition cond = lock.newCondition();
   /** Leadership status - true if leader. */
-  @GuardedBy("lock")
   private boolean isLeader = false;
 
   /** Curator framework leader monitor */

http://git-wip-us.apache.org/repos/asf/sentry/blob/af5c004b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
index bb8d61d..40d870f 100644
--- a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
+++ b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
@@ -111,7 +111,7 @@ public class TestPrivilegesAtFunctionScope extends AbstractTestWithStaticConfigu
       res.close();
       statement.execute("DROP TEMPORARY FUNCTION printf_test");
     } catch (Exception ex) {
-      LOGGER.error("test temp func printf_test failed with reason: " + ex.getStackTrace()
+ " " + ex.getMessage());
+      LOGGER.error("test temp func printf_test failed with reason: ", ex);
       fail("fail to test temp func printf_test");
     }
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/af5c004b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/PrivilegeResultSet.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/PrivilegeResultSet.java
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/PrivilegeResultSet.java
index 3e73cc6..c34bdf1 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/PrivilegeResultSet.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/PrivilegeResultSet.java
@@ -70,7 +70,7 @@ public class PrivilegeResultSet {
             try {
                 rs.close();
             } catch (Exception ex) {
-                LOGGER.error("failed to close result set: " + ex.getStackTrace());
+                LOGGER.error("failed to close result set: ", ex);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/sentry/blob/af5c004b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
index e18da1f..6c92c30 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
@@ -150,7 +150,7 @@ public class TestPrivilegesAtFunctionScope extends AbstractTestWithStaticConfigu
       statement.execute("CREATE TEMPORARY FUNCTION printf_test AS 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFPrintf'");
       verifyPrintFuncValues(statement, "SELECT printf_test('%s', value) FROM " + tableName1);
     } catch (Exception ex) {
-      LOGGER.error("test temp func printf_test failed with reason: " + ex.getStackTrace()
+ " " + ex.getMessage());
+      LOGGER.error("test temp func printf_test failed with reason: ", ex);
       fail("fail to test temp func printf_test");
     } finally {
       statement.execute("DROP TEMPORARY FUNCTION IF EXISTS printf_test");
@@ -162,7 +162,7 @@ public class TestPrivilegesAtFunctionScope extends AbstractTestWithStaticConfigu
           "CREATE FUNCTION printf_test_perm AS 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFPrintf'
");
       verifyPrintFuncValues(statement, "SELECT printf_test_perm('%s', value) FROM " + tableName1);
     } catch (Exception ex) {
-      LOGGER.error("test perm func printf_test_perm failed with reason: " + ex.getStackTrace()
+ " " + ex.getMessage());
+      LOGGER.error("test perm func printf_test_perm failed with reason: ", ex);
       fail("Fail to test perm func printf_test_perm");
     } finally {
       statement.execute("DROP FUNCTION IF EXISTS printf_test_perm");
@@ -175,8 +175,7 @@ public class TestPrivilegesAtFunctionScope extends AbstractTestWithStaticConfigu
           .execute("CREATE FUNCTION printf_test_perm_use_file AS 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFPrintf'
"
               + " using file 'file:///tmp'");
     } catch (Exception ex) {
-      LOGGER.error("test perm func printf_test_perm_use_file failed with reason: "
-          + ex.getStackTrace() + " " + ex.getMessage());
+      LOGGER.error("test perm func printf_test_perm_use_file failed with reason: ", ex);
       fail("Fail to test perm func printf_test_perm_use_file");
     } finally {
       statement.execute("DROP FUNCTION IF EXISTS printf_test_perm_use_file");
@@ -197,8 +196,7 @@ public class TestPrivilegesAtFunctionScope extends AbstractTestWithStaticConfigu
           "CREATE TEMPORARY FUNCTION printf_test_2 AS 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFPrintf'");
       verifyPrintFuncValues(statement, "SELECT printf_test_2('%s', value) FROM " + tableName1);
     } catch (Exception ex) {
-      LOGGER.error("test perm func printf_test_2 failed with reason: "
-          + ex.getStackTrace() + " " + ex.getMessage());
+      LOGGER.error("test perm func printf_test_2 failed with reason: ", ex);
       fail("Fail to test temp func printf_test_2");
     } finally {
       statement.execute("DROP TEMPORARY FUNCTION IF EXISTS printf_test_2");
@@ -209,8 +207,7 @@ public class TestPrivilegesAtFunctionScope extends AbstractTestWithStaticConfigu
           "CREATE FUNCTION " + DB1 + ".printf_test_2_perm AS 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFPrintf'");
       verifyPrintFuncValues(statement, "SELECT printf_test_2_perm('%s', value) FROM " + tableName1);
     } catch (Exception ex) {
-      LOGGER.error("test perm func printf_test_2_perm failed with reason: "
-          + ex.getStackTrace() + " " + ex.getMessage());
+      LOGGER.error("test perm func printf_test_2_perm failed with reason: ", ex);
       fail("Fail to test temp func printf_test_2_perm");
     } finally {
       statement.execute("DROP FUNCTION IF EXISTS printf_test_2_perm");

http://git-wip-us.apache.org/repos/asf/sentry/blob/af5c004b/sentry-tests/sentry-tests-solr/src/test/java/org/apache/sentry/tests/e2e/solr/TestRealTimeGet.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-solr/src/test/java/org/apache/sentry/tests/e2e/solr/TestRealTimeGet.java
b/sentry-tests/sentry-tests-solr/src/test/java/org/apache/sentry/tests/e2e/solr/TestRealTimeGet.java
index 6181d8b..f9b6c07 100644
--- a/sentry-tests/sentry-tests-solr/src/test/java/org/apache/sentry/tests/e2e/solr/TestRealTimeGet.java
+++ b/sentry-tests/sentry-tests-solr/src/test/java/org/apache/sentry/tests/e2e/solr/TestRealTimeGet.java
@@ -117,7 +117,7 @@ public class TestRealTimeGet extends AbstractSolrSentryTestBase {
       assertNull("Should be no doc present: " + doc, doc);
       assertNull("Should be no doc present: " + controlDoc, controlDoc);
       assertTrue((docList == null && controlDocList == null) ||
-          (controlDocList.getNumFound() == 0 && controlDocList.getNumFound() == 0));
+          (controlDocList.getNumFound() == 0));
     } else {
       if (docList == null) {
         assertNull(controlDocList);


Mime
View raw message