-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxbbackupcontroller.h
More file actions
71 lines (58 loc) · 1.93 KB
/
xbbackupcontroller.h
File metadata and controls
71 lines (58 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef XBBACKUPCONTROLLER_H
#define XBBACKUPCONTROLLER_H
#include <QObject>
#include <QProcess>
#include <QDebug>
#include <QFile>
#include <QDir>
class XBBackupController : public QObject
{
Q_OBJECT
public:
explicit XBBackupController(QString target, QString inc_base_path, QString inc_path, QObject *parent = 0);
void start(QString xtrabackup_binary);
signals:
void terminate();
void xbbackup_finished();
void dataCopied();
void finished_ok();
public slots:
void xtrabackup_backup_finished(int exitcode, QProcess::ExitStatus status) {
if(exitcode) {
qDebug() << "Error during backup" << exitcode;
emit terminate();
}
qDebug() << "Xtrabackup backup procedure finished with" << exitcode << status;
if(backup_inc_path.length() == 0) { // full backup
QDir backup_root(target_dir);
backup_root.cdUp();
backup_root.mkdir(backup_root.absolutePath() + "/fake-full");
QFile checkpoints(target_dir + "/xtrabackup_checkpoints");
checkpoints.copy(backup_root.absolutePath()+"/fake-full/xtrabackup_checkpoints");
}
emit xbbackup_finished();
}
void xtrabackup_process_started() {
QFile::remove( target_dir + "/xtrabackup_suspended_1");
qDebug() << "Backup started!";
}
void xtrabackup_copied_all_innodb_data() {
qDebug() << "Xtrabackup copied all innodb files";
emit dataCopied();
}
void xtrabackup_process_finished() {
qDebug() << "Stopping log copy process";
QFile::remove( target_dir + "/xtrabackup_suspended_2");
if (!process.waitForFinished()) {
qDebug() << "Error during xtrabackup stop";
emit terminate();
}
emit finished_ok();
}
private:
QProcess process;
QString target_dir;
QString backup_inc_base;
QString backup_inc_path;
};
#endif // XBBACKUPCONTROLLER_H