[ovs-dev] [idl 1/2] ovsdb-idl: Fix atomicity of writes that don't change a column's value.

Ben Pfaff blp at nicira.com
Fri Apr 8 17:27:36 UTC 2011


On Fri, Apr 08, 2011 at 10:25:26AM -0700, Andrew Evans wrote:
> On 4/5/11 12:24 PM, Ben Pfaff wrote:
> > +    /* If this is a write-only column and the datum being written is the same
> > +     * as the one already there, just skip the update entirely.  This is worth
> > +     * optimizing because we have a lot of columns that get periodically
> > +     * refreshed into the database but don't actually change that often.
> > +     *
> > +     * We don't do this for read/write columns because that would break
> > +     * atomicity of transactions--some other client might have written a
> > +     * different value in that column since we read it. */
> 
> What prevents another client from writing a different value since we
> last read the row?

A write-only column is only suitable for a client that owns a
particular column.  This is documented in ovsdb-idl.h:

/* Modes with which the IDL can monitor a column.
 *
 * If no bits are set, the column is not monitored at all.  Its value will
 * always appear to the client to be the default value for its type.
 *
 * If OVSDB_IDL_MONITOR is set, then the column is replicated.  Its value will
 * reflect the value in the database.  If OVSDB_IDL_ALERT is also set, then
 * ovsdb_idl_run() will return "true", and the value returned by
 * ovsdb_idl_get_seqno() will change, when the column's value changes.
 *
 * The possible mode combinations are:
 *
 *   - 0, for a column that a client doesn't care about.
 *
 *   - (OVSDB_IDL_MONITOR | OVSDB_IDL_ALERT), for a column that a client wants
 *     to track and possibly update.
 *
 *   - OVSDB_IDL_MONITOR, for columns that a client treats as "write-only",
 *     that is, it updates them but doesn't want to get alerted about its own
 *     updates.  It also won't be alerted about other clients' updates, so this
 *     is suitable only for use by a client that "owns" a particular column.
 *
 *   - OVDSB_IDL_ALERT without OVSDB_IDL_MONITOR is not valid.
 */



More information about the dev mailing list