ovsdb-monitor: add transaction ids
authorAndy Zhou <azhou@nicira.com>
Fri, 13 Mar 2015 06:15:56 +0000 (23:15 -0700)
committerAndy Zhou <azhou@nicira.com>
Sat, 30 May 2015 00:39:50 +0000 (17:39 -0700)
commit59c35e1198ee42887649297bb4fd8687c5005ac8
tree8e8a867277ee10a92399c5f96233ee297cc2c55b
parentd941283758dffb8471b13469c75f3512e0df6417
ovsdb-monitor: add transaction ids

With N:1 mappings, multiple jsonrpc server may be servicing the rpc
connection at a different pace. ovsdb-monitor thus needs to maintain
different change sets, depends on connection speed of each rpc
connections. Connections servicing at the same speed can share the
same change set.

Transaction ID is an concept added to describe the change set. One
possible view of the database state is a sequence of changes, more
precisely, commits be applied to it in order, starting from an
initial state, with commit 0. The logic can also be applied to the
jsonrpc monitor; each change it pushes corresponds to commits between
two transaction IDs.

This patch introduces transaction IDs. For ovsdb-monitor, it maintains
n_transactions, starting from 0. Each commit add 1 to the number.
Jsonrpc maintains and 'unflushed' transaction number, corresponding to
the next commit the remote has not seen. jsonrpc's job is simply to
notice there are changes in the ovsdb-monitor that it is interested in,
i.e.  'n_transactions' >= 'unflushed', get the changes in json format,
and push them to the remote site.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ovsdb/jsonrpc-server.c
ovsdb/monitor.c
ovsdb/monitor.h