3088c7e Ticket #47523 - Set up replcation/agreement before initializing the sub suffix, the sub suffix is not found by ldapsearch

Authored and Committed by nhosoi 5 years ago
    Ticket #47523 - Set up replcation/agreement before initializing the sub suffix, the sub suffix is not found by ldapsearch
    
    Bug description: If a replication is configured against a backend
    before initializing the backend with a suffix entry, an RUV entry
    is inserted first with the entryid 1. The RUV entry's entryrdn is
    added to the entryrdn index with a suffix entry which is a parent
    entry of the RUV entry having a temporary entryid 0, which was to
    be replaced with the real entryid when the real suffix entry is
    added.  But the replacement code was not executed.
    
    Fix description: When a real suffix is added to the entryrdn index,
    it returns DB_KEYEXIST, which used to be ignored by resetting 0
    (== SUCCESS).  This patch returns DB_KEYEXIST to the caller and let
    _entryrdn_insert_key use the info to replace the temporary entryid
    with the real one.  The error code is ignored by the other callers.
    
    https://fedorahosted.org/389/ticket/47523
    
    Reviewed by nkinder (Thanks!).
    (cherry picked from commit e6eab21920a0374eb356da3d1f041312c6857ecd)
    (cherry picked from commit 6b35dc7b04da023cc14045cc6dd1f5e304cf265f)
    (cherry picked from commit df1f0ed301db6404a8df479a051416da6c8b2738)