[ovs-dev] [PATCH 1/2] ovsdb-cluster.at: Wait until leader is elected before DB compact.

Han Zhou hzhou at ovn.org
Wed Dec 4 01:57:19 UTC 2019


In test case "election timer change", before testing DB compact,
we had to insert some data. Otherwise, inserting data after DB
compact will cause busy loop as mentioned in the XXX comment.

The root cause of the busy loop is still not clear, but the test
itself didn't wait until the leader election finish before initiating
DB compact. This patch adds the wait to make sure the test continue
after leader is elected so that the following tests are based on
a clean state. While this wait is added, the busy loop problem is
gone even without inserting the data, so the additional data insertion
is also removed by this patch.

A separate patch will address the busy loop problem in the scenario:
1. Restart cluster
2. DB compact before the cluster is ready
3. Insert data

Signed-off-by: Han Zhou <hzhou at ovn.org>
---
 tests/ovsdb-cluster.at | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/tests/ovsdb-cluster.at b/tests/ovsdb-cluster.at
index 72f8740..79c851e 100644
--- a/tests/ovsdb-cluster.at
+++ b/tests/ovsdb-cluster.at
@@ -233,17 +233,14 @@ done
 OVS_WAIT_UNTIL([ovs-appctl -t "`pwd`"/s1 cluster/status $schema_name | grep "Election timer: 4000"])
 OVS_WAIT_UNTIL([ovs-appctl -t "`pwd`"/s2 cluster/status $schema_name | grep "Election timer: 4000"])
 
+# Wait until cluster is ready
+for i in `seq $n`; do
+    OVS_WAIT_WHILE([ovs-appctl -t "`pwd`"/s$i cluster/status $schema_name | grep "Leader: unknown"])
+done
+
 # Latest timer should be restored after DB compact and restart.
 # This is to test the install_snapshot RPC.
 
-# XXX: Insert data before compact, because otherwise transaction will trigger
-# busy loop after compact.
-# poll_loop|DBG|wakeup due to 0-ms timeout at ../ovsdb/trigger.c:164 (89% CPU usage)
-AT_CHECK([ovsdb-client transact unix:s1.ovsdb '[["idltest",
-      {"op": "insert",
-       "table": "simple",
-       "row": {"i": 1}}]]'], [0], [ignore], [ignore])
-
 # Compact online
 for i in `seq $n`; do
     AT_CHECK([ovs-appctl -t "`pwd`"/s$i ovsdb-server/compact])
-- 
2.1.0



More information about the dev mailing list