Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 150603 Details for
Bug 233215
verify-db.pl still assumes the db dir is always in the instance dir
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
cvs diff template-verify-db.pl.in
verify-db.diff (text/plain), 7.69 KB, created by
Noriko Hosoi
on 2007-03-21 17:28:19 UTC
(
hide
)
Description:
cvs diff template-verify-db.pl.in
Filename:
MIME Type:
Creator:
Noriko Hosoi
Created:
2007-03-21 17:28:19 UTC
Size:
7.69 KB
patch
obsolete
>Index: template-verify-db.pl.in >=================================================================== >RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-verify-db.pl.in,v >retrieving revision 1.6 >diff -t -w -U4 -r1.6 template-verify-db.pl.in >--- template-verify-db.pl.in 12 Feb 2007 19:55:10 -0000 1.6 >+++ template-verify-db.pl.in 21 Mar 2007 17:12:32 -0000 >@@ -37,43 +37,85 @@ > # All rights reserved. > # END COPYRIGHT BLOCK > # > >+sub usage >+{ >+ print "Usage: $0 [ -a <fullpath_to_db_dir> ]\n"; >+} >+ >+# getDbDir checks up to 4 levels of db dirs >+# e.g., <server_inst_dir>/db/<backend_instance_dir>/<subdir> > sub getDbDir > { > (my $here) = @_; > my @dbdirs = (); > >- opendir(DIR, $here) or die "can't opendir $here : $!"; >- while (defined($dir = readdir(DIR))) >+ opendir(DIR0, $here) or die "can't opendir $here : $!"; >+ while (defined(my $file0 = readdir(DIR0))) > { >- my $thisdir; >- if ("$here" eq ".") >+ if ( "$file0" eq "\." || "$file0" eq "\.\." ) > { >- $thisdir = $dir; >+ ; > } >- else >+ elsif ( "$file0" eq "DBVERSION" ) > { >- $thisdir = $here . "{{SEP}}" . $dir; >+ $#dbdirs++; >+ $dbdirs[$#dbdirs] = $here; > } >- if (-d $thisdir) >+ elsif ( -d $here . "{{SEP}}" . $file0 ) > { >- if (!($thisdir =~ /\./)) >+ opendir(DIR1, $here . "{{SEP}}" . $file0) or die "can't opendir $file0 : $!"; >+ while (defined(my $file1 = readdir(DIR1))) > { >- opendir(SUBDIR, "$thisdir") or die "can't opendir $thisdir : $!"; >- while (defined($file = readdir(SUBDIR))) >+ if ( "$file1" eq "\." || "$file1" eq "\.\." ) > { >- if ($file eq "DBVERSION") >+ ; >+ } >+ elsif ( "$file1" eq "DBVERSION" ) > { > $#dbdirs++; >- $dbdirs[$#dbdirs] = $thisdir; >+ $dbdirs[$#dbdirs] = $here . "{{SEP}}" . $file0; > } >+ elsif ( -d $here . "{{SEP}}" . $file0 . "{{SEP}}" . $file1 ) >+ { >+ opendir(DIR2, $here . "{{SEP}}" . $file0 . "{{SEP}}" . $file1) or die "can't opendir $file1 : $!"; >+ while (defined(my $file2 = readdir(DIR2))) >+ { >+ if ( "$file2" eq "\." || "$file2" eq "\.\." ) >+ { >+ ; > } >- closedir(SUBDIR); >+ elsif ("$file2" eq "DBVERSION") >+ { >+ $#dbdirs++; >+ $dbdirs[$#dbdirs] = $here . "{{SEP}}" . $file0 . "{{SEP}}" . $file1; > } >+ elsif ( -d $here . "{{SEP}}" . $file0 . "{{SEP}}" . $file1 . "{{SEP}}" . $file2 ) >+ { >+ opendir(DIR3, $here . "{{SEP}}" . $file0 . "{{SEP}}" . $file1 . "{{SEP}}" . $file2) or die "can't opendir $file1 : $!"; >+ while (defined(my $file3 = readdir(DIR3))) >+ { >+ if ( "$file3" eq "\." || "$file3" eq "\.\." ) >+ { >+ ; > } >+ elsif ("$file3" eq "DBVERSION") >+ { >+ $#dbdirs++; >+ $dbdirs[$#dbdirs] = $here . "{{SEP}}" . $file0 . "{{SEP}}" . $file1 . "{{SEP}}" . $file2; > } >- closedir(DIR); >+ } >+ closedir(DIR3); >+ } >+ } >+ closedir(DIR2); >+ } >+ } >+ closedir(DIR1); >+ } >+ } >+ closedir(DIR0); > > return \@dbdirs; > } > >@@ -101,24 +143,43 @@ > } else { > $NULL = "/dev/null"; > } > >+my $i = 0; >+$startpoint = ""; >+while ($i <= $#ARGV) { >+ if ( "$ARGV[$i]" eq "-a" ) { # path to search the db files >+ $i++; $startpoint = $ARGV[$i]; >+ } else { >+ &usage; exit(1); >+ } >+ $i++; >+} >+ > print("*****************************************************************\n"); > print("verify-db: This tool should only be run if recovery start fails\n" . > "and the server is down. If you run this tool while the server is\n" . > "running, you may get false reports of corrupted files or other\n" . > "false errors.\n"); > print("*****************************************************************\n"); > >+if ( "$startpoint" eq "" ) { >+ $startpoint = "{{DB-DIR}}"; >+} > # get dirs having DBVERSION >-my $dbdirs = getDbDir("."); >+my $dbdirs = getDbDir($startpoint); > my $prefix = "{{DS-ROOT}}"; > > $ENV{'PATH'} = "$prefix@db_bindir@:$prefix/usr/bin:@db_bindir@:/usr/bin"; > $ENV{'LD_LIBRARY_PATH'} = "@db_libdir@:@libdir@"; > $ENV{'SHLIB_PATH'} = "@db_libdir@:@libdir@"; > >-for (my $i = 0; $i < @$dbdirs; $i++) >+# Check transaction logs by db_printlog >+for (my $i = 0; "$$dbdirs[$i]" ne ""; $i++) >+{ >+ my $logfile = getLastLogfile($$dbdirs[$i]); >+ >+ if ( "$$logfile" ne "" ) > { > # run db_printlog -h <dbdir> for each <dbdir> > print "Verify log files in $$dbdirs[$i] ... "; > open(PRINTLOG, "db_printlog -h $$dbdirs[$i] 2>&1 1> $NULL |"); >@@ -142,23 +203,23 @@ > print "Good\n"; > } > else > { >- my $logfile = getLastLogfile($$dbdirs[$i]); > print "Log file(s) in $$dbdirs[$i] could be corrupted.\n"; > print "Please delete a log file $$logfile, and try restarting the server.\n"; > } > } >+} > >-for (my $i = 0; $i < @$dbdirs; $i++) >+# Check db files by db_verify >+for (my $i = 0; "$$dbdirs[$i]" ne ""; $i++) > { >- # changelog > opendir(DB, $$dbdirs[$i]) or die "can't opendir $$dbdirs[$i] : $!"; > while (defined($db = readdir(DB))) > { > if ($db =~ /\.db/) > { >- my $thisdb = $$dbdirs[$i] . "{{SEP}}" . $db; >+ my $thisdb = $$dbdirs[$i] . "/" . $db; > print "Verify $thisdb ... "; > open(DBVERIFY, "db_verify $thisdb 2>&1 1> $NULL |"); > sleep 1; > my $haserr = 0; >@@ -180,61 +241,11 @@ > print "Good\n"; > } > else > { >- print "changelog file $db in $$dbdirs[$i] is corrupted.\n"; >+ print "db file $db in $$dbdirs[$i] is corrupted.\n"; > print "Please restore your backup and recover the database.\n"; > } > } > } > closedir(DB); >- >- # backend: get instance dirs under <dbdir> >- my $instdirs = getDbDir($$dbdirs[$i]); >- >- for (my $j = 0; $j < @$instdirs; $j++) >- { >- opendir(DIR, $$instdirs[$j]) or die "can't opendir $here : $!"; >- while (defined($db = readdir(DIR))) >- { >- if ($db =~ /\.db/) >- { >- my $thisdb = $$instdirs[$j] . "{{SEP}}" . $db; >- print "Verify $thisdb ... "; >- open(DBVERIFY, "db_verify $thisdb 2>&1 1> $NULL |"); >- sleep 1; >- my $haserr = 0; >- while ($l = <DBVERIFY>) >- { >- if ($haserr == 0) >- { >- print "\n"; >- } >- if ("$l" ne "") >- { >- $haserr++; >- print "DB ERROR: $l"; >- } >- } >- close(DBVERIFY); >- if ($haserr == 0 && $? == 0) >- { >- print "Good\n"; >- } >- else >- { >- if ("$db" =~ /id2entry.db/) >- { >- print "Primary db file $db in $$instdirs[$j] is corrupted.\n"; >- print "Please restore your backup and recover the database.\n"; >- } >- else >- { >- print "Secondary index file $db in $$instdirs[$j] is corrupted.\n"; >- print "Please run db2index(.pl) for reindexing.\n"; >- } >- } >- } >- } >- closedir(DIR); >- } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 233215
: 150603 |
150606
|
151245
|
151246
|
151247
|
151248
|
151305
|
152506
|
279051