mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / ndb / include / kernel / signaldata / BackupSignalData.hpp
blob3148bfb8dc38eee3800ec508e8f4f047f4acadcc
1 /* Copyright (c) 2003-2006 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef BACKUP_HPP
17 #define BACKUP_HPP
19 #include "SignalData.hpp"
20 #include <NodeBitmask.hpp>
22 /**
23 * Request to start a backup
25 class BackupReq {
26 /**
27 * Sender(s)
29 friend class MgmtSrvr;
31 /**
32 * Reciver(s)
34 friend class Backup;
36 friend bool printBACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
37 public:
38 STATIC_CONST( SignalLength = 3 );
40 private:
41 Uint32 senderData;
42 Uint32 backupDataLen;
43 /* & 0x3 - waitCompleted
45 Uint32 flags;
48 class BackupData {
49 /**
50 * Sender(s)
52 friend class BackupMaster;
54 /**
55 * Reciver(s)
57 friend class Backup;
59 friend bool printBACKUP_DATA(FILE *, const Uint32 *, Uint32, Uint16);
60 public:
61 STATIC_CONST( SignalLength = 25 );
63 enum KeyValues {
64 /**
65 * Buffer(s) and stuff
67 BufferSize = 1, // In MB
68 BlockSize = 2, // Write in chunks of this (in bytes)
69 MinWrite = 3, // Minimum write as multiple of blocksize
70 MaxWrite = 4, // Maximum write as multiple of blocksize
72 // Max throughput
73 // Parallell files
75 NoOfTables = 1000,
76 TableName = 1001 // char*
78 private:
79 enum RequestType {
80 ClientToMaster = 1,
81 MasterToSlave = 2
83 Uint32 requestType;
85 union {
86 Uint32 backupPtr;
87 Uint32 senderData;
89 Uint32 backupId;
91 /**
92 * totalLen = totalLen_offset >> 16
93 * offset = totalLen_offset & 0xFFFF
95 Uint32 totalLen_offset;
97 /**
98 * Length in this = signal->length() - 3
99 * Sender block ref = signal->senderBlockRef()
101 Uint32 backupData[21];
105 * The request to start a backup was refused
107 class BackupRef {
109 * Sender(s)
111 friend class Backup;
114 * Reciver(s)
116 friend class MgmtSrvr;
118 friend bool printBACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
119 public:
120 STATIC_CONST( SignalLength = 3 );
122 private:
123 enum ErrorCodes {
124 Undefined = 1300,
125 IAmNotMaster = 1301,
126 OutOfBackupRecord = 1302,
127 OutOfResources = 1303,
128 SequenceFailure = 1304,
129 BackupDefinitionNotImplemented = 1305,
130 CannotBackupDiskless = 1306
132 Uint32 senderData;
133 Uint32 errorCode;
134 union {
135 Uint32 masterRef;
140 * The backup has started
142 class BackupConf {
144 * Sender(s)
146 friend class Backup;
149 * Reciver(s)
151 friend class MgmtSrvr;
153 friend bool printBACKUP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
154 public:
155 STATIC_CONST( SignalLength = 2 + NdbNodeBitmask::Size );
157 private:
158 Uint32 senderData;
159 Uint32 backupId;
160 NdbNodeBitmask nodes;
164 * A backup has been aborted
166 class BackupAbortRep {
168 * Sender(s)
170 friend class Backup;
173 * Reciver(s)
175 friend class MgmtSrvr;
177 friend bool printBACKUP_ABORT_REP(FILE *, const Uint32 *, Uint32, Uint16);
178 public:
179 STATIC_CONST( SignalLength = 3 );
181 private:
182 Uint32 senderData;
183 Uint32 backupId;
184 Uint32 reason;
188 * A backup has been completed
190 class BackupCompleteRep {
192 * Sender(s)
194 friend class Backup;
197 * Reciver(s)
199 friend class MgmtSrvr;
201 friend bool printBACKUP_COMPLETE_REP(FILE *, const Uint32 *, Uint32, Uint16);
202 public:
203 STATIC_CONST( SignalLength = 10 + NdbNodeBitmask::Size );
204 private:
205 Uint32 senderData;
206 Uint32 backupId;
207 Uint32 startGCP;
208 Uint32 stopGCP;
209 Uint32 noOfBytesLow;
210 Uint32 noOfRecordsLow;
211 Uint32 noOfLogBytes;
212 Uint32 noOfLogRecords;
213 NdbNodeBitmask nodes;
214 Uint32 noOfBytesHigh;
215 Uint32 noOfRecordsHigh;
219 * A master has finished taking-over backup responsiblility
221 class BackupNFCompleteRep {
222 friend bool printBACKUP_NF_COMPLETE_REP(FILE*, const Uint32*, Uint32, Uint16);
226 * Abort of backup
228 class AbortBackupOrd {
230 * Sender / Reciver
232 friend class Backup;
233 friend class MgmtSrvr;
235 friend bool printABORT_BACKUP_ORD(FILE *, const Uint32 *, Uint32, Uint16);
236 public:
237 STATIC_CONST( SignalLength = 3 );
239 enum RequestType {
240 ClientAbort = 1321,
241 BackupComplete = 1322,
242 BackupFailure = 1323, // General backup failure coordinator -> slave
243 LogBufferFull = 1324, // slave -> coordinator
244 FileOrScanError = 1325, // slave -> coordinator
245 BackupFailureDueToNodeFail = 1326, // slave -> slave
246 OkToClean = 1327 // master -> slave
248 ,AbortScan = 1328
249 ,IncompatibleVersions = 1329
251 private:
252 Uint32 requestType;
253 Uint32 backupId;
254 union {
255 Uint32 backupPtr;
256 Uint32 senderData;
260 #endif