cac1b0a Ticket #48755 - moving an entry could make the online init fail

Authored and Committed by nhosoi 2 years ago
    Ticket #48755 - moving an entry could make the online init fail
    
    Bug Description: Online init (aka Total update, bulk import) scans the
    primary id2entry db in the order of ID.  If Entry A is moved under a
    new superior Entry B which was generated after Entry A, when Entry A
    is sent to a consumer using online init, its parent entry does not
    exist on the consumer and the online init fails.
    
    Fix Description:
    - Added a command BACK_INFO_IS_ENTRYRDN to slapi_back_get_info, which
      returns the status of entryrdn switch maintained in the backend.
    
    - If slapi_backend_get_info(BACK_INFO_IS_ENTRYRDN) returns true for
      the replicated backend, repl5_tot_run searches the entry with the
      filter:
        (parentid>=1)
      instead of:
        (|(objectclass=ldapsubentry)(objectclass=nstombstone)(nsuniqueid=*))".
      The filter MUST be this single range filter since the IDList created
      for this bulk-import is not sorted by ID, but in the order of parentid.
    
    - Added a new flag OP_FLAG_BULK_IMPORT to the operation.  Setting the
      flag implies to skip the internal operations such as eliminating
      ldapsubentry from the search results or a filter check.
    
    - In addition, idl_new_range_fetch is modified so that ...
      * A range search for parentid ignores nsslapd-idlistscanlimit by
        setting SLAPI_OP_RANGE_NO_ALLIDS as well as it skips sorting the
    	IDlist by ID by setting SLAPI_OP_RANGE_NO_IDL_SORT.
      * In case SLAPI_OP_RANGE_NO_IDL_SORT is set, idl_new_range_fetch
        checks whether the key (in this case parentid) is in the IDlist.
    	If it exists, the ID is appended.  If it does not, the ID is in
    	the leftover list and appended when the parent ID is found in the
    	IDlist.
    
    - Increased the version of rdn-format-# in DBVERSION to 3.
    
    - Upgrade script 91reindex.pl.in is added which reindex the parentid
      index file in the integer order if the version of rdn-format-# in
      DBVERSION is less than 3.
    
    - Notes: In case entryrdn is used (nsslapd-subtree-rename-switch: on),
      all the type of entries including the tombstone entry and the ldap-
      subentry are indexed with parentid.
    
    - Another notes: This special treatment is enabled only when nsslapd-
      subtree-rename-switch is on.  If entrydn is used instead of entryrdn,
      there is no possibility to establish the order that child comes first.
      Plus, to replace nsslapd-subtree-rename-switch on with off, the main
      db file id2entry.db needs to be recreated so that each entry stores
      DN in it.  It requires export then import, which corrects the order
      of the entries and the order problem disappears.
    
    https://fedorahosted.org/389/ticket/48755
    
    Reviewed by mreynolds@redhat and wibrown@redhat.com (Thank you, Mark and William!!)
    Also, thanks to lkrispen@redhat.com and tbordaz@redhat.com for their discussion!
    
    (cherry picked from commit f50e8ec950980af70d892cc45eac07684d6721a5)
    
        
file modified
+2 -1
file modified
+2 -1
file modified
+2 -2
file modified
+4 -0