Bugzilla – Attachment 195003 Details for
Bug 42028
DB backup improvements: use ZSTD compression and tweak default settings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH 1/3] Bug 42028: use ZTSD instead of GZIP for koha-dump
0001-Bug-42028-use-ZTSD-instead-of-GZIP-for-koha-dump.patch (text/plain), 5.36 KB, created by
Michał
on 2026-03-09 14:53:52 UTC
(
hide
)
Description:
[PATCH 1/3] Bug 42028: use ZTSD instead of GZIP for koha-dump
Filename:
MIME Type:
Creator:
Michał
Created:
2026-03-09 14:53:52 UTC
Size:
5.36 KB
patch
obsolete
>From 523e9ee9893f6abfc5235e5acb98cea86c578546 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Micha=C5=82=20Kula?= > <148193449+miku-orb@users.noreply.github.com> >Date: Mon, 9 Mar 2026 15:33:29 +0100 >Subject: [PATCH 1/3] Bug 42028: use ZTSD instead of GZIP for koha-dump > >Notes: > >1. By default ZSTD is much faster, while also providing smaller files > >2. In koha-run-backups I've reorganized the deletion to be more readable and support both old and new extension. The instance name is properly escaped juuust in case, and a single regex is used. Mtime option was simplified, it works the same way while being more lean. These shell expansions were tested in both bash and dash, so /bin/sh shebang should be fine to remain. Even though --days must be greater than 0, if someone removed that check, `-mtime +-1` would still work as expected, amazingly. > >--- > >Benchmarking: > ># time koha-dump biblioteka >Dumping Koha site biblioteka: >* DB to /var/spool/koha/biblioteka/biblioteka-2026-03-09.sql.gz >* configs, logs to /var/spool/koha/biblioteka/biblioteka-2026-03-09.tar.gz >Done. > >real 1m13.647s >user 1m22.566s >sys 0m4.807s > ># time koha-dump biblioteka >Dumping Koha site biblioteka: >* DB to /var/spool/koha/biblioteka/biblioteka-2026-03-09.sql.zst >* configs, logs to /var/spool/koha/biblioteka/biblioteka-2026-03-09.tar.zst >Done. > >real 0m15.590s >user 0m22.709s >sys 0m5.305s > ># ls -lh /var/spool/koha/biblioteka/ | grep -F '2026-03-09.' >-rw-r----- 1 root biblioteka-koha 111M Mar 9 15:20 biblioteka-2026-03-09.sql.gz >-rw-r----- 1 root biblioteka-koha 99M Mar 9 15:23 biblioteka-2026-03-09.sql.zst >-rw-r----- 1 root biblioteka-koha 949M Mar 9 15:21 biblioteka-2026-03-09.tar.gz >-rw-r----- 1 root biblioteka-koha 937M Mar 9 15:23 biblioteka-2026-03-09.tar.zst >--- > debian/control | 3 ++- > debian/control.in | 3 ++- > debian/scripts/koha-dump | 10 +++++----- > debian/scripts/koha-run-backups | 4 +++- > 4 files changed, 12 insertions(+), 8 deletions(-) > >diff --git a/debian/control b/debian/control >index 1e13743535..23646b607d 100644 >--- a/debian/control >+++ b/debian/control >@@ -202,7 +202,8 @@ Depends: ${misc:Depends}, ${koha:Depends}, > unzip, > weasyprint, > xmlstarlet, >- yaz >+ yaz, >+ zstd > Suggests: mysql-server | virtual-mysql-server, > letsencrypt, > Homepage: http://koha-community.org/ >diff --git a/debian/control.in b/debian/control.in >index 899b31947a..013dbd7d2a 100644 >--- a/debian/control.in >+++ b/debian/control.in >@@ -34,7 +34,8 @@ Depends: ${misc:Depends}, ${koha:Depends}, > unzip, > weasyprint, > xmlstarlet, >- yaz >+ yaz, >+ zstd > Suggests: mysql-server | virtual-mysql-server, > letsencrypt, > Homepage: http://koha-community.org/ >diff --git a/debian/scripts/koha-dump b/debian/scripts/koha-dump >index a4b5086cdb..b446f47e6b 100755 >--- a/debian/scripts/koha-dump >+++ b/debian/scripts/koha-dump >@@ -75,7 +75,7 @@ dump_instance() > mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )" > backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig || true )" > [ -z "$backupdir" ] && backupdir="/var/spool/koha/$name" >- dbdump="$backupdir/$name-$date.sql.gz" >+ dbdump="$backupdir/$name-$date.sql.zst" > dbflag="--databases" > [ "$without_db_name" = "yes" ] && dbflag="" > if [ "$schema_only" = "yes" ] >@@ -90,14 +90,14 @@ dump_instance() > [ "$quiet" = "no" ] && echo "* DB to $dbdump" > mysqldump $dbflag --host="$mysqlhost" --single-transaction \ > --user="$mysqluser" --password="$mysqlpass" "$mysqldb" | >- gzip > "$dbdump" >+ zstd > "$dbdump" > chown "root:$name-koha" "$dbdump" > chmod g+r "$dbdump" > > instancefile="$name.conf" > > # Dump configs, logs, etc. >- metadump="$backupdir/$name-$date.tar.gz" >+ metadump="$backupdir/$name-$date.tar.zst" > output="* configs, logs" > > if [ "$exclude_indexes" = "yes" ]; then >@@ -129,7 +129,7 @@ dump_instance() > set +e > > if [ "$exclude_logs" = "yes" ]; then >- tar -czf "$metadump" -C / $excludes \ >+ tar -caf "$metadump" -C / $excludes \ > "etc/koha/sites/$name" \ > "etc/apache2/sites-available/$instancefile" \ > "etc/apache2/sites-enabled/$instancefile" \ >@@ -137,7 +137,7 @@ dump_instance() > $uploaded_files_dir \ > $uploaded_temp_files_dir > else >- tar -czf "$metadump" -C / $excludes \ >+ tar -caf "$metadump" -C / $excludes \ > "etc/koha/sites/$name" \ > "etc/apache2/sites-available/$instancefile" \ > "etc/apache2/sites-enabled/$instancefile" \ >diff --git a/debian/scripts/koha-run-backups b/debian/scripts/koha-run-backups >index 2432f79738..1965b51659 100755 >--- a/debian/scripts/koha-run-backups >+++ b/debian/scripts/koha-run-backups >@@ -81,6 +81,8 @@ do > backupdir="$dirname/$name"; > fi > >- find $backupdir -maxdepth 1 \( -mtime +$days -or -mtime $days \) -name $name-'[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].???'.gz \( -name \*.sql.gz -or -name \*.tar.gz \) -print0 | xargs -0 -r rm >+ name_q=$(perl -s -e 'print quotemeta($name)' -- -name="$name") >+ find $backupdir -maxdepth 1 -type f -mtime +$((days - 1)) -regextype posix-egrep \ >+ -regex '.*/'"$name_q"'-[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\.(sql|tar)\.(gz|zst)$' -delete > fi > done >-- >2.53.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 42028
: 195003 |
195004
|
195005