From 98f3d42ab03da307cb51079a8f5553725caaa7a6 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 9 Feb 2021 11:27:50 +1100 Subject: [PATCH] gerrit: only backup accountPatchReviewDb Due to [1] --all-databases is no longer working with our version of database. Move to explicitly backing up the only database we care about now, which is accountPatchReviewDb; everything else is in notedb. [1] https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1914695 Change-Id: Iab2a8ab612cc0a0f10c90123f2936c0abda9e76f --- playbooks/roles/gerrit/tasks/main.yaml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/playbooks/roles/gerrit/tasks/main.yaml b/playbooks/roles/gerrit/tasks/main.yaml index edad89e89a..8e133b7143 100644 --- a/playbooks/roles/gerrit/tasks/main.yaml +++ b/playbooks/roles/gerrit/tasks/main.yaml @@ -326,7 +326,7 @@ user: root hour: 0 minute: 0 - job: '/usr/bin/mysqldump --defaults-file=/root/.gerrit_db.cnf --opt --ignore-table mysql.event --all-databases --single-transaction | gzip -9 > /home/gerrit2/mysql_backups/gerrit.sql.gz' + job: '/usr/bin/mysqldump --defaults-file=/root/.gerrit_db.cnf --opt --ignore-table mysql.event --single-transaction --databases accountPatchReviewDb | gzip -9 > /home/gerrit2/mysql_backups/gerrit.sql.gz' # Gerrit rotates their own logs, but doesn't clean them out # Delete logs older than a month @@ -346,8 +346,17 @@ path: /etc/borg-streams state: directory - - name: Create db streaming file + # NOTE(ianw) 2021-02-09 --all-databases stopped working with + # Xenial/our rax version of mysql so we have to backup db's + # explicitly. remove the old call. This can go after a + # deployment run. + - name: Remove old stream backup + file: + state: absent + path: /etc/borg-streams/mysql + + - name: Create accountPatchReviewDb streaming file copy: content: >- - /usr/bin/mysqldump --defaults-file=/root/.gerrit_db.cnf --skip-extended-insert --ignore-table mysql.event --all-databases --single-transaction - dest: /etc/borg-streams/mysql + /usr/bin/mysqldump --defaults-file=/root/.gerrit_db.cnf --skip-extended-insert --ignore-table mysql.event --single-transaction --databases accountPatchReviewDb + dest: /etc/borg-streams/mysql-accountPatchReviewDb