ShahriyarR / MySQL-AutoXtraBackup

MySQL-AutoXtraBackup commandline tool written in Python 3 based on Percona XtraBackup
https://autoxtrabackup.azepug.az/
MIT License
141 stars 78 forks source link

IsADirectoryError when Backup is removed from Archive #260

Closed prox2k closed 6 years ago

prox2k commented 6 years ago

When autoxtrabackup is cleaning the archive directory an IsADirectoryError occurs:

2018-02-21 09:03:27 DEBUG <pid.PidFile object at 0x7f47e94ee048> entering setup 2018-02-21 09:03:27 DEBUG <pid.PidFile object at 0x7f47e94ee048> create pidfile: /tmp/MySQL-AutoXtraBackup/2/autoxtrabackup.pid 2018-02-21 09:03:27 DEBUG <pid.PidFile object at 0x7f47e94ee048> check pidfile: /tmp/MySQL-AutoXtraBackup/2/autoxtrabackup.pid 2018-02-21 09:03:27 DEBUG Running mysqladmin command -> /usr/bin/mysqladmin --defaults-file=/etc/mysql/2/my.cnf --user=root --password=XXXXXXX status --socket=/var/run/mysqld/2/mysqld.sock 2018-02-21 09:03:27 DEBUG OK: Server is Up and running 2018-02-21 09:03:27 DEBUG OK: /usr/bin/mysql exists 2018-02-21 09:03:27 DEBUG OK: /usr/bin/mysqladmin exists 2018-02-21 09:03:27 DEBUG OK: MySQL configuration file exists 2018-02-21 09:03:27 DEBUG OK: XtraBackup exists 2018-02-21 09:03:27 DEBUG OK: Main backup directory exists 2018-02-21 09:03:27 DEBUG OK: Full Backup directory exists 2018-02-21 09:03:27 DEBUG OK: Increment directory exists 2018-02-21 09:03:27 DEBUG OK: Archive folder directory exists 2018-02-21 09:03:27 DEBUG OK: Check status 2018-02-21 09:03:27 DEBUG - - - - Your full backup is timeout : Taking new Full Backup! - - - - 2018-02-21 09:03:27 DEBUG Starting cleaning of old archives 2018-02-21 09:03:27 DEBUG Removing archive: /backup/mysql/2/archive/2018-02-01_00-00-02_archive due to max archive age 2018-02-21 09:03:27 DEBUG <pid.PidFile object at 0x7f47e94ee048> closing pidfile: /tmp/MySQL-AutoXtraBackup/2/autoxtrabackup.pid Traceback (most recent call last): File "/usr/local/bin/autoxtrabackup", line 9, in load_entry_point('mysql-autoxtrabackup==1.5.1', 'console_scripts', 'autoxtrabackup')() File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 535, in invoke return callback(args, *kwargs) File "/usr/local/lib/python3.4/dist-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/mysql_autoxtrabackup-1.5.1-py3.4.egg/autoxtrabackup.py", line 252, in all_procedure b.all_backup() File "/usr/local/lib/python3.4/dist-packages/mysql_autoxtrabackup-1.5.1-py3.4.egg/master_backup_script/backuper.py", line 851, in all_backup self.clean_old_archives() File "/usr/local/lib/python3.4/dist-packages/mysql_autoxtrabackup-1.5.1-py3.4.egg/master_backup_script/backuper.py", line 271, in clean_old_archives os.remove(self.archive_dir + "/" + archive) IsADirectoryError: [Errno 21] Is a directory: '/backup/mysql/2/archive/2018-02-01_00-00-02_archive' 2018-02-21 09:03:27 DEBUG <pid.PidFile object at 0x7f47e94ee048> closing pidfile: /tmp/MySQL-AutoXtraBackup/2/autoxtrabackup.pid

ShahriyarR commented 6 years ago

Thanks for report. Looking now.

ShahriyarR commented 6 years ago

@prox2k Could you please check the bugfix_issue260 branch?

prox2k commented 6 years ago

@ShahriyarR not working for me

prox2k commented 6 years ago

if os.path.isdir(archive):

I guess it have to be "self.archive_dir + "/" + archive", too?

ShahriyarR commented 6 years ago

ah right, right -> changing @prox2k please check again

prox2k commented 6 years ago

2018-02-21 09:40:53 DEBUG Starting cleaning of old archives 2018-02-21 09:40:53 DEBUG Removing archive: /backup/mysql/2/archive/2018-02-01_00-00-02_archive due to max archive age

Works for me now!

ShahriyarR commented 6 years ago

@prox2k thanks for fix :)))) Actually you did it)

prox2k commented 6 years ago

:D

prox2k commented 6 years ago

thx!

ShahriyarR commented 6 years ago

Merging to release_v1.5.2