ovsdb: Cleanly abort delete operations.
authorBen Pfaff <blp@nicira.com>
Fri, 11 Dec 2009 20:58:30 +0000 (12:58 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 11 Dec 2009 21:26:08 +0000 (13:26 -0800)
ovsdb/transaction.c
tests/ovsdb-transaction.at

index d5e3601678b3bf3ccd4599e32999ba8e734eabea..02cfeebf1aba21709a0eb103bdd127f4ca802ece 100644 (file)
@@ -82,6 +82,9 @@ ovsdb_txn_destroy(struct ovsdb_txn *txn, void (*cb)(struct ovsdb_txn_row *))
                             struct ovsdb_txn_row, hmap_node,
                             &txn_table->txn_rows)
         {
+            if (txn_row->old) {
+                txn_row->old->txn_row = NULL;
+            }
             if (txn_row->new) {
                 txn_row->new->txn_row = NULL;
             }
index f0c29d43c49948a5356af396177a5699e049e1aa..8abc5d3fe040d3f315c8207b5aed0cafb8fcc2d1 100644 (file)
@@ -382,3 +382,29 @@ print:
 2: i=2, j=3],
   [transaction])
 
+OVSDB_CHECK_POSITIVE([deletes are aborted cleanly],
+  [[transact \
+    '["insert", "1", "2", "3"]' \
+    '["commit"]' \
+    '["print"]' \
+    '["delete", "1"]' \
+    '["abort"]' \
+    '["print"]' \
+    '["delete", "1"]' \
+    '["abort"]' \
+    '["print"]']],
+  [dnl
+insert 1 2 3:
+commit:
+print:
+1: i=2, j=3
+delete 1:
+abort:
+print:
+1: i=2, j=3
+delete 1:
+abort:
+print:
+1: i=2, j=3],
+  [transaction])
+