You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2020/03/31 20:16:53 UTC

[impala] 02/03: IMPALA-9577: [test] Use `system_unsync` time for Kudu test clusters

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

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

commit 208d9d6896f39a25be00ae4a4ce4679aa5ecd636
Author: Grant Henke <gh...@cloudera.com>
AuthorDate: Fri Mar 27 09:12:13 2020 -0500

    IMPALA-9577: [test] Use `system_unsync` time for Kudu test clusters
    
    Recently Kudu made enhancements to time source configuration and
    adjusted the time source for local clusters/tests to `system_unsync`.
    
    This patch mirrors that behavior in Impala test clusters given there is no
    need to require NTP-synchronized clock for a test where all the
    participating Kudu masters and tablet servers are run at the same node
    using the same local wallclock.
    
    See the Kudu commit here for details:
    https://github.com/apache/kudu/commit/eb2b70d4b96be2fc2fdd6b3625acc284ac5774be
    
    While making this change, I removed all ntp related packages and special
    handling as they should not be needed in a development environment
    any more. I also added curl and gawk which were missing in my
    Docker ubuntu environment and broke my testing.
    
    Testing:
    I tested with the steps below using Docker for Mac:
    
      docker rm impala-dev
      docker volume rm impala
      docker run --privileged --interactive --tty --name impala-dev -v impala:/home -p 25000:25000 -p 25010:25010 -p 25020:25020 ubuntu:16.04 /bin/bash
    
      apt-get update
      apt-get install sudo
      adduser --disabled-password --gecos '' impdev
      echo 'impdev ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
      su - impdev
      cd ~
    
      sudo apt-get --yes install git
      git clone https://git-wip-us.apache.org/repos/asf/impala.git ~/Impala
      cd ~/Impala
      export IMPALA_HOME=`pwd`
      git remote add fork https://github.com/granthenke/impala.git
      git fetch fork
      git checkout kudu-system-time
    
      $IMPALA_HOME/bin/bootstrap_development.sh
    
      source $IMPALA_HOME/bin/impala-config.sh
      (pushd fe && mvn -fae test -Dtest=AnalyzeDDLTest)
      (pushd fe && mvn -fae test -Dtest=AnalyzeKuduDDLTest)
    
      $IMPALA_HOME/bin/start-impala-cluster.py
      ./tests/run-tests.py query_test/test_kudu.py
    
    Change-Id: Id99e5cb58ab988c3ad4f98484be8db193d5eaf99
    Reviewed-on: http://gerrit.cloudera.org:8080/15568
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 bin/bootstrap_system.sh                            | 31 +++++-----------------
 docker/entrypoint.sh                               |  9 -------
 testdata/cluster/admin                             | 21 ---------------
 .../common/etc/kudu/master.conf.tmpl               |  9 ++++++-
 .../common/etc/kudu/tserver.conf.tmpl              |  9 ++++++-
 5 files changed, 22 insertions(+), 57 deletions(-)

