[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Wed Feb 12 04:39:02 UTC 2020


The branch, master has been updated
       via  bd279d3f98d ctdb-tests: Fix getdbmap test so that it actually works sanely
       via  224e8978723 ctdb-tests: Fix handling of --no-event-scripts option
       via  a6d464aa2ea ctdb-tests: Use a here document to improve readability
       via  b9f23f5b49c ctdb-tests: Use select_test_node()
       via  0162fd87ed7 ctdb-tests: Increase to dumping up to 500 lines of logs on error
       via  5a702b01f66 ctdb-tests: Fix return value of DB test tool delete command
       via  a40fc709cc9 ctdb-tcp: Make error handling for outbound connection consistent
      from  ad78496664c samba-tool domain join: remove sub domain join code

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit bd279d3f98df58a3a8bdc84c34c2b14a650aa755
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Dec 10 12:03:10 2019 +1100

    ctdb-tests: Fix getdbmap test so that it actually works sanely
    
    * Typo in variable name db_map_pattern
    * Variable num_db_init used before set
    * dbmap_pattern does not cover database flags
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Wed Feb 12 04:38:47 UTC 2020 on sn-devel-184

commit 224e8978723bd469c2da772208a17725e868fbef
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Dec 12 09:43:58 2019 +1100

    ctdb-tests: Fix handling of --no-event-scripts option
    
    Shellcheck noticed that pnn was never referenced.  Not sure this ever
    worked or whether it got broken somewhere along the way.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a6d464aa2ea9d7633581ace6834bce8b06f2bd70
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Dec 11 18:54:42 2019 +1100

    ctdb-tests: Use a here document to improve readability
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit b9f23f5b49cc2a541c53703c509b70583bc346b4
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Dec 11 18:47:29 2019 +1100

    ctdb-tests: Use select_test_node()
    
    select_test_node_and_ips() is not required in these cases.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 0162fd87ed71d6055bfa626854889dcd196b577e
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 11 09:26:58 2020 +1100

    ctdb-tests: Increase to dumping up to 500 lines of logs on error
    
    100 lines are not enough to debug a current issue.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 5a702b01f66a2cd4c8ebbb142872dc19d584540d
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Feb 10 17:19:36 2020 +1100

    ctdb-tests: Fix return value of DB test tool delete command
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a40fc709cc972dadb40efbf1394b10fae3cfcc07
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jan 28 16:49:14 2020 +1100

    ctdb-tcp: Make error handling for outbound connection consistent
    
    If we can't bind the local end of an outgoing connection then
    something has gone wrong.  Retrying is better than failing into a
    zombie state.  The interface might come back up and/or the address my
    be reconfigured.
    
    While here, do the same thing for the other (potentially transient)
    failures.
    
    The unknown address family failure is special but just handle it via a
    retry.  Technically it can't happen because the node address parsing
    can only return values with address family AF_INET or AF_INET6.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14274
    
    Reported-by: 耿纪超 <gengjichao at jd.com>
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/tcp/tcp_connect.c                             | 36 ++++++++++------------
 .../INTEGRATION/database/basics.001.attach.sh      | 11 +++++--
 .../simple/cluster.091.version_check.sh            |  2 +-
 .../simple/eventscripts.090.debug_hung.sh          | 10 +++---
 ctdb/tests/scripts/integration_local_daemons.bash  | 10 +++---
 ctdb/tests/src/db_test_tool.c                      |  2 +-
 6 files changed, 37 insertions(+), 34 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index f54086fcd3c..559442f14bf 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -181,16 +181,14 @@ void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
 	tnode->out_fd = socket(sock_out.sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
 	if (tnode->out_fd == -1) {
 		DBG_ERR("Failed to create socket\n");
-		return;
+		goto failed;
 	}
 
 	ret = set_blocking(tnode->out_fd, false);
 	if (ret != 0) {
 		DBG_ERR("Failed to set socket non-blocking (%s)\n",
 			strerror(errno));
-		close(tnode->out_fd);
-		tnode->out_fd = -1;
-		return;
+		goto failed;
 	}
 
 	set_close_on_exec(tnode->out_fd);
@@ -222,32 +220,22 @@ void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
 		sockout_size = sizeof(sock_out.ip6);
 		break;
 	default:
-		DEBUG(DEBUG_ERR, (__location__ " unknown family %u\n",
-			sock_in.sa.sa_family));
-		close(tnode->out_fd);
-		tnode->out_fd = -1;
-		return;
+		DBG_ERR("Unknown address family %u\n", sock_in.sa.sa_family);
+		/* Can't happen to due to address parsing restrictions */
+		goto failed;
 	}
 
 	ret = bind(tnode->out_fd, (struct sockaddr *)&sock_in, sockin_size);
 	if (ret == -1) {
 		DBG_ERR("Failed to bind socket (%s)\n", strerror(errno));
-		close(tnode->out_fd);
-		tnode->out_fd = -1;
-		return;
+		goto failed;
 	}
 
 	ret = connect(tnode->out_fd,
 		      (struct sockaddr *)&sock_out,
 		      sockout_size);
 	if (ret != 0 && errno != EINPROGRESS) {
-		ctdb_tcp_stop_connection(node);
-		tnode->connect_te = tevent_add_timer(ctdb->ev,
-						     tnode,
-						     timeval_current_ofs(1, 0),
-						     ctdb_tcp_node_connect,
-						     node);
-		return;
+		goto failed;
 	}
 
 	/* non-blocking connect - wait for write event */
@@ -266,6 +254,16 @@ void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
 					     timeval_current_ofs(1, 0),
 					     ctdb_tcp_node_connect,
 					     node);
