ovs-brcompatd: Handle transaction errors slightly more gracefully.
authorBen Pfaff <blp@nicira.com>
Wed, 10 Feb 2010 18:41:44 +0000 (10:41 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 10 Feb 2010 18:41:44 +0000 (10:41 -0800)
It is not a good idea to just exit on an OVSDB transaction error.
TXN_TRY_AGAIN will definitely happen in practice; TXN_ERROR should not but
we should not just fail if it does.

This should allow us to better debug bug #2418.

vswitchd/ovs-brcompatd.c

index 9994fdb..beaefb2 100644 (file)
@@ -1225,7 +1225,6 @@ main(int argc, char *argv[])
             ovsdb_idl_txn_wait(txn);
             poll_block();
         }
-        ovsdb_idl_txn_destroy(txn);
             
         switch (status) {
         case TXN_INCOMPLETE:
@@ -1241,16 +1240,19 @@ main(int argc, char *argv[])
         
         case TXN_TRY_AGAIN:
             /* xxx Handle this better! */
-            printf("xxx We need to try again!\n");
+            VLOG_ERR("OVSDB transaction needs retry");
             break;
 
         case TXN_ERROR:
-            /* xxx Is this what we want to do? */
-            ovs_fatal(0, "transaction error");
-                
+            /* xxx Handle this better! */
+            VLOG_ERR("OVSDB transaction failed: %s",
+                     ovsdb_idl_txn_get_error(txn));
+            break;
+
         default:
             NOT_REACHED();
         }
+        ovsdb_idl_txn_destroy(txn);
 
         nl_sock_wait(brc_sock, POLLIN);
         ovsdb_idl_wait(idl);