ldap/admin/src/scripts/80upgradednformat.pl | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
New commits: commit 13b9aff869a6220b5f864b3e23c3eb396399064c Author: Noriko Hosoi nhosoi@redhat.com Date: Tue Oct 26 13:25:42 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/80upgradednformat.pl b/ldap/admin/src/scripts/80upgradednformat.pl index cb44b85..1bcebba 100644 --- a/ldap/admin/src/scripts/80upgradednformat.pl +++ b/ldap/admin/src/scripts/80upgradednformat.pl @@ -122,6 +122,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 -)") || @@ -161,6 +162,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