Hello Jason Fehr, Zoltan Borok-Nagy, Gergely Farkas, Pranav Lodha, Csaba 
Ringhofer, Impala Public Jenkins,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/23831

to look at the new patch set (#2).

Change subject: IMPALA-14460: Keep http connections open in impala-shell
......................................................................

IMPALA-14460: Keep http connections open in impala-shell

Leave HS2-HTTP connections open and retry on 401 or EPIPE failures to
re-use connections, greatly reducing the number of client connections
needed with the HS2-HTTP protocol.

Existing test_shell_interactive_reconnect tests that ImpalaShell - the
library implementing the impala-shell CLI - will automatically establish
a new connection with all protocols. Prior to this patch, after
restarting impalad you'd see

  2026-01-06 11:13:08 [Warning] close session RPC failed:
  <class 'impala_shell.shell_exceptions.RPCException'>
  ERROR: Invalid session id: be40a2618203ff7b:beacd4b5d28f7692

  Connection lost, reconnecting...
  Warning: --connect_timeout_ms is currently ignored with HTTP transport.
  Opened TCP connection to localhost:28001

If you instead introduce a load balancer like haproxy and restart the
lb, there's no apparent break because impala-shell would always
establish a new connection.

With this patch, when impalad is restarted we still see the lost session

  2026-01-06 11:20:43 [Exception] type=<class 'BrokenPipeError'> in
  PingImpalaHS2Service. Num remaining tries: 3 [Errno 32] Broken pipe
  Connection closed, reconnecting...
  2026-01-06 11:20:43 [Warning] close session RPC failed:
  <class 'impala_shell.shell_exceptions.RPCException'>
  ERROR: Invalid session id: 6e494c76a9a58278:dbb7016cb5999385

  Connection lost, reconnecting...
  Warning: --connect_timeout_ms is currently ignored with HTTP transport.
  Opened TCP connection to localhost:28000

If the lb is restarted, we now see that the connection is reopened

  2026-01-06 11:24:02 [Exception] type=<class 'BrokenPipeError'> in
  PingImpalaHS2Service. Num remaining tries: 3 [Errno 32] Broken pipe
  Connection closed, reconnecting...
  Query: ...

Triggering a retry due to 401 Unauthorized requires Kerberos, since
Basic and Bearer auth always send the Authorization header; it shows

  2026-01-06 17:02:27 [Exception] type=
  <class 'http.client.RemoteDisconnected'> in ExecuteStatement.
  Remote end closed connection without response
  2026-01-06 17:02:27 [Exception] type=
  <class 'http.client.RemoteDisconnected'> when listing query options.
  Num remaining tries: 3 Remote end closed connection without response
  2026-01-06 17:02:27 [Exception] type=<class 'ConnectionRefusedError'>
  in ExecuteStatement.  [Errno 111] Connection refused
  2026-01-06 17:02:27 [Exception] type=<class 'ConnectionRefusedError'>
  when listing query options. Num remaining tries: 2 [Errno 111]
  Connection refused
  Connection closed, reconnecting...
  Cookies expired, restarting authentication...
  Preserving cookies: impala.auth
  Connected to localhost:28005

Updates tests that count RPCs via number of connections as re-use means
they're no longer linked. Tests now rely on connection count, which
verifies we're re-using connections.

Updates testCookieRefresh to use a proxy where we can interrupt the
existing connection, which fixes the test so it again passes by forcing
a reconnection, and demonstrates that the client reconnects. Adds
tests using Kerberos authentication to trigger cookie retry.

Generated-by: Github Copilot (GPT-4.1)
Change-Id: Iafb3fc39817e93c691cd993902c6d939a7235a03
---
M fe/src/test/java/org/apache/impala/customcluster/LdapImpalaShellTest.java
M 
fe/src/test/java/org/apache/impala/customcluster/LdapKerberosImpalaShellTest.java
M 
fe/src/test/java/org/apache/impala/customcluster/LdapSearchBindImpalaShellTest.java
M 
fe/src/test/java/org/apache/impala/customcluster/LdapSimpleBindImpalaShellTest.java
A fe/src/test/java/org/apache/impala/testutil/InterruptibleProxyServer.java
M shell/impala_shell/ImpalaHttpClient.py
M tests/custom_cluster/test_hs2_fault_injection.py
M tests/custom_cluster/test_shell_commandline.py
M tests/custom_cluster/test_shell_jwt_auth.py
M tests/custom_cluster/test_shell_oauth_auth.py
10 files changed, 294 insertions(+), 93 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/31/23831/2
--
To view, visit http://gerrit.cloudera.org:8080/23831
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iafb3fc39817e93c691cd993902c6d939a7235a03
Gerrit-Change-Number: 23831
Gerrit-PatchSet: 2
Gerrit-Owner: Michael Smith <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Gergely Farkas <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Jason Fehr <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Pranav Lodha <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>

Reply via email to