diff mbox series

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

Message ID 1575424640-39553-1-git-send-email-hzhou@ovn.org
State Accepted
Commit 6d03405394b98ca934c274d6c4fc0ac1328c4adc
Headers show
Series [ovs-dev,1/2] ovsdb-cluster.at: Wait until leader is elected before DB compact. | expand

Commit Message

Han Zhou Dec. 4, 2019, 1:57 a.m. UTC
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@ovn.org>
---
 tests/ovsdb-cluster.at | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
diff mbox series

Patch

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])