+
+	return;
+
+failed:
+	ctdb_tcp_stop_connection(node);
+	tnode->connect_te = tevent_add_timer(ctdb->ev,
+					     tnode,
+					     timeval_current_ofs(1, 0),
+					     ctdb_tcp_node_connect,
+					     node);
 }
 
 /*
diff --git a/ctdb/tests/INTEGRATION/database/basics.001.attach.sh b/ctdb/tests/INTEGRATION/database/basics.001.attach.sh
index 32d6d26a4ff..bcec20afc5e 100755
--- a/ctdb/tests/INTEGRATION/database/basics.001.attach.sh
+++ b/ctdb/tests/INTEGRATION/database/basics.001.attach.sh
@@ -40,12 +40,17 @@ make_temp_db_filename ()
 
 try_command_on_node -v 0 "$CTDB getdbmap"
 
-db_map_pattern='^(Number of databases:[[:digit:]]+|dbid:0x[[:xdigit:]]+ name:[^[:space:]]+ path:[^[:space:]]+)$'
-
-sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern"
+dbid='dbid:0x[[:xdigit:]]+'
+name='name:[^[:space:]]+'
+path='path:[^[:space:]]+'
+opts='( (PERSISTENT|STICKY|READONLY|REPLICATED|UNHEALTHY))*'
+line="${dbid} ${name} ${path}${opts}"
+dbmap_pattern="^(Number of databases:[[:digit:]]+|${line})\$"
 
 num_db_init=$(sed -n -e '1s/.*://p' "$outfile")
 
+sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern"
+
 for i in $(seq 1 5) ; do
     f=$(make_temp_db_filename)
     echo "Creating test database: $f"
diff --git a/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh b/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh
index fccc802b370..4076047a8fe 100755
--- a/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh
+++ b/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh
@@ -17,7 +17,7 @@ ctdb_test_init
 
 cluster_is_healthy
 
-select_test_node_and_ips
+select_test_node
 
 try_command_on_node -v "$test_node" ctdb version
 version="$out"
diff --git a/ctdb/tests/INTEGRATION/simple/eventscripts.090.debug_hung.sh b/ctdb/tests/INTEGRATION/simple/eventscripts.090.debug_hung.sh
index 9a42af80946..e77c3987bc8 100755
--- a/ctdb/tests/INTEGRATION/simple/eventscripts.090.debug_hung.sh
+++ b/ctdb/tests/INTEGRATION/simple/eventscripts.090.debug_hung.sh
@@ -25,8 +25,7 @@ ctdb_test_init
 
 cluster_is_healthy
 
-# This is overkill but it at least provides a valid test node
-select_test_node_and_ips
+select_test_node
 
 ####################
 
@@ -39,11 +38,12 @@ ctdb_test_exit_hook_add "onnode $test_node rm -f $script_options"
 debug_output="${ctdb_base}/debug-hung-script.log"
 ctdb_test_exit_hook_add "onnode $test_node rm -f $debug_output"
 
-try_command_on_node -i $test_node tee "$script_options" <<<"\
+try_command_on_node -i "$test_node" tee "$script_options" <<EOF
 CTDB_RUN_TIMEOUT_MONITOR=yes
-CTDB_DEBUG_HUNG_SCRIPT_LOGFILE=\"$debug_output\"
+CTDB_DEBUG_HUNG_SCRIPT_LOGFILE='$debug_output'
 CTDB_DEBUG_HUNG_SCRIPT_STACKPAT='exportfs|rpcinfo|sleep'
-CTDB_SCRIPT_VARDIR=\"$ctdb_base\""
+CTDB_SCRIPT_VARDIR='$ctdb_base'
+EOF
 
 ####################
 
diff --git a/ctdb/tests/scripts/integration_local_daemons.bash b/ctdb/tests/scripts/integration_local_daemons.bash
index 0e7e07d540c..9850ad2208c 100644
--- a/ctdb/tests/scripts/integration_local_daemons.bash
+++ b/ctdb/tests/scripts/integration_local_daemons.bash
@@ -34,10 +34,10 @@ setup_ctdb ()
 	fi
 
 	if $no_event_scripts ; then
-		local pnn
-		for pnn in $(seq 0 $((CTDB_TEST_LOCAL_DAEMONS - 1))) ; do
-			rm -vf "${CTDB_BASE}/events/legacy/"*
-		done
+		# Want CTDB_BASE expanded when executed under onnode
+		# shellcheck disable=SC2016
+		$ctdb_local_daemons onnode -q all \
+				    'rm "${CTDB_BASE}/events/legacy/"*'
 	fi
 
 	if $CTDB_TEST_PRINT_LOGS_ON_ERROR ; then
@@ -89,6 +89,6 @@ _print_logs_on_test_failure ()
 	fi
 
 	echo "*** LOG START --------------------"
-	$ctdb_local_daemons print-log all | tail -n 100
+	$ctdb_local_daemons print-log all | tail -n 500
 	echo "*** LOG END   --------------------"
 }
diff --git a/ctdb/tests/src/db_test_tool.c b/ctdb/tests/src/db_test_tool.c
index eb0ad14fcba..fe0ab6c6e2a 100644
--- a/ctdb/tests/src/db_test_tool.c
+++ b/ctdb/tests/src/db_test_tool.c
@@ -305,7 +305,7 @@ static int db_test_fetch_local_delete(TALLOC_CTX *mem_ctx,
 done:
 	TALLOC_FREE(h);
 
-	return 0;
+	return ret;
 }
 
 #define ISASCII(x) (isprint(x) && ! strchr("\"\\", (x)))


-- 
Samba Shared Repository



More information about the samba-cvs mailing list