From: Ben Pfaff Date: Fri, 11 Dec 2009 20:58:30 +0000 (-0800) Subject: ovsdb: Cleanly abort delete operations. X-Git-Tag: v1.0.0~259^2~405 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=ee9e92d81a85344723be3dea504af9b584c81cd3;hp=577aebdfecb001155242aa9831613310f87ed13a;p=sliver-openvswitch.git ovsdb: Cleanly abort delete operations. --- diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c index d5e360167..02cfeebf1 100644 --- a/ovsdb/transaction.c +++ b/ovsdb/transaction.c @@ -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; } diff --git a/tests/ovsdb-transaction.at b/tests/ovsdb-transaction.at index f0c29d43c..8abc5d3fe 100644 --- a/tests/ovsdb-transaction.at +++ b/tests/ovsdb-transaction.at @@ -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]) +