Bug 194531 - db2bak is too noisy
db2bak is too noisy
Status: CLOSED CURRENTRELEASE
Product: 389
Classification: Community
Component: Database - Import/Export (Show other bugs)
1.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Noriko Hosoi
Viktor Ashirov
:
: 194534 (view as bug list)
Depends On:
Blocks: 389_1.2.7 639035
  Show dependency treegraph
 
Reported: 2006-06-08 15:12 EDT by Chris St. Pierre
Modified: 2015-12-07 11:37 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-07 11:37:15 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
git patch file (master) (12.05 KB, patch)
2010-08-05 17:03 EDT, Noriko Hosoi
no flags Details | Diff
git patch file (master) (13.09 KB, patch)
2010-08-09 19:31 EDT, Noriko Hosoi
nhosoi: review?
rmeggins: review+
Details | Diff

  None (edit)
Description Chris St. Pierre 2006-06-08 15:12:28 EDT
db2bak dumps all of its information to stderr, and it dumps a lot of it.  This 
isn't very nice for cron'ing a snapshot.  It would be awesome if it could dump 
its information to stdout, and have either a -q flag to silence it (except for 
errors), or a -v flag and be silent by default.
Comment 1 Chris St. Pierre 2006-06-08 16:04:23 EDT
*** Bug 194534 has been marked as a duplicate of this bug. ***
Comment 2 Noriko Hosoi 2010-08-05 17:03:11 EDT
Created attachment 436980 [details]
git patch file (master)

Description:
Added -v option to db2bak and bak2db and moved the Backing up/
Restoring logs to the verbose mode output.  To implement the
backend verbose mode, log level SLAPI_LOG_BACKLDBM has been
introduced.
  Usage: db2bak [archivedir] [-v]
  Usage: bak2db archivedir [-n backendname] [-v]

Files:
 ldap/admin/src/scripts/template-bak2db.in
 ldap/admin/src/scripts/template-db2bak.in
 ldap/include/ldaplog.h
 ldap/servers/slapd/back-ldbm/archive.c
 ldap/servers/slapd/back-ldbm/dblayer.c
 ldap/servers/slapd/log.c
 ldap/servers/slapd/main.c
 ldap/servers/slapd/slapi-plugin.h
Comment 3 Noriko Hosoi 2010-08-05 17:10:57 EDT
Test Usage:
# ./db2bak
Back up directory: /var/lib/dirsrv/slapd-ID/bak/ID-DATE
[..] - All database threads now stopped

# ./db2bak -v
Back up directory: /var/lib/dirsrv/slapd-ID/bak/ID-DATE
[..] 389-Directory/1.2.7.a1.git2e188fa - debug level: backend (524288)
[..] - Backing up file 1 (/var/lib/dirsrv/slapd-ID/bak/ID-DATE/userRoot/givenName.db4)
[..] - Backing up file 2 (/var/lib/dirsrv/slapd-ID/bak/ID-DATE/userRoot/uid.db4)
       ...
[..] - All database threads now stopped

# ./db2bak /tmp/bak
Back up directory: /tmp/bak
[..] - All database threads now stopped

# ./db2bak /tmp/bak -v
Back up directory: /tmp/bak
[..] 389-Directory/1.2.7.a1.git2e188fa - debug level: backend (524288)
[..] - db2archive: /tmp/bak exists. Renaming to /tmp/bak.bak
[..] - Backing up file 1 (/tmp/bak/userRoot/givenName.db4)
[..] - Backing up file 2 (/tmp/bak/userRoot/uid.db4)
       ...
[..] - All database threads now stopped

# ./bak2db /tmp/bak
[..] - All database threads now stopped

# ./bak2db /tmp/bak -v
[..] 389-Directory/1.2.7.a1.git2e188fa - debug level: backend (524288)
[..] - Deleting log file: (/var/lib/dirsrv/slapd-ID/db/log.0000000003)
[..] - Restoring file 1 (/var/lib/dirsrv/slapd-ID/db/NetscapeRoot/givenName.db4)
       ...
[..] - All database threads now stopped
Comment 4 Noriko Hosoi 2010-08-09 19:31:31 EDT
Created attachment 437730 [details]
git patch file (master)

