[ovs-dev] [Partial-Update-Map-Columns 0/7] Add Initial code for Partia-map-columns funtionality

Ben Pfaff blp at ovn.org
Fri Mar 11 05:05:56 UTC 2016


I understand the intention now.  The key seems to be your final
paragraph:

    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.

What I don't understand yet is the perceived problem with using the old
and new data to handle map operations.  When I've thought about
implementing a similar feature myself, I had basically concluded that
the following was a reasonable approach:

    * Add another bitmap to each IDL row, one bit per column.

    * Retain the current functions to set columns.  If the client calls
      such a function, set the column's bit to 0 for the row.

    * Add a function to insert a key into a set column (or a key-value
      pair into a map column) and one to delete a key from a set column.
      Ordinarily, the implementation of the function would add or delete
      the key to/from the "new" datum and set the column's bit to 1.

Then, when the transaction gets committed, output a column with a bit
set to 0 as an "update" operation, or one with a bit set to 1 as a
"mutate" operation.  I think there might be some extra details to deal
with situations where the IDL client actually does a combination of
"set" and "insert/delete" operations for a single column, but is there a
real reason this simpler doesn't work?

Thanks,

Ben.

On Thu, Mar 03, 2016 at 02:40:32AM +0000, Aymerich, Edward wrote:
> Hello,
> 
> 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.
> 
> 
> Regards,
> 
> Edward Aymerich
> Networking Software Engineer
> 
> edward.aymerich at hpe.com
> 
> Building 8, Ultra Park
> Heredia, Costa Rica
> hpe.com
> 
> -----Original Message-----
> From: dev [mailto:dev-bounces at openvswitch.org] On Behalf Of Ben Pfaff
> Sent: viernes 26 de febrero de 2016 03:29 p.m.
> To: Lutz, Arnoldo
> Cc: dev at openvswitch.org
> Subject: Re: [ovs-dev] [Partial-Update-Map-Columns 0/7] Add Initial code for Partia-map-columns funtionality
> 
> On Mon, Feb 22, 2016 at 07:58:16PM +0000, Lutz, Arnoldo wrote:
> > 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 the frequency at which these values are 
> > updated is high that making the cost of the modifications to become 
> > high in terms of time and bandwidth.
> > 
> > In this solution, the ovsdb-idl code is modified to use mutate 
> > operation, already implemented in the server code, to allow that kind 
> > of partial modifications on map columns. The functionality is exposed 
> > to clients in the vswitch idl.
> > 
> > Arnoldo Lutz (3):
> >       Add code to create partial map functions in autogenerated code
> >       Add documentation on how to use partial update of map columns
> >       Adds usage help on command to test of partial update of map 
> > column
> > 
> > Edward Aymerich (3):
> >       Add functionality to skeleton functions for Partial Map Update
> >       Add and correct functionality of Partial Update Map Columns
> >       Add fixes, improvements, refactors and cleans code
> 
> Thanks for working on this.  It seems like a useful feature.
> 
> I've started skimming through the series.  Before I get into all the details, though, please help me with a general question.  It seems to me like this is actually a pretty simple thing to do.  The idea is that if the client just wants to add or remove key-value pairs, instead of replacing the entire map, then the IDL should be able to send operations to do that.  I can see why this requires a new bit-vector, to distinguish columns where the client wants to add/remove columns from those where the client wants to replace the map, but it seems like the series add a lot more infrastructure than that.  Can you explain the overall design?
> 
> Thanks,
> 
> Ben.
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list