[ovs-dev] [PATCH 5/5] ovsdb-idl: Improve check in ovsdb_idl_row_is_orphan().
Jesse Gross
jesse at nicira.com
Wed Mar 3 18:59:25 UTC 2010
The rest of this set looks good.
On Wed, Mar 3, 2010 at 12:59 PM, Ben Pfaff <blp at nicira.com> wrote:
> When a transaction is in progress, newly inserted rows have NULL 'old'
> values. These rows are not orphans, so ovsdb_idl_row_is_orphan() should
> not treat them as such.
>
> I do not believe that this changes behavior at all, because I have not been
> able to find a case where ovsdb_idl_row_is_orphan() is called while a
> transaction is in progress. It is a code cleanup.
> ---
> lib/ovsdb-idl.c | 13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
> index cc9deac..f60ec4b 100644
> --- a/lib/ovsdb-idl.c
> +++ b/lib/ovsdb-idl.c
> @@ -541,10 +541,21 @@ ovsdb_idl_row_update(struct ovsdb_idl_row *row, const
> struct json *row_json)
> }
> }
>
> +/* When a row A refers to row B through a column with a "refTable"
> constraint,
> + * but row B does not exist, row B is called an "orphan row". Orphan rows
> + * should not persist, because the database enforces referential
> integrity, but
> + * they can appear transiently as changes from the database are received
> (the
> + * database doesn't try to topologically sort them and circular references
> mean
> + * it isn't always possible anyhow).
> + *
> + * This function returns true if 'row' is an orphan row, otherwise false.
> + */
> static bool
> ovsdb_idl_row_is_orphan(const struct ovsdb_idl_row *row)
> {
> - return !row->old;
> + return !row->old && !row->new;
> +}
> +
> /* Returns true if 'row' is conceptually part of the database as modified
> by
> * the current transaction (if any), false otherwise.
> *
> --
> 1.6.6.1
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20100303/c2eb4d4d/attachment-0003.html>
More information about the dev
mailing list