diff options
author | Martin Schwenke <martin@meltin.net> | 2018-10-05 10:34:29 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2018-10-08 05:36:11 +0200 |
commit | 80f3f7c1889d225dcc1e7841e28e9a3f7918c99c (patch) | |
tree | 57f2d8bc8ae1db9ae974ca12b3d6a4eec3b9828c | |
parent | 52dcecbc923ec16e85f01f822b1450ab7b91900d (diff) | |
download | samba-80f3f7c1889d225dcc1e7841e28e9a3f7918c99c.tar.gz |
ctdb-tests: Improve counting of database records
Record counts are sometimes incomplete for large databases when
relevant tests are run on a real cluster.
This probably has something to do with ssh, pipes and buffering, so
move the filtering and counting to the remote end. This means that
only the count comes across the pipe, instead of all the record data.
Instead of explicitly excluding the key for persistent database
sequence numbers, just exclude any key starting with '_'. Such keys
are not used in tests.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Oct 8 05:36:11 CEST 2018 on sn-devel-144
-rw-r--r-- | ctdb/tests/scripts/integration.bash | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash index b255f063ba2..248a7caddd1 100644 --- a/ctdb/tests/scripts/integration.bash +++ b/ctdb/tests/scripts/integration.bash @@ -701,9 +701,13 @@ db_get_path () # $1: pnn, $2: DB name db_ctdb_cattdb_count_records () { - try_command_on_node -v $1 $CTDB cattdb "$2" | - grep '^key' | grep -v '__db_sequence_number__' | - wc -l + # Count the number of keys, excluding any that begin with '_'. + # This excludes at least the sequence number record in + # persistent/replicated databases. The trailing "|| :" forces + # the command to succeed when no records are matched. + try_command_on_node $1 \ + "$CTDB cattdb $2 | grep -c '^key([0-9][0-9]*) = \"[^_]' || :" + echo "$out" } # $1: pnn, $2: DB name, $3: key string, $4: value string, $5: RSN (default 7) |