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/07/11 18:00:34 UTC
sentry git commit: SENTRY-1817: Deprecate SENTRY_HA_ENABLED and all
tests that use it (Na Li, reviewed by Alex Kolbasov and Sergio Pena)
Repository: sentry
Updated Branches:
refs/heads/sentry-ha-redesign b9eca2144 -> 5c1d55993
SENTRY-1817: Deprecate SENTRY_HA_ENABLED and all tests that use it (Na Li, reviewed by Alex Kolbasov and Sergio Pena)
Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/5c1d5599
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/5c1d5599
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/5c1d5599
Branch: refs/heads/sentry-ha-redesign
Commit: 5c1d559930c3baaa943e2a220e8c89b1f7b51118
Parents: b9eca21
Author: Alexander Kolbasov <ak...@cloudera.com>
Authored: Tue Jul 11 20:00:11 2017 +0200
Committer: Alexander Kolbasov <ak...@cloudera.com>
Committed: Tue Jul 11 20:00:11 2017 +0200
----------------------------------------------------------------------
.../apache/sentry/hdfs/ServiceConstants.java | 14 --
.../sentry/service/thrift/ServiceConstants.java | 3 -
.../TestSentryServerForPoolWithoutKerberos.java | 1 -
.../TestSentryServiceForPoolWithKerberos.java | 1 -
.../thrift/SentryServiceIntegrationBase.java | 53 +-----
.../dbprovider/AbstractTestWithDbProvider.java | 15 +-
.../TestPrivilegeWithHAGrantOption.java | 1 -
.../sentry/tests/e2e/ha/TestHaEnd2End.java | 171 -------------------
.../AbstractTestWithStaticConfiguration.java | 14 +-
.../tests/e2e/minisentry/InternalSentrySrv.java | 34 ----
.../sentry/tests/e2e/minisentry/SentrySrv.java | 14 --
.../dbprovider/AbstractTestWithDbProvider.java | 15 +-
.../TestPrivilegeWithHAGrantOption.java | 1 -
.../sentry/tests/e2e/ha/TestFailover.java | 49 ------
.../AbstractTestWithStaticConfiguration.java | 14 +-
.../tests/e2e/minisentry/InternalSentrySrv.java | 36 +---
.../sentry/tests/e2e/minisentry/SentrySrv.java | 14 --
17 files changed, 9 insertions(+), 441 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/ServiceConstants.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/ServiceConstants.java b/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/ServiceConstants.java
index dee4dc2..f993010 100644
--- a/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/ServiceConstants.java
+++ b/sentry-hdfs/sentry-hdfs-common/src/main/java/org/apache/sentry/hdfs/ServiceConstants.java
@@ -49,25 +49,12 @@ public class ServiceConstants {
/**
* This configuration parameter is only meant to be used for testing purposes.
*/
- public static final String SENTRY_HDFS_INTEGRATION_PATH_PREFIXES = "sentry.hdfs.integration.path.prefixes";
- public static final String[] SENTRY_HDFS_INTEGRATION_PATH_PREFIXES_DEFAULT =
- new String[]{"/user/hive/warehouse"};
- public static final String SENTRY_HDFS_INIT_UPDATE_RETRY_DELAY_MS = "sentry.hdfs.init.update.retry.delay.ms";
- public static final int SENTRY_HDFS_INIT_UPDATE_RETRY_DELAY_DEFAULT = 10000;
- public static final String SENTRY_HDFS_SYNC_CHECKER_PERIOD_MS = "sentry.hdfs.sync.checker.period.ms";
- public static final int SENTRY_HDFS_SYNC_CHECKER_PERIOD_DEFAULT = 1000;
- public static final String SENTRY_HDFS_HA_ZOOKEEPER_NAMESPACE = "sentry.hdfs.ha.zookeeper.namespace";
- public static final String SENTRY_HDFS_HA_ZOOKEEPER_NAMESPACE_DEFAULT = "/sentry_hdfs";
- public static final String SENTRY_METASTORE_HA_ZOOKEEPER_NAMESPACE = "sentry.metastore.ha.zookeeper.namespace";
- public static final String SENTRY_METASTORE_HA_ZOOKEEPER_NAMESPACE_DEFAULT = "/sentry_metastore";
public static final String SENTRY_HDFS_SYNC_METASTORE_CACHE_INIT_THREADS = "sentry.hdfs.sync.metastore.cache.init.threads";
public static final int SENTRY_HDFS_SYNC_METASTORE_CACHE_INIT_THREADS_DEFAULT = 10;
public static final String SENTRY_HDFS_SYNC_METASTORE_CACHE_RETRY_MAX_NUM = "sentry.hdfs.sync.metastore.cache.retry.max.num";
public static final int SENTRY_HDFS_SYNC_METASTORE_CACHE_RETRY_MAX_NUM_DEFAULT = 1;
public static final String SENTRY_HDFS_SYNC_METASTORE_CACHE_RETRY_WAIT_DURAION_IN_MILLIS = "sentry.hdfs.sync.metastore.cache.retry.wait.duration.millis";
public static final int SENTRY_HDFS_SYNC_METASTORE_CACHE_RETRY_WAIT_DURAION_IN_MILLIS_DEFAULT = 1000;
- public static final String SENTRY_HDFS_SYNC_METASTORE_CACHE_ASYNC_INIT_ENABLE = "sentry.hdfs.sync.metastore.cache.async-init.enable";
- public static final boolean SENTRY_HDFS_SYNC_METASTORE_CACHE_ASYNC_INIT_ENABLE_DEFAULT = false;
public static final String SENTRY_HDFS_SYNC_METASTORE_CACHE_MAX_PART_PER_RPC = "sentry.hdfs.sync.metastore.cache.max-partitions-per-rpc";
public static final int SENTRY_HDFS_SYNC_METASTORE_CACHE_MAX_PART_PER_RPC_DEFAULT = 100;
@@ -81,7 +68,6 @@ public class ServiceConstants {
public static final String SECURITY_MODE = "sentry.hdfs.service.security.mode";
public static final String SECURITY_MODE_KERBEROS = "kerberos";
- public static final String SECURITY_MODE_NONE = "none";
public static final String SECURITY_USE_UGI_TRANSPORT = "sentry.hdfs.service.security.use.ugi";
public static final String PRINCIPAL = "sentry.hdfs.service.server.principal";
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
index 83f00ca..193c611 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
@@ -123,8 +123,6 @@ public class ServiceConstants {
public static final String SENTRY_STORE_CLEAN_PERIOD_SECONDS =
"sentry.store.clean.period.seconds";
public static final long SENTRY_STORE_CLEAN_PERIOD_SECONDS_DEFAULT = 43200; // 12 hours.
- public static final String SENTRY_HA_ENABLED = "sentry.ha.enabled";
- public static final boolean SENTRY_HA_ENABLED_DEFAULT = false;
public static final String SENTRY_HA_ZK_PROPERTY_PREFIX = "sentry.ha.zookeeper.";
public static final String SENTRY_HA_ZOOKEEPER_SECURITY = SENTRY_HA_ZK_PROPERTY_PREFIX + "security";
public static final boolean SENTRY_HA_ZOOKEEPER_SECURITY_DEFAULT = false;
@@ -243,7 +241,6 @@ public class ServiceConstants {
public static final String SERVER_RPC_CONN_TIMEOUT = "sentry.service.client.server.rpc-connection-timeout";
// HA configuration
- public static final String SENTRY_HA_ENABLED = "sentry.ha.enabled";
public static final String SENTRY_HA_ZOOKEEPER_QUORUM = ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM;
public static final String SENTRY_HA_ZOOKEEPER_NAMESPACE = ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE;
public static final String SERVER_HA_ZOOKEEPER_NAMESPACE_DEFAULT = ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE_DEFAULT;
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerForPoolWithoutKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerForPoolWithoutKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerForPoolWithoutKerberos.java
index 62fbb2f..ac8cd71 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerForPoolWithoutKerberos.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerForPoolWithoutKerberos.java
@@ -25,7 +25,6 @@ public class TestSentryServerForPoolWithoutKerberos extends TestSentryServerWith
@BeforeClass
public static void setup() throws Exception {
kerberos = false;
- haEnabled = false;
pooled = true;
beforeSetup();
setupConf();
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceForPoolWithKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceForPoolWithKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceForPoolWithKerberos.java
index bd3c1cc..bac1c15 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceForPoolWithKerberos.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceForPoolWithKerberos.java
@@ -25,7 +25,6 @@ public class TestSentryServiceForPoolWithKerberos extends TestSentryServiceWithK
@BeforeClass
public static void setup() throws Exception {
kerberos = true;
- haEnabled = false;
pooled = true;
beforeSetup();
setupConf();
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
index dd37e7e..6895720 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
@@ -26,7 +26,6 @@ import java.util.concurrent.TimeoutException;
import com.google.common.io.Resources;
import org.apache.commons.io.FileUtils;
-import org.apache.curator.test.TestingServer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.minikdc.MiniKdc;
import org.apache.hadoop.net.NetUtils;
@@ -37,7 +36,6 @@ import org.apache.sentry.provider.db.service.thrift.TSentryRole;
import org.apache.sentry.provider.file.PolicyFile;
import org.apache.sentry.service.thrift.ServiceConstants.ClientConfig;
import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperSaslServer;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -59,8 +57,6 @@ public abstract class SentryServiceIntegrationBase extends SentryMiniKdcTestcase
protected static final String HTTP_PRINCIPAL = "HTTP/" + SERVER_HOST;
protected static final String CLIENT_PRINCIPAL = "hive/" + SERVER_HOST;
protected static final String CLIENT_KERBEROS_SHORT_NAME = "hive";
- protected static final String CLIENT_KERBEROS_NAME = CLIENT_KERBEROS_SHORT_NAME
- + "/" + SERVER_HOST + "@" + REALM;
protected static final String ADMIN_USER = "admin_user";
protected static final String ADMIN_GROUP = "admin_group";
@@ -79,12 +75,6 @@ public abstract class SentryServiceIntegrationBase extends SentryMiniKdcTestcase
protected File policyFilePath;
protected static Properties kdcConfOverlay = new Properties();
- protected static boolean haEnabled = false;
- protected static final String ZK_SERVER_PRINCIPAL = "zookeeper/" + SERVER_HOST;
- protected static TestingServer zkServer;
-
- private static File ZKKeytabFile;
-
protected static boolean webServerEnabled = false;
protected static int webServerPort = ServerConfig.SENTRY_WEB_PORT_DEFAULT;
protected static boolean webSecurity = false;
@@ -150,15 +140,7 @@ public abstract class SentryServiceIntegrationBase extends SentryMiniKdcTestcase
LOGGER.info("Stopped KDC");
conf.set(ServerConfig.SECURITY_MODE, ServerConfig.SECURITY_MODE_NONE);
}
- if (haEnabled) {
- zkServer = getZKServer();
- conf.set(ServerConfig.SENTRY_HA_ENABLED, "true");
- conf.set(ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM, zkServer.getConnectString());
- conf.set(ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE, "sentry-test-case");
- if (kerberos) {
- conf.set(ServerConfig.SENTRY_HA_ZOOKEEPER_SECURITY, "true");
- }
- }
+
if (webServerEnabled) {
conf.set(ServerConfig.SENTRY_WEB_ENABLE, "true");
conf.set(ServerConfig.SENTRY_WEB_PORT, String.valueOf(webServerPort));
@@ -305,39 +287,6 @@ public abstract class SentryServiceIntegrationBase extends SentryMiniKdcTestcase
policyFile.write(policyFilePath);
}
- protected static TestingServer getZKServer() throws Exception {
- if (!kerberos) {
- LOGGER.info("Creating a non-security ZooKeeper Server.");
- return new TestingServer();
- } else {
- LOGGER.info("Creating a security ZooKeeper Server.");
- // Not entirely sure exactly what "javax.security.auth.useSubjectCredsOnly=false" does, but it has something to do with
- // re-authenticating in cases where it otherwise wouldn't. One of the sections on this page briefly mentions it:
- // http://docs.oracle.com/javase/7/docs/technotes/guides/security/jgss/tutorials/Troubleshooting.html
- System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
-
- // Setup KDC and principal
- kdc = getKdc();
- ZKKeytabFile = new File(kdcWorkDir, "test.keytab");
- kdc.createPrincipal(ZKKeytabFile, ZK_SERVER_PRINCIPAL);
-
- System.setProperty("zookeeper.authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider");
- System.setProperty("zookeeper.kerberos.removeHostFromPrincipal", "true");
- System.setProperty("zookeeper.kerberos.removeRealmFromPrincipal", "true");
-
- JaasConfiguration.addEntryForKeytab("Server", ZK_SERVER_PRINCIPAL, ZKKeytabFile.getAbsolutePath());
- // Here's where we add the "Client" to the jaas configuration, even though we'd like not to
- JaasConfiguration.addEntryForKeytab(ServiceConstants.SENTRY_ZK_JAAS_NAME,
- SERVER_KERBEROS_NAME, serverKeytab.getAbsolutePath());
- javax.security.auth.login.Configuration.setConfiguration(JaasConfiguration.getInstance());
-
- System.setProperty(ZooKeeperSaslServer.LOGIN_CONTEXT_NAME_KEY, "Server");
-
- return new TestingServer();
- }
-
- }
-
protected void runTestAsSubject(final TestOperation test) throws Exception {
/*if (false) {
clientUgi.doAs(new PrivilegedExceptionAction<Void>() {
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
index d843829..4c416f7 100644
--- a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
+++ b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
@@ -26,7 +26,6 @@ import java.util.Map;
import java.util.concurrent.TimeoutException;
import org.apache.commons.io.FileUtils;
-import org.apache.curator.test.TestingServer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
@@ -61,9 +60,6 @@ public abstract class AbstractTestWithDbProvider extends AbstractTestWithHiveSer
private static File policyFilePath;
protected static Context context;
- protected static boolean haEnabled;
- private static TestingServer zkServer;
-
@BeforeClass
public static void setupTest() throws Exception {
}
@@ -88,13 +84,7 @@ public abstract class AbstractTestWithDbProvider extends AbstractTestWithHiveSer
policyFilePath = new File(Files.createTempDir(), "sentry-policy-file.ini");
properties.put(ServerConfig.SENTRY_STORE_GROUP_MAPPING_RESOURCE,
policyFilePath.getPath());
- if (haEnabled) {
- zkServer = new TestingServer();
- zkServer.start();
- properties.put(ServerConfig.SENTRY_HA_ENABLED, "true");
- properties.put(ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE, "sentry-test");
- properties.put(ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM, zkServer.getConnectString());
- }
+
for (Map.Entry<String, String> entry : properties.entrySet()) {
conf.set(entry.getKey(), entry.getValue());
}
@@ -128,9 +118,6 @@ public abstract class AbstractTestWithDbProvider extends AbstractTestWithHiveSer
if (dbDir != null) {
FileUtils.deleteQuietly(dbDir);
}
- if (zkServer != null) {
- zkServer.stop();
- }
}
protected void setupAdmin(Context context) throws Exception {
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
index 70b48e1..a1607d5 100644
--- a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
+++ b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
@@ -37,7 +37,6 @@ public class TestPrivilegeWithHAGrantOption extends AbstractTestWithDbProvider {
@BeforeClass
public static void setup() throws Exception {
- haEnabled = true;
properties = new HashMap<String, String>();
properties.put(HiveAuthzConf.AuthzConfVars.AUTHZ_ONFAILURE_HOOKS.getVar(),
DummySentryOnFailureHook.class.getName());
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/ha/TestHaEnd2End.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/ha/TestHaEnd2End.java b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/ha/TestHaEnd2End.java
deleted file mode 100644
index 07d74b5..0000000
--- a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/ha/TestHaEnd2End.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * 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.sentry.tests.e2e.ha;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import org.apache.sentry.core.common.exception.SentryAccessDeniedException;
-import org.apache.sentry.provider.file.PolicyFile;
-import org.apache.sentry.service.thrift.HAClientInvocationHandler;
-import org.apache.sentry.tests.e2e.hive.AbstractTestWithStaticConfiguration;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.io.Resources;
-
-/**
- * End2End tests with Sentry service HA enabled.
- */
-public class TestHaEnd2End extends AbstractTestWithStaticConfiguration {
-
- private final String SINGLE_TYPE_DATA_FILE_NAME = "kv1.dat";
- private File dataFile;
-
- @BeforeClass
- public static void setupTestStaticConfiguration() throws Exception {
- useSentryService = true;
- enableSentryHA = true;
- AbstractTestWithStaticConfiguration.setupTestStaticConfiguration();
- }
-
- @Override
- @Before
- public void setup() throws Exception {
- super.setupAdmin();
- super.setup();
- dataFile = new File(dataDir, SINGLE_TYPE_DATA_FILE_NAME);
- FileOutputStream to = new FileOutputStream(dataFile);
- Resources.copy(Resources.getResource(SINGLE_TYPE_DATA_FILE_NAME), to);
- to.close();
- PolicyFile.setAdminOnServer1(ADMINGROUP);
- }
-
- /**
- * Basic test with two Sentry service running.
- * @throws Exception
- */
- @Test
- public void testBasic() throws Exception {
- Connection connection = context.createConnection(ADMIN1);
- Statement statement = context.createStatement(connection);
- statement.execute("CREATE TABLE t1 (c1 string)");
- statement.execute("CREATE ROLE user_role");
- statement.execute("GRANT SELECT ON TABLE t1 TO ROLE user_role");
- statement.execute("GRANT ROLE user_role TO GROUP " + USERGROUP1);
- statement.close();
- connection.close();
- connection = context.createConnection(USER1_1);
- statement = context.createStatement(connection);
- context.assertSentryException(statement, "CREATE ROLE r2",
- SentryAccessDeniedException.class.getSimpleName());
- // test default of ALL
- statement.execute("SELECT * FROM t1");
- // test a specific role
- statement.execute("SET ROLE user_role");
- statement.execute("SELECT * FROM t1");
-
- // test ALL
- statement.execute("SET ROLE ALL");
- statement.execute("SELECT * FROM t1");
- statement.close();
- connection.close();
-
- // cleanup
- connection = context.createConnection(ADMIN1);
- statement = context.createStatement(connection);
- statement.execute("DROP ROLE user_role");
- statement.close();
- connection.close();
- }
-
- /**
- * Test service failover. Run Sentry operations with shutting down one or more
- * of the services.
- * @throws Exception
- */
- @Test
- public void testFailover() throws Exception {
- String roleName1 = "test_role_1";
- String roleName2 = "test_role_2";
- String roleName3 = "test_role_3";
-
- dropDb(ADMIN1, DB1);
- createDb(ADMIN1, DB1);
- createTable(ADMIN1, DB1, dataFile, TBL1);
-
- Connection adminCon = context.createConnection(ADMIN1);
- Statement adminStmt = context.createStatement(adminCon);
- // access the new databases
- adminStmt.execute("use " + DB1);
-
- // stop server1 and verify sentry continues to work
- getSentrySrv().stop(0);
- adminStmt.execute("CREATE ROLE " + roleName1);
- verifyRoleExists(adminStmt, roleName1);
-
- // restart server1 and stop server2
- getSentrySrv().start(0);
- getSentrySrv().stop(1);
- adminStmt.execute("CREATE ROLE " + roleName2);
- verifyRoleExists(adminStmt, roleName2);
-
- // stop both servers and verify it fails
- getSentrySrv().stop(0);
- getSentrySrv().stop(1);
- context.assertAuthzExecHookException(adminStmt, "CREATE ROLE " + roleName3,
- HAClientInvocationHandler.SENTRY_HA_ERROR_MESSAGE);
-
- getSentrySrv().start(0);
- getSentrySrv().start(1);
- adminStmt.execute("CREATE ROLE " + roleName3);
- verifyRoleExists(adminStmt, roleName3);
-
- // cleanup
-
- dropDb(ADMIN1, DB1);
- adminStmt.execute("DROP ROLE " + roleName1);
- adminStmt.execute("DROP ROLE " + roleName2);
- adminStmt.execute("DROP ROLE " + roleName3);
- adminStmt.close();
- adminCon.close();
-
- }
-
- private void verifyRoleExists(Statement statement, String roleName)
- throws Exception {
- ResultSet resultSet = null;
- try {
- resultSet = statement.executeQuery("SHOW ROLES ");
- while (resultSet.next()) {
- if (roleName.equalsIgnoreCase(resultSet.getString(1))) {
- return;
- }
- }
- throw new Exception("Role " + roleName + " does not exist");
- } finally {
- if (resultSet != null) {
- resultSet.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
index 458e91d..f791543 100644
--- a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
+++ b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
@@ -119,7 +119,6 @@ public abstract class AbstractTestWithStaticConfiguration {
protected static final String SERVER_HOST = "localhost";
private static final String EXTERNAL_SENTRY_SERVICE = "sentry.e2etest.external.sentry";
protected static final String EXTERNAL_HIVE_LIB = "sentry.e2etest.hive.lib";
- private static final String ENABLE_SENTRY_HA = "sentry.e2etest.enable.service.ha";
protected static boolean policyOnHdfs = false;
protected static boolean useSentryService = false;
@@ -141,7 +140,6 @@ public abstract class AbstractTestWithStaticConfiguration {
protected static Map<String, String> properties;
protected static SentrySrv sentryServer;
protected static Configuration sentryConf;
- protected static boolean enableSentryHA = false;
protected static Context context;
protected final String semanticException = "Exception No valid privileges";
@@ -267,9 +265,7 @@ public abstract class AbstractTestWithStaticConfiguration {
}
boolean startSentry = Boolean.valueOf(System.getProperty(EXTERNAL_SENTRY_SERVICE, "false"));
- if ("true".equalsIgnoreCase(System.getProperty(ENABLE_SENTRY_HA, "false"))) {
- enableSentryHA = true;
- }
+
if (useSentryService && (!startSentry)) {
setupSentryService();
}
@@ -451,7 +447,7 @@ public abstract class AbstractTestWithStaticConfiguration {
sentryConf.set(entry.getKey(), entry.getValue());
}
sentryServer = SentrySrvFactory.create(
- SentrySrvType.INTERNAL_SERVER, sentryConf, enableSentryHA ? 2 : 1);
+ SentrySrvType.INTERNAL_SERVER, sentryConf, 1);
properties.put(ClientConfig.SERVER_RPC_ADDRESS, sentryServer.get(0)
.getAddress()
.getHostName());
@@ -462,11 +458,7 @@ public abstract class AbstractTestWithStaticConfiguration {
String.valueOf(sentryServer.get(0).getAddress().getPort()));
sentryConf.set(ClientConfig.SERVER_RPC_PORT,
String.valueOf(sentryServer.get(0).getAddress().getPort()));
- if (enableSentryHA) {
- properties.put(ClientConfig.SERVER_HA_ENABLED, "true");
- properties.put(ClientConfig.SENTRY_HA_ZOOKEEPER_QUORUM,
- sentryServer.getZKQuorum());
- }
+
startSentryService();
if (setMetastoreListener) {
LOGGER.info("setMetastoreListener is enabled");
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
index 054b193..62bcf62 100644
--- a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
+++ b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
@@ -17,12 +17,10 @@
*/
package org.apache.sentry.tests.e2e.minisentry;
-import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.curator.test.TestingServer;
import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.service.thrift.SentryService;
import org.apache.sentry.service.thrift.SentryServiceFactory;
@@ -105,24 +103,12 @@ public class InternalSentrySrv implements SentrySrv {
}
private List<SentryService> sentryServers = Lists.newArrayList();
- private static TestingServer zkServer; // created only if in case of HA
private static final Logger LOGGER = LoggerFactory
.getLogger(InternalSentrySrv.class);
private boolean isActive = false;
public InternalSentrySrv(Configuration sentryConf, int numServers)
throws Exception {
- // Enable HA when numServers is more that 1, start Curator TestingServer
- if (numServers > 1) {
- zkServer = new TestingServer();
- zkServer.start();
- sentryConf.setBoolean(ServerConfig.SENTRY_HA_ENABLED, true);
- sentryConf.set(ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM,
- zkServer.getConnectString());
- } else if (numServers <= 0) {
- throw new IllegalArgumentException("Invalid number of Servers: "
- + numServers + " ,must be > 0");
- }
for (int count = 0; count < numServers; count++) {
Configuration servConf = new Configuration(sentryConf);
SentryService sentryServer = new SentryServiceFactory().create(servConf);
@@ -202,13 +188,6 @@ public class InternalSentrySrv implements SentrySrv {
LOGGER.error("Error stoping Sentry service ", e);
}
}
- if (zkServer != null) {
- try {
- zkServer.stop();
- } catch (IOException e) {
- LOGGER.warn("Error stoping ZK service ", e);
- }
- }
sentryServers.clear();
isActive = false;
}
@@ -219,19 +198,6 @@ public class InternalSentrySrv implements SentrySrv {
}
@Override
- public String getZKQuorum() throws Exception {
- if (zkServer == null) {
- throw new IOException("Sentry HA is not enabled");
- }
- return zkServer.getConnectString();
- }
-
- @Override
- public boolean isHaEnabled() {
- return zkServer != null;
- }
-
- @Override
public long getNumActiveClients(int serverNum) {
SentryThriftEvenHandler thriftHandler = (SentryThriftEvenHandler) get(
serverNum).getThriftEventHandler();
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
index dac1151..9139706 100644
--- a/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
+++ b/sentry-tests/sentry-tests-hive-v2/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
@@ -58,26 +58,12 @@ public interface SentrySrv {
SentryService get(int serverNum);
/**
- * Get the ZK connection string
- * @return
- * @throws Exception
- * - If HA is not enabled
- */
- String getZKQuorum() throws Exception;
-
- /**
* Stop all the nodes and ZK if started. The SentrySrv can't be reused once
* closed.
*/
void close();
/**
- * Check if the sentry server is created with HA enabled.
- * @return True - HA is enabled False - HA is not enabled
- */
- boolean isHaEnabled();
-
- /**
* Get the number of active clients connections across servers
*/
long getNumActiveClients();
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
index 17a2d1e..b416ef8 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/AbstractTestWithDbProvider.java
@@ -26,7 +26,6 @@ import java.util.Map;
import java.util.concurrent.TimeoutException;
import org.apache.commons.io.FileUtils;
-import org.apache.curator.test.TestingServer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
import org.apache.sentry.binding.hive.SentryHiveAuthorizationTaskFactoryImpl;
@@ -60,9 +59,6 @@ public abstract class AbstractTestWithDbProvider extends AbstractTestWithHiveSer
private static File policyFilePath;
protected static Context context;
- protected static boolean haEnabled;
- private static TestingServer zkServer;
-
@BeforeClass
public static void setupTest() throws Exception {
}
@@ -87,13 +83,7 @@ public abstract class AbstractTestWithDbProvider extends AbstractTestWithHiveSer
policyFilePath = new File(Files.createTempDir(), "sentry-policy-file.ini");
properties.put(ServerConfig.SENTRY_STORE_GROUP_MAPPING_RESOURCE,
policyFilePath.getPath());
- if (haEnabled) {
- zkServer = new TestingServer();
- zkServer.start();
- properties.put(ServerConfig.SENTRY_HA_ENABLED, "true");
- properties.put(ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE, "sentry-test");
- properties.put(ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM, zkServer.getConnectString());
- }
+
for (Map.Entry<String, String> entry : properties.entrySet()) {
conf.set(entry.getKey(), entry.getValue());
}
@@ -127,9 +117,6 @@ public abstract class AbstractTestWithDbProvider extends AbstractTestWithHiveSer
if (dbDir != null) {
FileUtils.deleteQuietly(dbDir);
}
- if (zkServer != null) {
- zkServer.stop();
- }
}
protected void setupAdmin(Context context) throws Exception {
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
index 53cbd00..f3db301 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestPrivilegeWithHAGrantOption.java
@@ -39,7 +39,6 @@ public class TestPrivilegeWithHAGrantOption extends AbstractTestWithDbProvider {
@BeforeClass
public static void setup() throws Exception {
- haEnabled = true;
properties = new HashMap<String, String>();
properties.put(HiveAuthzConf.AuthzConfVars.AUTHZ_ONFAILURE_HOOKS.getVar(),
DummySentryOnFailureHook.class.getName());
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/ha/TestFailover.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/ha/TestFailover.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/ha/TestFailover.java
deleted file mode 100644
index 1c7cd8b..0000000
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/ha/TestFailover.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.sentry.tests.e2e.ha;
-
-import org.apache.sentry.tests.e2e.hive.AbstractTestWithStaticConfiguration;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * End2End tests with Sentry service HA enabled.
- */
-public class TestFailover extends AbstractTestWithStaticConfiguration {
-
- @BeforeClass
- public static void setupTestStaticConfiguration() throws Exception {
- useSentryService = true;
- enableSentryHA = true;
- clearDbPerTest = false;
- AbstractTestWithStaticConfiguration.setupTestStaticConfiguration();
- }
-
-
- /**
- * Test service failover. Run Sentry operations with shutting down one or more
- * of the services.
- * TODO: We need rewrite the failover test for Active/Active.
- * @throws Exception
- */
- @Test
- public void testFailover() throws Exception {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
index fe68f49..6ea6763 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java
@@ -128,7 +128,6 @@ public abstract class AbstractTestWithStaticConfiguration extends RulesForE2ETes
protected static final String SERVER_HOST = "localhost";
private static final String EXTERNAL_SENTRY_SERVICE = "sentry.e2etest.external.sentry";
protected static final String EXTERNAL_HIVE_LIB = "sentry.e2etest.hive.lib";
- private static final String ENABLE_SENTRY_HA = "sentry.e2etest.enable.service.ha";
private static final String ENABLE_NOTIFICATION_LOG = "sentry.e2etest.enable.notification.log";
protected static boolean policyOnHdfs = false;
@@ -153,7 +152,6 @@ public abstract class AbstractTestWithStaticConfiguration extends RulesForE2ETes
protected static Map<String, String> properties;
protected static SentrySrv sentryServer;
protected static Configuration sentryConf;
- protected static boolean enableSentryHA = false;
protected static boolean enableNotificationLog = false;
protected static Context context;
protected final String semanticException = "SemanticException No valid privileges";
@@ -284,10 +282,6 @@ public abstract class AbstractTestWithStaticConfiguration extends RulesForE2ETes
policyURI = policyFileLocation.getPath();
}
- if ("true".equalsIgnoreCase(System.getProperty(ENABLE_SENTRY_HA, "false"))) {
- enableSentryHA = true;
- }
-
if ("true".equalsIgnoreCase(System.getProperty(ENABLE_NOTIFICATION_LOG, "false"))) {
enableNotificationLog = true;
}
@@ -511,7 +505,7 @@ public abstract class AbstractTestWithStaticConfiguration extends RulesForE2ETes
sentryConf.set(entry.getKey(), entry.getValue());
}
sentryServer = SentrySrvFactory.create(
- SentrySrvType.INTERNAL_SERVER, sentryConf, enableSentryHA ? 2 : 1);
+ SentrySrvType.INTERNAL_SERVER, sentryConf, 1);
properties.put(ClientConfig.SERVER_RPC_ADDRESS, sentryServer.get(0)
.getAddress()
.getHostName());
@@ -522,11 +516,7 @@ public abstract class AbstractTestWithStaticConfiguration extends RulesForE2ETes
String.valueOf(sentryServer.get(0).getAddress().getPort()));
sentryConf.set(ClientConfig.SERVER_RPC_PORT,
String.valueOf(sentryServer.get(0).getAddress().getPort()));
- if (enableSentryHA) {
- properties.put(ClientConfig.SENTRY_HA_ENABLED, "true");
- properties.put(ClientConfig.SENTRY_HA_ZOOKEEPER_QUORUM,
- sentryServer.getZKQuorum());
- }
+
startSentryService();
if (setMetastoreListener) {
LOGGER.info("setMetastoreListener is enabled");
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
index 054b193..4cfb1f7 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
@@ -17,17 +17,14 @@
*/
package org.apache.sentry.tests.e2e.minisentry;
-import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.curator.test.TestingServer;
import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.service.thrift.SentryService;
import org.apache.sentry.service.thrift.SentryServiceFactory;
import org.apache.sentry.service.thrift.ServiceConstants.ClientConfig;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.server.ServerContext;
import org.apache.thrift.server.TServerEventHandler;
@@ -105,24 +102,13 @@ public class InternalSentrySrv implements SentrySrv {
}
private List<SentryService> sentryServers = Lists.newArrayList();
- private static TestingServer zkServer; // created only if in case of HA
private static final Logger LOGGER = LoggerFactory
.getLogger(InternalSentrySrv.class);
private boolean isActive = false;
public InternalSentrySrv(Configuration sentryConf, int numServers)
throws Exception {
- // Enable HA when numServers is more that 1, start Curator TestingServer
- if (numServers > 1) {
- zkServer = new TestingServer();
- zkServer.start();
- sentryConf.setBoolean(ServerConfig.SENTRY_HA_ENABLED, true);
- sentryConf.set(ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM,
- zkServer.getConnectString());
- } else if (numServers <= 0) {
- throw new IllegalArgumentException("Invalid number of Servers: "
- + numServers + " ,must be > 0");
- }
+
for (int count = 0; count < numServers; count++) {
Configuration servConf = new Configuration(sentryConf);
SentryService sentryServer = new SentryServiceFactory().create(servConf);
@@ -202,13 +188,6 @@ public class InternalSentrySrv implements SentrySrv {
LOGGER.error("Error stoping Sentry service ", e);
}
}
- if (zkServer != null) {
- try {
- zkServer.stop();
- } catch (IOException e) {
- LOGGER.warn("Error stoping ZK service ", e);
- }
- }
sentryServers.clear();
isActive = false;
}
@@ -219,19 +198,6 @@ public class InternalSentrySrv implements SentrySrv {
}
@Override
- public String getZKQuorum() throws Exception {
- if (zkServer == null) {
- throw new IOException("Sentry HA is not enabled");
- }
- return zkServer.getConnectString();
- }
-
- @Override
- public boolean isHaEnabled() {
- return zkServer != null;
- }
-
- @Override
public long getNumActiveClients(int serverNum) {
SentryThriftEvenHandler thriftHandler = (SentryThriftEvenHandler) get(
serverNum).getThriftEventHandler();
http://git-wip-us.apache.org/repos/asf/sentry/blob/5c1d5599/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
index dac1151..9139706 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
@@ -58,26 +58,12 @@ public interface SentrySrv {
SentryService get(int serverNum);
/**
- * Get the ZK connection string
- * @return
- * @throws Exception
- * - If HA is not enabled
- */
- String getZKQuorum() throws Exception;
-
- /**
* Stop all the nodes and ZK if started. The SentrySrv can't be reused once
* closed.
*/
void close();
/**
- * Check if the sentry server is created with HA enabled.
- * @return True - HA is enabled False - HA is not enabled
- */
- boolean isHaEnabled();
-
- /**
* Get the number of active clients connections across servers
*/
long getNumActiveClients();