Bug 10782

Summary: Add a koha-mysqlcheck script
Product: Koha Reporter: Magnus Enger <magnus>
Component: Command-line UtilitiesAssignee: Magnus Enger <magnus>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: fridolin.somers, gitbot, gmcharlt, martin.renvoize, robin
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 10782 - Add a koha-mysqlcheck script
Bug 10782 - Add a koha-mysqlcheck script
[PASSED QA] Bug 10782 - Add a koha-mysqlcheck script

Description Magnus Enger 2013-08-26 07:41:09 UTC
I'm creating this for myself anyway, so I thought I'd see if there is any interest in getting it into Koha...

The idea is to add a script similar to koha-mysql, but instead of running the "mysql" command, it would run the "mysqlcheck" command:
http://dev.mysql.com/doc/refman/5.0/en/mysqlcheck.html
This will make it very easy to check the database of a given instance for errors. 

There will be command line options for what kind of checks to perform (quick, fast, changed, medium, extended) and verbosity (silent, verbose). 

If this sounds like a stupid idea, please feel free to mark this bug as "RESOLVED WONTFIX" or similar
Comment 1 Magnus Enger 2013-10-14 19:20:01 UTC Comment hidden (obsolete)
Comment 2 Magnus Enger 2013-10-14 19:21:57 UTC
Just to be clear: My plan changed a little between the initial comment and the actual commit. Please disregard the description given in the first comment, and focus on the description in the actual commit. :-)
Comment 3 I'm just a bot 2013-10-30 07:12:52 UTC
Patch applied cleanly, go forth and signoff
Comment 4 Chris Cormack 2014-02-18 06:24:52 UTC Comment hidden (obsolete)
Comment 5 Robin Sheat 2014-04-21 23:00:27 UTC
This seems perfectly fine and sensible (and documented) to me. I won't mark it as passed-QA given Chris signed off on it, but it's pretty straight forward and doesn't interfere with any other part of the system.
Comment 6 Martin Renvoize 2014-04-23 11:26:47 UTC
Created attachment 27459 [details] [review]
[PASSED QA] Bug 10782 - Add a koha-mysqlcheck script

This patch adds the koha-mysqlcheck script, as a "frontend" for
the mysqlcheck command. It can be used to check the integrity of
database tables, as well as to repair them. See "man mysqlcheck"
for more information.

The script takes a Koha instance name as its only required
parameter. Any other parameters provided before the instance
name are passed directly to mysqlcheck, which means that all
the functionality of mysqlcheck is available through this script.

To test the script:
- Apply the patch, build your own packages and install them, or
- copy koha-mysqlcheck to a server already running off packages

- Run some variations of the command, with and without arguments,
  and check that the output makes sense. E.g.:
    sudo koha-mysqlcheck myinstance
    sudo koha-mysqlcheck -e myinstance # Extended checks
    sudo koha-mysqlcheck -e -v myinstance # Extended checks and verbose
- See "man mysqlcheck" for other relevant options

To test the man page:
- Run these commands and look at the formatted man page:
    $ xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl \
      debian/docs/koha-mysqlcheck.xml
    $ man -l koha-mysqlcheck.8
- Make sure this test passes:
    $ prove -v xt/verify-debian-docbook.t

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2014-04-23 11:27:24 UTC
Nice simple script, does what it says on the tin and causes no regressions.  A worthwhile addition.
Comment 8 Galen Charlton 2014-04-23 12:33:24 UTC
Pushed to master.  Thanks, Magnus!
Comment 9 Fridolin Somers 2014-09-10 15:20:22 UTC
Pushed to 3.14.x, will be in 3.14.11