ldap/admin/src/scripts/template-dn2rdn.in | 11 ++---------
ldap/servers/slapd/back-ldbm/ldif2ldbm.c | 10 +++++++++-
2 files changed, 11 insertions(+), 10 deletions(-)
New commits:
commit 062c4d9df34998ac15817406e73a6b0fe6928120
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Aug 10 13:17:47 2011 -0600
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
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 87048c9..4427a43 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");