Thanks to Nathan for his comments to the previous proposal.  Based upon the discussion with him, changed the spec as follows:
1) leave the db2bak/bak2db's behaviour intact (verbose by default)
2) introduced a suppress option "-q" not to send the verbose messages to the standard error, but just to the errors log.

Description: Introduced "-q" option to suppress the backing up/
restoring message for each db file.
  Usage: db2bak [archivedir] [-q] [-h]
  Usage: bak2db archivedir [-n backendname] [-q] | [-h]
If "-q" is specified, the verbose messages are not prited to
the standard error, but just to the errors log.

In addition, new log level SLAPI_LOG_BACKLDBM/LDAP_DEBUG_BACKLDBM
has been introduced.
Comment 5 Noriko Hosoi 2010-08-09 19:43:51 EDT
Usages:
# ./db2bak -h
Usage: db2bak [archivedir] [-q] [-h]

# ./bak2db -h
Usage: bak2db archivedir [-n backendname] [-q] | [-h]

# ./db2bak
Back up directory: /var/lib/dirsrv/slapd-ID/bak/ID-DATE
[..] 389-Directory/1.2.7.a1.git8fa94a3 - debug level: backend (524288)
[..] - Backing up file 1 (/var/lib/dirsrv/slapd-ID/bak/ID-DATE/userRoot/givenName.db4)
[..] ...
[..] - All database threads now stopped

# ./db2bak -q
Back up directory: /var/lib/dirsrv/slapd-ID/bak/ID-DATE
# tail /var/log/dirsrv/slapd-ID/errors
[..] - Backing up file 1 (/var/lib/dirsrv/slapd-ID/bak/ID-DATE/userRoot/givenName.db4)
[..] - Backing up file 2 (/var/lib/dirsrv/slapd-ID/bak/ID-DATE/userRoot/uid.db4)
[..] ...
[..] - All database threads now stopped

# ./bak2db /var/lib/dirsrv/slapd-ID/bak/ID-DATE
[..] 389-Directory/1.2.7.a1.git8fa94a3 - debug level: backend (524288)
[..] - Deleting log file: (/var/lib/dirsrv/slapd-ID/db/log.0000000001)
[..] - Restoring file 1 (/var/lib/dirsrv/slapd-ID/db/log.0000000001)
[..] ...
[..] - All database threads now stopped

# ./bak2db /var/lib/dirsrv/slapd-ID/bak/ID-DATE -q
# tail /var/log/dirsrv/slapd-ID/errors
[..] - Deleting log file: (/var/lib/dirsrv/slapd-ID/db/log.0000000001)
[..] - Restoring file 1 (/var/lib/dirsrv/slapd-ID/db/log.0000000001)
[..] - Restoring file 2 (/var/lib/dirsrv/slapd-ID/db/userRoot/givenName.db4)
[..] ...
[..] - All database threads now stopped
Comment 6 Noriko Hosoi 2010-08-10 12:35:28 EDT
Reviewed by Rich (Thank you!!).

Pushed to master

$ git merge 194531
Updating 8fa94a3..9f07f9d
Fast-forward
 ldap/admin/src/scripts/template-bak2db.in    |   34 +++++++++++++++-------
 ldap/admin/src/scripts/template-db2bak.in    |   38 ++++++++++++++++++++++---
 ldap/include/ldaplog.h                       |    1 +
 ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c |   34 +++++++++++-----------
 ldap/servers/slapd/log.c                     |    1 +
 ldap/servers/slapd/main.c                    |    8 +++++
 ldap/servers/slapd/slapi-plugin.h            |    3 +-
 7 files changed, 85 insertions(+), 34 deletions(-)

$ git push
Counting objects: 33, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (17/17), 2.65 KiB, done.
Total 17 (delta 13), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   8fa94a3..9f07f9d  master -> master
Comment 8 Noriko Hosoi 2011-06-16 12:37:57 EDT
It works just fine for me...  Again, you'd better give me your test env.

