You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by mi...@apache.org on 2026/07/13 22:09:51 UTC

(impala) 02/02: IMPALA-15176: Fix Trino tests where $HOSTNAME is fqdn

This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 21cd965f1670580f96d0ea846d9a2e83f66a2176
Author: Csaba Ringhofer <cs...@cloudera.com>
AuthorDate: Mon Jul 13 16:03:19 2026 +0200

    IMPALA-15176: Fix Trino tests where $HOSTNAME is fqdn
    
    If node.id is unset, Trino uses $HOSTNAME, which can be a problem
    if it is fqdn, because . is not allowed in node.id.
    Fixed this by setting node.id to impala-minicluster-trino.
    
    Also added more diagnostics to Trino cluster startup to make
    investigating similar problems easier.
    
    Assisted-by: Cloude Opus 4.8
    Change-Id: I6778d8b85d3d3565a49dd88df1a4209bcde3a82b
    Reviewed-on: http://gerrit.cloudera.org:8080/24580
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 testdata/bin/minicluster_trino/Dockerfile |  1 +
 tests/common/trino_cluster.py             | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/testdata/bin/minicluster_trino/Dockerfile b/testdata/bin/minicluster_trino/Dockerfile
index a0f68f4c1..c508ff46a 100644
--- a/testdata/bin/minicluster_trino/Dockerfile
+++ b/testdata/bin/minicluster_trino/Dockerfile
@@ -26,6 +26,7 @@ RUN \
     sed -i '/^http-server\.http\.port=/d' /etc/trino/config.properties && \
     echo "http-server.http.port=9091" >> /etc/trino/config.properties && \
     sed -i 's/localhost:8080/localhost:9091/g' /etc/trino/config.properties && \
+    echo "node.id=impala-minicluster-trino" >> /etc/trino/node.properties && \
     echo "-DHADOOP_USER_NAME=$USERNAME" >> /etc/trino/jvm.config
 
 COPY hive-site.xml core-site.xml hdfs-site.xml /etc/
diff --git a/tests/common/trino_cluster.py b/tests/common/trino_cluster.py
index 0797bd264..9b1a0d1e5 100644
--- a/tests/common/trino_cluster.py
+++ b/tests/common/trino_cluster.py
@@ -143,16 +143,35 @@ class TrinoCluster(object):
     except Exception as e:
       LOG.warning("Error while stopping Trino container '%s': %s", self.container, e)
 
+  def _container_logs_tail(self, max_lines=50):
+    """Best-effort tail of the container's stdout/stderr, for embedding in error
+    messages."""
+    try:
+      out = subprocess.check_output(
+          ['docker', 'logs', '--tail', str(max_lines), self.container],
+          stderr=subprocess.STDOUT, universal_newlines=True)
+      return out.strip() or "(container produced no log output yet)"
+    except Exception as e:
+      return "(could not read 'docker logs {0}': {1})".format(self.container, e)
+
   def _wait_until_ready(self, timeout_s):
     deadline = time.time() + timeout_s
     host, _, port = self.server.partition(':')
     port = int(port)
     # Phase 1: wait for the coordinator to accept TCP connections.
+    connected = False
     while time.time() < deadline:
       with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
         if s.connect_ex((host, port)) == 0:
+          connected = True
           break
       time.sleep(0.5)
+    if not connected:
+      raise TrinoUnavailable(
+          "Trino coordinator did not accept a connection on {0}:{1} within {2}s; it "
+          "likely crashed or is still starting up. Last {3} lines of "
+          "'docker logs {4}':\n{5}".format(
+              host, port, timeout_s, 50, self.container, self._container_logs_tail()))
     # Phase 2: wait until the coordinator can actually answer a trivial query
     # (catalogs registered, workers available).
     last_err = ''