The following changes fix a bug in the clearing of the replication server db that make the clearing sometimes fail silently .
Particularly Berkeley DB requires to close the db and any reference to the db handle released before to truncate the db.
That requires to lock the db when it is closed/cleared with a limited impact on the performances in the other cases.
A RW lock is added on the db : every thread using the db takes/releases the READ lock before /after usage. That still allow these threads to run concurrently and prevent a big impact on performances. Every thread closing the db
(shutdown or clear) takes/releases the WRITE lock before/after the closure.
The changes also include a fix on the search scope processing in the replication backend.
Test:
------
In addition, the generation ID unit test has been improved with some check on the replication server db content that go through these 2 fixes. Successfully ran nightly build.