mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
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
This commit is contained in:
parent
52dcecbc92
commit
80f3f7c188
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user