Skip to content
  • Rodriguez Betancourt, Esteban's avatar
    ovsdb: Weak references performance fix · aa1fc801
    Rodriguez Betancourt, Esteban authored
    Prevents the cloning of rows with outgoing or incoming weak references when
    those rows aren't being modified.
    
    It improves the OVSDB Server performance when many rows with weak references
    are involved in a transaction.
    
    In the original code (dst_refs is created from scratch):
    
    old->dst_refs = all the rows that weak referenced old
    
    new->dst_refs = all the rows that weak referenced old and are still weak
    +referencing new + rows in the transaction that weak referenced new
    
    In the patch (dst_refs incrementally built):
    Old->dst_refs = all the rows that weak referenced old
    
    Ideally, but expansive to calculate:
    New->dst_refs = old->dst_refs - "weak references removed within this TXN" +
    +"weak references created within this TXN"
    
    What this patch implements:
    New->dst_refs = old->dst_refs - "weak references in old rows in TXN" + "weak
    +references in new rows in TXN"
    
    The resulting sets should be equal in both cases.
    
    We do some more optimizations:
    
    - If we know that the transactions must be successful at some point then,
      instead of cloning dst_refs we could just move the elements between
      the lists.
    
    - At that point we lost the rollback feature, but we aren't going to need
      it anyway (note that we didn't really touch the src_refs part).
    
    - The references in dst_refs must point to new instead than old.
      Previously we iterated over all the weak references in dst_refs
      to change that pointer, but using an UUID is easier, and prevents
      that iteration completely.
    
    For some more commentary, see:
    http://openvswitch.org/pipermail/dev/2016-July/074840.html
    
    
    
    Signed-off-by: default avatarEsteban Rodriguez Betancourt <estebarb@hpe.com>
    Signed-off-by: default avatarBen Pfaff <blp@ovn.org>
    aa1fc801