Bug 21111 - Add --exclude-indexes option to koha-run-backups
Summary: Add --exclude-indexes option to koha-run-backups
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Nick Clemens (kidclamp)
URL:
Keywords:
Depends on: 14532
Blocks:
  Show dependency treegraph
 
Reported: 2018-07-24 14:53 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2021-12-13 21:10 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00
Circulation function:


Attachments
Bug 21111: Add --exclude_indexes to koha-run-backups (3.08 KB, patch)
2020-07-13 13:29 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 21111: Add --exclude_indexes to koha-run-backups (3.08 KB, patch)
2020-07-13 13:32 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 21111: Add --exclude-indexes to koha-run-backups (3.08 KB, patch)
2020-07-13 14:44 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 21111: Add --exclude-indexes to koha-run-backups (3.33 KB, patch)
2020-10-14 21:00 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 21111: Add --exclude-indexes to koha-run-backups (3.37 KB, patch)
2020-10-15 07:31 UTC, David Nind
Details | Diff | Splinter Review
Bug 21111: Add --exclude-indexes to koha-run-backups (3.43 KB, patch)
2020-10-15 13:56 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 21111: Add --exclude-indexes to koha-run-backups (3.51 KB, patch)
2020-11-04 10:58 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2018-07-24 14:53:02 UTC
koha-dump implements the --exclude-indexes option, and koha-run-backups should inherit it so it is of more use.
Comment 1 Tomás Cohen Arazi (tcohen) 2020-07-13 13:29:51 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi (tcohen) 2020-07-13 13:32:36 UTC Comment hidden (obsolete)
Comment 3 Tomás Cohen Arazi (tcohen) 2020-07-13 14:44:57 UTC
Created attachment 106835 [details] [review]
Bug 21111: Add --exclude-indexes to koha-run-backups

This patch adds a trivial switch so koha-run-backups can pass the
--exclude-indexes option switch to koha-dump. This way if the sysadmin
doesn't want to backup the Zebra indexes, it can be controlled by
tweaking the cron definition.

To test:
1. Apply this patch
2. Run:
   $ debian/scripts/koha-run-backups --days 2 --output /var/spool/koha
3. Notice the size of the backups:
   $ ls -lh /var/spool/koha/kohadev
4. Try the new option switch:
   $ debian/scripts/koha-run-backups \
       --exclude-indexes \
       --days 2 --output /var/spool/koha
5. Repeat 3
=> SUCCESS: Backups are smaller!
6. Sign off :-D
Comment 4 David Nind 2020-10-08 19:06:33 UTC
Hi Tomás.

After applying the patch I get these errors:

- re-running step 2:
  root@kohadevbox:koha(bz21111)$ debian/scripts/koha-run-backups --days 2 --output /var/spool/koha
  Error: Invalid instance name indexes

- running step 4: 

root@kohadevbox:koha(bz21111)$ debian/scripts/koha-run-backups --exclude-indexes --days 2 --output /var/spool/koha
koha-run-backups: unrecognized option '--exclude-indexes'
debian/scripts/koha-run-backups - performs backups of the koha installations on the system

This allows automation of backing up the koha data and configuration to the
filesystem. It will keep the past so many backups, discarding older ones.

Options:
    --output /path     The directory that the resulting files will be placed into.
                       (default: /var/spool/koha)
    --days 2           The number of days to keep backups around for
                       (default: 2)
    --exclude-indexes  Exclude Zebra indexes from the backups (default: false)

