[ovs-dev] [PATCH 3/5] ovsdb-server: Integrate stream replay engine.

Ilya Maximets i.maximets at ovn.org
Tue Jun 30 01:24:33 UTC 2020


This change adds support of stream record/replay functionality to
ovsdb-server.

Since current replay engine doesn't work well with time-based
events generated locally, it will work only with standalone databases
for now (raft heavily depends on time).

To use this functionality run:

  # record:
  <copy current db for later use by replay>
  ovsdb-server --sream-replay-record --predictable-uuids-with-seed=1234 <...>
  <connect some clients and run some ovsdb transactions>
  ovs-appctl -t ovsdb-server exit

  # replay:
  <restore db from the copy>
  ovsdb-server --sream-replay --predictable-uuids-with-seed=1234 <...>
  At this point ovsdb-server should execute all the same commands
  and transactions.  Since the last command was 'exit' via unixctl,
  ovsdb-server will exit in the end.

Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
---
 ovsdb/ovsdb-server.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 3af09c8c1..178fa6fa5 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -1716,6 +1716,7 @@ parse_options(int argc, char *argv[],
         VLOG_OPTION_ENUMS,
         DAEMON_OPTION_ENUMS,
         SSL_OPTION_ENUMS,
+        STREAM_REPLAY_OPTION_ENUMS,
     };
 
     static const struct option long_options[] = {
@@ -1731,6 +1732,7 @@ parse_options(int argc, char *argv[],
         {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT},
         {"peer-ca-cert", required_argument, NULL, OPT_PEER_CA_CERT},
         STREAM_SSL_LONG_OPTIONS,
+        STREAM_REPLAY_LONG_OPTIONS,
         {"sync-from",   required_argument, NULL, OPT_SYNC_FROM},
         {"sync-exclude-tables", required_argument, NULL, OPT_SYNC_EXCLUDE},
         {"active", no_argument, NULL, OPT_ACTIVE},
@@ -1807,6 +1809,8 @@ parse_options(int argc, char *argv[],
             stream_ssl_set_peer_ca_cert_file(optarg);
             break;
 
+        STREAM_REPLAY_OPTION_HANDLERS
+
         case OPT_SYNC_FROM:
             *sync_from = xstrdup(optarg);
             break;
@@ -1868,7 +1872,7 @@ usage(void)
            program_name, program_name, ovs_dbdir());
     printf("\nJSON-RPC options (may be specified any number of times):\n"
            "  --remote=REMOTE         connect or listen to REMOTE\n");
-    stream_usage("JSON-RPC", true, true, true, false);
+    stream_usage("JSON-RPC", true, true, true, true);
     daemon_usage();
     vlog_usage();
     replication_usage();
-- 
2.25.4



More information about the dev mailing list