You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2017/07/07 22:59:35 UTC
kudu git commit: [client_samples-test] wait for tserver registration
Repository: kudu
Updated Branches:
refs/heads/master 04f84020f -> 2c0237469
[client_samples-test] wait for tserver registration
Wait for the tserver to register with the master for ~10 seconds max
prior to starting the client sample application. Also, updated the
tserver-->master heartbeat parameters to run the test faster.
This is a follow-up for 2fc07eb811f351757a0085a7e318affd120fbaf9.
Change-Id: I01ee263f00097e300d68bfb40fe4409e55d7402c
Reviewed-on: http://gerrit.cloudera.org:8080/7378
Reviewed-by: Dan Burkert <da...@apache.org>
Tested-by: Kudu Jenkins
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/2c023746
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/2c023746
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/2c023746
Branch: refs/heads/master
Commit: 2c0237469b2d43668317c25019d500745fb6e9f4
Parents: 04f8402
Author: Alexey Serbin <as...@cloudera.com>
Authored: Fri Jul 7 13:06:59 2017 -0700
Committer: Alexey Serbin <as...@cloudera.com>
Committed: Fri Jul 7 22:58:51 2017 +0000
----------------------------------------------------------------------
src/kudu/client/client_samples-test.sh | 47 +++++++++++++++++++++++------
1 file changed, 37 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/2c023746/src/kudu/client/client_samples-test.sh
----------------------------------------------------------------------
diff --git a/src/kudu/client/client_samples-test.sh b/src/kudu/client/client_samples-test.sh
index ee8c7ca..c2160c6 100755
--- a/src/kudu/client/client_samples-test.sh
+++ b/src/kudu/client/client_samples-test.sh
@@ -77,6 +77,16 @@ wait_for_listen_port() {
return 1
}
+exit_error() {
+ local err_msg="$1"
+
+ set +x
+ echo ----------------------------------------------------------------------
+ echo ERROR: $err_msg
+ echo ----------------------------------------------------------------------
+ exit 1
+}
+
OUTPUT_DIR=$(cd $(dirname "$BASH_SOURCE"); pwd)
# Install the client library to a temporary directory.
@@ -159,6 +169,8 @@ TSERVER_RPC_PORT=7050
mkdir -p "$BASE_DIR/ts/logs"
$OUTPUT_DIR/kudu-tserver \
--unlock_experimental_flags \
+ --heartbeat_interval_ms=200 \
+ --heartbeat_rpc_timeout_ms=1000 \
--log_dir=$BASE_DIR/ts/logs \
--fs_wal_dir=$BASE_DIR/ts/wals \
--fs_data_dirs=$BASE_DIR/ts/data \
@@ -173,18 +185,33 @@ TS_PID=$!
# master's and the tablet server's RPC ports before running the client sample
# application.
if ! wait_for_listen_port $MASTER_PID $MASTER_RPC_PORT 30; then
- set +x
- echo -----------------------------------------
- echo master is not accepting connections
- echo -----------------------------------------
- exit 1
+ exit_error "master is not accepting connections"
fi
if ! wait_for_listen_port $TS_PID $TSERVER_RPC_PORT 30; then
- set +x
- echo -----------------------------------------
- echo tserver is not accepting connections
- echo -----------------------------------------
- exit 1
+ exit_error "tserver is not accepting connections"
+fi
+
+# Allow for the tablet server registering with the master: wait for ~10s max.
+max_attempts=10
+attempt=0
+num_tservers=0
+while [ true ]; do
+ if ! num_tservers=$($OUTPUT_DIR/kudu tserver list \
+ $LOCALHOST_IP:$MASTER_RPC_PORT -format=space | wc -l); then
+ exit_error "failed to determine number of registered tservers"
+ fi
+ if [ $num_tservers -ge 1 ]; then
+ break
+ fi
+ attempt=$((attempt+1))
+ if [ $attempt -ge $max_attempts ]; then
+ break
+ fi
+ sleep 1
+done
+
+if [ $num_tservers -lt 1 ]; then
+ exit_error "tserver has not registered with the master"
fi
# Run the samples.