IMPALA-10471: Making deadline for Shutdown by SIGRTMIN configurable
Making deadline for Shutdown caused by SIGRTMIN configurable
using flag: shutdown_deadline_s. The deadline for shutdown
by SIGRTMIN was fixed to 1 year and was independent of the
flag earlier. This patch ensures even this shutdown behaviour
is governed by the common flag: shutdown_deadline_s.
TESTING:
1. Modified existing test to reflect the configurable deadline.
2. Verified manually
3. Ran the cluster tests (which include test_restart_services)
Change-Id: I52cb1ba76e7ce9de86ceb2f84389b1ab257e4c05
Reviewed-on: http://gerrit.cloudera.org:8080/17348
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
diff --git a/be/src/common/init.cc b/be/src/common/init.cc
index 3b67247..a5cfbc8 100644
--- a/be/src/common/init.cc
+++ b/be/src/common/init.cc
@@ -191,8 +191,7 @@
CHECK(err == 0) << "sigwait(): " << GetStrErrMsg(err) << ": " << err;
CHECK_EQ(IMPALA_SHUTDOWN_SIGNAL, signal);
ShutdownStatusPB shutdown_status;
- const int ONE_YEAR_IN_SECONDS = 365 * 24 * 60 * 60;
- Status status = impala_server->StartShutdown(ONE_YEAR_IN_SECONDS, &shutdown_status);
+ Status status = impala_server->StartShutdown(-1, &shutdown_status);
if (!status.ok()) {
LOG(ERROR) << "Shutdown signal received but unable to initiate shutdown. Status: "
<< status.GetDetail();
diff --git a/tests/custom_cluster/test_restart_services.py b/tests/custom_cluster/test_restart_services.py
index 4115ef0..771c686 100644
--- a/tests/custom_cluster/test_restart_services.py
+++ b/tests/custom_cluster/test_restart_services.py
@@ -577,8 +577,10 @@
@pytest.mark.execute_serially
@CustomClusterTestSuite.with_args(
impalad_args="--shutdown_grace_period_s={grace_period} \
+ --shutdown_deadline_s={deadline} \
--hostname={hostname}".format(grace_period=IDLE_SHUTDOWN_GRACE_PERIOD_S,
- hostname=socket.gethostname()), cluster_size=1)
+ deadline=EXEC_SHUTDOWN_DEADLINE_S, hostname=socket.gethostname()),
+ cluster_size=1)
def test_shutdown_signal(self):
"""Test that an idle impalad shuts down in a timely manner after the shutdown grace
period elapses."""
@@ -597,7 +599,8 @@
# Make sure signal was received and the grace period and deadline are as expected.
self.assert_impalad_log_contains('INFO',
"Shutdown signal received. Current Shutdown Status: shutdown grace period left: "
- "{0}s000ms, deadline left: 8760h".format(self.IDLE_SHUTDOWN_GRACE_PERIOD_S))
+ "{0}s000ms, deadline left: {1}s000ms".format(self.IDLE_SHUTDOWN_GRACE_PERIOD_S,
+ self.EXEC_SHUTDOWN_DEADLINE_S))
@pytest.mark.execute_serially
@CustomClusterTestSuite.with_args(cluster_size=1)