summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@ovn.org>2023-01-03 17:22:36 +0100
committerIlya Maximets <i.maximets@ovn.org>2023-01-18 13:54:42 +0100
commit7402dae8f463f9ca091efb69bb346bfa64c3935b (patch)
tree88d51ea5361e9167ee5fa80d046185a23c95fec3 /tests
parentb02356ebbf6b049bfbd8938bbeb6cdb717001797 (diff)
downloadopenvswitch-7402dae8f463f9ca091efb69bb346bfa64c3935b.tar.gz
ovsdb: Fix database statistics during the database replacement.
The counter for the number of atoms has to be re-set to the number from the new database, otherwise the value will be incorrect. For example, this is causing the atom counter doubling after online conversion of a clustered database. Miscounting may also lead to increased memory consumption by the transaction history or otherwise too aggressive transaction history sweep. Fixes: 317b1bfd7dd3 ("ovsdb: Don't let transaction history grow larger than the database.") Acked-by: Han Zhou <hzhou@ovn.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ovsdb-server.at18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
index 0828e6d04..bf539b6e5 100644
--- a/tests/ovsdb-server.at
+++ b/tests/ovsdb-server.at
@@ -1308,6 +1308,24 @@ dnl After removing all the bridges, the number of atoms in the database
dnl should return to its initial value.
AT_CHECK([test $(get_memory_value atoms) -eq $initial_db_atoms])
+dnl Add a few more resources.
+for i in $(seq 1 10); do
+ cmd=$(add_ports $i $(($i / 4 + 1)))
+ AT_CHECK([ovs-vsctl --no-wait add-br br$i $cmd])
+done
+check_atoms
+
+db_atoms_before_conversion=$(get_memory_value atoms)
+
+dnl Trigger online conversion.
+AT_CHECK([ovsdb-client convert $abs_top_srcdir/vswitchd/vswitch.ovsschema],
+ [0], [ignore], [ignore])
+
+dnl Check that conversion didn't change the number of atoms and the history
+dnl still has a reasonable size.
+check_atoms
+AT_CHECK([test $(get_memory_value atoms) -eq $db_atoms_before_conversion])
+
OVS_APP_EXIT_AND_WAIT([ovsdb-server])
AT_CLEANUP