#48662 db2index with no attribute args fail.
Closed: wontfix None Opened 5 years ago by firstyear.

The man page lists:

 db2index [-Z serverID] [-n backend | {-s includeSuffix}* -t attribute[:indextypes[:matchingrules]] -T vlvTag] [-h]

IE, -t is optional.

Our examples show:

       db2index -Z instance3

Yet, running this:

db2index -Z localhost
Usage: db2index [-Z serverID] [-n backend | {-s includesuffix}* -t attribute[:indextypes[:matchingrules]]
                -T vlvTag] [-h]
echo $?

db2index should be fixed that listing no attributes, triggers and index of all attributes.

Thank you for finding out the defect, William... The command line was not properly adjusted when the scripts were cleaned up... :(

One question. If I run this fixed script, I get these logs. Do you think it's ok?

db2index -Z testinst

[16/Feb/2016:18:25:40 -0800] util_info_sys_pages - USING pages=51365, procpages=3323, availpages=51365
[16/Feb/2016:18:25:40 -0800] util_info_sys_pages - USING pages=51365, procpages=3463, availpages=51365

I added these as part of the dbcache sanity clean up. We probably don't want it appearing in the cli output.

There is no harm in them there, but I guess we should not print them out.

Test cases:
1) index all
$ db2index
$ db2index -Z inst

2) index a particular index
$ db2index -t index -n backend
$ db2index -Z inst -t index -n backend

3) syntax error
$ db2index -t index
$ db2index -n backend
$ db2index -Z testinst -t index
$ db2index -Z testinst -n backend

git patch file (master) -- revised with a fix to support with -Z as well as without -Z, and removal of unnecessary messages from the server

AHhh I didn't think to test without -Z. Good thinking!

Reviewed by William (Thank you!!)

Pushed to master:
476af05..5a33dc0 master -> master
commit 5a33dc0

Hi, sorry to be a pain Noriko, but I think on git master this is failing:

sudo /opt/dirsrv/sbin/db2index -Z localhost -n userRoot
usage: ns-slapd db2index -D configdir -n backend-instance-name [-d debuglevel] {-t attributetype} {-T VLV Search Name}

But these work:

sudo /opt/dirsrv/sbin/db2index -Z localhost
sudo /opt/dirsrv/sbin/db2index -Z localhost -n userRoot -t uid

Do you mind confirming if this is an issue?

Indeed... Shame shame.

If I change the script like this, then it works. If it looks ok, I'm attaching the script... Thanks!

diff -twU4 /tmp/db2index.orig /usr/sbin/db2index

--- /tmp/db2index.orig 2016-04-25 08:44:15.366446457 -0700
+++ /usr/sbin/db2index 2016-04-25 09:01:41.602920666 -0700
@@ -71,10 +71,12 @@
if [ -z $servid ] && [ $# -lt 2 ]; then
-elif [ "$servid" ] && [ $# -lt 4 ]; then
+elif [ -n "$servid" ] && [ $# -lt 4 ]; then
+elif [ -n "$servid" ] && [ $# -eq 4 ]; then
+ idxall=1

servid=normalize_server_id $initfile
. $initfile

db2index -Z test0 -n userRoot

[25/Apr/2016:09:02:44.201295426 -0700] Import allocates 101356KB import cache.
[25/Apr/2016:09:02:44.231047059 -0700] Reindex - userRoot: Start reindexing.
[25/Apr/2016:09:02:45.188189725 -0700] reindex userRoot: Reindexing complete. Processed 9 entries in 1 seconds. (9.00 entries/sec)
[25/Apr/2016:09:02:45.195935436 -0700] All database threads now stopped

I think that will fix it. Thanks, I'm happy to ack that change :)

git patch file (master) -- additional patch for "db2index -Z SERVERID -n BACKEND".

Reviewed by William (Thank you!!)

Pushed to master:
d5589b5..b2ef43e master -> master
commit b2ef43e

Metadata Update from @nhosoi:
- Issue assigned to firstyear
- Issue set to the milestone:

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/1791

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

a year ago

Login to comment on this ticket.