Bug 236256
Summary: | verify-db.pl (db_verify) does not work on a little endian machine | ||
---|---|---|---|
Product: | [Retired] 389 | Reporter: | Noriko Hosoi <nhosoi> |
Component: | Database - Indexes/Searches | Assignee: | Noriko Hosoi <nhosoi> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Viktor Ashirov <vashirov> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 1.0.4 | CC: | nkinder, rmeggins |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2015-12-07 16:52:38 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 152373, 240316, 427409 | ||
Attachments: |
Description
Noriko Hosoi
2007-04-12 18:20:32 UTC
Created attachment 189281 [details]
New File: ldapserver/ldap/servers/slapd/back-ldbm/dbverify.c
Implemented dbverify function which calls Berkeley DB's DB->verify on each
database file (.db# file).
It works as a command line mode via dbverify script (being attached next).
I've also implemented and tested the task mode, but DB->verify function does
not like the way the DS opens the DB environment:
[05/Sep/2007:18:41:16 -0700] - libdb: DB->verify may not be used with
transactions, logging, or locking
If we cannot share the DB environment, there is no much advantage to implement
using the task, I think. Thus, I removed the task mode for now.
Created attachment 189291 [details]
New File: ldapserver/ldap/admin/src/scripts/template-dbverify.in
This is a template file to be instantiated when a server instance is created.
Usage: dbverify [-n backend_instance] [-V]
Note : if "-n backend_instance" is not passed, verify all DBs.
-V : verbose
Sample usages:
[nhosoi@laputa slapd-laputa2]$ dbverify
DB verify: Passed
$ dbverify -n userRoot
DB verify: Passed
$ dbverify -n bogus
DB verify: Failed
$ dbverify -V
[06/Sep/2007:15:06:52 -0700] DB verify -
/export/servers/ds72/var/lib/dirsrv/slapd-laputa2/db/userRoot/sn.db4: ok
[06/Sep/2007:15:06:52 -0700] DB verify -
/export/servers/ds72/var/lib/dirsrv/slapd-laputa2/db/userRoot/parentid.db4: ok
[...]
[06/Sep/2007:15:06:52 -0700] DB verify -
/export/servers/ds72/var/lib/dirsrv/slapd-laputa2/db/userRoot/id2entry.db4: ok
DB verify: Passed
$ dbverify -V
[06/Sep/2007:15:08:05 -0700] DB verify -
/export/servers/ds72/var/lib/dirsrv/slapd-laputa3/db/userRoot/parentid.db4: ok
[...]
[06/Sep/2007:15:08:05 -0700] - libdb: Page 0: nonsensical bt_minkey value 1 on
metadata page
[06/Sep/2007:15:08:05 -0700] - libdb: Page 0: nonsensical root page 0 on
metadata page
[06/Sep/2007:15:08:05 -0700] DB verify - verify failed(-30976):
/export/servers/ds72/var/lib/dirsrv/slapd-laputa3/db/userRoot/cn.db4
[...]
[06/Sep/2007:15:08:05 -0700] DB verify -
/export/servers/ds72/var/lib/dirsrv/slapd-laputa3/db/userRoot/id2entry.db4: ok
DB verify: Failed
Created attachment 189301 [details]
cvs diffs
Modified Files:
Makefile.am
ldap/admin/src/scripts/template-verify-db.pl.in
ldap/servers/slapd/main.c
ldap/servers/slapd/pblock.c
ldap/servers/slapd/slap.h
ldap/servers/slapd/slapi-private.h
ldap/servers/slapd/task.c
ldap/servers/slapd/back-ldbm/dblayer.c
ldap/servers/slapd/back-ldbm/init.c
ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
Descriptions:
1) adding dbverify (template-dbverify.in)
2) adding dbverify.c
3) updating verify-db.pl calling dbverify instead of db_verify from Berkeley DB
4) updating main.c/pblock.c/slap.h/slapi-private.c to make dbverify mode
available
5) fixing minor memory leak (task.c) and mode confusion (dblayer.c)
Sample usages:
$ verify-db.pl
*****************************************************************
verify-db: This tool should only be run if recovery start fails
and the server is down. If you run this tool while the server is
running, you may get false reports of corrupted files or other
false errors.
*****************************************************************
Verify log files in /export/servers/ds72/var/lib/dirsrv/slapd-laputa2/db ...
Good
$ verify-db.pl
*****************************************************************
verify-db: This tool should only be run if recovery start fails
and the server is down. If you run this tool while the server is
running, you may get false reports of corrupted files or other
false errors.
*****************************************************************
Verify log files in /export/servers/ds72/var/lib/dirsrv/slapd-laputa3/db ...
Good
[06/Sep/2007:15:11:18 -0700] - libdb: Page 0: nonsensical bt_minkey value 1 on
metadata page
[06/Sep/2007:15:11:18 -0700] - libdb: Page 0: nonsensical root page 0 on
metadata page
[06/Sep/2007:15:11:18 -0700] DB verify - verify failed(-30976):
/export/servers/ds72/var/lib/dirsrv/slapd-laputa3/db/userRoot/cn.db4
Found the index file(s) was corrupted
Please run db2index on the corrupted index
+ /* check for slapi v2 support */ + if (! SLAPI_PLUGIN_IS_V2(backend_plugin)) { + LDAPDebug(LDAP_DEBUG_ANY, "ERROR: %s is too old to do imports.\n", + backend_plugin->plg_name, 0, 0); + exit(1); + } Should this be "to do dbverify"? + IFP plg_un_db_verify; /* verify db files */ If you can, put this new struct member at the end of the structure to minimize potential binary compatability problems. Created attachment 190451 [details] cvs commit message (comment #1-#4) (In reply to comment #4) > + /* check for slapi v2 support */ > + if (! SLAPI_PLUGIN_IS_V2(backend_plugin)) { > + LDAPDebug(LDAP_DEBUG_ANY, "ERROR: %s is too old to do imports.\n", > + backend_plugin->plg_name, 0, 0); > + exit(1); > + } > > Should this be "to do dbverify"? > > + IFP plg_un_db_verify; /* verify db files */ > > If you can, put this new struct member at the end of the structure to minimize > potential binary compatability problems. Thank you, Rich, for your reviews and comments. I applied your changes and checked in into HEAD. It turned out there are 2 issues in this problem:
1. These 2 packages need to be installed on Solaris:
HATdb4x-4.2.52-7.1.sparcv9.pkg RHATdb4x-utils-4.2.52-7.1.sparcv9.pkg
Proudfoot did not have utils:
bash-2.05# pkginfo | egrep RHATdb4x
application RHATdb4x The Berkeley DB database library
(version 4) for C. [64-bit]
I installed utils package:
$ pkgadd -d ./RHATdb4x-utils-4.2.52-7.1.sparcv9.pkg
## Installing part 1 of 1.
/usr/bin/sparcv9/berkeley_db_svc
/usr/bin/sparcv9/db_archive
/usr/bin/sparcv9/db_checkpoint
/usr/bin/sparcv9/db_deadlock
/usr/bin/sparcv9/db_dump
/usr/bin/sparcv9/db_dump185
/usr/bin/sparcv9/db_load
/usr/bin/sparcv9/db_printlog
/usr/bin/sparcv9/db_recover
/usr/bin/sparcv9/db_stat
/usr/bin/sparcv9/db_upgrade
/usr/bin/sparcv9/db_verify
[ verifying class <none> ]
2. verify-db.pl is setting PATH and LDB_LIBRARY_PATH as follows to pick up
db_printlog and dbverify.
my $prefix = "";
$ENV{'PATH'} =
"$prefix/usr/bin/sparcv9:$prefix/usr/bin:/usr/bin/sparcv9:/usr/bin";
$ENV{'LD_LIBRARY_PATH'} = "/usr/lib/sparcv9:/usr/lib/sparcv9";
$ENV{'SHLIB_PATH'} = "/usr/lib/sparcv9:/usr/lib/sparcv9";
dbverify is in the same directory and it failed to be picked up since '.' was
not in PATH. We need to change the PATH as follows:
diff verify-db.pl.orig verify-db.pl
172c172
< $ENV{'PATH'} =
"$prefix/usr/bin/sparcv9:$prefix/usr/bin:/usr/bin/sparcv9:/usr/bin";
---
> $ENV{'PATH'} =
".:$prefix/usr/bin/sparcv9:$prefix/usr/bin:/usr/bin/sparcv9:/usr/bin";
With the above 2 changes, it works fine on Solaris:
./verify-db.pl
*****************************************************************
verify-db: This tool should only be run if recovery start fails
and the server is down. If you run this tool while the server is
running, you may get false reports of corrupted files or other
false errors.
*****************************************************************
Verify log files in /export/ds80/db ... Good
Verify db files ... Good
verify-db.pl is fixed. The bug is 367671 "verify-db.pl : can't find dbverify". Regarding the package dependency on RHATdb4x-utils, could you open another bug, if necessary? Modifying the status to "MODIFIED" for the bug verification. |