Message ID | CS1PR84MB0040520805EBDE652A21DAC8FA220@CS1PR84MB0040.NAMPRD84.PROD.OUTLOOK.COM |
---|---|
State | Not Applicable |
Headers | show |
On Tue, Jun 28, 2016 at 09:58:59PM +0000, Cabrera Vega, Mario Alberto wrote: > Currently disconnecting from the replicator server means closing the jsonrpc > connection and destroying the monitored table names and blacklisted table > names. > > This patch makes a distinction between disconnecting from the remote server, > applicable when the replication incurs in an error, and destroying the > remote server info, applicable when ovsdb-server exits gracefully. > > Signed-off-by: Mario Cabrera <mario.cabrera@hpe.com> Thanks for the patch. I couldn't apply this; "git am" reports that it is corrupt. Perhaps you should also submit it as a pull request, if it is difficult to send the patch without corruption.
Here's the pull request: https://github.com/openvswitch/ovs/pull/140 -----Original Message----- From: Ben Pfaff [mailto:blp@ovn.org] Sent: Saturday, July 2, 2016 9:42 PM To: Cabrera Vega, Mario Alberto <mario.cabrera@hpe.com> Cc: dev@openvswitch.org Subject: Re: [ovs-dev] [PATCH] ovsdb: Fix OVSDB disconnect replication bug On Tue, Jun 28, 2016 at 09:58:59PM +0000, Cabrera Vega, Mario Alberto wrote: > Currently disconnecting from the replicator server means closing the > jsonrpc connection and destroying the monitored table names and > blacklisted table names. > > This patch makes a distinction between disconnecting from the remote > server, applicable when the replication incurs in an error, and > destroying the remote server info, applicable when ovsdb-server exits gracefully. > > Signed-off-by: Mario Cabrera <mario.cabrera@hpe.com> Thanks for the patch. I couldn't apply this; "git am" reports that it is corrupt. Perhaps you should also submit it as a pull request, if it is difficult to send the patch without corruption.
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 1b9de19..c9a3297 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -351,7 +351,7 @@ main(int argc, char *argv[]) sset_destroy(&remotes); sset_destroy(&db_filenames); unixctl_server_destroy(unixctl); - disconnect_remote_server(); + destroy_remote_server(); if (run_process && process_exited(run_process)) { int status = process_status(run_process); diff --git a/ovsdb/replication.c b/ovsdb/replication.c index 9bf3721..c5b2368 100644 --- a/ovsdb/replication.c +++ b/ovsdb/replication.c @@ -141,6 +141,14 @@ void disconnect_remote_server(void) { jsonrpc_close(rpc); + sset_clear(&monitored_tables); + sset_clear(&tables_blacklist); +} + +void +destroy_remote_server(void) +{ + jsonrpc_close(rpc); sset_destroy(&monitored_tables); sset_destroy(&tables_blacklist); @@ -449,15 +457,13 @@ process_notification(struct json *table_updates, struct ovsdb *database) error = ovsdb_txn_commit(txn, false); if (error) { ovsdb_error_assert(error); - sset_clear(&monitored_tables); + disconnect_remote_server(); } } else { ovsdb_txn_abort(txn); ovsdb_error_assert(error); - sset_clear(&monitored_tables); + disconnect_remote_server(); } - - ovsdb_error_destroy(error); } static struct ovsdb_error * @@ -497,6 +503,9 @@ process_table_update(struct json *table_update, const char *table_name, error = execute_update(txn, node->name, table, new); } } + if (error) { + break; + } } return error; } diff --git a/ovsdb/replication.h b/ovsdb/replication.h index 74acdba..f8dd5fe 100644 --- a/ovsdb/replication.h +++ b/ovsdb/replication.h @@ -34,6 +34,7 @@ void replication_run(struct shash *dbs); void set_remote_ovsdb_server(const char *remote_server); void set_tables_blacklist(const char *blacklist); void disconnect_remote_server(void); +void destroy_remote_server(void); const struct db *find_db(const struct shash *all_dbs, const char *db_name); void replication_usage(void); -- 1.9.1
Currently disconnecting from the replicator server means closing the jsonrpc connection and destroying the monitored table names and blacklisted table names. This patch makes a distinction between disconnecting from the remote server, applicable when the replication incurs in an error, and destroying the remote server info, applicable when ovsdb-server exits gracefully. Signed-off-by: Mario Cabrera <mario.cabrera@hpe.com> --- ovsdb/ovsdb-server.c | 2 +- ovsdb/replication.c | 17 +++++++++++++---- ovsdb/replication.h | 1 + 3 files changed, 15 insertions(+), 5 deletions(-)