ldap/admin/src/scripts/70upgradednformat.pl | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
New commits: commit 1176d3fe353c629c00652ef5a2a90f44f51efbc2 Author: Noriko Hosoi nhosoi@kiki-rhel5.usersys.redhat.com Date: Tue Oct 26 12:29:28 2010 -0700
Bug 644608 - RHDS 8.1->8.2 upgrade fails to properly migrate ACIs
https://bugzilla.redhat.com/show_bug.cgi?id=644608
Description: Adding the ancestorid fix code to ##upgradednformat.pl. The upgrade utility upgradednformat in the previous version could have broken the ancestorid index file. The ID list in the updated index value may not be in the ascendant order. This patch checks the ID order in the ID lists. Once it detects the disorder, it reindexes the corrupted ancestorid.
diff --git a/ldap/admin/src/scripts/70upgradednformat.pl b/ldap/admin/src/scripts/70upgradednformat.pl index 8364bdd..16d18ec 100644 --- a/ldap/admin/src/scripts/70upgradednformat.pl +++ b/ldap/admin/src/scripts/70upgradednformat.pl @@ -106,6 +106,7 @@ sub runinst { # -1 -- error my $escapes = system("$upgradednformat -n $backend -a $dbinstdir -N"); if (0 == $escapes) { + # need to upgrade dn format my $rc = 0;
if (system("cd $pdbdir; tar cf - db/DBVERSION | (cd $dbinstdir; tar xf -)") || @@ -145,6 +146,40 @@ sub runinst { rmdir("$dbinstdir/dnupgrade"); return ("error_cant_convert_db", $backend, $rc); } + } else { + # already upgraded or an error occurred. + # check ancestorid to see if it has not-sorted ID list or not. + my $ancestorid = $dbinstdir . "/ancestorid.db4"; + if (-e "$ancestorid") { + my $disorder = 0; + open(ANCESTOR, "/usr/bin/dbscan -f $ancestorid -r |"); + while (<ANCESTOR>) { + if (!/^=[0-9]*/) { + chomp($_); + my @IDs = split(/ | /, $_); + # print "ID count: $#IDs\n"; + my $lasti = $#IDs; + for (my $i = 1; $i < $lasti; $i++) { + if ($IDs[$i] >= $IDs[$i + 1]) { + $disorder = 1; + last; + } + } + # print "Result: $disorder \n"; + if ($disorder) { + last; + } + } + } + close(ANCESTOR); + + # ancestorid index is in disorder; need to reindex it. + if ($disorder) { + print "The ancestorid index in $backend is in disorder; Reindexing $ancestorid.\n"; + my $reindex = $instancedir . "/db2index"; + my $rc = system("$reindex -n $backend -t ancestorid"); + } + } } }
389-commits@lists.fedoraproject.org