diff --git a/bin/bootstrap_system.sh b/bin/bootstrap_system.sh
index 9d043d0..115a9eb 100755
--- a/bin/bootstrap_system.sh
+++ b/bin/bootstrap_system.sh
@@ -187,10 +187,10 @@ function apt-get {
 
 echo ">>> Installing build tools"
 ubuntu apt-get update
-ubuntu apt-get --yes install ccache g++ gcc libffi-dev liblzo2-dev libkrb5-dev \
-        krb5-admin-server krb5-kdc krb5-user libsasl2-dev libsasl2-modules \
-        libsasl2-modules-gssapi-mit libssl-dev make ninja-build ntp \
-        ntpdate python-dev python-setuptools postgresql ssh wget vim-common psmisc \
+ubuntu apt-get --yes install ccache curl gawk g++ gcc libffi-dev liblzo2-dev \
+        libkrb5-dev krb5-admin-server krb5-kdc krb5-user libsasl2-dev \
+        libsasl2-modules libsasl2-modules-gssapi-mit libssl-dev make ninja-build \
+        python-dev python-setuptools postgresql ssh wget vim-common psmisc \
         lsof openjdk-8-jdk openjdk-8-source openjdk-8-dbg apt-utils git ant
 
 if [[ "$UBUNTU" == true ]]; then
@@ -224,8 +224,8 @@ else
   ubuntu18 sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
 fi
 
-redhat sudo yum install -y curl gcc gcc-c++ git krb5-devel krb5-server krb5-workstation \
-        libevent-devel libffi-devel make ntp ntpdate ntp-perl openssl-devel cyrus-sasl \
+redhat sudo yum install -y curl gawk gcc gcc-c++ git krb5-devel krb5-server \
+        krb5-workstation libevent-devel libffi-devel make openssl-devel cyrus-sasl \
         cyrus-sasl-gssapi cyrus-sasl-devel cyrus-sasl-plain \
         python-devel python-setuptools postgresql postgresql-server \
         wget vim-common nscd cmake lzo-devel fuse-devel snappy-devel zlib-devel \
@@ -272,25 +272,6 @@ fi
 
 echo ">>> Configuring system"
 
-ubuntu sudo service ntp stop
-redhat6 sudo service ntpd stop
-redhat7 notindocker sudo service ntpd stop
-sudo ntpdate us.pool.ntp.org
-# If on EC2, use Amazon's ntp servers
-# EC2 nodes expose this IP address internally as a way to gather instance metadata.
-# The assumption is that only AWS nodes do this
-if wget -q -T 1 -t 1 -o /dev/null http://169.254.169.254/latest/dynamic/instance-identity
-then
-  sudo sed -i 's/ubuntu\.pool/amazon\.pool/' /etc/ntp.conf
-fi
-# While it is nice to have ntpd running to keep the clock in sync, that does not work in a
-# --privileged docker container, and a non-privileged container cannot run ntpdate, which
-# is strictly needed by Kudu.
-# TODO: Make privileged docker start ntpd
-ubuntu sudo service ntp start || grep docker /proc/1/cgroup
-redhat6 sudo service ntpd start || grep docker /proc/1/cgroup
-notindocker redhat7 sudo service ntpd start
-
 # IMPALA-3932, IMPALA-3926
 if [[ $UBUNTU = true && ( $DISTRIB_RELEASE = 16.04 || $DISTRIB_RELEASE = 18.04 ) ]]
 then
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 3f56252..2d55a30 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -447,15 +447,6 @@ function shell() {
   mkdir -p logs
   boot_container
   impala_environment
-  # Kudu requires --privileged for the Docker container; see
-  # https://issues.apache.org/jira/browse/KUDU-2000. Because
-  # our goal here is convenience for new developers, we
-  # skip kudu if "ntptime" doesn't work, which is a good
-  # proxy for Kudu won't start.
-  if ! ntptime > /dev/null; then
-    export KUDU_IS_SUPPORTED=false
-    KUDU_MSG="Kudu is not started."
-  fi
   start_minicluster
   bin/start-impala-cluster.py
   cat <<"EOF"
diff --git a/testdata/cluster/admin b/testdata/cluster/admin
index 708599a..dee8dbf 100755
--- a/testdata/cluster/admin
+++ b/testdata/cluster/admin
@@ -329,27 +329,6 @@ function start_cluster {
 
   if [ ${#SUPPORTED_SERVICES[@]} -gt 0 ]; then
     for SERVICE in ${SUPPORTED_SERVICES[@]-}; do
-      # If all of the following are true, we wait for ntp to sync before proceeding:
-      #
-      # 1. Kudu is being started
-      # 2. An internet connection is available (checked by pinging $NTP_CANARY)
-      # 3. ntp-wait is installed (checked by calling ntp-wait with the "--help" flag)
-      if [[ "${SERVICE}" == "kudu" ]]; then
-        NTP_CANARY=pool.ntp.org
-        if ! ping -c 1 -w 5 "${NTP_CANARY}" >/dev/null 2>/dev/null; then
-          echo "WARNING: cannot reach ${NTP_CANARY}; ntp sync recommended for Kudu"
-        else
-          # ntp-wait is in /usr/sbin on both CentOS and Debian-based systems, but regular
-          # users don't always have /usr/sbin in $PATH. Use the absolute path.
-          ntp_wait=$(command -v ntp-wait || echo /usr/sbin/ntp-wait)
-          if [[ ! -x $ntp_wait ]]; then
-            echo "WARNING: ntp-wait not installed; ntp sync recommended for Kudu"
-          elif ! $ntp_wait -v; then
-            echo "ntp-wait failed; cannot start kudu"
-            return 1
-          fi
-        fi
-      fi
       start $SERVICE
     done
 
diff --git a/testdata/cluster/node_templates/common/etc/kudu/master.conf.tmpl b/testdata/cluster/node_templates/common/etc/kudu/master.conf.tmpl
index f272eb7..e4460c1 100644
--- a/testdata/cluster/node_templates/common/etc/kudu/master.conf.tmpl
+++ b/testdata/cluster/node_templates/common/etc/kudu/master.conf.tmpl
@@ -2,8 +2,15 @@
 -fs_data_dirs=${NODE_DIR}/var/lib/kudu/master/data
 -log_dir=${NODE_DIR}/var/log/kudu/master
 
+# The flags below require unsafe flags to be unlocked.
+-unlock_unsafe_flags
+
 # fsync is disabled for additional speed. Sometimes operations are slow on EC2/GCE test
 # machines. Some data loss could occur if the system crashes before the OS has a chance
 # to flush data to disk but that is acceptable for development purposes.
--unlock_unsafe_flags
 -never_fsync
+
+# There is no need to require NTP-synchronized clock for tests where all the
+# participating Kudu masters and tablet servers are run at the same node using the same
+# local wallclock.
+-time_source=system_unsync
diff --git a/testdata/cluster/node_templates/common/etc/kudu/tserver.conf.tmpl b/testdata/cluster/node_templates/common/etc/kudu/tserver.conf.tmpl
index 1c6b4cb..e0512da 100644
--- a/testdata/cluster/node_templates/common/etc/kudu/tserver.conf.tmpl
+++ b/testdata/cluster/node_templates/common/etc/kudu/tserver.conf.tmpl
@@ -4,8 +4,15 @@
 -fs_data_dirs=${NODE_DIR}/var/lib/kudu/ts/data
 -log_dir=${NODE_DIR}/var/log/kudu/ts
 
+# The flags below require unsafe flags to be unlocked.
+-unlock_unsafe_flags
+
 # fsync is disabled for additional speed. Sometimes operations are slow on EC2/GCE test
 # machines. Some data loss could occur if the system crashes before the OS has a chance
 # to flush data to disk but that is acceptable for development purposes.
--unlock_unsafe_flags
 -never_fsync
+
+# There is no need to require NTP-synchronized clock for tests where all the
+# participating Kudu masters and tablet servers are run at the same node using the same
+# local wallclock.
+-time_source=system_unsync