Browse Source

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: master
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
Rich Megginson 14 years ago
parent
commit
062c4d9df3

+ 2 - 9
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" "$@"

+ 9 - 1
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");