# ./db2bak -h
Usage: db2bak [archivedir] [-q] [-h]
# ./db2bak -q
Back up directory: /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_45
# ./db2bak
Back up directory: /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38
[16/Jun/2011:09:29:38 -0700] 389-Directory/1.2.9.a2.git9cd0752 - debug level: backend (524288)
[16/Jun/2011:09:29:38 -0700] - Backing up file 1 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/objectclass.db4)
[16/Jun/2011:09:29:38 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/objectclass.db4 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/objectclass.db4
[16/Jun/2011:09:29:38 -0700] - Backing up file 2 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/id2entry.db4)
[16/Jun/2011:09:29:38 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/id2entry.db4 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/id2entry.db4
[16/Jun/2011:09:29:38 -0700] - Backing up file 3 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/uniquemember.db4)
[16/Jun/2011:09:29:38 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/uniquemember.db4 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/uniquemember.db4
[16/Jun/2011:09:29:38 -0700] - Backing up file 4 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/ancestorid.db4)
[16/Jun/2011:09:29:38 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/ancestorid.db4 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/ancestorid.db4
[16/Jun/2011:09:29:38 -0700] - Backing up file 5 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/cn.db4)
[16/Jun/2011:09:29:38 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/cn.db4 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/cn.db4
[16/Jun/2011:09:29:38 -0700] - Backing up file 6 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/numsubordinates.db4)
[16/Jun/2011:09:29:39 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/numsubordinates.db4 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/numsubordinates.db4
[16/Jun/2011:09:29:39 -0700] - Backing up file 7 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/DBVERSION)
[16/Jun/2011:09:29:39 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/DBVERSION to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/DBVERSION
[16/Jun/2011:09:29:39 -0700] - Backing up file 8 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/entryrdn.db4)
[16/Jun/2011:09:29:39 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/entryrdn.db4 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/entryrdn.db4
[16/Jun/2011:09:29:39 -0700] - Backing up file 9 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/parentid.db4)
[16/Jun/2011:09:29:39 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/parentid.db4 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/parentid.db4
[16/Jun/2011:09:29:39 -0700] - Backing up file 10 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/aci.db4)
[16/Jun/2011:09:29:39 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/aci.db4 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/aci.db4
[16/Jun/2011:09:29:39 -0700] - Backing up file 11 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/nsuniqueid.db4)
[16/Jun/2011:09:29:39 -0700] - Copying /var/lib/dirsrv/slapd-test/db/userRoot/nsuniqueid.db4 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/userRoot/nsuniqueid.db4
[16/Jun/2011:09:29:39 -0700] - Backing up file 12 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/log.0000000001)
[16/Jun/2011:09:29:39 -0700] - Copying /var/lib/dirsrv/slapd-test/db/log.0000000001 to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/log.0000000001
[16/Jun/2011:09:29:39 -0700] - Backing up file 13 (/var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/DBVERSION)
[16/Jun/2011:09:29:39 -0700] - Copying /var/lib/dirsrv/slapd-test/db/DBVERSION to /var/lib/dirsrv/slapd-test/bak/test-2011_06_16_09_29_38/DBVERSION
[16/Jun/2011:09:29:39 -0700] - All database threads now stopped
Comment 9 Amita Sharma 2011-06-17 02:49:10 EDT
[root@rhel61-ds90-amita slapd-M1]# ./db2bak -h
Usage: db2bak [archivedir] [-q] [-h]

[root@rhel61-ds90-amita slapd-M1]# ./db2bak -q
Back up directory: /var/lib/dirsrv/slapd-M1/bak/M1-2011_06_17_11_36_56


[root@rhel61-ds90-amita slapd-M1]# ./db2bak
Back up directory: /var/lib/dirsrv/slapd-M1/bak/M1-2011_06_17_11_37_17
[17/Jun/2011:11:37:17 +051800] 389-Directory/1.2.8.4 - debug level: backend (524288)
[17/Jun/2011:11:37:17 +051800] NSMMReplicationPlugin - changelog program - cl5WriteRUV: server (pid 14165) is already running; bail.
[17/Jun/2011:11:37:17 +051800] - db2archive: pre-backup-plugin failed (1).
[17/Jun/2011:11:37:17 +051800] - ERROR: Standalone db2bak is not supported when a multimaster replication enabled server is coexisting.
Please use db2bak.pl, instead.
[17/Jun/2011:11:37:17 +051800] - db2archive failed: removing /var/lib/dirsrv/slapd-M1/bak/M1-2011_06_17_11_37_17
[17/Jun/2011:11:37:17 +051800] - All database threads now stopped

Marking as VERIFIED.

Note You need to log in before you can comment on or make changes to this bug.