Below is the list of changes that have just been committed into a local
5.1 repository of zhl. When zhl does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-09-04 14:27:42+00:00, lzhou@dev3-63.(none) +35 -0
BUG#26498 Implement two function:
1: Can start a backup using "Backup N".
2: Backup process will stop when backup files exist
storage/ndb/include/kernel/GlobalSignalNumbers.h@stripped, 2007-09-04 14:27:32+00:00,
lzhou@dev3-63.(none) +3 -3
Add signal number
storage/ndb/include/kernel/ndb_limits.h@stripped, 2007-09-04 14:27:32+00:00,
lzhou@dev3-63.(none) +1 -0
Add max backups defination
storage/ndb/include/kernel/signaldata/BackupImpl.hpp@stripped, 2007-09-04 14:27:32+00:00,
lzhou@dev3-63.(none) +2 -1
Add backup file type
storage/ndb/include/kernel/signaldata/BackupSignalData.hpp@stripped, 2007-09-04
14:27:32+00:00, lzhou@dev3-63.(none) +2 -1
Add backup variable in BackupReq
storage/ndb/include/kernel/signaldata/FsConf.hpp@stripped, 2007-09-04 14:27:32+00:00,
lzhou@dev3-63.(none) +1 -1
Add comment of FSSTATCONF
storage/ndb/include/kernel/signaldata/FsRef.hpp@stripped, 2007-09-04 14:27:32+00:00,
lzhou@dev3-63.(none) +1 -1
Add comment of FSSTATREF
storage/ndb/include/kernel/signaldata/FsStatReq.hpp@stripped, 2007-09-04 14:27:35+00:00,
lzhou@dev3-63.(none) +125 -0
New file to definate FSSTATREQ signal.
storage/ndb/include/kernel/signaldata/FsStatReq.hpp@stripped, 2007-09-04 14:27:35+00:00,
lzhou@dev3-63.(none) +0 -0
storage/ndb/include/kernel/signaldata/SignalData.hpp@stripped, 2007-09-04 14:27:32+00:00,
lzhou@dev3-63.(none) +3 -0
Add print function
storage/ndb/include/kernel/signaldata/UtilSequence.hpp@stripped, 2007-09-04 14:27:32+00:00,
lzhou@dev3-63.(none) +4 -2
Add new RequestType to set backup id
storage/ndb/include/mgmapi/mgmapi.h@stripped, 2007-09-04 14:27:32+00:00,
lzhou@dev3-63.(none) +3 -1
Add input backup parameter in ndb_mgm_start_backup function
storage/ndb/src/common/debugger/signaldata/FsStatReq.cpp@stripped, 2007-09-04 14:27:34+00:00,
lzhou@dev3-63.(none) +33 -0
New file implement printFsStat
storage/ndb/src/common/debugger/signaldata/FsStatReq.cpp@stripped, 2007-09-04 14:27:34+00:00,
lzhou@dev3-63.(none) +0 -0
storage/ndb/src/common/debugger/signaldata/Makefile.am@stripped, 2007-09-04 14:27:32+00:00,
lzhou@dev3-63.(none) +1 -1
Add FsStatReq.cpp file
storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp@stripped, 2007-09-04
14:27:33+00:00, lzhou@dev3-63.(none) +3 -0
Add signal print
storage/ndb/src/common/debugger/signaldata/SignalNames.cpp@stripped, 2007-09-04
14:27:33+00:00, lzhou@dev3-63.(none) +3 -0
Add signal name of FSSTAT*
storage/ndb/src/common/debugger/signaldata/UtilSequence.cpp@stripped, 2007-09-04
14:27:33+00:00, lzhou@dev3-63.(none) +2 -0
Add type of 'setVal' when invert type to string
storage/ndb/src/kernel/blocks/backup/Backup.cpp@stripped, 2007-09-04 14:27:33+00:00,
lzhou@dev3-63.(none) +163 -3
Implement 2 function: Check file status and Backup N.
storage/ndb/src/kernel/blocks/backup/Backup.hpp@stripped, 2007-09-04 14:27:33+00:00,
lzhou@dev3-63.(none) +7 -0
Add new function defination.
storage/ndb/src/kernel/blocks/backup/BackupInit.cpp@stripped, 2007-09-04 14:27:33+00:00,
lzhou@dev3-63.(none) +2 -0
Add sinal<->function
storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp@stripped, 2007-09-04 14:27:33+00:00,
lzhou@dev3-63.(none) +53 -1
Implement Backup N.
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp@stripped, 2007-09-04 14:27:33+00:00,
lzhou@dev3-63.(none) +14 -0
Implement file status checking
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp@stripped, 2007-09-04 14:27:33+00:00,
lzhou@dev3-63.(none) +2 -0
Add 'status' action of file request
storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp@stripped, 2007-09-04 14:27:33+00:00,
lzhou@dev3-63.(none) +1 -0
Add FsStatReq headfile
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp@stripped, 2007-09-04 14:27:33+00:00,
lzhou@dev3-63.(none) +47 -0
Implement file status check
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp@stripped, 2007-09-04 14:27:33+00:00,
lzhou@dev3-63.(none) +1 -0
add one funtion to implement file status check
storage/ndb/src/kernel/vm/SimulatedBlock.cpp@stripped, 2007-09-04 14:27:33+00:00,
lzhou@dev3-63.(none) +7 -0
Add FSSTATREF error function
storage/ndb/src/kernel/vm/SimulatedBlock.hpp@stripped, 2007-09-04 14:27:34+00:00,
lzhou@dev3-63.(none) +1 -0
Add function declaration
storage/ndb/src/mgmapi/mgmapi.cpp@stripped, 2007-09-04 14:27:34+00:00, lzhou@dev3-63.(none)
+4 -1
Add input_backupId and send it to mgm server
storage/ndb/src/mgmclient/CommandInterpreter.cpp@stripped, 2007-09-04 14:27:34+00:00,
lzhou@dev3-63.(none) +59 -4
Implement backup n. mgm client part
storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2007-09-04 14:27:34+00:00,
lzhou@dev3-63.(none) +3 -1
Add input backup id into BACKUP_REQ
storage/ndb/src/mgmsrv/MgmtSrvr.hpp@stripped, 2007-09-04 14:27:34+00:00,
lzhou@dev3-63.(none) +1 -1
Modify startBackup declaration. Add input backup id.
storage/ndb/src/mgmsrv/Services.cpp@stripped, 2007-09-04 14:27:34+00:00,
lzhou@dev3-63.(none) +9 -1
Add input backup id into starbackup function to implement 'backup n'
storage/ndb/src/ndbapi/ndberror.c@stripped, 2007-09-04 14:27:34+00:00, lzhou@dev3-63.(none)
+1 -0
Add new error message
storage/ndb/test/include/NDBT_Test.hpp@stripped, 2007-09-04 14:27:34+00:00,
lzhou@dev3-63.(none) +1 -0
Add head file of ndb_limits.h to get MAX_BACKUP
storage/ndb/test/ndbapi/testBackup.cpp@stripped, 2007-09-04 14:27:34+00:00,
lzhou@dev3-63.(none) +27 -0
Add test case of 'backup n'
storage/ndb/test/src/NdbBackup.cpp@stripped, 2007-09-04 14:27:34+00:00, lzhou@dev3-63.(none)
+2 -1
Add test case when backup files exist
diff -Nrup a/storage/ndb/include/kernel/GlobalSignalNumbers.h
b/storage/ndb/include/kernel/GlobalSignalNumbers.h
--- a/storage/ndb/include/kernel/GlobalSignalNumbers.h 2007-02-14 05:35:27 +00:00
+++ b/storage/ndb/include/kernel/GlobalSignalNumbers.h 2007-09-04 14:27:32 +00:00
@@ -377,10 +377,10 @@ extern const GlobalSignalNumber NO_OF_SI
#define GSN_GCP_SAVEREF 282
#define GSN_GCP_SAVEREQ 283
#define GSN_GCP_TCFINISHED 284
+#define GSN_FSSTATREQ 285
+#define GSN_FSSTATREF 286
+#define GSN_FSSTATCONF 287
-/* 285 unused */
-/* 286 unused */
-/* 287 unused */
#define GSN_GETGCICONF 288
#define GSN_GETGCIREQ 289
#define GSN_HOT_SPAREREP 290
diff -Nrup a/storage/ndb/include/kernel/ndb_limits.h
b/storage/ndb/include/kernel/ndb_limits.h
--- a/storage/ndb/include/kernel/ndb_limits.h 2006-12-23 19:20:03 +00:00
+++ b/storage/ndb/include/kernel/ndb_limits.h 2007-09-04 14:27:32 +00:00
@@ -27,6 +27,7 @@
#define MAX_NDB_NODES 49
#define MAX_NODES 64
#define UNDEF_NODEGROUP 0xFFFF
+#define MAX_BACKUPS 0xFFFFFFFF
/**
* MAX_API_NODES = MAX_NODES - No of NDB Nodes in use
diff -Nrup a/storage/ndb/include/kernel/signaldata/BackupImpl.hpp
b/storage/ndb/include/kernel/signaldata/BackupImpl.hpp
--- a/storage/ndb/include/kernel/signaldata/BackupImpl.hpp 2006-12-23 19:20:03 +00:00
+++ b/storage/ndb/include/kernel/signaldata/BackupImpl.hpp 2007-09-04 14:27:32 +00:00
@@ -94,7 +94,8 @@ public:
FailedInsertTableList = 1346,
FailedAllocateTableMem = 1347,
FailedToAllocateFileRecord = 1348,
- FailedToAllocateAttributeRecord = 1349
+ FailedToAllocateAttributeRecord = 1349,
+ FailedForBackupFilesAleadyExist = 1350
};
private:
Uint32 backupId;
diff -Nrup a/storage/ndb/include/kernel/signaldata/BackupSignalData.hpp
b/storage/ndb/include/kernel/signaldata/BackupSignalData.hpp
--- a/storage/ndb/include/kernel/signaldata/BackupSignalData.hpp 2006-12-23 19:20:03
+00:00
+++ b/storage/ndb/include/kernel/signaldata/BackupSignalData.hpp 2007-09-04 14:27:32
+00:00
@@ -35,7 +35,7 @@ class BackupReq {
friend bool printBACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
public:
- STATIC_CONST( SignalLength = 3 );
+ STATIC_CONST( SignalLength = 4 );
private:
Uint32 senderData;
@@ -43,6 +43,7 @@ private:
/* & 0x3 - waitCompleted
*/
Uint32 flags;
+ Uint32 inputBackupId;
};
class BackupData {
diff -Nrup a/storage/ndb/include/kernel/signaldata/FsConf.hpp
b/storage/ndb/include/kernel/signaldata/FsConf.hpp
--- a/storage/ndb/include/kernel/signaldata/FsConf.hpp 2006-12-23 19:20:05 +00:00
+++ b/storage/ndb/include/kernel/signaldata/FsConf.hpp 2007-09-04 14:27:32 +00:00
@@ -21,7 +21,7 @@
/**
* FsConf - Common signal class for all CONF signals sent from Ndbfs
* GSN_FSCLOSECONF, GSN_FSOPENCONF, GSN_FSWRITECONF, GSN_FSREADCONF,
- * GSN_FSSYNCCONF, GSN_FSREMOVECONF
+ * GSN_FSSYNCCONF, GSN_FSREMOVECONF, GSN_FSSTATCONF
*/
/**
diff -Nrup a/storage/ndb/include/kernel/signaldata/FsRef.hpp
b/storage/ndb/include/kernel/signaldata/FsRef.hpp
--- a/storage/ndb/include/kernel/signaldata/FsRef.hpp 2006-12-23 19:20:05 +00:00
+++ b/storage/ndb/include/kernel/signaldata/FsRef.hpp 2007-09-04 14:27:32 +00:00
@@ -22,7 +22,7 @@
/**
* FsRef - Common signal class for all REF signals sent from Ndbfs
* GSN_FSCLOSEREF, GSN_FSOPENREF, GSN_FSWRITEREF, GSN_FSREADREF,
- * GSN_FSSYNCREF
+ * GSN_FSSYNCREF,GSN_FSSTATREF
*/
diff -Nrup a/storage/ndb/include/kernel/signaldata/FsStatReq.hpp
b/storage/ndb/include/kernel/signaldata/FsStatReq.hpp
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/storage/ndb/include/kernel/signaldata/FsStatReq.hpp 2007-09-04 14:27:35 +00:00
@@ -0,0 +1,125 @@
+/* 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; version 2 of the License.
+
+ 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 FS_STAT_REQ_H
+#define FS_STAT_REQ_H
+
+#include "SignalData.hpp"
+
+/**
+ *
+ * SENDER: Backup
+ * RECIVER: Ndbfs
+ */
+class FsStatReq {
+ /**
+ * Reciver(s)
+ */
+ friend class Ndbfs; // Reciver
+
+ /**
+ * Sender(s)
+ */
+ friend class Backup;
+
+ /**
+ * For printing
+ */
+ friend bool printFSSTATREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16
receiverBlockNo);
+
+public:
+ /**
+ * Length of signal
+ */
+ STATIC_CONST( SignalLength = 6 );
+ SECTION( FILENAME = 0 );
+
+private:
+
+ /**
+ * DATA VARIABLES
+ */
+
+ UintR userReference; // DATA 0
+ UintR userPointer; // DATA 1
+ UintR fileNumber[4]; // DATA 2 - 5
+
+ enum Suffixes {
+ S_DATA = 0,
+ S_FRAGLOG = 1,
+ S_LOGLOG = 2,
+ S_FRAGLIST = 3,
+ S_TABLELIST = 4,
+ S_SCHEMALOG = 5,
+ S_SYSFILE = 6,
+ S_LOG = 7,
+ S_CTL = 8
+ };
+
+ static void setVersion(Uint32 fileNumber[], Uint8 val);
+ static void setSuffix(Uint32 fileNumber[], Uint8 val);
+
+ /**
+ * V2 - Backup
+ */
+ static void v2_setSequence(Uint32 fileNumber[], Uint32 no);
+ static void v2_setNodeId(Uint32 fileNumber[], Uint32 no);
+ static void v2_setCount(Uint32 fileNumber[], Uint32 no);
+
+};
+
+/**
+ * -- v2 --
+ * File number[0] = Backup Sequence Number
+ * File number[1] = Node Id
+ * File number[3] =
+ * v = version 24 - 31
+ * s = v1_suffix 16 - 23
+ *
+ * 1111111111222222222233
+ * 01234567890123456789012345678901
+ * ssssssssvvvvvvvv
+ */
+
+inline
+void FsStatReq::setVersion(Uint32 fileNumber[], Uint8 val){
+ const Uint32 t = fileNumber[3];
+ fileNumber[3] = t & 0x00FFFFFF | (((Uint32)val) << 24);
+}
+
+inline
+void FsStatReq::setSuffix(Uint32 fileNumber[], Uint8 val){
+ const Uint32 t = fileNumber[3];
+ fileNumber[3] = t & 0xFF00FFFF | (((Uint32)val) << 16);
+}
+
+/****************/
+inline
+void FsStatReq::v2_setSequence(Uint32 fileNumber[], Uint32 val){
+ fileNumber[0] = val;
+}
+
+inline
+void FsStatReq::v2_setNodeId(Uint32 fileNumber[], Uint32 val){
+ fileNumber[1] = val;
+}
+
+inline
+void FsStatReq::v2_setCount(Uint32 fileNumber[], Uint32 val){
+ fileNumber[2] = val;
+}
+
+#endif
+
diff -Nrup a/storage/ndb/include/kernel/signaldata/SignalData.hpp
b/storage/ndb/include/kernel/signaldata/SignalData.hpp
--- a/storage/ndb/include/kernel/signaldata/SignalData.hpp 2006-12-23 19:20:06 +00:00
+++ b/storage/ndb/include/kernel/signaldata/SignalData.hpp 2007-09-04 14:27:32 +00:00
@@ -63,6 +63,7 @@ GSN_PRINT_SIGNATURE(printTUPKEYCONF);
GSN_PRINT_SIGNATURE(printTUPKEYREF);
GSN_PRINT_SIGNATURE(printTUPCOMMITREQ);
GSN_PRINT_SIGNATURE(printCONTINUEB);
+GSN_PRINT_SIGNATURE(printFSSTATREQ);
GSN_PRINT_SIGNATURE(printFSOPENREQ);
GSN_PRINT_SIGNATURE(printFSCLOSEREQ);
GSN_PRINT_SIGNATURE(printFSREADWRITEREQ);
@@ -72,6 +73,8 @@ GSN_PRINT_SIGNATURE(printFSREF);
GSN_PRINT_SIGNATURE(printFSREF);
GSN_PRINT_SIGNATURE(printFSREF);
GSN_PRINT_SIGNATURE(printFSREF);
+GSN_PRINT_SIGNATURE(printFSREF);
+GSN_PRINT_SIGNATURE(printFSCONF);
GSN_PRINT_SIGNATURE(printFSCONF);
GSN_PRINT_SIGNATURE(printFSCONF);
GSN_PRINT_SIGNATURE(printFSCONF);
diff -Nrup a/storage/ndb/include/kernel/signaldata/UtilSequence.hpp
b/storage/ndb/include/kernel/signaldata/UtilSequence.hpp
--- a/storage/ndb/include/kernel/signaldata/UtilSequence.hpp 2006-12-23 19:20:07 +00:00
+++ b/storage/ndb/include/kernel/signaldata/UtilSequence.hpp 2007-09-04 14:27:32 +00:00
@@ -33,17 +33,19 @@ class UtilSequenceReq {
friend bool printUTIL_SEQUENCE_REQ(FILE *, const Uint32 *, Uint32, Uint16);
public:
- STATIC_CONST( SignalLength = 3 );
+ STATIC_CONST( SignalLength = 4 );
enum RequestType {
NextVal = 1, // Return uniq value
CurrVal = 2, // Read
- Create = 3 // Create a sequence
+ Create = 3, // Create a sequence
+ SetVal = 4 // Set a new sequence
};
private:
Uint32 senderData;
Uint32 sequenceId; // Number of sequence variable
Uint32 requestType;
+ Uint32 backupId;
};
class UtilSequenceConf {
diff -Nrup a/storage/ndb/include/mgmapi/mgmapi.h b/storage/ndb/include/mgmapi/mgmapi.h
--- a/storage/ndb/include/mgmapi/mgmapi.h 2007-06-14 10:35:33 +00:00
+++ b/storage/ndb/include/mgmapi/mgmapi.h 2007-09-04 14:27:32 +00:00
@@ -980,13 +980,15 @@ extern "C" {
* 2: Wait for backup to be completed
* @param backup_id Backup ID is returned from function.
* @param reply Reply message.
+ * @param input_backupId user input backupId.
* @return -1 on error.
* @note backup_id will not be returned if
* wait_completed == 0
*/
int ndb_mgm_start_backup(NdbMgmHandle handle, int wait_completed,
unsigned int* backup_id,
- struct ndb_mgm_reply* reply);
+ struct ndb_mgm_reply* reply,
+ unsigned int input_backupId = 0);
/**
* Abort backup
diff -Nrup a/storage/ndb/src/common/debugger/signaldata/FsStatReq.cpp
b/storage/ndb/src/common/debugger/signaldata/FsStatReq.cpp
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/storage/ndb/src/common/debugger/signaldata/FsStatReq.cpp 2007-09-04 14:27:34 +00:00
@@ -0,0 +1,33 @@
+/* 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; version 2 of the License.
+
+ 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 */
+
+
+
+#include <signaldata/FsStatReq.hpp>
+
+bool
+printFSSTATREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16
receiverBlockNo){
+
+ const FsStatReq * const sig = (FsStatReq *) theData;
+
+
+ fprintf(output, " UserReference: H\'%.8x, userPointer: H\'%.8x\n",
+ sig->userReference, sig->userPointer);
+ fprintf(output, " FileNumber[1-4]: H\'%.8x H\'%.8x H\'%.8x H\'%.8x\n",
+ sig->fileNumber[0], sig->fileNumber[1], sig->fileNumber[2],
sig->fileNumber[3]);
+
+ fprintf(output, "\n");
+ return true;
+}
diff -Nrup a/storage/ndb/src/common/debugger/signaldata/Makefile.am
b/storage/ndb/src/common/debugger/signaldata/Makefile.am
--- a/storage/ndb/src/common/debugger/signaldata/Makefile.am 2006-12-31 00:06:42 +00:00
+++ b/storage/ndb/src/common/debugger/signaldata/Makefile.am 2007-09-04 14:27:32 +00:00
@@ -19,7 +19,7 @@ libsignaldataprint_la_SOURCES = \
TcKeyReq.cpp TcKeyConf.cpp TcKeyRef.cpp \
TcRollbackRep.cpp \
TupKey.cpp TupCommit.cpp LqhKey.cpp \
- FsOpenReq.cpp FsCloseReq.cpp FsRef.cpp FsConf.cpp FsReadWriteReq.cpp\
+ FsStatReq.cpp FsOpenReq.cpp FsCloseReq.cpp FsRef.cpp FsConf.cpp
FsReadWriteReq.cpp\
SignalDataPrint.cpp SignalNames.cpp \
ContinueB.cpp DihContinueB.cpp NdbfsContinueB.cpp \
CloseComReqConf.cpp PackedSignal.cpp PrepFailReqRef.cpp \
diff -Nrup a/storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp
b/storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp
--- a/storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp 2006-12-23 19:20:10
+00:00
+++ b/storage/ndb/src/common/debugger/signaldata/SignalDataPrint.cpp 2007-09-04 14:27:33
+00:00
@@ -37,16 +37,19 @@ SignalDataPrintFunctions[] = {
{ GSN_TUPKEYREF, printTUPKEYREF },
{ GSN_TUP_COMMITREQ, printTUPCOMMITREQ },
{ GSN_CONTINUEB, printCONTINUEB },
+ { GSN_FSSTATREQ, printFSSTATREQ },
{ GSN_FSOPENREQ, printFSOPENREQ },
{ GSN_FSCLOSEREQ, printFSCLOSEREQ },
{ GSN_FSREADREQ, printFSREADWRITEREQ },
{ GSN_FSWRITEREQ, printFSREADWRITEREQ },
{ GSN_FSCLOSEREF, printFSREF },
+ { GSN_FSSTATREF, printFSREF },
{ GSN_FSOPENREF, printFSREF },
{ GSN_FSWRITEREF, printFSREF },
{ GSN_FSREADREF, printFSREF },
{ GSN_FSSYNCREF, printFSREF },
{ GSN_FSCLOSECONF, printFSCONF },
+ { GSN_FSSTATCONF, printFSCONF },
{ GSN_FSOPENCONF, printFSCONF },
{ GSN_FSWRITECONF, printFSCONF },
{ GSN_FSREADCONF, printFSCONF },
diff -Nrup a/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp
b/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp
--- a/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp 2007-05-07 14:07:00
+00:00
+++ b/storage/ndb/src/common/debugger/signaldata/SignalNames.cpp 2007-09-04 14:27:33
+00:00
@@ -218,6 +218,9 @@ const GsnName SignalNames [] = {
,{ GSN_GCP_SAVEREF, "GCP_SAVEREF" }
,{ GSN_GCP_SAVEREQ, "GCP_SAVEREQ" }
,{ GSN_GCP_TCFINISHED, "GCP_TCFINISHED" }
+ ,{ GSN_FSSTATREQ, "FSSTATREQ" }
+ ,{ GSN_FSSTATREF, "FSSTATREF" }
+ ,{ GSN_FSSTATCONF, "FSSTATCONF" }
,{ GSN_GET_TABINFOREF, "GET_TABINFOREF" }
,{ GSN_GET_TABINFOREQ, "GET_TABINFOREQ" }
,{ GSN_GET_TABINFO_CONF, "GET_TABINFO_CONF" }
diff -Nrup a/storage/ndb/src/common/debugger/signaldata/UtilSequence.cpp
b/storage/ndb/src/common/debugger/signaldata/UtilSequence.cpp
--- a/storage/ndb/src/common/debugger/signaldata/UtilSequence.cpp 2006-12-23 19:20:11
+00:00
+++ b/storage/ndb/src/common/debugger/signaldata/UtilSequence.cpp 2007-09-04 14:27:33
+00:00
@@ -25,6 +25,8 @@ type2string(UtilSequenceReq::RequestType
return "CurrVal";
case UtilSequenceReq::Create:
return "Create";
+ case UtilSequenceReq::SetVal:
+ return "SetVal";
default:
return "Unknown";
}
diff -Nrup a/storage/ndb/src/kernel/blocks/backup/Backup.cpp
b/storage/ndb/src/kernel/blocks/backup/Backup.cpp
--- a/storage/ndb/src/kernel/blocks/backup/Backup.cpp 2007-06-12 08:38:05 +00:00
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.cpp 2007-09-04 14:27:33 +00:00
@@ -32,6 +32,7 @@
#include <signaldata/ListTables.hpp>
#include <signaldata/FsOpenReq.hpp>
+#include <signaldata/FsStatReq.hpp>
#include <signaldata/FsAppendReq.hpp>
#include <signaldata/FsCloseReq.hpp>
#include <signaldata/FsConf.hpp>
@@ -1046,6 +1047,7 @@ Backup::execBACKUP_REQ(Signal* signal)
const BlockReference senderRef = signal->senderBlockRef();
const Uint32 dataLen32 = req->backupDataLen; // In 32 bit words
const Uint32 flags = signal->getLength() > 2 ? req->flags : 2;
+ const Uint32 input_backupId = signal->getLength() > 3 ? req->inputBackupId :
0;
if(getOwnNodeId() != getMasterNodeId()) {
jam();
@@ -1090,7 +1092,10 @@ Backup::execBACKUP_REQ(Signal* signal)
ptr.p->flags = flags;
ptr.p->masterRef = reference();
ptr.p->nodes = c_aliveNodes;
- ptr.p->backupId = 0;
+ if(input_backupId > 0)
+ ptr.p->backupId = input_backupId;
+ else
+ ptr.p->backupId = 0;
ptr.p->backupKey[0] = 0;
ptr.p->backupKey[1] = 0;
ptr.p->backupDataLen = 0;
@@ -1101,7 +1106,13 @@ Backup::execBACKUP_REQ(Signal* signal)
ptr.p->masterData.gsn = GSN_UTIL_SEQUENCE_REQ;
utilReq->senderData = ptr.i;
utilReq->sequenceId = BACKUP_SEQUENCE;
- utilReq->requestType = UtilSequenceReq::NextVal;
+ if(input_backupId > 0) {
+ utilReq->requestType = UtilSequenceReq::SetVal;
+ utilReq->backupId = input_backupId;
+ }
+ else {
+ utilReq->requestType = UtilSequenceReq::NextVal;
+ }
sendSignal(DBUTIL_REF, GSN_UTIL_SEQUENCE_REQ,
signal, UtilSequenceReq::SignalLength, JBB);
}
@@ -1183,11 +1194,13 @@ Backup::execUTIL_SEQUENCE_CONF(Signal* s
}//if
+ if(ptr.p->backupId <= 0 && conf->requestType !=
UtilSequenceReq::SetVal)
{
Uint64 backupId;
memcpy(&backupId,conf->sequenceValue,8);
ptr.p->backupId= (Uint32)backupId;
}
+
ptr.p->backupKey[0] = (getOwnNodeId() << 16) | (ptr.p->backupId &
0xFFFF);
ptr.p->backupKey[1] = NdbTick_CurrentMillisecond();
@@ -2754,7 +2767,154 @@ Backup::execLIST_TABLES_CONF(Signal* sig
/**
* All tables fetched
*/
- openFiles(signal, ptr);
+ getBackupFileStatus(signal, ptr);
+
+}
+
+void
+Backup::getBackupFileStatus(Signal* signal, BackupRecordPtr ptr)
+{
+ jam();
+
+ BackupFilePtr filePtr LINT_SET_PTR;
+
+ FsStatReq* req = (FsStatReq*)signal->getDataPtr();
+ req->userReference = reference();
+ //req->fileFlags = FsStatReq::OM_READONLY;
+ FsStatReq::v2_setCount(req->fileNumber, 0xFFFFFFFF);
+ //req->auto_sync_size = c_defaults.m_disk_synch_size;
+ /**
+ * Ctl file
+ */
+ c_backupFilePool.getPtr(filePtr, ptr.p->ctlFilePtr);
+ filePtr.p->m_flags |= BackupFile::BF_CHECKING;
+
+ req->userPointer = filePtr.i;
+ FsStatReq::setVersion(req->fileNumber, 2);
+ FsStatReq::setSuffix(req->fileNumber, FsStatReq::S_CTL);
+ FsStatReq::v2_setSequence(req->fileNumber, ptr.p->backupId);
+ FsStatReq::v2_setNodeId(req->fileNumber, getOwnNodeId());
+ sendSignal(NDBFS_REF, GSN_FSSTATREQ, signal, FsStatReq::SignalLength, JBA);
+ /**
+ * Log file
+ */
+ c_backupFilePool.getPtr(filePtr, ptr.p->logFilePtr);
+ filePtr.p->m_flags |= BackupFile::BF_CHECKING;
+
+ req->userPointer = filePtr.i;
+ FsStatReq::setVersion(req->fileNumber, 2);
+ FsStatReq::setSuffix(req->fileNumber, FsStatReq::S_LOG);
+ FsStatReq::v2_setSequence(req->fileNumber, ptr.p->backupId);
+ FsStatReq::v2_setNodeId(req->fileNumber, getOwnNodeId());
+ sendSignal(NDBFS_REF, GSN_FSSTATREQ, signal, FsStatReq::SignalLength, JBA);
+ /**
+ * Data file
+ */
+ c_backupFilePool.getPtr(filePtr, ptr.p->dataFilePtr);
+ filePtr.p->m_flags |= BackupFile::BF_CHECKING;
+
+ req->userPointer = filePtr.i;
+ FsStatReq::setVersion(req->fileNumber, 2);
+ FsStatReq::setSuffix(req->fileNumber, FsStatReq::S_DATA);
+ FsStatReq::v2_setSequence(req->fileNumber, ptr.p->backupId);
+ FsStatReq::v2_setNodeId(req->fileNumber, getOwnNodeId());
+ FsStatReq::v2_setCount(req->fileNumber, 0);
+
+ sendSignal(NDBFS_REF, GSN_FSSTATREQ, signal, FsStatReq::SignalLength, JBA);
+
+}
+
+void
+Backup::execFSSTATREF(Signal* signal)
+{
+ jamEntry();
+
+ FsRef * ref = (FsRef *)signal->getDataPtr();
+
+ const Uint32 userPtr = ref->userPointer;
+
+ BackupFilePtr filePtr LINT_SET_PTR;
+ c_backupFilePool.getPtr(filePtr, userPtr);
+
+ BackupRecordPtr ptr LINT_SET_PTR;
+ c_backupPool.getPtr(ptr, filePtr.p->backupPtr);
+
+ ndbrequire(filePtr.p->m_flags & BackupFile::BF_CHECKING);
+ filePtr.p->m_flags &= ~(Uint32)BackupFile::BF_CHECKING;
+ filePtr.p->m_flags &= ~(Uint32)BackupFile::BF_EXIST;
+
+ getFilesStatReply(signal, ptr, filePtr);
+}
+
+void
+Backup::execFSSTATCONF(Signal* signal)
+{
+ jamEntry();
+
+ FsConf * conf = (FsConf *)signal->getDataPtr();
+
+ const Uint32 userPtr = conf->userPointer;
+
+ BackupFilePtr filePtr LINT_SET_PTR;
+ c_backupFilePool.getPtr(filePtr, userPtr);
+
+ BackupRecordPtr ptr LINT_SET_PTR;
+ c_backupPool.getPtr(ptr, filePtr.p->backupPtr);
+
+ ndbrequire(filePtr.p->m_flags & BackupFile::BF_CHECKING);
+ filePtr.p->m_flags &= ~(Uint32)BackupFile::BF_CHECKING;
+ filePtr.p->m_flags |= BackupFile::BF_EXIST;
+
+ getFilesStatReply(signal, ptr, filePtr);
+}
+
+void
+Backup::getFilesStatReply(Signal* signal,
+ BackupRecordPtr ptr, BackupFilePtr filePtr)
+{
+ jam();
+ bool exist= false;
+ /**
+ * Check if all files have recived FSSTAT reply
+ */
+ for(ptr.p->files.first(filePtr); filePtr.i!=RNIL;ptr.p->files.next(filePtr))
+ {
+ jam();
+ if(filePtr.p->m_flags & BackupFile::BF_CHECKING) {
+ jam();
+ return;
+ }//if
+ }
+ /**
+ * If file exist, will return REF
+ */
+ for(ptr.p->files.first(filePtr); filePtr.i!=RNIL;ptr.p->files.next(filePtr))
+ {
+ jam();
+ if(filePtr.p->m_flags & BackupFile::BF_EXIST) {
+ jam();
+ //should clearup all the backupFile's m_flags
+ filePtr.p->m_flags &= ~(Uint32)BackupFile::BF_EXIST;
+ exist = true;
+ }//if
+ }
+
+ if (ERROR_INSERTED(10037)) {
+ jam();
+ defineBackupRef(signal, ptr, DefineBackupRef::FailedForBackupFilesAleadyExist);
+ return;
+ }
+
+ if(exist == true)
+ {
+ defineBackupRef(signal, ptr, DefineBackupRef::FailedForBackupFilesAleadyExist);
+ return;
+ }
+ else
+ /**
+ * All backup files don't already exist
+ */
+ openFiles(signal, ptr);
}
void
diff -Nrup a/storage/ndb/src/kernel/blocks/backup/Backup.hpp
b/storage/ndb/src/kernel/blocks/backup/Backup.hpp
--- a/storage/ndb/src/kernel/blocks/backup/Backup.hpp 2007-06-05 15:29:32 +00:00
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.hpp 2007-09-04 14:27:33 +00:00
@@ -110,6 +110,9 @@ protected:
/**
* FS signals
*/
+ void execFSSTATREF(Signal* signal);
+ void execFSSTATCONF(Signal* signal);
+
void execFSOPENREF(Signal* signal);
void execFSOPENCONF(Signal* signal);
@@ -351,6 +354,8 @@ public:
,BF_FILE_THREAD = 0x8
,BF_SCAN_THREAD = 0x10
,BF_LCP_META = 0x20
+ ,BF_CHECKING = 0x40
+ ,BF_EXIST = 0x80
};
Uint32 m_flags;
Uint32 m_pos;
@@ -582,6 +587,8 @@ public:
void getFragmentInfo(Signal*, BackupRecordPtr, TablePtr, Uint32 fragNo);
void getFragmentInfoDone(Signal*, BackupRecordPtr);
+ void getBackupFileStatus(Signal* signal, BackupRecordPtr ptr);
+ void getFilesStatReply(Signal*, BackupRecordPtr ptr, BackupFilePtr);
void openFiles(Signal* signal, BackupRecordPtr ptr);
void openFilesReply(Signal*, BackupRecordPtr ptr, BackupFilePtr);
void closeFiles(Signal*, BackupRecordPtr ptr);
diff -Nrup a/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp
b/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp
--- a/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp 2007-06-05 15:29:32 +00:00
+++ b/storage/ndb/src/kernel/blocks/backup/BackupInit.cpp 2007-09-04 14:27:33 +00:00
@@ -67,6 +67,8 @@ Backup::Backup(Block_context& ctx) :
addRecSignal(GSN_DI_FCOUNTCONF, &Backup::execDI_FCOUNTCONF);
addRecSignal(GSN_DIGETPRIMCONF, &Backup::execDIGETPRIMCONF);
+ addRecSignal(GSN_FSSTATREF, &Backup::execFSSTATREF, true);
+ addRecSignal(GSN_FSSTATCONF, &Backup::execFSSTATCONF);
addRecSignal(GSN_FSOPENREF, &Backup::execFSOPENREF, true);
addRecSignal(GSN_FSOPENCONF, &Backup::execFSOPENCONF);
diff -Nrup a/storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp
b/storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp
--- a/storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp 2006-12-23 19:20:17 +00:00
+++ b/storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp 2007-09-04 14:27:33 +00:00
@@ -171,7 +171,7 @@ DbUtil::execREAD_CONFIG_REQ(Signal* sign
c_pagePool.setSize(10);
c_preparePool.setSize(1); // one parallel prepare at a time
- c_preparedOperationPool.setSize(5); // three hardcoded, two for test
+ c_preparedOperationPool.setSize(6); // three hardcoded, one for setval, two for test
c_operationPool.setSize(64); // 64 parallel operations
c_transactionPool.setSize(32); // 16 parallel transactions
c_attrMappingPool.setSize(100);
@@ -1496,6 +1496,35 @@ DbUtil::hardcodedPrepare() {
ptr.p->tckey.requestInfo = requestInfo;
ptr.p->tckey.tableSchemaVersion = 1;
}
+
+ /**
+ * Prepare SetSequence (UPDATE)
+ */
+ {
+ PreparedOperationPtr ptr;
+ ndbrequire(c_preparedOperationPool.seizeId(ptr, 3));
+ ptr.p->keyLen = 1;
+ ptr.p->rsLen = 0;
+ ptr.p->tckeyLenInBytes = (TcKeyReq::StaticLength + ptr.p->keyLen + 5) * 4;
+ ptr.p->keyDataPos = TcKeyReq::StaticLength;
+ ptr.p->tckey.attrLen = 9;
+ ptr.p->tckey.tableId = 0;
+ Uint32 requestInfo = 0;
+ TcKeyReq::setAbortOption(requestInfo, TcKeyReq::CommitIfFailFree);
+ TcKeyReq::setOperationType(requestInfo, ZUPDATE);
+ TcKeyReq::setKeyLength(requestInfo, 1);
+ TcKeyReq::setAIInTcKeyReq(requestInfo, 5);
+ TcKeyReq::setInterpretedFlag(requestInfo, 1);
+ ptr.p->tckey.requestInfo = requestInfo;
+ ptr.p->tckey.tableSchemaVersion = 1;
+
+ Uint32 * attrInfo = &ptr.p->tckey.distrGroupHashValue;
+ attrInfo[0] = 0; // IntialReadSize
+ attrInfo[1] = 3; // InterpretedSize
+ attrInfo[2] = 0; // FinalUpdateSize
+ attrInfo[3] = 1; // FinalReadSize
+ attrInfo[4] = 0; // SubroutineSize
+ }
}
void
@@ -1516,6 +1545,10 @@ DbUtil::execUTIL_SEQUENCE_REQ(Signal* si
case UtilSequenceReq::Create:
prepOp = c_preparedOperationPool.getPtr(2); //c_CreateSequence
break;
+ case UtilSequenceReq::SetVal:{
+ prepOp = c_preparedOperationPool.getPtr(3);
+ break;
+ }
default:
ndbrequire(false);
prepOp = 0; // remove warning
@@ -1566,6 +1599,21 @@ DbUtil::execUTIL_SEQUENCE_REQ(Signal* si
* it.data = 0;
}
+ if(req->requestType == UtilSequenceReq::SetVal)
+ { // AttrInfo
+ ndbrequire(opPtr.p->attrInfo.seize(4));
+ AttrInfoBuffer::DataBufferIterator it;
+ opPtr.p->attrInfo.first(it);
+ * it.data = Interpreter::LoadConst16(7, req->backupId);
+ ndbrequire(opPtr.p->attrInfo.next(it));
+ * it.data = Interpreter::Write(1, 7);
+ ndbrequire(opPtr.p->attrInfo.next(it))
+ * it.data = Interpreter::ExitOK();
+
+ ndbrequire(opPtr.p->attrInfo.next(it));
+ AttributeHeader::init(it.data, 1, 0);
+ }
+
runTransaction(signal, transPtr);
}
@@ -1643,6 +1691,9 @@ DbUtil::reportSequence(Signal* signal, c
ret->sequenceValue[1] = rsit.data[2];
break;
}
+ case UtilSequenceReq::SetVal:
+ ok = true;
+ break;
case UtilSequenceReq::Create:
ok = true;
ret->sequenceValue[0] = 0;
@@ -1659,6 +1710,7 @@ DbUtil::reportSequence(Signal* signal, c
switch(transP->sequence.requestType)
{
+ case UtilSequenceReq::SetVal:
case UtilSequenceReq::CurrVal:
case UtilSequenceReq::NextVal:{
if (transP->errorCode == 626)
diff -Nrup a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
--- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp 2007-08-27 18:57:18 +00:00
+++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp 2007-09-04 14:27:33 +00:00
@@ -29,6 +29,7 @@
#include <NdbThread.h>
#include <signaldata/FsRef.hpp>
#include <signaldata/FsOpenReq.hpp>
+#include <signaldata/FsStatReq.hpp>
#include <signaldata/FsReadWriteReq.hpp>
// use this to test broken pread code
@@ -187,6 +188,9 @@ AsyncFile::run()
}//if
m_current_request= request;
switch (request->action) {
+ case Request:: status:
+ statusReq(request);
+ break;
case Request:: open:
openReq(request);
break;
@@ -325,6 +329,16 @@ reopen:
return 0;
}
+void AsyncFile::statusReq(Request* request)
+{
+ struct stat buf;
+ if ((stat(theFileName.c_str(), &buf) == -1))
+ {
+ request->error = errno;
+ return;
+ }
+}
+
void AsyncFile::openReq(Request* request)
{
m_auto_sync_freq = 0;
diff -Nrup a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
--- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp 2007-08-27 18:57:18 +00:00
+++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp 2007-09-04 14:27:33 +00:00
@@ -109,6 +109,7 @@ public:
Request() {}
enum Action {
+ status,
open,
close,
closeRemove,
@@ -199,6 +200,7 @@ public:
Request *m_current_request, *m_last_request;
private:
+ void statusReq(Request *request);
void openReq(Request *request);
void readReq(Request *request);
void readvReq(Request *request);
diff -Nrup a/storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp
b/storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp
--- a/storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp 2006-12-23 19:20:18 +00:00
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp 2007-09-04 14:27:33 +00:00
@@ -23,6 +23,7 @@
#include "DebuggerNames.hpp"
#include <signaldata/FsOpenReq.hpp>
+#include <signaldata/FsStatReq.hpp>
static const char* fileExtension[] = {
".Data",
diff -Nrup a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
--- a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp 2007-05-30 07:02:48 +00:00
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp 2007-09-04 14:27:33 +00:00
@@ -20,6 +20,7 @@
#include "Filename.hpp"
#include <signaldata/FsOpenReq.hpp>
+#include <signaldata/FsStatReq.hpp>
#include <signaldata/FsCloseReq.hpp>
#include <signaldata/FsReadWriteReq.hpp>
#include <signaldata/FsAppendReq.hpp>
@@ -62,6 +63,7 @@ Ndbfs::Ndbfs(Block_context& ctx) :
addRecSignal(GSN_READ_CONFIG_REQ, &Ndbfs::execREAD_CONFIG_REQ);
addRecSignal(GSN_DUMP_STATE_ORD, &Ndbfs::execDUMP_STATE_ORD);
addRecSignal(GSN_STTOR, &Ndbfs::execSTTOR);
+ addRecSignal(GSN_FSSTATREQ, &Ndbfs::execFSSTATREQ);
addRecSignal(GSN_FSOPENREQ, &Ndbfs::execFSOPENREQ);
addRecSignal(GSN_FSCLOSEREQ, &Ndbfs::execFSCLOSEREQ);
addRecSignal(GSN_FSWRITEREQ, &Ndbfs::execFSWRITEREQ);
@@ -174,6 +176,42 @@ Ndbfs::forward( AsyncFile * file, Reques
return 1;
}
+void
+Ndbfs::execFSSTATREQ(Signal* signal)
+{
+ jamEntry();
+ const FsStatReq * const fsStatReq = (FsStatReq *)&signal->theData[0];
+ const BlockReference userRef = fsStatReq->userReference;
+ AsyncFile* file = getIdleFile();
+ ndbrequire(file != NULL);
+ Filename::NameSpec spec(theFileSystemPath, theBackupFilePath);
+
+ Uint32 userPointer = fsStatReq->userPointer;
+
+ ndbassert(file->m_page_ptr.isNull());
+ file->m_page_ptr.setNull();
+
+ if(signal->getNoOfSections() == 0){
+ jam();
+ file->theFileName.set(spec, userRef, fsStatReq->fileNumber);
+ } else {
+ jam();
+ SegmentedSectionPtr ptr;
+ signal->getSection(ptr, FsStatReq::FILENAME);
+ file->theFileName.set(spec, ptr, g_sectionSegmentPool);
+ releaseSections(signal);
+ }
+ file->reportTo(&theFromThreads);
+
+ Request* request = theRequestPool->get();
+ request->action = Request::status;
+ request->error = 0;
+ request->set(userRef, userPointer, newId() );
+ request->file = file;
+ request->theTrace = signal->getTrace();
+ ndbrequire(forward(file, request));
+}
+
void
Ndbfs::execFSOPENREQ(Signal* signal)
{
@@ -717,6 +755,11 @@ Ndbfs::report(Request * request, Signal*
fsRef->osErrorCode = request->error;
}
switch (request->action) {
+ case Request:: status: {
+ jam();
+ sendSignal(ref, GSN_FSSTATREF, signal, FsRef::SignalLength, JBB);
+ break;
+ }
case Request:: open: {
jam();
// Put the file back in idle files list
@@ -775,6 +818,10 @@ Ndbfs::report(Request * request, Signal*
FsConf * const fsConf = (FsConf *)&signal->theData[0];
fsConf->userPointer = request->theUserPointer;
switch (request->action) {
+ case Request:: status: {
+ sendSignal(ref, GSN_FSSTATCONF, signal, 3, JBB);
+ break;
+ }
case Request:: open: {
jam();
theOpenFiles.insert(request->file, request->theFilePointer);
diff -Nrup a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
--- a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp 2006-12-23 19:20:18 +00:00
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp 2007-09-04 14:27:33 +00:00
@@ -43,6 +43,7 @@ protected:
// The signal processing functions
void execREAD_CONFIG_REQ(Signal* signal);
void execDUMP_STATE_ORD(Signal* signal);
+ void execFSSTATREQ(Signal* signal);
void execFSOPENREQ(Signal* signal);
void execFSCLOSEREQ(Signal* signal);
void execFSWRITEREQ(Signal* signal);
diff -Nrup a/storage/ndb/src/kernel/vm/SimulatedBlock.cpp
b/storage/ndb/src/kernel/vm/SimulatedBlock.cpp
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.cpp 2007-06-14 14:10:10 +00:00
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.cpp 2007-09-04 14:27:33 +00:00
@@ -147,6 +147,7 @@ SimulatedBlock::installSimulatedBlockFun
a[GSN_UTIL_LOCK_CONF] = &SimulatedBlock::execUTIL_LOCK_CONF;
a[GSN_UTIL_UNLOCK_REF] = &SimulatedBlock::execUTIL_UNLOCK_REF;
a[GSN_UTIL_UNLOCK_CONF] = &SimulatedBlock::execUTIL_UNLOCK_CONF;
+ a[GSN_FSSTATREF] = &SimulatedBlock::execFSSTATREF;
a[GSN_FSOPENREF] = &SimulatedBlock::execFSOPENREF;
a[GSN_FSCLOSEREF] = &SimulatedBlock::execFSCLOSEREF;
a[GSN_FSWRITEREF] = &SimulatedBlock::execFSWRITEREF;
@@ -1860,6 +1861,12 @@ void
SimulatedBlock::execFSCLOSEREF(Signal* signal)
{
fsRefError(signal, __LINE__, "File system close failed");
+}
+
+void
+SimulatedBlock::execFSSTATREF(Signal* signal)
+{
+ fsRefError(signal, __LINE__, "File system get status failed");
}
void
diff -Nrup a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp
b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2007-07-11 12:36:40 +00:00
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2007-09-04 14:27:34 +00:00
@@ -541,6 +541,7 @@ protected:
void fsRefError(Signal* signal, Uint32 line, const char *msg);
void execFSWRITEREF(Signal* signal);
void execFSREADREF(Signal* signal);
+ void execFSSTATREF(Signal* signal);
void execFSOPENREF(Signal* signal);
void execFSCLOSEREF(Signal* signal);
void execFSREMOVEREF(Signal* signal);
diff -Nrup a/storage/ndb/src/mgmapi/mgmapi.cpp b/storage/ndb/src/mgmapi/mgmapi.cpp
--- a/storage/ndb/src/mgmapi/mgmapi.cpp 2007-08-29 00:51:05 +00:00
+++ b/storage/ndb/src/mgmapi/mgmapi.cpp 2007-09-04 14:27:34 +00:00
@@ -2031,7 +2031,8 @@ extern "C"
int
ndb_mgm_start_backup(NdbMgmHandle handle, int wait_completed,
unsigned int* _backup_id,
- struct ndb_mgm_reply* /*reply*/)
+ struct ndb_mgm_reply*, /*reply*/
+ unsigned int input_backupId)
{
SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_start_backup");
const ParserRow<ParserDummy> start_backup_reply[] = {
@@ -2045,6 +2046,8 @@ ndb_mgm_start_backup(NdbMgmHandle handle
Properties args;
args.put("completed", wait_completed);
+ if(input_backupId > 0)
+ args.put("backupid", input_backupId);
const Properties *reply;
{ // start backup can take some time, set timeout high
Uint64 old_timeout= handle->timeout;
diff -Nrup a/storage/ndb/src/mgmclient/CommandInterpreter.cpp
b/storage/ndb/src/mgmclient/CommandInterpreter.cpp
--- a/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2007-07-30 09:28:28 +00:00
+++ b/storage/ndb/src/mgmclient/CommandInterpreter.cpp 2007-09-04 14:27:34 +00:00
@@ -260,7 +260,7 @@ static const char* helpText =
"SHOW CONFIG Print configuration\n"
"SHOW PARAMETERS Print configuration parameters\n"
#endif
-"START BACKUP [NOWAIT | WAIT STARTED | WAIT COMPLETED]\n"
+"START BACKUP [N | NOWAIT | WAIT STARTED | WAIT COMPLETED]\n"
" Start backup (default WAIT COMPLETED)\n"
"ABORT BACKUP <backup id> Abort backup\n"
"SHUTDOWN Shutdown all processes in cluster\n"
@@ -324,12 +324,15 @@ static const char* helpTextStartBackup =
" NDB Cluster -- Management Client -- Help for START BACKUP command\n"
"---------------------------------------------------------------------------\n"
"START BACKUP Start a cluster backup\n\n"
-"START BACKUP [NOWAIT | WAIT STARTED | WAIT COMPLETED]\n"
+"START BACKUP [N | NOWAIT | WAIT STARTED | WAIT COMPLETED]\n"
" Start a backup for the cluster.\n"
" Each backup gets an ID number that is reported to the\n"
" user. This ID number can help you find the backup on the\n"
" file system, or ABORT BACKUP if you wish to cancel a \n"
-" running backup.\n\n"
+" running backup.\n"
+" You can also start specified backup using START BACKUP N \n\n"
+" N \n"
+" Start a specified backup using N as bakcup ID number.\n"
" NOWAIT \n"
" Start a cluster backup and return immediately.\n"
" The management client will return control directly\n"
@@ -606,6 +609,7 @@ struct st_cmd_help {
{"HELP", helpTextHelp},
{"BACKUP", helpTextBackup},
{"START BACKUP", helpTextStartBackup},
+ {"START BACKUP N", helpTextStartBackup},
{"START BACKUP NOWAIT", helpTextStartBackup},
{"START BACKUP WAIT STARTED", helpTextStartBackup},
{"START BACKUP WAIT", helpTextStartBackup},
@@ -654,6 +658,28 @@ convert(const char* s, int& val) {
return true;
}
+static bool
+convertU(const char* s, unsigned int& val) {
+
+ if (s == NULL)
+ return false;
+
+ if (strlen(s) == 0)
+ return false;
+
+ errno = 0;
+ char* p;
+ long v = strtol(s, &p, 10);
+ if (errno != 0)
+ return false;
+
+ if (p != &s[strlen(s)])
+ return false;
+
+ val = v;
+ return true;
+}
+
/*
* Constructor
*/
@@ -2604,6 +2630,7 @@ CommandInterpreter::executeStartBackup(c
{
struct ndb_mgm_reply reply;
unsigned int backupId;
+ unsigned int input_backupId = 0;
Vector<BaseString> args;
{
@@ -2632,6 +2659,31 @@ CommandInterpreter::executeStartBackup(c
ndbout_c("Waiting for started, this may take several minutes");
flags = 1;
}
+ else if (convertU(args[1].c_str(), input_backupId) && input_backupId > 0
&& input_backupId < MAX_BACKUPS)
+ {
+ // start backup n nowait
+ if (sz == 3 && args[2] == "NOWAIT")
+ {
+ flags = 0;
+ }
+ // start backup n; start backup n wait complete
+ else if ( sz == 2 || (sz == 4 && args[2] == "WAIT" && args[3]
=="COMPLETED"))
+ {
+ flags = 2;
+ ndbout_c("Waiting for completed, this may take several minutes");
+ }
+ //start backup n wait started
+ else if (sz == 4 && args[2] == "WAIT" && args[3] == "STARTED")
+ {
+ ndbout_c("Waiting for started, this may take several minutes");
+ flags = 1;
+ }
+ else
+ {
+ invalid_command(parameters);
+ return -1;
+ }
+ }
else
{
invalid_command(parameters);
@@ -2651,7 +2703,10 @@ CommandInterpreter::executeStartBackup(c
return -1;
}
}
- result = ndb_mgm_start_backup(m_mgmsrv, flags, &backupId, &reply);
+ if (input_backupId > 0)
+ result = ndb_mgm_start_backup(m_mgmsrv, flags, &backupId, &reply,
input_backupId);
+ else
+ result = ndb_mgm_start_backup(m_mgmsrv, flags, &backupId, &reply);
if (result != 0) {
ndbout << "Backup failed" << endl;
diff -Nrup a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2007-06-14 09:26:52 +00:00
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2007-09-04 14:27:34 +00:00
@@ -2505,7 +2505,7 @@ MgmtSrvr::eventReport(const Uint32 * the
***************************************************************************/
int
-MgmtSrvr::startBackup(Uint32& backupId, int waitCompleted)
+MgmtSrvr::startBackup(Uint32& backupId, int waitCompleted, Uint32 input_backupId)
{
SignalSender ss(theFacade);
ss.lock(); // lock will be released on exit
@@ -2530,6 +2530,8 @@ MgmtSrvr::startBackup(Uint32& backupId,
req->backupDataLen = 0;
assert(waitCompleted < 3);
req->flags = waitCompleted & 0x3;
+ if(input_backupId > 0)
+ req->inputBackupId = input_backupId;
BackupEvent event;
int do_send = 1;
diff -Nrup a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2007-06-14 09:26:52 +00:00
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2007-09-04 14:27:34 +00:00
@@ -307,7 +307,7 @@ public:
/**
* Backup functionallity
*/
- int startBackup(Uint32& backupId, int waitCompleted= 2);
+ int startBackup(Uint32& backupId, int waitCompleted= 2, Uint32 input_backupId= 0);
int abortBackup(Uint32 backupId);
int performBackup(Uint32* backupId);
diff -Nrup a/storage/ndb/src/mgmsrv/Services.cpp b/storage/ndb/src/mgmsrv/Services.cpp
--- a/storage/ndb/src/mgmsrv/Services.cpp 2007-07-11 12:36:40 +00:00
+++ b/storage/ndb/src/mgmsrv/Services.cpp 2007-09-04 14:27:34 +00:00
@@ -189,6 +189,7 @@ ParserRow<MgmApiSession> commands[] = {
MGM_CMD("start backup", &MgmApiSession::startBackup, ""),
MGM_ARG("completed", Int, Optional ,"Wait until completed"),
+ MGM_ARG("backupid", Int, Optional ,"User input backup id"),
MGM_CMD("abort backup", &MgmApiSession::abortBackup, ""),
MGM_ARG("id", Int, Mandatory, "Backup id"),
@@ -690,12 +691,19 @@ MgmApiSession::startBackup(Parser<MgmApi
Properties const &args) {
DBUG_ENTER("MgmApiSession::startBackup");
unsigned backupId;
+ unsigned input_backupId;
Uint32 completed= 2;
int result;
args.get("completed", &completed);
- result = m_mgmsrv.startBackup(backupId, completed);
+ if(args.contains("backupid"))
+ {
+ args.get("backupid", &input_backupId);
+ result = m_mgmsrv.startBackup(backupId, completed, input_backupId);
+ }
+ else
+ result = m_mgmsrv.startBackup(backupId, completed);
m_output->println("start backup reply");
if(result != 0)
diff -Nrup a/storage/ndb/src/ndbapi/ndberror.c b/storage/ndb/src/ndbapi/ndberror.c
--- a/storage/ndb/src/ndbapi/ndberror.c 2007-06-14 09:26:52 +00:00
+++ b/storage/ndb/src/ndbapi/ndberror.c 2007-09-04 14:27:34 +00:00
@@ -465,6 +465,7 @@ ErrorBundle ErrorCodes[] = {
{ 1347, DMEC, AE, "Backup failed to allocate table memory (check configuration)" },
{ 1348, DMEC, AE, "Backup failed to allocate file record (check configuration)" },
{ 1349, DMEC, AE, "Backup failed to allocate attribute record (check configuration)" },
+ { 1350, DMEC, TR, "Backup failed: file already exists (use 'START BACKUP N')" },
{ 1329, DMEC, AE, "Backup during software upgrade not supported" },
/**
diff -Nrup a/storage/ndb/test/include/NDBT_Test.hpp
b/storage/ndb/test/include/NDBT_Test.hpp
--- a/storage/ndb/test/include/NDBT_Test.hpp 2007-03-01 09:39:45 +00:00
+++ b/storage/ndb/test/include/NDBT_Test.hpp 2007-09-04 14:27:34 +00:00
@@ -17,6 +17,7 @@
#define NDBT_TEST_HPP
#include <ndb_global.h>
+#include <kernel/ndb_limits.h>
#include "NDBT_ReturnCodes.h"
#include <Properties.hpp>
diff -Nrup a/storage/ndb/test/ndbapi/testBackup.cpp
b/storage/ndb/test/ndbapi/testBackup.cpp
--- a/storage/ndb/test/ndbapi/testBackup.cpp 2006-12-23 19:20:26 +00:00
+++ b/storage/ndb/test/ndbapi/testBackup.cpp 2007-09-04 14:27:34 +00:00
@@ -137,6 +137,19 @@ int runBackupOne(NDBT_Context* ctx, NDBT
return NDBT_OK;
}
+int runBackupRandom(NDBT_Context* ctx, NDBT_Step* step){
+ NdbBackup backup(GETNDB(step)->getNodeId()+1);
+ unsigned backupId = rand() % (MAX_BACKUPS);
+
+ if (backup.start(backupId) == -1){
+ return NDBT_FAILED;
+ }
+ ndbout << "Started backup " << backupId << endl;
+ ctx->setProperty("BackupId", backupId);
+
+ return NDBT_OK;
+}
+
int
runBackupLoop(NDBT_Context* ctx, NDBT_Step* step){
NdbBackup backup(GETNDB(step)->getNodeId()+1);
@@ -470,6 +483,20 @@ TESTCASE("BackupOne",
"5. Verify count and content of table\n"){
INITIALIZER(runLoadTable);
INITIALIZER(runBackupOne);
+ INITIALIZER(runDropTablesRestart);
+ INITIALIZER(runRestoreOne);
+ VERIFIER(runVerifyOne);
+ FINALIZER(runClearTable);
+}
+TESTCASE("BackupRandom",
+ "Test that backup n and restore works on one table \n"
+ "1. Load table\n"
+ "2. Backup\n"
+ "3. Drop tables and restart \n"
+ "4. Restore\n"
+ "5. Verify count and content of table\n"){
+ INITIALIZER(runLoadTable);
+ INITIALIZER(runBackupRandom);
INITIALIZER(runDropTablesRestart);
INITIALIZER(runRestoreOne);
VERIFIER(runVerifyOne);
diff -Nrup a/storage/ndb/test/src/NdbBackup.cpp b/storage/ndb/test/src/NdbBackup.cpp
--- a/storage/ndb/test/src/NdbBackup.cpp 2006-12-23 19:20:31 +00:00
+++ b/storage/ndb/test/src/NdbBackup.cpp 2007-09-04 14:27:34 +00:00
@@ -350,7 +350,8 @@ FailS_codes[] = {
10025,
10027,
10033,
- 10035
+ 10035,
+ 10037
};
int
| Thread |
|---|
| • bk commit into 5.1 tree (lzhou:1.2548) BUG#26498 | lzhou | 4 Sep |