23a3ff6 Ticket 48179 - Starting a replica agreement can lead to

Authored and Committed by mreynolds 4 years ago
    Ticket 48179 - Starting a replica agreement can lead to
     deadlock
    
    Bug Description:  When starting a replica agreement and setting the agmt maxcsn
                      a deadlock can occur with another op updating nsuniqueid index.
                      When setting the agmt maxcsn the server searches for the tombstone
                      ruv which uses the nsuniqueid index, and it does this while holding
                      the repl agmt lock.  If another thread is doing a delete and
                      writing to the change log, it can also grab a write lock on the
                      nsuniqueid index, before it attempts to grab the agmt lock.  This
                      can lead to a deadlock if the timing is right.
    
    Fix Description:  When starting the agmt and setting the agmt maxcsn, search/get
                      the tombstone ruv before we take the repl agmt lock.
    
    https://fedorahosted.org/389/ticket/48179
    
    Reviewed by: nhosoi(Thanks!)
    
    (cherry picked from commit eb3086dcb0c56a23d6cee00a12f38b2584fe59a2)