Note: backups produced using this tool can be restored using `koha-restore'.
Comment 5 Tomás Cohen Arazi (tcohen) 2020-10-14 21:00:42 UTC
Created attachment 111641 [details] [review]
Bug 21111: Add --exclude-indexes to koha-run-backups

This patch adds a trivial switch so koha-run-backups can pass the
--exclude-indexes option switch to koha-dump. This way if the sysadmin
doesn't want to backup the Zebra indexes, it can be controlled by
tweaking the cron definition.

To test:
1. Apply this patch
2. Run:
   $ debian/scripts/koha-run-backups --days 2 --output /var/spool/koha
3. Notice the size of the backups:
   $ ls -lh /var/spool/koha/kohadev
4. Try the new option switch:
   $ debian/scripts/koha-run-backups \
       --exclude-indexes \
       --days 2 --output /var/spool/koha
5. Repeat 3
=> SUCCESS: Backups are smaller!
6. Sign off :-D
Comment 6 Tomás Cohen Arazi (tcohen) 2020-10-14 21:01:46 UTC
(In reply to David Nind from comment #4)
> Hi Tomás.
> 
> After applying the patch I get these errors:

Thanks for testing it! I've already submitted a fixed version.
Comment 7 David Nind 2020-10-15 07:31:22 UTC
Created attachment 111680 [details] [review]
Bug 21111: Add --exclude-indexes to koha-run-backups

This patch adds a trivial switch so koha-run-backups can pass the
--exclude-indexes option switch to koha-dump. This way if the sysadmin
doesn't want to backup the Zebra indexes, it can be controlled by
tweaking the cron definition.

To test:
1. Apply this patch
2. Run:
   $ debian/scripts/koha-run-backups --days 2 --output /var/spool/koha
3. Notice the size of the backups:
   $ ls -lh /var/spool/koha/kohadev
4. Try the new option switch:
   $ debian/scripts/koha-run-backups \
       --exclude-indexes \
       --days 2 --output /var/spool/koha
5. Repeat 3
=> SUCCESS: Backups are smaller!
6. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2020-10-15 07:34:09 UTC
> Thanks for testing it! I've already submitted a fixed version.

Thanks Tomás!

FYI - Here are my results:

Without --exclude-indexes:
  -rw-r----- 1 root kohadev-koha  998883 Oct 15 07:25 kohadev-2020-10-15.sql.gz
  -rw------- 1 root root         3958411 Oct 15 07:25 kohadev-2020-10-15.tar.gz

Using --exclude-indexes:
  -rw-r----- 1 root kohadev-koha 998883 Oct 15 07:26 kohadev-2020-10-15.sql.gz
  -rw------- 1 root root          15536 Oct 15 07:26 kohadev-2020-10-15.tar.gz
Comment 9 Nick Clemens (kidclamp) 2020-10-15 13:56:35 UTC
Created attachment 111746 [details] [review]
Bug 21111: Add --exclude-indexes to koha-run-backups

This patch adds a trivial switch so koha-run-backups can pass the
--exclude-indexes option switch to koha-dump. This way if the sysadmin
doesn't want to backup the Zebra indexes, it can be controlled by
tweaking the cron definition.

To test:
1. Apply this patch
2. Run:
   $ debian/scripts/koha-run-backups --days 2 --output /var/spool/koha
3. Notice the size of the backups:
   $ ls -lh /var/spool/koha/kohadev
4. Try the new option switch:
   $ debian/scripts/koha-run-backups \
       --exclude-indexes \
       --days 2 --output /var/spool/koha
5. Repeat 3
=> SUCCESS: Backups are smaller!
6. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Jonathan Druart 2020-11-04 10:58:59 UTC
Created attachment 112982 [details] [review]
Bug 21111: Add --exclude-indexes to koha-run-backups

This patch adds a trivial switch so koha-run-backups can pass the
--exclude-indexes option switch to koha-dump. This way if the sysadmin
doesn't want to backup the Zebra indexes, it can be controlled by
tweaking the cron definition.

To test:
1. Apply this patch
2. Run:
   $ debian/scripts/koha-run-backups --days 2 --output /var/spool/koha
3. Notice the size of the backups:
   $ ls -lh /var/spool/koha/kohadev
4. Try the new option switch:
   $ debian/scripts/koha-run-backups \
       --exclude-indexes \
       --days 2 --output /var/spool/koha
5. Repeat 3
=> SUCCESS: Backups are smaller!
6. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

JD amended patch: fix --exclude_indexes vs --exclude-indexes in koha-run-backups.xml
Comment 11 Jonathan Druart 2020-11-04 12:02:42 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 12 Lucas Gass (lukeg) 2020-11-16 21:27:36 UTC
enhancement will not be backported to 20.05.x