holland-backup / holland

Holland Backup Manager
http://hollandbackup.org
Other
152 stars 49 forks source link

Running holland with --dry-run flag creates a backup. #259

Closed Markpayne01 closed 5 years ago

Markpayne01 commented 5 years ago

Version holland-1.1.9-1 creates a backup when called with the --dry-run flag.

This can be reproduced using 3 SSH sessions to the server:

    Session 1
    mysql> create database testdb;
    mysql> use testdb;
    mysql> create table test1 (col1 int not null);
    mysql> start transaction;
    mysql> insert into test1 values (1);
    *** Leave this session connected to MySQL ***

    Session 2 (run this once you have run the insert in Session 1)
    mysql> use testdb;
    mysql> rename table test1 to test2;
    *** This will hang waiting for a table metadata lock ***

    Session 3 (run this when the command in Session 2 is hanging)
    # holland bk --dry-run
    *** This will hang trying to run mysqldump against testdb ***

    Back in Session 1:
    mysql> show processlist;
    *** You'll see two queries waiting on table metadata lock - the rename, and the SELECT from the mysqldump ***
    mysql> commit;
    *** Now everything will complete ***

You will see in the holland logs

[INFO] --- Starting dry run ---
.....
[INFO] Executing: /usr/bin/mysqldump 

Tested this on version 1.1.8, the --dry-run there works as expected.

Please let me know if you need any further details.

Thanks, Mark

soulen3 commented 5 years ago

Hi Mark,

Thanks for reporting this issue. The way we were handing the dry-run was overly complicated. So I've already completely reworked this feature in 1.1.10. It now just prints out the mysqldump commands that would be run during a backup.

$ sudo holland bk --dry-run
Holland 1.1.10 started with pid 27132
--- Starting dry run ---
Creating backup path /var/spool/holland/default/20190117_091733
Estimating size of mysqldump backup
Estimated Backup Size: 294.25MB
Using Historic Space Estimate: Checking for information in /var/spool/holland/default/newest/backup.conf
Last backup used 92.08MB
Adjusting estimated size to last backup total * 1.1: 101.28MB
Starting backup[default/20190117_091733] via plugin mysqldump
Running in dry-run mode.
Using mysqldump executable: /usr/bin/mysqldump
mysqldump version 10.2.19
Using mysqldump option --flush-privileges
Using mysqldump option --routines
Using mysqldump option --events
Using mysqldump option --max-allowed-packet=128M
Using gzip compression level 1 with args
Wrote backup manifest /var/spool/holland/default/20190117_091733/backup_data/MANIFEST.txt
Dry Run: /usr/bin/mysqldump --defaults-file=/var/spool/holland/default/20190117_091733/my.cnf --flush-privileges --routines --events --max-allowed-packet=128M --single-transaction employee1
Dry Run: /usr/bin/mysqldump --defaults-file=/var/spool/holland/default/20190117_091733/my.cnf --flush-privileges --routines --events --max-allowed-packet=128M --single-transaction employees
Dry Run: /usr/bin/mysqldump --defaults-file=/var/spool/holland/default/20190117_091733/my.cnf --flush-privileges --routines --events --max-allowed-packet=128M --lock-tables mysql
Dry Run: /usr/bin/mysqldump --defaults-file=/var/spool/holland/default/20190117_091733/my.cnf --flush-privileges --routines --events --max-allowed-packet=128M --single-transaction test
Backup completed in 0.59 seconds
--- Ending dry run ---