You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by ak...@apache.org on 2017/03/04 01:37:12 UTC
sentry git commit: SENTRY-1642 Integrate Sentry build with Error
Prone (Alex Kolbasov, reviewed by: Lei Xu)
Repository: sentry
Updated Branches:
refs/heads/master fc8c626ee -> c2013f236
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/c2013f23
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/c2013f23
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/c2013f23
Branch: refs/heads/master
Commit: c2013f236c9d4d92d813c962f4dc5ab85ce89749
Parents: fc8c626
Author: Alexander Kolbasov <ak...@cloudera.com>
Authored: Fri Mar 3 17:37:05 2017 -0800
Committer: Alexander Kolbasov <ak...@cloudera.com>
Committed: Fri Mar 3 17:37:05 2017 -0800
----------------------------------------------------------------------
pom.xml | 23 ++++++++++++++++++++
.../binding/hive/HiveAuthzBindingHook.java | 2 +-
.../hdfs/SentryINodeAttributesProvider.java | 2 +-
.../db/service/thrift/SentryMetrics.java | 1 +
.../e2e/hive/TestPrivilegesAtFunctionScope.java | 2 +-
.../tests/e2e/hive/PrivilegeResultSet.java | 2 +-
.../e2e/hive/TestPrivilegesAtFunctionScope.java | 17 ++++++---------
.../e2e/tools/CreateSentryTestScaleData.java | 1 +
.../sentry/tests/e2e/solr/TestRealTimeGet.java | 2 +-
9 files changed, 37 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sentry/blob/c2013f23/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 330c973..66e9220 100644
--- a/pom.xml
+++ b/pom.xml
@@ -784,7 +784,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/c2013f23/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 f41960f..d269d5f 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/c2013f23/sentry-hdfs/sentry-hdfs-namenode-plugin/src/main/java/org/apache/sentry/hdfs/SentryINodeAttributesProvider.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/sentry-hdfs-namenode-plugin/src/main/java/org/apache/sentry/hdfs/SentryINodeAttributesProvider.java b/sentry-hdfs/sentry-hdfs-namenode-plugin/src/main/java/org/apache/sentry/hdfs/SentryINodeAttributesProvider.java
index 809c816..23b831d 100644
--- a/sentry-hdfs/sentry-hdfs-namenode-plugin/src/main/java/org/apache/sentry/hdfs/SentryINodeAttributesProvider.java
+++ b/sentry-hdfs/sentry-hdfs-namenode-plugin/src/main/java/org/apache/sentry/hdfs/SentryINodeAttributesProvider.java
@@ -168,7 +168,7 @@ public class SentryINodeAttributesProvider extends INodeAttributeProvider
PermissionStatus permissionStatus = new PermissionStatus(getUserName(),
getGroupName(), getFsPermission());
// No other way to get the long permission currently
- return new INodeDirectory(0l, null, permissionStatus, 0l)
+ return new INodeDirectory(0L, null, permissionStatus, 0L)
.getPermissionLong();
}
http://git-wip-us.apache.org/repos/asf/sentry/blob/c2013f23/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
----------------------------------------------------------------------
diff --git a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
index 9d09971..af70c99 100644
--- a/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
+++ b/sentry-service/sentry-service-server/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryMetrics.java
@@ -178,6 +178,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/c2013f23/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 d04c25f..9bd8418 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/c2013f23/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/c2013f23/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 e440fb2..b56cfda 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
@@ -185,7 +185,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");
}
@@ -200,7 +200,7 @@ public class TestPrivilegesAtFunctionScope extends AbstractTestWithStaticConfigu
try {
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");
}
@@ -218,7 +218,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");
}
@@ -233,7 +233,7 @@ public class TestPrivilegesAtFunctionScope extends AbstractTestWithStaticConfigu
try {
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");
}
@@ -252,8 +252,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");
@@ -274,8 +273,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");
@@ -286,8 +284,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/c2013f23/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/tools/CreateSentryTestScaleData.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/tools/CreateSentryTestScaleData.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/tools/CreateSentryTestScaleData.java
index cd9fa28..cbdaa0d 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/tools/CreateSentryTestScaleData.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/tools/CreateSentryTestScaleData.java
@@ -338,6 +338,7 @@ public class CreateSentryTestScaleData {
case "MAX_PAR":
exec(statement, String.format("GRANT SELECT(num) ON TABLE %s TO ROLE %s", objName, roleName));
privilegeStatus.num_partitions += 1;
+ break;
case "MAX_COL":
StringBuilder grantPars = new StringBuilder("GRANT SELECT(");
for(int i = 0; i < MAX_COLUMNS_PER_TABLE - 1; i++) {
http://git-wip-us.apache.org/repos/asf/sentry/blob/c2013f23/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);