2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

34 Commits

Author SHA1 Message Date
Mike Pattrick
0add983b38 ovsdb: Use table indexes if available for ovsdb_query().
Currently all OVSDB database queries except for UUID lookups all result
in linear lookups over the entire table, even if an index is present.

This patch modifies ovsdb_query() to attempt an index lookup first, if
possible. If no matching indexes are present then a linear index is
still conducted.

To test this, I set up an ovsdb database with a variable number of rows
and timed the average of how long ovsdb-client took to query a single
row. The first two tests involved a linear scan that didn't match any
rows, so there was no overhead associated with sending or encoding
output. The post-patch linear scan was a worst case scenario where the
table did have an appropriate index but the conditions made its usage
impossible. The indexed lookup test was for a matching row, which did
also include overhead associated with a match. The results are included
in the table below.

Rows                   | 100k | 200k | 300k | 400k | 500k
-----------------------+------+------+------+------+-----
Pre-patch linear scan  |  9ms | 24ms | 37ms | 49ms | 61ms
Post-patch linear scan |  9ms | 24ms | 38ms | 49ms | 61ms
Indexed lookup         |  3ms |  3ms |  3ms |  3ms |  3ms

I also tested the performance of ovsdb_query() by wrapping it in a loop
and measuring the time it took to perform 1000 linear scans on 1, 10,
100k, and 200k rows. This test showed that the new index checking code
did not slow down worst case lookups to a statistically detectable
degree.

Reported-at: https://issues.redhat.com/browse/FDP-590
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-07-15 18:05:32 +02:00
Roi Dayan
68517f43a8 tests: ovsdb: Add ovsdb prefix to related tests.
Add ovsdb-idl prefix for tests in ovsdb-idl.at.
Add ovsdb-log prefix for tests in ovsdb-log.at.
Add ovsdb prefix for the rest of the ovsdb tests.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2024-09-26 08:30:53 +02:00
Mike Pattrick
33f45ded67 ovsdb: Don't iterate over rows on empty mutation.
Previously when an empty mutation was used to count the number of rows
in a table, OVSDB would iterate over all rows twice. First to perform an
RBAC check, and then to perform the no-operation.

This change adds a short circuit to mutate operations with no conditions
and an empty mutation set, returning immediately. One notable change in
functionality is not performing the RBAC check in this condition, as no
mutation actually takes place.

Reported-by: Terry Wilson <twilson@redhat.com>
Reported-at: https://issues.redhat.com/browse/FDP-359
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-03-08 20:21:27 +01:00
Ilya Maximets
d6fd6e5917 tests: Add ovsdb execution cases for set size constraints.
Adding an extra check to one of the ovsdb execution cases that will
verify that ovsdb-server is able to read back transactions previously
written to a database file.  And also adding new execution tests
that cover previously discovered issues with size checks on sets.

Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-08-03 14:20:10 +02:00
Ben Pfaff
a529e3cd1f ovsdb-server: Allow OVSDB clients to specify the UUID for inserted rows.
Acked-by: Han Zhou <hzhou@ovn.org>
Requested-by: Leonid Ryzhyk <lryzhyk@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2020-01-16 16:02:05 -08:00
Ben Pfaff
c724bd674f tests: Convert uuidfilt utility from Perl to Python.
Perl is unfashionable and Python is more widely available and understood,
so this commit converts one of the OVS uses of Perl into Python.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
2017-11-26 16:07:55 -08:00
Andy Zhou
e51879e99b ovsdb: Make OVSDB backup sever read only
When ovsdb-sever is running in the backup state, it would be nice to
make sure there is no un-intended changes to the backup database.

This patch makes the ovsdb server only accepts 'read' transactions as
a backup server. When the server role is changed into an active server,
all existing client connections will be reset. After reconnect, all
clinet transactions will then be accepted.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-08-14 23:32:47 -07:00
Ryan Moats
cd423a77c6 ovsdb: Use better error message for "timeout" without waiting.
When setting a where clause, if the timeout is set to a value of 0,
the clause is tested once and if it fails, a message of '"wait" timed
out' is returned.  This can be misleading because there wasn't any
real time, so change the message to '"where" clause test failed'.

