[ovs-dev] [PATCH 2/2] ovsdb: Return NULL if prev_txn == next_txn

Andy Zhou azhou at ovn.org
Mon Feb 22 09:13:07 UTC 2016


On Sat, Feb 20, 2016 at 8:35 AM, Liran Schour <lirans at il.ibm.com> wrote:

> In case that we flushed everything already, we can immeidately return NULL.
>
> Signed-off-by: Liran Schour <lirans at il.ibm.com>
> ---
>  ovsdb/monitor.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c
> index 5ae9cdb..1a07f19 100644
> --- a/ovsdb/monitor.c
> +++ b/ovsdb/monitor.c
> @@ -733,6 +733,10 @@ ovsdb_monitor_get_update(struct ovsdb_monitor *dbmon,
>      uint64_t prev_txn = *unflushed;
>      uint64_t next_txn = dbmon->n_transactions + 1;
>
> +    if (prev_txn == next_txn) {
> +        return NULL;
> +    }
> +
>
Thanks for reporting the issue. The change as is breaks the unit tests. But
the optimziation
does make sense.  After looking further, I was able to find a bug.

I have posted a patch series that fixes this bug and folded the suggested
optimization
(in a slightly different manner). . Would you please review them:

http://openvswitch.org/pipermail/dev/2016-February/066513.html

Thanks!




>      /* Return a clone of cached json if one exists. Otherwise,
>       * generate a new one and add it to the cache.  */
>      cache_node = ovsdb_monitor_json_cache_search(dbmon, version,
> prev_txn);
> --
> 2.1.4
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list