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!)