[389-commits] ldap/admin ldap/servers

Richard Allen Megginson rmeggins at fedoraproject.org
Tue Jan 31 00:29:17 UTC 2012


 ldap/admin/src/scripts/91subtreereindex.pl |   14 ++++++++++----
 ldap/servers/slapd/back-ldbm/back-ldbm.h   |    2 +-
 ldap/servers/slapd/back-ldbm/ldif2ldbm.c   |   21 ++++++++++++++++++---
 3 files changed, 29 insertions(+), 8 deletions(-)

New commits:
commit 6037bfe7592f7953a813c6e10f31e6aa4b20ecdb
Author: Rich Megginson <rmeggins at redhat.com>
Date:   Fri Jan 27 17:09:06 2012 -0700

    Ticket #273 - ruv tombstone searches don't work after reindex entryrdn
    
    https://fedorahosted.org/389/ticket/273
    Resolves: Ticket #273
    Bug Description: ruv tombstone searches don't work after reindex entryrdn
    Reviewed by: nhosoi (Thanks!)
    Branch: master
    Fix Description: When indexing entryrdn, if there is no parentid in the
    entry, assume the parent is the suffix entry.  It appears the only case
    where there was no parentid in the entry is the ruv tombstone case.
    Bump the database rdn-format version to 2.
    Platforms tested: RHEL6 x86_64
    Flag Day: no
    Doc impact: no

diff --git a/ldap/admin/src/scripts/91subtreereindex.pl b/ldap/admin/src/scripts/91subtreereindex.pl
index f5aee9f..c512435 100644
--- a/ldap/admin/src/scripts/91subtreereindex.pl
+++ b/ldap/admin/src/scripts/91subtreereindex.pl
@@ -51,11 +51,14 @@ sub runinst {
                 if ($_ =~ /rdn-format-1/) {
                     $is_rdn_format = 2;
                 }
+                if ($_ =~ /rdn-format-2/) {
+                    $is_rdn_format = 3;
+                }
             }
         }
         close DBVERSION;
 
-        if (2 == $is_rdn_format) {
+        if (3 == $is_rdn_format) {
             return (); # DB already has the new rdn format.
         }
 
@@ -95,11 +98,14 @@ sub runinst {
                     if ($_ =~ /rdn-format-1/) {
                         $is_rdn_format = 2;
                     }
+                    if ($_ =~ /rdn-format-2/) {
+                        $is_rdn_format = 3;
+                    }
                 }
             }
             close DBVERSION;
     
-            if (2 == $is_rdn_format) {
+            if (3 == $is_rdn_format) {
                 # DB already has the new rdn format.
                 goto NEXT;
             }
@@ -117,7 +123,7 @@ sub runinst {
                 if (!open(DBVERSION, "> $dbversion1")) {
                     push @errs, ['error_opening_file', $dbversion1, $!];
                 } else {
-                    $versionstr =~ y/rdn\-format/rdn\-format\-1/;
+                    $versionstr =~ y/rdn\-format/rdn\-format\-2/;
                     print DBVERSION $versionstr . "\n";
                     close DBVERSION;
                 }
@@ -131,7 +137,7 @@ NEXT:
     if (!open(DBVERSION, "$dbversion0")) {
         push @errs, ['error_opening_file', $dbversion0, $!];
     } else {
-        $dbversionstr = y/rdn\-format/rdn\-format\-1/;
+        $dbversionstr = y/rdn\-format/rdn\-format\-2/;
         print DBVERSION $versionstr . "\n";
         close DBVERSION;
     }
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index 3a92f59..f11ec82 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -167,7 +167,7 @@ typedef unsigned short u_int16_t;
 #define BDB_BACKEND     "libback-ldbm" /* This backend plugin */
 #define BDB_NEWIDL      "newidl"       /* new idl format */
 #define BDB_RDNFORMAT   "rdn-format"   /* Subtree rename enabled */
-#define BDB_RDNFORMAT_VERSION   "1"    /* rdn-format version (by default, 0) */
+#define BDB_RDNFORMAT_VERSION   "2"    /* rdn-format version (by default, 0) */
 #define BDB_DNFORMAT    "dn-4514"      /* DN format RFC 4514 compliant */
 
 #define DBVERSION_NEWIDL      0x1
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index b430f9a..b4bdc52 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -1678,6 +1678,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
     int              index_ext = 0;
     struct vlvIndex  *vlvip = NULL;
     back_txn         txn;
+    ID               suffixid = NOID; /* holds the id of the suffix entry */
 
     LDAPDebug( LDAP_DEBUG_TRACE, "=> ldbm_back_ldbm2index\n", 0, 0, 0 );
     if ( g_get_shutdown() || c_get_shutdown() ) {
@@ -2021,9 +2022,23 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                 /* get a parent pid */
                 rc = get_value_from_string((const char *)data.dptr,
                                                    LDBM_PARENTID_STR, &pid_str);
-                if (rc) {
-                    rc = 0; /* assume this is a suffix */
-                } else {
+                if (rc || !pid_str) {
+                    /* see if this is a suffix or some entry without a parent id
+                       e.g. a tombstone entry */
+                    Slapi_DN sufdn;
+
+                    slapi_sdn_init_dn_byref(&sufdn, rdn);
+                    if (slapi_be_issuffix(be, &sufdn)) {
+                        rc = 0; /* is a suffix */
+                        suffixid = temp_id; /* this is the ID of a suffix entry */
+                    } else {
+                        /* assume the parent entry is the suffix entry for this backend
+                           set pid to the id of that entry */
+                        pid = suffixid;
+                    }
+                    slapi_sdn_done(&sufdn);
+                }
+                if (pid_str) {
                     pid = (ID)strtol(pid_str, (char **)NULL, 10);
                     slapi_ch_free_string(&pid_str);
                     /* if pid is larger than the current pid temp_id,




More information about the 389-commits mailing list