index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-03-29 13:48:23 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-03-29 13:48:23 +0200 |
commit | 37dd4786515d78db928d6bdd7fd844452f0dd0c9 (patch) | |
tree | cc7be1436a34d15aa86d5c3b0022c21c1c558d49 | |
parent | 792664b9373ded19f242163b3f9cfe16c224d5db (diff) |
-rwxr-xr-x | lib/mysql-functions | 41 |
diff --git a/lib/mysql-functions b/lib/mysql-functions index 095f1cc..418f15b 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -785,6 +785,7 @@ mysql_find_build_assignment_loops() { # clean up left overs from mysql database mysql_cleanup() { local operator + local partition if [ "$#" = '0' ]; then operator='DELETE' elif [ "$#" = '1' ] && [ "x$1" = 'xdry' ]; then @@ -892,23 +893,29 @@ mysql_cleanup() { fi printf ' WHERE `build_slaves`.`currently_building` IS NULL' printf ' AND `build_slaves`.`logged_lines` IS NOT NULL;\n' - # remove obsolete file_providers - printf '%s FROM `file_providers`' \ - "${operator}" - printf ' WHERE NOT EXISTS (' - printf 'SELECT * FROM `binary_packages`' - printf ' WHERE `binary_packages`.`id`=`file_providers`.`package`' - printf ') OR NOT EXISTS (' - printf 'SELECT * FROM `files`' - printf ' WHERE `files`.`id`=`file_providers`.`file`' - printf ');\n' - # remove obsolete files - printf '%s FROM `files`' \ - "${operator}" - printf ' WHERE NOT EXISTS (' - printf 'SELECT * FROM `file_providers`' - printf ' WHERE `files`.`id`=`file_providers`.`file`' - printf ');\n' + for partition in $(seq 0 15); do + # remove obsolete file_providers + printf '%s FROM `file_providers` PARTITION (p%s)' \ + "${operator}" "${partition}" + printf ' WHERE NOT EXISTS (' + printf 'SELECT * FROM `binary_packages`' + printf ' WHERE `binary_packages`.`id`=`file_providers`.`package`' + printf ') OR NOT EXISTS (' + printf 'SELECT * FROM `files` PARTITION (p%s)' \ + "${partition}" + printf ' WHERE `files`.`id`=`file_providers`.`file`' + printf ' AND `files`.`name_hash`=`file_providers`.`name_hash`' + printf ');\n' + # remove obsolete files + printf '%s FROM `files` PARTITION (p%s)' \ + "${operator}" "${partition}" + printf ' WHERE NOT EXISTS (' + printf 'SELECT * FROM `file_providers` PARTITION (p%s)' \ + "${partition}" + printf ' WHERE `files`.`id`=`file_providers`.`file`' + printf ' AND `files`.`name_hash`=`file_providers`.`name_hash`' + printf ');\n' + done } | \ mysql_run_query } |