summaryrefslogtreecommitdiff
path: root/lib/ovsdb-cs.c
diff options
context:
space:
mode:
authorDumitru Ceara <dceara@redhat.com>2022-01-11 17:37:54 +0100
committerIlya Maximets <i.maximets@ovn.org>2022-01-31 21:23:47 +0100
commitc1691cceac322d8a49a6aeb52a608362385ae037 (patch)
treea6afa499db487753f5fc310ffca1cf4ff44e88cd /lib/ovsdb-cs.c
parent718dc8fca794307f4cda2d01c9552be8682e0fca (diff)
downloadopenvswitch-c1691cceac322d8a49a6aeb52a608362385ae037.tar.gz
ovsdb-cs: Clear last_id on reconnect if condition changes in-flight.
When reconnecting, if there are condition changes already sent to the server but not yet acked, reset the db's 'last-id', esentially clearing the local cache after reconnect. This is needed because the client cannot easily differentiate between the following cases: a. either the server already processed the requested monitor condition change but the FSM was restarted before the client was notified. In this case the client should clear its local cache because it's out of sync with the monitor view on the server side. b. OR the server hasn't processed the requested monitor condition change yet. Conditions changing at the same time with a reconnection happening are rare so the performance impact of this patch should be minimal. Also, the tests are updated to cover the fact that we cannot control which of the two scenarios ("a" and "b" above) are hit during the test. Reported-by: Maxime Coquelin <maxime.coquelin@redhat.com> Signed-off-by: Dumitru Ceara <dceara@redhat.com> Acked-by: Han Zhou <hzhou@ovn.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'lib/ovsdb-cs.c')
-rw-r--r--lib/ovsdb-cs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/ovsdb-cs.c b/lib/ovsdb-cs.c
index 2d2b77026..dead31275 100644
--- a/lib/ovsdb-cs.c
+++ b/lib/ovsdb-cs.c
@@ -1109,6 +1109,23 @@ ovsdb_cs_db_sync_condition(struct ovsdb_cs_db *db)
}
table->req_cond = NULL;
db->cond_changed = true;
+
+ /* There are two cases:
+ * a. either the server already processed the requested monitor
+ * condition change but the FSM was restarted before the
+ * client was notified. In this case the client should
+ * clear its local cache because it's out of sync with the
+ * monitor view on the server side.
+ *
+ * b. OR the server hasn't processed the requested monitor
+ * condition change yet.
+ *
+ * As there's no easy way to differentiate between the two,
+ * and given that this condition should be rare, reset the
+ * 'last_id', essentially flushing the local cached DB
+ * contents.
+ */
+ db->last_id = UUID_ZERO;
}
}
}