Signed-off-by: Ryan Moats <rmoats@us.ibm.com>
Reported-by: Ryan Moats <rmoats@us.ibm.com>
Reported-at: http://openvswitch.org/pipermail/dev/2016-August/077083.html
Fixes: f85f8ebb ("Initial implementation of OVSDB.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-08-13 22:11:12 -07:00
Ben Pfaff
6132b241ef tests: Automatically initialize OVS_*DIR vars when tests begin.
A lot of tests need to initialize the OVS_RUNDIR, OVS_LOGDIR, etc.
variables to point to the directory in which the tests run.  Until now,
each of them has had to do this individually, which is redundant.  This
commit starts to do this automatically.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
2015-09-09 10:24:24 -07:00
Arun Sharma
e731d71bf4 Add IPv6 support for OpenFlow, OVSDB, NetFlow, and sFlow.
Does not add IPv6 support for in-band control.

Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Nandan Nivgune <nandan.nivgune@calsoftinc.com>
Signed-off-by: Abhijit Bhopatkar <abhijit.bhopatkar@calsoftinc.com>
Signed-off-by: Arun Sharma <arun.sharma@calsoftinc.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-02-06 16:08:34 -08:00
YAMAMOTO Takashi
5c6d0628ac invoke perl as ${PERL}
as suggested by Ben Pfaff.

Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-04-22 08:49:32 -07:00
Pavithra Ramesh
2c487bc808 stream-unix: Use rundir as root for relative paths.
Until now, "unix:" and "punix:" paths that are not absolute have
been considered relative to the current working directory.  It
is more useful to consider them relative to the rundir, so this
commit makes that change to the C and Python implementations of
the stream code.

This commit also relaxes the whitelist check in the bridge code
so that any name that does not contain a "/" is considered OK.

Signed-off-by: Pavithra Ramesh <paramesh@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-02-11 11:18:58 -08:00
Ben Pfaff
341c4e59f5 ovsdb: Enforce immutability of immutable columns.
OVSDB has always had the ability to mark a column as "immutable", so that
its value cannot be changed in a given row after that row is initially
inserted.  However, we discovered recently that ovsdb-server has never
enforced this constraint.  This commit implements enforcement.

Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
2012-09-05 10:35:20 -07:00
Ben Pfaff
39ab07affb tests: Convert *_SCHEMA macros to shell functions.
This reduces tests/testsuite by about 70 kB, by collapsing a number of
macro expansions into just one copy in a shell function.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-03-07 14:17:45 -08:00
Ben Pfaff
6910a6e6f2 ovsdb: Implement table uniqueness constraints ("indexes"). 2011-06-06 09:09:10 -07:00
Ben Pfaff
b7585d1dff ovsdb: Check ovsdb_mutation_set_execute() return value in transactions.
Errors from this function were being ignored, which meant that transactions
could use "mutate" to bypass number-of-elements constraints on sets and
maps.  This fixes the problem and adds a test to prevent the problem from
recurring.

Bug #5781.
2011-05-31 13:46:00 -07:00
Ben Pfaff
c5f341ab19 ovsdb: Implement garbage collection. 2011-03-10 11:24:00 -08:00
Ben Pfaff
19b48a816b ovsdb: Improve error message for duplicate uuid-name.
ovsdb_execute_insert() tried to return a helpful error message when there
was a duplicate uuid-name, but ovsdb_execute() (its caller) makes any
parse error override a parse error.  Since ovsdb_execute_insert() would
skip parsing the row when the uuid-name was a duplicate, this meant that
the error actually reported would be that "row" was not allowed here, which
wasn't at all helpful (since "row" is in fact mandatory).

This commit clears up the problem by always retrieving the "row" member,
which required a small amount of refactoring, and adds a test.
2011-03-10 11:23:59 -08:00
Ben Pfaff
d198c4beee ovsdb-data: Verify that named-uuid string is an <id>.
The "uuid-name" that creates symbols must be an <id> but we weren't
verifying the same constraint on the "named-uuid"s that refer to symbols,
which was a bit confusing in writing transactions by hand.  This commit
fixes the inconsistency and updates the SPECS file to clarify that a
named-uuid string has to be an <id>.
2011-03-10 11:23:59 -08:00
Ben Pfaff
6aa0931372 ovsdb-tool: Add commands for printing the database checksum. 2011-02-15 12:24:29 -08:00
Ben Pfaff
8159b984dc Implement database schema versioning.
As the database schema evolves, it might be useful to have an identifier
for the particular version in use.  This commit adds that feature.
2010-12-27 14:26:47 -08:00
Ben Pfaff
97f7803b8e ovsdb-server: Improve logging for referential integrity violations.
This may help with bug #2727 "ovs-vsctl transaction error while changing
VM power state", if it is reproducible.
2010-06-22 11:48:51 -07:00
Ben Pfaff
1f4f3cd7e0 tests: Fix bug in "weak references" test.
One part of the "weak references" test inserts invalid all-zeros weak
references into two columns and expects to get an error message mentioning
one of them.  Unfortunately the one that actually gets mentioned depends
on hash ordering and thus differs between big-endian and little-endian
machines.  This commit fixes the problem by only putting an invalid
reference in a single column, instead of two of them.
2010-05-07 14:36:03 -07:00
Ben Pfaff
87ab878cad ovsdb: Allow constraining the number of rows in a table. 2010-03-18 11:32:26 -07:00
Ben Pfaff
7360012bdf ovsdb: Add support for weak references. 2010-03-17 14:24:56 -07:00
Ben Pfaff
8894256573 ovsdb: Fix commit to disk of rows added to a table with all-default values. 2010-02-15 11:28:39 -08:00
Ben Pfaff
9cb53f2613 ovsdb: Add support for multiple databases to the protocol.
This also adds protocol compatibility to the database itself and to
ovsdb-client.  It doesn't actually add multiple database support to
ovsdb-server, since we don't really need that yet.
2010-02-09 14:25:32 -08:00
Ben Pfaff
fbf925e45d ovsdb: Get rid of "declare" operation.
It's more elegant, and just as easy to implement, if we allow a
"named-uuid" to be a forward reference to a "uuid-name" in a later
"insert" operation.
2010-02-08 16:03:21 -08:00
Ben Pfaff
0d0f05b909 ovsdb: Add support for referential integrity in the database itself. 2010-02-08 14:16:19 -08:00
Ben Pfaff
bd76d25d8b ovsdb: Add simple constraints. 2010-02-08 14:16:19 -08:00
Ben Pfaff
7c126fbb8a Rework and simplify the "lcov" support for the testsuite. 2010-02-02 15:21:09 -08:00
Ben Pfaff
e9f8f9367e ovsdb: Add new "mutation" operation to transactions. 2009-12-16 10:56:04 -08:00
Ben Pfaff
21ff1aee1b ovsdb: Add tests for file storage and for ovsdb-server. 2009-11-16 15:20:01 -08:00
Ben Pfaff
f85f8ebbfa Initial implementation of OVSDB. 2009-11-04 17:12:10 -08:00