Skip to content

Commit

Permalink
ovsdb: Replication usability improvements
Browse files Browse the repository at this point in the history
Based on feedbacks from initial HA manager integration, added the
'--active' command line option and appctl command
"ovsdb-server/sync-status. See man page updates for details.

Added the RPL_S_INIT state in the state machine. This state is
not strictly necessary for the replication state machine, but is
introduced to make sure the state is update immediately when
the state machine is reset, via replication_init(). Without it
ovsdb/sync-status may display "replicating" or crash, if the command
is issued between after replication_init() is called, but before
the state variable is updated from replication_run().

Added a test to simulate the integration of HA manager with OVSDB
server using replication.

Other documentation and API improvements.

Tested-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
  • Loading branch information
azhou-nicira committed Sep 4, 2016
1 parent d254184 commit 77eb90b
Show file tree
Hide file tree
Showing 9 changed files with 414 additions and 116 deletions.
2 changes: 1 addition & 1 deletion Documentation/OVSDB-replication.md
Expand Up @@ -144,7 +144,7 @@ commands are the following.
between the active server and frees the memory used for the replication
configuration.

- ovsdb-server/set-sync-excluded-tables {db:table,...}: sets the tables list
- ovsdb-server/set-sync-exclude-tables {db:table,...}: sets the tables list
that will be excluded from being replicated.

- ovsdb-server/get-sync-excluded-tables: gets the tables list that is
Expand Down
6 changes: 6 additions & 0 deletions ovsdb/jsonrpc-server.c
Expand Up @@ -343,6 +343,12 @@ ovsdb_jsonrpc_server_reconnect(struct ovsdb_jsonrpc_server *svr, bool read_only)
}
}

bool
ovsdb_jsonrpc_server_is_read_only(struct ovsdb_jsonrpc_server *svr)
{
return svr->read_only;
}

void
ovsdb_jsonrpc_server_run(struct ovsdb_jsonrpc_server *svr)
{
Expand Down
1 change: 1 addition & 0 deletions ovsdb/jsonrpc-server.h
Expand Up @@ -65,6 +65,7 @@ void ovsdb_jsonrpc_server_reconnect(struct ovsdb_jsonrpc_server *, bool read_onl

void ovsdb_jsonrpc_server_run(struct ovsdb_jsonrpc_server *);
void ovsdb_jsonrpc_server_wait(struct ovsdb_jsonrpc_server *);
bool ovsdb_jsonrpc_server_is_read_only(struct ovsdb_jsonrpc_server *);

void ovsdb_jsonrpc_server_get_memory_usage(const struct ovsdb_jsonrpc_server *,
struct simap *usage);
Expand Down
24 changes: 17 additions & 7 deletions ovsdb/ovsdb-server.1.in
Expand Up @@ -36,7 +36,7 @@ If none is specified, the default is \fB@DBDIR@/conf.db\fR. The database
files must already have been created and initialized using, for
example, \fBovsdb\-tool create\fR.
.
.SH "ACTIVE and BACKUP "
.SH "ACTIVE and BACKUP"
\fBovsdb\-server\fR runs either as a backup server, or as an active server.
When \fBovsdb\-server\fR is running as a backup server, all transactions that
can modify the database content, including the lock commands are rejected.
Expand All @@ -45,12 +45,12 @@ When \fBovsdb\-server\fR role changes, all existing client connection are
reset, requiring clients to reconnect to the server.
.PP
By default, \fBovsdb\-server\fR runs as an active server, except when the
\fB\-\-sync\-from=\fIserver\fR command line option is specified. During
runtime, \fBovsdb\-server\fR role can be switch by using appctl commands.
\fB\-\-sync\-from=\fIserver\fR command line option is specified and without
the \fB\-\-no\-sync option\fR. During runtime, \fBovsdb\-server\fR role can be switch by using appctl commands.
.PP
\fBovsdb-server/connect\-active\-ovsdb\-server\fR switches
\fBovsdb\-server\fR role into a backup server, Conversely,
\fBovsdb-server/disconnect\-active\-ovsdb\-server\fR changes server into
\fBovsdb\-server\fR into a backup server, Conversely,
\fBovsdb-server/disconnect\-active\-ovsdb\-server\fR switches server into
an active one.
.
.SH OPTIONS
Expand Down Expand Up @@ -220,12 +220,22 @@ specified by \fBovsdb\-server/set\-active\-ovsdb\-server\fR.
.IP "\fBovsdb\-server/disconnect\-active\-ovsdb\-server"
Causes \fBovsdb\-server\fR to stop synchronizing its databases with a active server.
.
.IP "\fBovsdb\-server/set\-sync\-excluded\-tables \fIdb\fB:\fItable\fR[\fB,\fIdb\fB:\fItable\fR]..."
.IP "\fBovsdb\-server/set\-sync\-exclude\-tables \fIdb\fB:\fItable\fR[\fB,\fIdb\fB:\fItable\fR]..."
Sets the \fItable\fR whitin \fIdb\fR that will be excluded from synchronization.
.
.IP "\fBovsdb\-server/get\-sync\-excluded\-tables"
.IP "\fBovsdb\-server/get\-sync\-exclude\-tables"
Gets the tables that are currently excluded from synchronization.
.
.IP "\fBovsdb\-server/sync\-status"
Prints a summary of replication run time information. The \fBstate\fR
information is always provided, indicating whether the server is running
in the \fIactive\fR or the \fIbackup\fR mode.
When running in backup mode, replication connection status, which
can be either \fIconnecting\fR, \fIreplicating\fR or \fIerror\fR, are shown.
When the connection is in \fIreplicating\fR state, further output shows
the list of databases currently replicating, and the tables that are
excluded.
.
.so lib/vlog-unixctl.man
.so lib/memory-unixctl.man
.so lib/coverage-unixctl.man
Expand Down

0 comments on commit 77eb90b

Please sign in to comment.