mirror of
https://github.com/MariaDB/server.git
synced 2025-01-24 07:44:22 +01:00
4c7d6191b6
BACKUP previous set up triggers using DICT. This lead to all kind of trouble. An smaller alternative to using SUMA for backup is to just make BACKUP handle triggers to TUP directly. This way all triggers will be totally local, and error handling is much simpler. --- old impl. Start: Master recives GSN_DEFINE_BACKUP_CONF from all participants Master sends CREATE_TRIG_REQ for all tables to local DICT (dict master) Master sends START_BACKUP_REQ to all paricipants with trigger ids from DICT Master sends ALTER_TRIG_REQ (online) to local DICT Master waits for GCP Master starts distributed scan When scan has finished Master waits for GCP Master sends DROP_TRIGGER to local DICT Master sends STOP_BACKUP_REQ to all participants --- new impl. Start: Master recives GSN_DEFINE_BACKUP_CONF from all participants Master sends START_BACKUP_REQ to all paricipants Participand sends CREATE_TRIG_REQ for all tables to local TUP Master waits for GCP Master starts distributed scan When scan has finished Master waits for GCP Master sends STOP_BACKUP_REQ to all participants Participant sends DROP_TRIGGER to local TUP Changes: All trigger handling is _local_ This implies, that abort (e.g due to node failure) can be _local_ fix testBackup test so that it will run successfully with the (now correct) backup trigger code. storage/ndb/include/kernel/signaldata/BackupImpl.hpp: rework START_BACKUP signals as we no longer need tableId and triggerIds. storage/ndb/src/common/debugger/signaldata/BackupImpl.cpp: START_BACKUP_REQ no longer has tableIds and trigger ids storage/ndb/src/kernel/blocks/backup/Backup.cpp: Use TUP triggers directly. removes ALTER trigger simplifies DROP triggers changes to node failure handling changes in signal order use SlaveData to track slave status. storage/ndb/src/kernel/blocks/backup/Backup.hpp: - remove ALTER_TRIG (now unused) - add signalNo to BackupRecord - add SlaveData - remove dead items from MasterData - update prototype of startBackupReply storage/ndb/src/kernel/blocks/backup/Backup.txt: Update signals for new backup code. storage/ndb/src/kernel/blocks/backup/BackupInit.cpp: remove ALTER_TRIG REF and CONF as we no longer use them. storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp: Add comment about meaning of triggerId Add sender BlockNumber parameter to dropTrigger. storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp: for SUBSCRIPTION triggers, make it so that the trigger ids are private to each block. storage/ndb/test/ndbapi/testBackup.cpp: Don't do initial restart, just a restart. This is to avoid cache issues with schema versions storage/ndb/test/src/NdbBackup.cpp: Update error insertions.
369 lines
6.3 KiB
C++
369 lines
6.3 KiB
C++
/* Copyright (C) 2003 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
#ifndef BACKUP_IMPL_HPP
|
|
#define BACKUP_IMPL_HPP
|
|
|
|
#include "SignalData.hpp"
|
|
#include <NodeBitmask.hpp>
|
|
|
|
class DefineBackupReq {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class Backup;
|
|
friend class Dblqh;
|
|
|
|
friend bool printDEFINE_BACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 9 + NdbNodeBitmask::Size);
|
|
|
|
private:
|
|
/**
|
|
* i - value of backup object
|
|
*/
|
|
Uint32 backupPtr;
|
|
|
|
Uint32 backupId;
|
|
Uint32 clientRef;
|
|
Uint32 clientData;
|
|
Uint32 senderRef;
|
|
|
|
/**
|
|
* Which node(s) is participating in the backup
|
|
*/
|
|
NdbNodeBitmask nodes;
|
|
|
|
/**
|
|
* Generated random number
|
|
*/
|
|
Uint32 backupKey[2];
|
|
|
|
/**
|
|
* Length of backup data
|
|
*/
|
|
Uint32 backupDataLen;
|
|
|
|
/**
|
|
* Backup flags
|
|
*/
|
|
/* & 0x3 - waitCompleted
|
|
*/
|
|
Uint32 flags;
|
|
};
|
|
|
|
class DefineBackupRef {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class Backup;
|
|
friend class Dblqh;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
friend bool printDEFINE_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 4 );
|
|
|
|
enum ErrorCode {
|
|
Undefined = 1340,
|
|
FailedToAllocateBuffers = 1342,
|
|
FailedToSetupFsBuffers = 1343,
|
|
FailedToAllocateTables = 1344,
|
|
FailedInsertFileHeader = 1345,
|
|
FailedInsertTableList = 1346,
|
|
FailedAllocateTableMem = 1347,
|
|
FailedToAllocateFileRecord = 1348,
|
|
FailedToAllocateAttributeRecord = 1349
|
|
};
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
Uint32 errorCode;
|
|
Uint32 nodeId;
|
|
};
|
|
|
|
class DefineBackupConf {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class Backup;
|
|
friend class Dblqh;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
friend bool printDEFINE_BACKUP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 2 );
|
|
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
};
|
|
|
|
class StartBackupReq {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class Backup;
|
|
|
|
friend bool printSTART_BACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
|
|
STATIC_CONST( SignalLength = 2 );
|
|
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
};
|
|
|
|
class StartBackupRef {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class Backup;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
friend bool printSTART_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 4 );
|
|
|
|
enum ErrorCode {
|
|
FailedToAllocateTriggerRecord = 1
|
|
};
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
Uint32 errorCode;
|
|
Uint32 nodeId;
|
|
};
|
|
|
|
class StartBackupConf {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class Backup;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
friend bool printSTART_BACKUP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 2 );
|
|
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
};
|
|
|
|
class BackupFragmentReq {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class Backup;
|
|
friend class Dblqh;
|
|
|
|
friend bool printBACKUP_FRAGMENT_REQ(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 5 );
|
|
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
Uint32 tableId;
|
|
Uint32 fragmentNo;
|
|
Uint32 count;
|
|
};
|
|
|
|
class BackupFragmentRef {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class Backup;
|
|
friend class Dblqh;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
friend bool printBACKUP_FRAGMENT_REF(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 5 );
|
|
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
Uint32 errorCode;
|
|
Uint32 nodeId;
|
|
};
|
|
|
|
class BackupFragmentConf {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class Backup;
|
|
friend class Dblqh;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
friend bool printBACKUP_FRAGMENT_CONF(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 6 );
|
|
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
Uint32 tableId;
|
|
Uint32 fragmentNo;
|
|
Uint32 noOfRecords;
|
|
Uint32 noOfBytes;
|
|
};
|
|
|
|
class StopBackupReq {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class Backup;
|
|
|
|
friend bool printSTOP_BACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 4 );
|
|
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
Uint32 startGCP;
|
|
Uint32 stopGCP;
|
|
};
|
|
|
|
class StopBackupRef {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class Backup;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
friend bool printSTOP_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 4 );
|
|
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
Uint32 errorCode;
|
|
Uint32 nodeId;
|
|
};
|
|
|
|
class StopBackupConf {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class Backup;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
friend bool printSTOP_BACKUP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 4 );
|
|
|
|
private:
|
|
Uint32 backupId;
|
|
Uint32 backupPtr;
|
|
Uint32 noOfLogBytes;
|
|
Uint32 noOfLogRecords;
|
|
};
|
|
|
|
class BackupStatusReq {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class Backup;
|
|
|
|
friend bool printBACKUP_STATUS_REQ(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 1 );
|
|
|
|
private:
|
|
};
|
|
|
|
class BackupStatusConf {
|
|
/**
|
|
* Sender(s)
|
|
*/
|
|
friend class Backup;
|
|
|
|
/**
|
|
* Reciver(s)
|
|
*/
|
|
friend class BackupMaster;
|
|
|
|
friend bool printBACKUP_STATUS_CONF(FILE *, const Uint32 *, Uint32, Uint16);
|
|
public:
|
|
STATIC_CONST( SignalLength = 1 );
|
|
|
|
private:
|
|
};
|
|
|
|
|
|
#endif
|