Repository: drill Updated Branches: refs/heads/master b4c599e33 -> f1cfaaf3a
DRILL-6005: Fixed TestGracefulShutdown tests to skip check for loopback address usage in distributed mode closes #1162 Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/844d5323 Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/844d5323 Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/844d5323 Branch: refs/heads/master Commit: 844d5323072b826da41ae1c85f5aa6fbf1200d62 Parents: b4c599e Author: dvjyothsna <[email protected]> Authored: Mon Mar 12 15:38:13 2018 -0700 Committer: Vitalii Diravka <[email protected]> Committed: Fri Mar 23 19:07:03 2018 +0200 ---------------------------------------------------------------------- .../main/java/org/apache/drill/exec/ExecConstants.java | 2 ++ .../main/java/org/apache/drill/exec/server/Drillbit.java | 4 ++-- exec/java-exec/src/main/resources/drill-module.conf | 4 +++- .../java/org/apache/drill/test/TestGracefulShutdown.java | 10 ++++++---- 4 files changed, 13 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/844d5323/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java b/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java index 54fb46a..0565254 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/ExecConstants.java @@ -640,4 +640,6 @@ public final class ExecConstants { public static final String DRILL_PORT_HUNT = "drill.exec.port_hunt"; + public static final String ALLOW_LOOPBACK_ADDRESS_BINDING = "drill.exec.allow_loopback_address_binding"; + } http://git-wip-us.apache.org/repos/asf/drill/blob/844d5323/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java index a734ca1..e7bdd2e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java @@ -134,19 +134,19 @@ public class Drillbit implements AutoCloseable { final Stopwatch w = Stopwatch.createStarted(); logger.debug("Construction started."); boolean drillPortHunt = config.getBoolean(ExecConstants.DRILL_PORT_HUNT); + boolean bindToLoopbackAddress = config.getBoolean(ExecConstants.ALLOW_LOOPBACK_ADDRESS_BINDING); final boolean allowPortHunting = (serviceSet != null) || drillPortHunt; context = new BootStrapContext(config, definitions, classpathScan); manager = new WorkManager(context); webServer = new WebServer(context, manager, this); - boolean isDistributedMode = false; + boolean isDistributedMode = (serviceSet == null) && !bindToLoopbackAddress; if (serviceSet != null) { coord = serviceSet.getCoordinator(); storeProvider = new CachingPersistentStoreProvider(new LocalPersistentStoreProvider(config)); } else { coord = new ZKClusterCoordinator(config); storeProvider = new PersistentStoreRegistry<ClusterCoordinator>(this.coord, config).newPStoreProvider(); - isDistributedMode = true; } //Check if InMemory Profile Store, else use Default Store Provider http://git-wip-us.apache.org/repos/asf/drill/blob/844d5323/exec/java-exec/src/main/resources/drill-module.conf ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/resources/drill-module.conf b/exec/java-exec/src/main/resources/drill-module.conf index 32be387..a227e0d 100644 --- a/exec/java-exec/src/main/resources/drill-module.conf +++ b/exec/java-exec/src/main/resources/drill-module.conf @@ -380,7 +380,9 @@ drill.exec: { # refresh time. grace_period_ms : 0, //port hunting for drillbits. Enabled only for testing purposes. - port_hunt : false + port_hunt : false, + // Allow drillbit to bind to loopback address in distributed mode. Enabled only for testing purposes. + allow_loopback_address_binding : false } drill.jdbc: { http://git-wip-us.apache.org/repos/asf/drill/blob/844d5323/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 a1d4eca..9608e21 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 @@ -62,6 +62,7 @@ public class TestGracefulShutdown extends BaseTestQuery { put(ExecConstants.HTTP_PORT_HUNT, true); put(ExecConstants.DRILL_PORT_HUNT, true); put(ExecConstants.GRACE_PERIOD, 10000); + put(ExecConstants.ALLOW_LOOPBACK_ADDRESS_BINDING, true); } }; @@ -69,6 +70,7 @@ public class TestGracefulShutdown extends BaseTestQuery { { put(ExecConstants.DRILL_PORT_HUNT, true); put(ExecConstants.GRACE_PERIOD, 10000); + put(ExecConstants.ALLOW_LOOPBACK_ADDRESS_BINDING, true); } }; @@ -95,7 +97,7 @@ public class TestGracefulShutdown extends BaseTestQuery { public void testOnlineEndPoints() throws Exception { String[] drillbits = {"db1" ,"db2","db3", "db4", "db5", "db6"}; - ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).withBits(drillbits).withLocalZk(); + ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).withLocalZk().withBits(drillbits); enableDrillPortHunting(builder); try ( ClusterFixture cluster = builder.build()) { @@ -145,7 +147,7 @@ public class TestGracefulShutdown extends BaseTestQuery { public void testStateChange() throws Exception { String[] drillbits = {"db1" ,"db2", "db3", "db4", "db5", "db6"}; - ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).withBits(drillbits).withLocalZk(); + ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).withLocalZk().withBits(drillbits); enableDrillPortHunting(builder); try (ClusterFixture cluster = builder.build()) { @@ -196,7 +198,7 @@ public class TestGracefulShutdown extends BaseTestQuery { public void testRestApi() throws Exception { String[] drillbits = { "db1" ,"db2", "db3" }; - ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).withBits(drillbits).withLocalZk(); + ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).withLocalZk().withBits(drillbits); builder = enableWebServer(builder); QueryBuilder.QuerySummaryFuture listener; final String sql = "select * from dfs.root.`.`"; @@ -247,7 +249,7 @@ public class TestGracefulShutdown extends BaseTestQuery { public void testRestApiShutdown() throws Exception { String[] drillbits = {"db1" ,"db2", "db3"}; - ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).withBits(drillbits).withLocalZk(); + ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).withLocalZk().withBits(drillbits); builder = enableWebServer(builder); QueryBuilder.QuerySummaryFuture listener; final String sql = "select * from dfs.root.`.`";
