[ovs-git] [openvswitch/ovs] f199df: ovsdb-idl: Add partial map updates functionality.

GitHub noreply at github.com
Wed May 18 17:15:23 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: f199df26e8e286a0e6556c7347eb4cf5a83703a2
      https://github.com/openvswitch/ovs/commit/f199df26e8e286a0e6556c7347eb4cf5a83703a2
  Author: Edward Aymerich <edward.aymerich at hpe.com>
  Date:   2016-05-18 (Wed, 18 May 2016)

  Changed paths:
    M lib/automake.mk
    M lib/ovsdb-idl-provider.h
    M lib/ovsdb-idl.c
    M lib/ovsdb-idl.h
    A lib/ovsdb-map-op.c
    A lib/ovsdb-map-op.h

  Log Message:
  -----------
  ovsdb-idl: Add partial map updates functionality.

In the current implementation, every time an element of either a map or set
column has to be modified, the entire content of the column is sent to the
server to be updated. This is not a major problem if the information contained
in the column for the corresponding row is small, but there are cases where
these columns can have a significant amount of elements per row, or these
values are updated frequently, therefore the cost of the modifications becomes
high in terms of time and bandwidth.

In this solution, the ovsdb-idl code is modified to use the RFC 7047 'mutate'
operation, to allow sending partial modifications on map columns to the server.
The functionality is exposed to clients in the vswitch idl. This was
implemented through map operations.

A map operation is defined as an insertion, update or deletion of a key-value
pair inside a map. The idea is to minimize the amount of map operations
that are send to the OVSDB server when a transaction is committed.

In order to keep track of the requested map operations, structs map_op and
map_op_list were defined with accompanying functions to manipulate them. These
functions make sure that only one operation is send to the server for each
key-value that wants to be modified, so multiple operation on a key value are
collapsed into a single operation.

As an example, if a client using the IDL updates several times the value for
the same key, the functions will ensure that only the last value is send to
the server, instead of multiple updates. Or, if the client inserts a key-value,
and later on deletes the key before committing the transaction, then both
actions cancel out and no map operation is send for that key.

To keep track of the desired map operations on each transaction, a list of map
operations (struct map_op_list) is created for every column on the row on which
a map operation is performed. When a new map operation is requested on the same
column, the corresponding map_op_list is checked to verify if a previous
operations was performed on the same key, on the same transaction. If there is
no previous operation, then the new operation is just added into the list. But
if there was a previous operation on the same key, then the previous operation
is collapsed with the new operation into a single operation that preserves the
final result if both operations were to be performed sequentially. This design
keep a small memory footprint during transactions.

When a transaction is committed, the map operations lists are checked and
all map operations that belong to the same map are grouped together into a
single JSON RPC "mutate" operation, in which each map_op is transformed into
the necessary "insert" or "delete" mutators. Then the "mutate" operation is
added to the operations that will be send to the server.

Once the transaction is finished, all map operation lists are cleared and
deleted, so the next transaction starts with a clean board for map operations.

Using different structures and logic to handle map operations, instead of
trying to force the current structures (like 'old' and 'new' datums in the row)
to handle then, ensures that map operations won't mess up with the current
logic to generate JSON messages for other operations, avoids duplicating the
whole map for just a few changes, and is faster for insert and delete
operations, because there is no need to maintain the invariants in the 'new'
datum.

Signed-off-by: Edward Aymerich <edward.aymerich at hpe.com>
Signed-off-by: Arnoldo Lutz <arnoldo.lutz.guevara at hpe.com>
Co-authored-by: Arnoldo Lutz <arnoldo.lutz.guevara at hpe.com>
[blp at ovn.org made style changes and factored out error checking]
Signed-off-by: Ben Pfaff <blp at ovn.org>


  Commit: 010fe7ae80f95a764d9049f34c872fee6ac89a86
      https://github.com/openvswitch/ovs/commit/010fe7ae80f95a764d9049f34c872fee6ac89a86
  Author: Edward Aymerich <edward.aymerich at hpe.com>
  Date:   2016-05-18 (Wed, 18 May 2016)

  Changed paths:
    M ovsdb/ovsdb-idlc.in

  Log Message:
  -----------
  ovsdb-idlc.in: Autogenerate partial map updates functions.

Code inserted that autogenerates corresponding map functions to set and
delete elements in map columns.
Inserts description to the functions that are autogenerated.

Signed-off-by: Edward Aymerich <edward.aymerich at hpe.com>
Signed-off-by: Arnoldo Lutz <arnoldo.lutz.guevara at hpe.com>
Co-authored-by: Arnoldo Lutz <arnoldo.lutz.guevara at hpe.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>


  Commit: 7251075c245675cbff20800291435818e60318ae
      https://github.com/openvswitch/ovs/commit/7251075c245675cbff20800291435818e60318ae
  Author: Edward Aymerich <edward.aymerich at hpe.com>
  Date:   2016-05-18 (Wed, 18 May 2016)

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

  Log Message:
  -----------
  tests: Add test for partial map updates.

Insert basic functionality for testing partial map updates
and add a new test table named "simple2".

Signed-off-by: Edward Aymerich <edward.aymerich at hpe.com>
Signed-off-by: Arnoldo Lutz <arnoldo.lutz.guevara at hpe.com>
Co-authored-by: Arnoldo Lutz <arnoldo.lutz.guevara at hpe.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>


Compare: https://github.com/openvswitch/ovs/compare/cae7529c16e3...7251075c2456


More information about the git mailing list