Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
- Loading branch information
Showing
5 changed files
with
113 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters