diff mbox series

[ovs-dev,4/5] ovsdb-server: Don't update manager status if replay engine is active.

Message ID 20200630012435.205590-5-i.maximets@ovn.org
State New
Headers show
Series Stream Record/Replay. | expand

Commit Message

Ilya Maximets June 30, 2020, 1:24 a.m. UTC
Current version or replay engine doesn't handle correctly internal
time-based events that ends up in stream events.  For example,
updates of a database status that happens each 2.5 seconds reults
in updates on client monitors.  Disable updates for now if replay
engine is active.  The very first update kept to store the initial
information about the server.

The proper solution whould be to record time and replay it, probably,
with time warping or in some other way.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 lib/stream.h         |  6 ++++++
 ovsdb/ovsdb-server.c | 10 +++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/lib/stream.h b/lib/stream.h
index 40357137e..8b88c3ceb 100644
--- a/lib/stream.h
+++ b/lib/stream.h
@@ -105,6 +105,12 @@  enum stream_replay_state {
 
 void stream_replay_set_state(enum stream_replay_state);
 enum stream_replay_state stream_replay_get_state(void);
+static inline bool
+stream_replay_is_active(void)
+{
+    return stream_replay_get_state() != STREAM_REPLAY_NONE;
+}
+
 void stream_replay_open_wfd(struct stream *);
 void pstream_replay_open_wfd(struct pstream *);
 void stream_replay_close_wfd(struct stream *);
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 178fa6fa5..25425569e 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -252,8 +252,10 @@  main_loop(struct server_config *config,
             }
         }
 
-        /* update Manager status(es) every 2.5 seconds */
-        if (time_msec() >= status_timer) {
+        /* update Manager status(es) every 2.5 seconds.  Don't update if we're
+         * reconding or performing replay. */
+        if (status_timer == LLONG_MIN ||
+             (!stream_replay_is_active() && time_msec() >= status_timer)) {
             status_timer = time_msec() + 2500;
             update_remote_status(jsonrpc, remotes, all_dbs);
         }
@@ -279,7 +281,9 @@  main_loop(struct server_config *config,
         if (*exiting) {
             poll_immediate_wake();
         }
-        poll_timer_wait_until(status_timer);
+        if (!stream_replay_is_active()) {
+            poll_timer_wait_until(status_timer);
+        }
         poll_block();
         if (should_service_stop()) {
             *exiting = true;