diff mbox series

[ovs-dev,02/10] ovsdb-idl: Treat "unknown database" error as reason to reconnect.

Message ID 20181115060534.7146-2-blp@ovn.org
State Accepted
Headers show
Series [ovs-dev,01/10] ovsdb-idl: Avoid sending transactions when the DB is not synced up. | expand

Commit Message

Ben Pfaff Nov. 15, 2018, 6:05 a.m. UTC
Ordinarily the IDL finds out in advance whether a particular database is
on its server, or it finds out via notifications.  But it's also a good
idea to adopt a belt-and-suspenders approach so that, if the IDL does
receive an "unknown database" error, we treat it as a "soft" error that
can be fixed by reconnecting to another server, rather than a "hard" error
that should cause an immediate abort.

Signed-off-by: Ben Pfaff <blp@ovn.org>
 lib/ovsdb-idl.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series


diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index a1f246d6f7b7..a7274dea2a8b 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -4686,6 +4686,10 @@  ovsdb_idl_db_txn_process_reply(struct ovsdb_idl_db *db,
                     if (error->type == JSON_STRING) {
                         if (!strcmp(error->string, "timed out")) {
+                        } else if (!strcmp(error->string,
+                                           "unknown database")) {
+                            ovsdb_idl_retry(db->idl);
+                            soft_errors++;
                         } else if (!strcmp(error->string, "not owner")) {
                         } else if (!strcmp(error->string, "not allowed")) {