Bug #42639 mysqladmin --sleep=x --count=x sleeps one time to many
Submitted: 6 Feb 2009 4:21 Modified: 8 Aug 2009 0:06
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1.30, 4.1, 5.0, 5.1, 6.0 bzr OS:Any
Assigned to: Jim Winstead
Triage: Triaged: D4 (Minor)

[6 Feb 2009 4:21] Roel Van de Paar
Description:
Small bug for: mysqladmin --sleep=x --count=x

Documentation and command line help state 'Execute commands repeatedly, sleeping for delay seconds in between.' and 'Execute commands again and again with a sleep between.', yet what happens is 'Execute commands repeatedly, sleeping for delay seconds after each command, including the last one'

How to repeat:
mysqladmin -uroot -psystem --sleep=120 --count=3 processlist

will result in:

processlist 
sleep 120 seconds
processlist
sleep 120 seconds
processlist
sleep 120 seconds <<< unnecessary 

Suggested fix:
Either documentation could be changed to 'Execute commands repeatedly, sleeping for delay seconds after each command', or the last sleep could be removed (preferred, so that process exists earlier)
[6 Feb 2009 4:35] Roel Van de Paar
Also, if CTRL-C is pressed, the current sleep is finished before returning to the command prompt.
[6 Feb 2009 6:46] Sveta Smirnova
Thank  you for the report.

Verified as described.
[21 May 2009 0:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/74665

2906 Jim Winstead	2009-05-20
      mysqladmin --count=X --sleep=Y would always delay Y seconds after the last
      iteration before exiting. (Bug #42639)
      modified:
        client/mysqladmin.cc
[14 Jul 2009 17:20] Jim Winstead
Pushed to 5.1-bugteam and mysql-pe.
[4 Aug 2009 19:52] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090804194615-h40sa098mx4z49qg) (version source revid:jimw@mysql.com-20090714171651-ziq080rkon3u244l) (merge vers: 5.4.4-alpha) (pib:11)
[4 Aug 2009 20:45] Bugs System
Pushed into 5.1.38 (revid:davi.arnaut@sun.com-20090804204317-ggodqkik7de6nfpz) (version source revid:davi.arnaut@sun.com-20090804204317-ggodqkik7de6nfpz) (merge vers: 5.1.38) (pib:11)
[8 Aug 2009 0:06] Paul Dubois
Noted in 5.1.38, 5.4.4 changelogs.

mysqladmin --count=X --sleep=Y incorrectly delayed Y seconds after
the last iteration before exiting.
[12 Aug 2009 22:42] Paul Dubois
Noted in 5.4.2 changelog because next 5.4 version will be 5.4.2 and not 5.4.4.
[15 Aug 2009 2:01] Paul Dubois
Ignore previous comment about 5.4.2.
[1 Oct 2009 5:59] Bugs System
Pushed into 5.1.39-ndb-6.3.28 (revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (version source revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (merge vers: 5.1.39-ndb-6.3.28) (pib:11)
[1 Oct 2009 7:25] Bugs System
Pushed into 5.1.39-ndb-7.0.9 (revid:jonas@mysql.com-20091001072547-kv17uu06hfjhgjay) (version source revid:jonas@mysql.com-20091001071652-irejtnumzbpsbgk2) (merge vers: 5.1.39-ndb-7.0.9) (pib:11)
[1 Oct 2009 13:25] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (version source revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (merge vers: 5.1.39-ndb-7.1.0) (pib:11)
[5 Oct 2009 10:50] Bugs System
Pushed into 5.1.39-ndb-6.2.19 (revid:jonas@mysql.com-20091005103850-dwij2dojwpvf5hi6) (version source revid:jonas@mysql.com-20090930185117-bhud4ek1y0hsj1nv) (merge vers: 5.1.39-ndb-6.2.19) (pib:11)
[8 Oct 2009 2:50] Paul Dubois
The 5.4 fix has been pushed to 5.4.2.
[16 Nov 2010 8:56] Roel Van de Paar
See bug #58221