Ticket 48179 - Starting a replica agreement can lead to
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.
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit eb3086dcb0c56a23d6cee00a12f38b2584fe59a2)