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 d5e3601..02cfeeb 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 f0c29d4..8abc5d3 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])
+