From af9b0d5d5f458d6c36a93556d02ad179c4cbda70 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Aug 11 2011 19:58:01 +0000 Subject: Bug 729369 - upgrade DB to upgrade from entrydn to entryrdn format is not working. https://bugzilla.redhat.com/show_bug.cgi?id=729369 Resolves: bug 729369 Bug Description: upgrade DB to upgrade from entrydn to entryrdn format is not working. Reviewed by: nhosoi (Thanks!) Branch: RHEL-6_1-Z Fix Description: Looks like the test to see if upgrade should proceed is only looking at the old IDL to new IDL case, not the upgrade from earlier versions of bdb, nor the upgrade DN to RDN case. Also, there was no way to pass the -f (force) flag to dn2rdn to force the conversion. Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: no (cherry picked from commit 062c4d9df34998ac15817406e73a6b0fe6928120) --- diff --git a/ldap/admin/src/scripts/template-dn2rdn.in b/ldap/admin/src/scripts/template-dn2rdn.in index a9402fd..8e85db6 100755 --- a/ldap/admin/src/scripts/template-dn2rdn.in +++ b/ldap/admin/src/scripts/template-dn2rdn.in @@ -19,12 +19,5 @@ SHLIB_PATH=$LD_LIBRARY_PATH export SHLIB_PATH cd {{SERVERBIN-DIR}} -if [ $# -eq 0 ] -then - bak_dir={{BAK-DIR}}/reindex_`date +%Y_%m_%d_%H_%M_%S` - ./ns-slapd upgradedb -D {{CONFIG-DIR}} -r -a "$bak_dir" -else - echo "Usage: dn2rdn" - exit 1 -fi - +bak_dir={{BAK-DIR}}/reindex_`date +%Y_%m_%d_%H_%M_%S` +./ns-slapd upgradedb -D {{CONFIG-DIR}} -r -a "$bak_dir" "$@" diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c index fd7934a..62d7b85 100644 --- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c +++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c @@ -2652,12 +2652,20 @@ int ldbm_back_upgradedb(Slapi_PBlock *pb) inst = (ldbm_instance *)object_get_data(inst_obj); if (!(up_flags & SLAPI_UPGRADEDB_FORCE)) { /* upgrade idl to new */ + int need_upgrade = 0; li->li_flags |= LI_FORCE_MOD_CONFIG; /* set new idl */ ldbm_config_internal_set(li, CONFIG_IDL_SWITCH, "new"); /* First check the dbversion */ rval = check_db_inst_version(inst); - if (!(DBVERSION_NEED_IDL_OLD2NEW & rval)) + need_upgrade = (DBVERSION_NEED_IDL_OLD2NEW & rval); + if (!need_upgrade && (up_flags & SLAPI_UPGRADEDB_DN2RDN)) { + need_upgrade = (rval & DBVERSION_NEED_DN2RDN); + } + if (!need_upgrade) { + need_upgrade = (rval & (DBVERSION_UPGRADE_3_4|DBVERSION_UPGRADE_4_4)); + } + if (!need_upgrade) { slapi_log_error(SLAPI_LOG_FATAL, "upgrade DB", "Index version is up-to-date\n");