[ovs-git] [openvswitch/ovs] 0c597d: ovsdb-idl: Correct singleton insert logic

GitHub noreply at github.com
Mon Jun 25 20:22:31 UTC 2018


  Branch: refs/heads/branch-2.9
  Home:   https://github.com/openvswitch/ovs
  Commit: 0c597d10aa10e1a4b0855ae759db947b7ce39391
      https://github.com/openvswitch/ovs/commit/0c597d10aa10e1a4b0855ae759db947b7ce39391
  Author: Mark Michelson <mmichels at redhat.com>
  Date:   2018-06-25 (Mon, 25 Jun 2018)

  Changed paths:
    M lib/ovsdb-idl.c
    M tests/idltest.ovsschema
    M tests/ovsdb-idl.at
    M tests/test-ovsdb.c
    M tests/test-ovsdb.py

  Log Message:
  -----------
  ovsdb-idl: Correct singleton insert logic

When inserting data into a "singleton" table (one that has maxRows ==
1), there is a check that ensures that the table is currently empty
before inserting the row. The intention is to prevent races where
multiple clients might attempt to insert rows at the same time.

The problem is that this singleton check can cause legitimate
transactions to fail. Specifically, a transaction that attempts to
delete the current content of the table and insert new data will cause
the singleton check to fail since the table currently has data.

This patch corrects the issue by keeping a count of the rows being
deleted and added to singleton tables. If the total is larger than zero,
then the net operation is attempting to insert rows. If the total is
less than zero, then the net operation is attempting to remove rows. If
the total is zero, then the operation is inserting and deleting an equal
number of rows (or is just updating rows). We only add the singleton
check if the total is larger than zero.

This patch also includes a new test for singleton tables that ensures
that the maxRows constraint works as expected.

Signed-off-by: Mark Michelson <mmichels at redhat.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>



      **NOTE:** This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the git mailing list