https://bugzilla.redhat.com/show_bug.cgi?id=612771https://bugzilla.redhat.com/attachment.cgi?id=432203&action=diffhttps://bugzilla.redhat.com/attachment.cgi?id=432203&action=edit
(In reply to comment #7)
> > (From update of attachment 431976 [details])
> > An entry may already have an nsUniqueID attribute - in that case, we should use
> > it. I was hoping we could use an attribute already in the entry for the
> > renaming - I guess when you're not using replication, the nsUniqueID is not
> > generated? If so, perhaps we could just use entryid instead of nsuniqueid?
>
Thanks, Rich! Fixed it. I confirmed nsUniqueId is always assigned regardless
of the replication use. Now, upgradednformat utility picks up UUID from the
entry and add nsuniqueid=<UUID> to the DN if duplicated DN is found. (The
upgrade fails if UUID is not found in the entry, which should not happen.)
Since it always uses the existing UUID, we don't have to reindex nsuniqueid.
Thus, I removed the following special treatment for nsuniqueid since it is not
needed any longer.
> > Also, at
> > https://bugzilla.redhat.com/attachment.cgi?id=431976&action=diff#a/ldap/ser…
> > - nsuniqueid will never have a DN value?
>
Thanks,
--noriko
https://bugzilla.redhat.com/show_bug.cgi?id=612771https://bugzilla.redhat.com/attachment.cgi?id=431976&action=diffhttps://bugzilla.redhat.com/attachment.cgi?id=431976&action=edit
Thanks to Rich for the good idea to enhance the procedure.
> What if we do what replication conflicts do and rename the entry to
> nsuniqueid=<uuid>+oldDN? or use some other unique name?
Based upon the suggestion by Rich, in case duplicated DNs are found, the second
DN is renamed to nsuniqueid=<uuid>+oldDN (import_foreman in import-threads.c).
In addition, there was a bug to handle multi-valued RDNs in
slapi_dn_normalize_ext. In case multi-valued RDN appears with DN value (e.g.,
nsuniqueid=<uuid>+cn=uid\=<uid>\,o\=<org>,dc=<dc>),
it was not normalized properly. Introduced additional rdn_av_stack
(subinitial_rdn_av_stack) for the nested DN value.
https://bugzilla.redhat.com/show_bug.cgi?id=612771https://bugzilla.redhat.com/attachment.cgi?id=431626&action=diffhttps://bugzilla.redhat.com/attachment.cgi?id=431626&action=edithttp://directory.fedoraproject.org/wiki/Upgrade_to_New_DN_Format#Another_Up…
Fix Description:
This patch fixes the upgradednformat utility to eliminate the
duplicated DNs found in the upgrading time. If DN: attr0=value0,
attr1=value1,...,attrn=valuen exists in the DB and identical DN
is found, the second DN is renamed to attr0=dup_value0,attr1=value1,
...,attrn=valuen. The modification is logged in the error log.
Detailed Change Description:
70upgradednformat.pl - replaced the server up/down checking code
with the conservative algorithm.
ancestorid.c - When creating a new ancestorid index file, changed
to truncate (initialize) the file.
back-ldbm.h - introduced a new macro DBOPEN_TRUNCATE to specify
the truncated db open (used for opening ancestorid)
introduced an error code LDBM_ERROR_FOUND_DUPDN to
represent the duplicated DN error.
dblayer.c - added a code to open a db file with the truncated
option (DB_TRUNCATE).
import-threads.c - instead of e_deleted_attrs, use e_aux_attrs
to stash attributes to delete in the worker
thread and/or entrydn and parentid foreman
function.
upgradedn_producer - for the UPGRADEDNFORMAT mode, use
obsolete dn normalizer to distinguish
the duplicated DNs.
foreman_do_parentid - in case parent& child relationship
has been updated in the upgradednformat,
takes care of the changes.
foreman_do_entrydn - if a duplicated DN is detected, return
the specific error code LDBM_ERROR_FOUND_DUPDN.
import_foreman - if received LDBM_ERROR_FOUND_DUPDN
from foreman_do_entrydn, replace the DN
to<leaf_attr>=dup_<leaf_value>,<rest> and
pass it to foreman_do_entrydn again.
- enabled the parentid index update
(foreman_do_parentid) for the
UPGRADEDNFORMAT case, too.
import.c - for the UPGRADEDNFORMAT mode, only indexes which
associates with the DN syntax attribute were
reindexed. CN and OU are added to the list.
import.h - added a macro IMPORT_ADD_OP_ATTRS_SAVE_OLD_PID to
specify the original parentid is stored in e_aux_attrs
before replaced with the new one, which is used in
foreman_do_parentid.
ldif2ldbm.c - add_op_attrs - if the macro IMPORT_ADD_OP_ATTRS_SAVE_OLD_PID
is passed, the parentid is set to e_aux_attrs.
ldbm_back_ldbm2index - initialized the local txn object.
dn.c - resurrected once dead old slapi_dn_normalize as
slapi_dn_normalize_original used in upgradedn_producer.
entry.c - create an entry using the obsolete dn normalizer
slapi_dn_normalize_original if
SLAPI_STR2ENTRY_USE_OBSOLETE_DNFORMAT flag is passed.
slap.h - introduced e_aux_attrs to Slapi_Entry
slapi-plugin.h - defined a macro SLAPI_STR2ENTRY_USE_OBSOLETE_DNFORMAT