[ovs-git] [openvswitch/ovs] 932104: ovsdb-idl: Add support for change tracking.

GitHub noreply at github.com
Mon Nov 23 16:53:25 UTC 2015

  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 932104f483ef4384d15dec1d26661da8da58de8d
  Author: Shad Ansari <shad.ansari at hp.com>
  Date:   2015-11-23 (Mon, 23 Nov 2015)

  Changed paths:
    M lib/ovsdb-idl-provider.h
    M lib/ovsdb-idl.c
    M lib/ovsdb-idl.h
    M ovsdb/ovsdb-idlc.in
    M tests/ovsdb-idl.at
    M tests/test-ovsdb.c

  Log Message:
  ovsdb-idl: Add support for change tracking.

Ovsdb-idl notifies a client that something changed; it does not track
which table, row changed in what way (insert, modify or delete).
As a result, a client has to scan or reconfigure the entire idl after
ovsdb_idl_run(). This is presumably fine for typical ovs schemas where
tables are relatively small. In use-cases where ovsdb is used with
schemas that can have very large tables, the current ovsdb-idl
notification mechanism does not appear to scale - clients need to do a
lot of processing to determine the exact change delta.

This change adds support for:
 - Table and row based change sequence numbers to record the
   most recent IDL change sequence numbers associated with insert,
   modify or delete update on that table or row.
 - Change tracking of specific columns. This ensures that changed
   rows (inserted, modified, deleted) that have tracked columns, are
   tracked by IDL. The client can directly access the changed rows
   with get_first, get_next operations without the need to scan the
   entire table.
   The tracking functionality is not enabled by default and needs to
   be turned on per-column by the client after ovsdb_idl_create()
   and before ovsdb_idl_run().

     /* Example Usage */

     idl = ovsdb_idl_create(...);

     /* Track specific columns */
     ovsdb_idl_track_add_column(idl, column);
     /* Or, track all columns */

     for (;;) {
   seqno = ovsdb_idl_get_seqno(idl);
    /* Process only the changed rows in Table FOO */
   FOO_FOR_EACH_TRACKED(row, idl) {
       /* Determine the type of change from the row seqnos */
       if (foo_row_get_seqno(row, OVSDB_IDL_CHANGE_DELETE)
              >= seqno)) {
           printf("row deleted\n");
       } else if (foo_row_get_seqno(row, OVSDB_IDL_CHANGE_MODIFY)
                     >= seqno))
           printf("row modified\n");
       } else if (foo_row_get_seqno(row, OVSDB_IDL_CHANGE_INSERT)
                     >= seqno))
           printf("row inserted\n");
    /* All changes processed - clear the change track */

Signed-off-by: Shad Ansari <shad.ansari at hp.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>

More information about the git mailing list