ovsdb: Update _version more accurately in transaction commit.
authorBen Pfaff <blp@nicira.com>
Mon, 31 Aug 2015 16:53:18 +0000 (09:53 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 4 Sep 2015 23:50:15 +0000 (16:50 -0700)
commiteac0dc83c468dc7c5b5751c96cda0e568b8b188b
tree4fd529cc4da47021f404e5f5205600b7cf76ef0f
parentaa59fe8c228f18941d7a4a5f79179ef01dab83d9
ovsdb: Update _version more accurately in transaction commit.

The _version column in each OVSDB row is supposed to be updated whenever
any other column in the row changes.  However, the transaction code was
not careful to do this only when a row actually changed--there were other
cases where a row was considered at transaction commit time and _version
updated even though the row did not actually change.  For example,
ovsdb_txn_adjust_atom_refs() calls find_or_make_txn_row(), which calls
ovsdb_txn_row_modify(), which updates _version, but
ovsdb_txn_adjust_atom_refs() doesn't actually update any data.

One way to fix this would be to carefully consider and adjust all the code
that looks at transaction rows.  However, this seems somewhat error prone
and thus difficult to test.  This commit takes a different approach: it
drops the code that adjusts _version on the fly, instead replacing it by
a final pass over the database at the end of the commit process that checks
for each row whether any columns changed and updates _version at that point
if any did.  That seems pretty foolproof to me.

Reported-by: RishiRaj Maulick <rishi.raj2509@gmail.com>
Reported-at: http://openvswitch.org/pipermail/dev/2015-August/059439.html
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Tested-by: RishiRaj Maulick <rishi.raj2509@gmail.com>
AUTHORS
ovsdb/transaction.c