Skip to content

Commit

Permalink
ovsdb-server: Integrate stream replay engine.
Browse files Browse the repository at this point in the history
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:

  Recording:

    # create a directory for replay files.
    mkdir replay_dir
    # copy current db for later use by replay
    cp my_db ./replay_dir/my_db
    ovsdb-server --record=./replay_dir <OVSDB_ARGS> my_db
    # connect some clients and run some ovsdb transactions
    ovs-appctl -t ovsdb-server exit

  Replay:

    # restore db from the copy
    cp ./replay_dir/my_db my_db.for_replay
    ovsdb-server --replay=./replay_dir <OVSDB_ARGS> my_db.for_replay
    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 <[email protected]>
Acked-by: Dumitru Ceara <[email protected]>
  • Loading branch information
igsilya committed Jun 7, 2021
1 parent 07a07d0 commit 182a0b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ovsdb/ovsdb-server.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ovsdb\-server \- Open vSwitch database server
.so lib/ssl-peer-ca-cert-syn.man
.so lib/ssl-connect-syn.man
.so lib/unixctl-syn.man
.so lib/ovs-replay-syn.man
.so lib/common-syn.man
.
.SH DESCRIPTION
Expand Down Expand Up @@ -188,6 +189,7 @@ one row in \fItable\fR.)
.so lib/ssl-connect.man
.SS "Other Options"
.so lib/unixctl.man
.so lib/ovs-replay.man
.so lib/common.man
.SH "RUNTIME MANAGEMENT COMMANDS"
\fBovs\-appctl\fR(8) can send commands to a running
Expand Down
6 changes: 6 additions & 0 deletions ovsdb/ovsdb-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "openvswitch/list.h"
#include "memory.h"
#include "monitor.h"
#include "ovs-replay.h"
#include "ovsdb.h"
#include "ovsdb-data.h"
#include "ovsdb-types.h"
Expand Down Expand Up @@ -1797,6 +1798,7 @@ parse_options(int argc, char *argv[],
VLOG_OPTION_ENUMS,
DAEMON_OPTION_ENUMS,
SSL_OPTION_ENUMS,
OVS_REPLAY_OPTION_ENUMS,
};

static const struct option long_options[] = {
Expand All @@ -1812,6 +1814,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,
OVS_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},
Expand Down Expand Up @@ -1887,6 +1890,8 @@ parse_options(int argc, char *argv[],
stream_ssl_set_peer_ca_cert_file(optarg);
break;

OVS_REPLAY_OPTION_HANDLERS

case OPT_SYNC_FROM:
*sync_from = xstrdup(optarg);
break;
Expand Down Expand Up @@ -1945,6 +1950,7 @@ usage(void)
daemon_usage();
vlog_usage();
replication_usage();
ovs_replay_usage();
printf("\nOther options:\n"
" --run COMMAND run COMMAND as subprocess then exit\n"
" --unixctl=SOCKET override default control socket name\n"
Expand Down

0 comments on commit 182a0b8

Please sign in to comment.