Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Not A Bug
-
Impala 2.0
-
None
-
cherry-pick f93ffd113fbeb624d08cb986a0ed3842ce1440bb from
http://gerrit.sjc.cloudera.com:8080/#/c/4062/
to get HS2 shell change
Description
In Abdullah's HS2 shell patch, the ^C signal handler intends to cancel the active query:
def __signal_handler(self, signal, frame): if not self.cursor._last_operation_active: return # Create a new connection to the impalad and cancel the query. try: # self.query_handle_closed = True print_to_stderr(ImpalaShell.CANCELLATION_MESSAGE) cursor = self.imp_conn.cursor(session_handle=self.cursor.session_handle) cursor._last_operation_active = self.cursor._last_operation_active cursor._last_operation_handle = self.cursor._last_operation_handle cursor._last_operation_string = self.cursor._last_operation_string cursor.cancel_operation() self.cursor._last_operation_active = False self._validate_database() except Exception, e: print_to_stderr("Failed to reconnect and close: %s" % str(e)) # TODO: Add a retry here
However, IMPALA-1178 shows that sometimes the shell is closing the session in response to ^C. It seems to happen if you press ^C immediately after issuing the query. If you wait a second and press ^C, then the query is cancelled correctly.
localhost:21050] > select * from tpch.lineitem x, tpch.lineitem y where x.l_orderkey=y.l_orderkey; Query: select * from tpch.lineitem x, tpch.lineitem y where x.l_orderkey=y.l_orderkey <immediately press ctrl+C> ^CSession closed [localhost:21050] > select * from tpch.lineitem x, tpch.lineitem y where x.l_orderkey=y.l_orderkey; Query: select * from tpch.lineitem x, tpch.lineitem y where x.l_orderkey=y.l_orderkey Invalid session id [localhost:21050] > connect; Connected to localhost:21050 Server version: Hive Server 2 [localhost:21050] > select * from tpch.lineitem x, tpch.lineitem y where x.l_orderkey=y.l_orderkey; Query: select * from tpch.lineitem x, tpch.lineitem y where x.l_orderkey=y.l_orderkey <wait one second then press ctrl+C> ^C Cancelling Query