openvswitch/ovsdb-cluster.at-Wait-until-leader-is-elected-before.patch

60 lines
2.3 KiB
Diff
Raw Normal View History

2020-09-01 18:09:31 +08:00
From 9f301dc92a45206edaeb9cf0f3a9d7e01c32499a Mon Sep 17 00:00:00 2001
From: Han Zhou <hzhou@ovn.org>
Date: Tue, 3 Dec 2019 17:57:19 -0800
Subject: ovsdb-cluster.at: Wait until leader is elected before DB compact.
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>
Signed-off-by: Ben Pfaff <blp@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 70812a787..ef4ec205a 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.14.1