mariadb/ndb/tools/restore/Restore.hpp

380 lines
8.7 KiB
C++
Raw Normal View History

/* 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 RESTORE_H
#define RESTORE_H
#include <ndb_global.h>
#include <NdbOut.hpp>
moved ndb_restore together with rest of the ndb tools kernel includes needed by ndb_restore changed link order moved LocalConfig to mgmapi Moved NdbConfig to Portlib mgmapi to use LocalConfig for connectstring parsing instead of it's own enable usage of "NULL" connectstring for default new ndbmgmclient lib that can be used by e.g. mysqladmin later LocalConfig no longer needed here, now in mgmapi Send connectstring to mgmapi instead added valid connectstring to be with only host without port i.e. valid connectstring =host1,host2,host3 default port will be added ndb/src/common/portlib/NdbConfig.c: Rename: ndb/src/common/mgmcommon/NdbConfig.c -> ndb/src/common/portlib/NdbConfig.c ndb/include/portlib/NdbConfig.h: Rename: ndb/include/mgmcommon/NdbConfig.h -> ndb/include/portlib/NdbConfig.h ndb/include/mgmapi/LocalConfig.hpp: Rename: ndb/include/mgmcommon/LocalConfig.hpp -> ndb/include/mgmapi/LocalConfig.hpp ndb/tools/restore/Makefile.am: Rename: ndb/src/kernel/blocks/backup/restore/Makefile.am -> ndb/tools/restore/Makefile.am ndb/tools/restore/consumer.cpp: Rename: ndb/src/kernel/blocks/backup/restore/consumer.cpp -> ndb/tools/restore/consumer.cpp ndb/tools/restore/consumer.hpp: Rename: ndb/src/kernel/blocks/backup/restore/consumer.hpp -> ndb/tools/restore/consumer.hpp ndb/tools/restore/consumer_printer.hpp: Rename: ndb/src/kernel/blocks/backup/restore/consumer_printer.hpp -> ndb/tools/restore/consumer_printer.hpp ndb/tools/restore/consumer_printer.cpp: Rename: ndb/src/kernel/blocks/backup/restore/consumer_printer.cpp -> ndb/tools/restore/consumer_printer.cpp ndb/tools/restore/consumer_restore.hpp: Rename: ndb/src/kernel/blocks/backup/restore/consumer_restore.hpp -> ndb/tools/restore/consumer_restore.hpp ndb/tools/restore/main.cpp: Rename: ndb/src/kernel/blocks/backup/restore/main.cpp -> ndb/tools/restore/main.cpp ndb/tools/restore/consumer_restorem.cpp: Rename: ndb/src/kernel/blocks/backup/restore/consumer_restorem.cpp -> ndb/tools/restore/consumer_restorem.cpp configure.in: moved ndb_restore together with rest of the ndb tools ndb/config/type_ndbapitools.mk.am: kernel includes needed by ndb_restore ndb/src/Makefile.am: changed link order ndb/src/common/mgmcommon/Makefile.am: mived LocalConfig to mgmapi ndb/src/common/portlib/Makefile.am: Moved NdbConfig to Portlib ndb/src/kernel/blocks/backup/Makefile.am: moved restore together with rest of ndb tools ndb/src/mgmapi/LocalConfig.cpp: added valid connectstring to be with only host without port i.e. valid connectstring =host1,host2,host3 default port will be added ndb/src/mgmapi/Makefile.am: LocalConfig part of the libmgmapi ndb/src/mgmapi/mgmapi.cpp: mgmapi to use LocalConfig for connectstring parsing instead of it's own ndb/src/mgmclient/CommandInterpreter.cpp: enable usage of "NULL" connectstring for default ndb/src/mgmclient/Makefile.am: new ndbmgmclient lib that can be used by e.g. mysqladmin later ndb/src/mgmclient/main.cpp: LocalConfig no longer needed here, now in mgmapi Send connectstring to mgmapi instead ndb/tools/Makefile.am: add ndb_restore to make of tools ndb/tools/restore/Restore.cpp: moved include BackupFormat and NdbDictionaryImpl to Restore.hpp ndb/tools/restore/Restore.hpp: moved include BackupFormat and NdbDictionaryImpl to Restore.hpp ndb/tools/restore/consumer_restore.cpp: moved include BackupFormat and NdbDictionaryImpl to Restore.hpp ndb/tools/waiter.cpp: LocalConfig moved
2004-11-14 11:02:06 +00:00
#include "../src/kernel/blocks/backup/BackupFormat.hpp"
#include "../src/ndbapi/NdbDictionaryImpl.hpp"
#include <NdbApi.hpp>
#include <ndb_version.h>
#include <version.h>
static const char * delimiter = ";"; // Delimiter in file dump
const int FileNameLenC = 256;
const int TableNameLenC = 256;
const int AttrNameLenC = 256;
const Uint32 timeToWaitForNdbC = 10000;
const Uint32 opsDefaultC = 1000;
// Forward declarations
//class AttributeDesc;
struct AttributeDesc;
struct AttributeData;
struct AttributeS;
struct AttributeData {
bool null;
Uint32 size;
union {
Int8 * int8_value;
Uint8 * u_int8_value;
Int16 * int16_value;
Uint16 * u_int16_value;
Int32 * int32_value;
Uint32 * u_int32_value;
Int64 * int64_value;
Uint64 * u_int64_value;
char * string_value;
void* void_value;
};
};
struct AttributeDesc {
//private:
friend class TupleS;
friend class TableS;
friend class RestoreDataIterator;
friend class RestoreMetaData;
friend struct AttributeS;
Uint32 size; // bits
Uint32 arraySize;
ndb source tree cleanup, see respective file BitKeeper/deleted/.del-BinDist.sh~8ea6fee0be3de36: Delete: ndb/old_files/BinDist.sh BitKeeper/deleted/.del-Defs.mk~fab44ad996ed5499: Delete: ndb/old_files/Defs.mk BitKeeper/deleted/.del-Makefile~726e96331d4343ce: Delete: ndb/old_files/Makefile BitKeeper/deleted/.del-SrcDist.sh~ad4f1cd7aae4265b: Delete: ndb/old_files/SrcDist.sh BitKeeper/deleted/.del-configure~501239931f8bb1: Delete: ndb/old_files/configure BitKeeper/deleted/.del-Epilogue.mk~60f7edf886726154: Delete: ndb/old_files/Epilogue.mk BitKeeper/deleted/.del-README~b619a580720ec3d8: Delete: ndb/old_files/README BitKeeper/deleted/.del-env.sh~91075f1664ce8292: Delete: ndb/old_files/env.sh BitKeeper/deleted/.del-mysqlclusterenv.sh~f0d8a63e844255f5: Delete: ndb/old_files/mysqlclusterenv.sh BitKeeper/deleted/.del-Defs.DEBUG.mk~8ed7bb195181c74a: Delete: ndb/config/old_files/Defs.DEBUG.mk BitKeeper/deleted/.del-acinclude.m4~b1472f9faac0c71: Delete: ndb/config/old_files/acinclude.m4 BitKeeper/deleted/.del-Defs.HPUX.HPPA.GCC.mk~b50ab324c3ce07ce: Delete: ndb/config/old_files/Defs.HPUX.HPPA.GCC.mk BitKeeper/deleted/.del-Defs.IBMAIX.POWERPC.GCC.mk~76bea6928ca7b8f0: Delete: ndb/config/old_files/Defs.IBMAIX.POWERPC.GCC.mk BitKeeper/deleted/.del-Defs.LINUX.x86.GCC.mk~15f3c82665d141a0: Delete: ndb/config/old_files/Defs.LINUX.x86.GCC.mk BitKeeper/deleted/.del-Defs.LINUX.x86.ICC.mk~e51a6e19daeb353: Delete: ndb/config/old_files/Defs.LINUX.x86.ICC.mk BitKeeper/deleted/.del-Defs.LINUX.x86_64.GCC.mk~9e853e7e1142b2d7: Delete: ndb/config/old_files/Defs.LINUX.x86_64.GCC.mk BitKeeper/deleted/.del-Defs.MACOSX.POWERPC.GCC.mk~d661574b758ac911: Delete: ndb/config/old_files/Defs.MACOSX.POWERPC.GCC.mk BitKeeper/deleted/.del-Defs.OSE.PPC750.DIAB.mk~d5d7116c512290bc: Delete: ndb/config/old_files/Defs.OSE.PPC750.DIAB.mk BitKeeper/deleted/.del-Defs.RELEASE.mk~6c195617d8e1c8ec: Delete: ndb/config/old_files/Defs.RELEASE.mk BitKeeper/deleted/.del-Defs.RELEASE_TRACE.mk~e367d147bd3ad0bf: Delete: ndb/config/old_files/Defs.RELEASE_TRACE.mk BitKeeper/deleted/.del-Defs.SIMCELLO.SOFTOSE.GCC.mk~5acee8046e3dfd21: Delete: ndb/config/old_files/Defs.SIMCELLO.SOFTOSE.GCC.mk BitKeeper/deleted/.del-Defs.WIN32.x86.VC7.mk~582038c28dd89391: Delete: ndb/config/old_files/Defs.WIN32.x86.VC7.mk BitKeeper/deleted/.del-Defs.SOFTOSE.SPARC.GCC.mk~ebd0c4aab56c1202: Delete: ndb/config/old_files/Defs.SOFTOSE.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC.FORTE6.mk~4367e18b8246761e: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC.FORTE6.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC.GCC.mk~d781a20b8235525c: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC_64.GCC.mk~76626f56dcd0e8e9: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC_64.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS6.SPARC.GCC.mk~2b05903f79ce771: Delete: ndb/config/old_files/Defs.SOLARIS6.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.TRU64X.ALPHA.GCC.mk~6ba3fc0cfaa37cb2: Delete: ndb/config/old_files/Defs.TRU64X.ALPHA.GCC.mk BitKeeper/deleted/.del-GuessConfig.sh~ebdb504ed6b7ab68: Delete: ndb/config/old_files/GuessConfig.sh BitKeeper/deleted/.del-Makefile.am~c28d15539f926269: Delete: ndb/config/old_files/Makefile.am BitKeeper/deleted/.del-configure.in~3e0ef32c155b79bc: Delete: ndb/config/old_files/configure.in BitKeeper/deleted/.del-config.h.in~b9209994763e30f8: Delete: ndb/config/old_files/config.h.in BitKeeper/deleted/.del-Makefile~71ad5c694da8711: Delete: ndb/src/old_files/Makefile BitKeeper/deleted/.del-Makefile~261cfb7897aa2259: Delete: ndb/test/newtonapi/Makefile BitKeeper/deleted/.del-Makefile~d46bb4a49ae611f9: Delete: ndb/test/odbc/Makefile BitKeeper/deleted/.del-Makefile_old~5ce89facf68772b: Delete: ndb/test/Makefile_old ndb/test/include/NdbSchemaCon.hpp: Rename: ndb/include/ndbapi/NdbSchemaCon.hpp -> ndb/test/include/NdbSchemaCon.hpp ndb/test/include/NdbSchemaOp.hpp: Rename: ndb/include/ndbapi/NdbSchemaOp.hpp -> ndb/test/include/NdbSchemaOp.hpp ndb/include/Makefile.am: removed NdbSchema from ndbapi ndb/include/ndbapi/NdbDictionary.hpp: added Column::getSize() and print function for Column::Type ndb/include/ndbapi/NdbRecAttr.hpp: made an operator<< friend to NdbRecAttr ndb/src/kernel/blocks/backup/restore/Restore.cpp: Rewritten restore to remove NdbSchema ndb/src/kernel/blocks/backup/restore/Restore.hpp: Rewritten restore to remove NdbSchema ndb/src/kernel/blocks/backup/restore/main.cpp: Rewritten restore to remove NdbSchema ndb/src/ndbapi/Makefile.am: removed NdbSchema from ndbapi ndb/src/ndbapi/NdbDictionary.cpp: added operator << for Column::Type ndb/src/ndbapi/NdbRecAttr.cpp: updated operator<< for NdbRecAttr ndb/src/ndbapi/Ndberr.cpp: removed NdbSchema from ndbapi ndb/test/src/Makefile.am: moved NdbSchema to test ndb/test/src/NDBT_ResultRow.cpp: use common print method for NDBT_ResultRow ndb/test/src/NdbBackup.cpp: fixed bug in testBackup ndb/test/src/NdbSchemaCon.cpp: moved NdbError NdbSchema ndb/test/src/NdbSchemaOp.cpp: updated include file list
2004-06-07 17:31:32 +00:00
Uint32 attrId;
NdbDictionary::Column *m_column;
Uint32 m_nullBitIndex;
public:
ndb source tree cleanup, see respective file BitKeeper/deleted/.del-BinDist.sh~8ea6fee0be3de36: Delete: ndb/old_files/BinDist.sh BitKeeper/deleted/.del-Defs.mk~fab44ad996ed5499: Delete: ndb/old_files/Defs.mk BitKeeper/deleted/.del-Makefile~726e96331d4343ce: Delete: ndb/old_files/Makefile BitKeeper/deleted/.del-SrcDist.sh~ad4f1cd7aae4265b: Delete: ndb/old_files/SrcDist.sh BitKeeper/deleted/.del-configure~501239931f8bb1: Delete: ndb/old_files/configure BitKeeper/deleted/.del-Epilogue.mk~60f7edf886726154: Delete: ndb/old_files/Epilogue.mk BitKeeper/deleted/.del-README~b619a580720ec3d8: Delete: ndb/old_files/README BitKeeper/deleted/.del-env.sh~91075f1664ce8292: Delete: ndb/old_files/env.sh BitKeeper/deleted/.del-mysqlclusterenv.sh~f0d8a63e844255f5: Delete: ndb/old_files/mysqlclusterenv.sh BitKeeper/deleted/.del-Defs.DEBUG.mk~8ed7bb195181c74a: Delete: ndb/config/old_files/Defs.DEBUG.mk BitKeeper/deleted/.del-acinclude.m4~b1472f9faac0c71: Delete: ndb/config/old_files/acinclude.m4 BitKeeper/deleted/.del-Defs.HPUX.HPPA.GCC.mk~b50ab324c3ce07ce: Delete: ndb/config/old_files/Defs.HPUX.HPPA.GCC.mk BitKeeper/deleted/.del-Defs.IBMAIX.POWERPC.GCC.mk~76bea6928ca7b8f0: Delete: ndb/config/old_files/Defs.IBMAIX.POWERPC.GCC.mk BitKeeper/deleted/.del-Defs.LINUX.x86.GCC.mk~15f3c82665d141a0: Delete: ndb/config/old_files/Defs.LINUX.x86.GCC.mk BitKeeper/deleted/.del-Defs.LINUX.x86.ICC.mk~e51a6e19daeb353: Delete: ndb/config/old_files/Defs.LINUX.x86.ICC.mk BitKeeper/deleted/.del-Defs.LINUX.x86_64.GCC.mk~9e853e7e1142b2d7: Delete: ndb/config/old_files/Defs.LINUX.x86_64.GCC.mk BitKeeper/deleted/.del-Defs.MACOSX.POWERPC.GCC.mk~d661574b758ac911: Delete: ndb/config/old_files/Defs.MACOSX.POWERPC.GCC.mk BitKeeper/deleted/.del-Defs.OSE.PPC750.DIAB.mk~d5d7116c512290bc: Delete: ndb/config/old_files/Defs.OSE.PPC750.DIAB.mk BitKeeper/deleted/.del-Defs.RELEASE.mk~6c195617d8e1c8ec: Delete: ndb/config/old_files/Defs.RELEASE.mk BitKeeper/deleted/.del-Defs.RELEASE_TRACE.mk~e367d147bd3ad0bf: Delete: ndb/config/old_files/Defs.RELEASE_TRACE.mk BitKeeper/deleted/.del-Defs.SIMCELLO.SOFTOSE.GCC.mk~5acee8046e3dfd21: Delete: ndb/config/old_files/Defs.SIMCELLO.SOFTOSE.GCC.mk BitKeeper/deleted/.del-Defs.WIN32.x86.VC7.mk~582038c28dd89391: Delete: ndb/config/old_files/Defs.WIN32.x86.VC7.mk BitKeeper/deleted/.del-Defs.SOFTOSE.SPARC.GCC.mk~ebd0c4aab56c1202: Delete: ndb/config/old_files/Defs.SOFTOSE.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC.FORTE6.mk~4367e18b8246761e: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC.FORTE6.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC.GCC.mk~d781a20b8235525c: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC_64.GCC.mk~76626f56dcd0e8e9: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC_64.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS6.SPARC.GCC.mk~2b05903f79ce771: Delete: ndb/config/old_files/Defs.SOLARIS6.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.TRU64X.ALPHA.GCC.mk~6ba3fc0cfaa37cb2: Delete: ndb/config/old_files/Defs.TRU64X.ALPHA.GCC.mk BitKeeper/deleted/.del-GuessConfig.sh~ebdb504ed6b7ab68: Delete: ndb/config/old_files/GuessConfig.sh BitKeeper/deleted/.del-Makefile.am~c28d15539f926269: Delete: ndb/config/old_files/Makefile.am BitKeeper/deleted/.del-configure.in~3e0ef32c155b79bc: Delete: ndb/config/old_files/configure.in BitKeeper/deleted/.del-config.h.in~b9209994763e30f8: Delete: ndb/config/old_files/config.h.in BitKeeper/deleted/.del-Makefile~71ad5c694da8711: Delete: ndb/src/old_files/Makefile BitKeeper/deleted/.del-Makefile~261cfb7897aa2259: Delete: ndb/test/newtonapi/Makefile BitKeeper/deleted/.del-Makefile~d46bb4a49ae611f9: Delete: ndb/test/odbc/Makefile BitKeeper/deleted/.del-Makefile_old~5ce89facf68772b: Delete: ndb/test/Makefile_old ndb/test/include/NdbSchemaCon.hpp: Rename: ndb/include/ndbapi/NdbSchemaCon.hpp -> ndb/test/include/NdbSchemaCon.hpp ndb/test/include/NdbSchemaOp.hpp: Rename: ndb/include/ndbapi/NdbSchemaOp.hpp -> ndb/test/include/NdbSchemaOp.hpp ndb/include/Makefile.am: removed NdbSchema from ndbapi ndb/include/ndbapi/NdbDictionary.hpp: added Column::getSize() and print function for Column::Type ndb/include/ndbapi/NdbRecAttr.hpp: made an operator<< friend to NdbRecAttr ndb/src/kernel/blocks/backup/restore/Restore.cpp: Rewritten restore to remove NdbSchema ndb/src/kernel/blocks/backup/restore/Restore.hpp: Rewritten restore to remove NdbSchema ndb/src/kernel/blocks/backup/restore/main.cpp: Rewritten restore to remove NdbSchema ndb/src/ndbapi/Makefile.am: removed NdbSchema from ndbapi ndb/src/ndbapi/NdbDictionary.cpp: added operator << for Column::Type ndb/src/ndbapi/NdbRecAttr.cpp: updated operator<< for NdbRecAttr ndb/src/ndbapi/Ndberr.cpp: removed NdbSchema from ndbapi ndb/test/src/Makefile.am: moved NdbSchema to test ndb/test/src/NDBT_ResultRow.cpp: use common print method for NDBT_ResultRow ndb/test/src/NdbBackup.cpp: fixed bug in testBackup ndb/test/src/NdbSchemaCon.cpp: moved NdbError NdbSchema ndb/test/src/NdbSchemaOp.cpp: updated include file list
2004-06-07 17:31:32 +00:00
AttributeDesc(NdbDictionary::Column *column);
AttributeDesc();
Uint32 getSizeInWords() const { return (size * arraySize + 31)/ 32;}
}; // AttributeDesc
struct AttributeS {
const AttributeDesc * Desc;
2004-06-10 01:38:38 +00:00
AttributeData Data;
};
class TupleS {
private:
friend class RestoreDataIterator;
class TableS *m_currentTable;
AttributeData *allAttrData;
2004-10-01 02:38:03 +00:00
bool prepareRecord(TableS &);
public:
2004-06-10 01:38:38 +00:00
TupleS() {
m_currentTable= 0;
allAttrData= 0;
};
~TupleS()
{
if (allAttrData)
delete [] allAttrData;
};
TupleS(const TupleS& tuple); // disable copy constructor
TupleS & operator=(const TupleS& tuple);
int getNoOfAttributes() const;
2004-10-01 02:38:03 +00:00
TableS * getTable() const;
const AttributeDesc * getDesc(int i) const;
AttributeData * getData(int i) const;
}; // class TupleS
class TableS {
friend class TupleS;
friend class RestoreMetaData;
friend class RestoreDataIterator;
Uint32 schemaVersion;
Uint32 backupVersion;
Vector<AttributeDesc *> allAttributesDesc;
Vector<AttributeDesc *> m_fixedKeys;
//Vector<AttributeDesc *> m_variableKey;
Vector<AttributeDesc *> m_fixedAttribs;
Vector<AttributeDesc *> m_variableAttribs;
Uint32 m_noOfNullable;
Uint32 m_nullBitmaskSize;
2004-10-01 02:38:03 +00:00
Uint32 m_auto_val_id;
Uint64 m_max_auto_val;
int pos;
ndb source tree cleanup, see respective file BitKeeper/deleted/.del-BinDist.sh~8ea6fee0be3de36: Delete: ndb/old_files/BinDist.sh BitKeeper/deleted/.del-Defs.mk~fab44ad996ed5499: Delete: ndb/old_files/Defs.mk BitKeeper/deleted/.del-Makefile~726e96331d4343ce: Delete: ndb/old_files/Makefile BitKeeper/deleted/.del-SrcDist.sh~ad4f1cd7aae4265b: Delete: ndb/old_files/SrcDist.sh BitKeeper/deleted/.del-configure~501239931f8bb1: Delete: ndb/old_files/configure BitKeeper/deleted/.del-Epilogue.mk~60f7edf886726154: Delete: ndb/old_files/Epilogue.mk BitKeeper/deleted/.del-README~b619a580720ec3d8: Delete: ndb/old_files/README BitKeeper/deleted/.del-env.sh~91075f1664ce8292: Delete: ndb/old_files/env.sh BitKeeper/deleted/.del-mysqlclusterenv.sh~f0d8a63e844255f5: Delete: ndb/old_files/mysqlclusterenv.sh BitKeeper/deleted/.del-Defs.DEBUG.mk~8ed7bb195181c74a: Delete: ndb/config/old_files/Defs.DEBUG.mk BitKeeper/deleted/.del-acinclude.m4~b1472f9faac0c71: Delete: ndb/config/old_files/acinclude.m4 BitKeeper/deleted/.del-Defs.HPUX.HPPA.GCC.mk~b50ab324c3ce07ce: Delete: ndb/config/old_files/Defs.HPUX.HPPA.GCC.mk BitKeeper/deleted/.del-Defs.IBMAIX.POWERPC.GCC.mk~76bea6928ca7b8f0: Delete: ndb/config/old_files/Defs.IBMAIX.POWERPC.GCC.mk BitKeeper/deleted/.del-Defs.LINUX.x86.GCC.mk~15f3c82665d141a0: Delete: ndb/config/old_files/Defs.LINUX.x86.GCC.mk BitKeeper/deleted/.del-Defs.LINUX.x86.ICC.mk~e51a6e19daeb353: Delete: ndb/config/old_files/Defs.LINUX.x86.ICC.mk BitKeeper/deleted/.del-Defs.LINUX.x86_64.GCC.mk~9e853e7e1142b2d7: Delete: ndb/config/old_files/Defs.LINUX.x86_64.GCC.mk BitKeeper/deleted/.del-Defs.MACOSX.POWERPC.GCC.mk~d661574b758ac911: Delete: ndb/config/old_files/Defs.MACOSX.POWERPC.GCC.mk BitKeeper/deleted/.del-Defs.OSE.PPC750.DIAB.mk~d5d7116c512290bc: Delete: ndb/config/old_files/Defs.OSE.PPC750.DIAB.mk BitKeeper/deleted/.del-Defs.RELEASE.mk~6c195617d8e1c8ec: Delete: ndb/config/old_files/Defs.RELEASE.mk BitKeeper/deleted/.del-Defs.RELEASE_TRACE.mk~e367d147bd3ad0bf: Delete: ndb/config/old_files/Defs.RELEASE_TRACE.mk BitKeeper/deleted/.del-Defs.SIMCELLO.SOFTOSE.GCC.mk~5acee8046e3dfd21: Delete: ndb/config/old_files/Defs.SIMCELLO.SOFTOSE.GCC.mk BitKeeper/deleted/.del-Defs.WIN32.x86.VC7.mk~582038c28dd89391: Delete: ndb/config/old_files/Defs.WIN32.x86.VC7.mk BitKeeper/deleted/.del-Defs.SOFTOSE.SPARC.GCC.mk~ebd0c4aab56c1202: Delete: ndb/config/old_files/Defs.SOFTOSE.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC.FORTE6.mk~4367e18b8246761e: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC.FORTE6.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC.GCC.mk~d781a20b8235525c: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC_64.GCC.mk~76626f56dcd0e8e9: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC_64.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS6.SPARC.GCC.mk~2b05903f79ce771: Delete: ndb/config/old_files/Defs.SOLARIS6.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.TRU64X.ALPHA.GCC.mk~6ba3fc0cfaa37cb2: Delete: ndb/config/old_files/Defs.TRU64X.ALPHA.GCC.mk BitKeeper/deleted/.del-GuessConfig.sh~ebdb504ed6b7ab68: Delete: ndb/config/old_files/GuessConfig.sh BitKeeper/deleted/.del-Makefile.am~c28d15539f926269: Delete: ndb/config/old_files/Makefile.am BitKeeper/deleted/.del-configure.in~3e0ef32c155b79bc: Delete: ndb/config/old_files/configure.in BitKeeper/deleted/.del-config.h.in~b9209994763e30f8: Delete: ndb/config/old_files/config.h.in BitKeeper/deleted/.del-Makefile~71ad5c694da8711: Delete: ndb/src/old_files/Makefile BitKeeper/deleted/.del-Makefile~261cfb7897aa2259: Delete: ndb/test/newtonapi/Makefile BitKeeper/deleted/.del-Makefile~d46bb4a49ae611f9: Delete: ndb/test/odbc/Makefile BitKeeper/deleted/.del-Makefile_old~5ce89facf68772b: Delete: ndb/test/Makefile_old ndb/test/include/NdbSchemaCon.hpp: Rename: ndb/include/ndbapi/NdbSchemaCon.hpp -> ndb/test/include/NdbSchemaCon.hpp ndb/test/include/NdbSchemaOp.hpp: Rename: ndb/include/ndbapi/NdbSchemaOp.hpp -> ndb/test/include/NdbSchemaOp.hpp ndb/include/Makefile.am: removed NdbSchema from ndbapi ndb/include/ndbapi/NdbDictionary.hpp: added Column::getSize() and print function for Column::Type ndb/include/ndbapi/NdbRecAttr.hpp: made an operator<< friend to NdbRecAttr ndb/src/kernel/blocks/backup/restore/Restore.cpp: Rewritten restore to remove NdbSchema ndb/src/kernel/blocks/backup/restore/Restore.hpp: Rewritten restore to remove NdbSchema ndb/src/kernel/blocks/backup/restore/main.cpp: Rewritten restore to remove NdbSchema ndb/src/ndbapi/Makefile.am: removed NdbSchema from ndbapi ndb/src/ndbapi/NdbDictionary.cpp: added operator << for Column::Type ndb/src/ndbapi/NdbRecAttr.cpp: updated operator<< for NdbRecAttr ndb/src/ndbapi/Ndberr.cpp: removed NdbSchema from ndbapi ndb/test/src/Makefile.am: moved NdbSchema to test ndb/test/src/NDBT_ResultRow.cpp: use common print method for NDBT_ResultRow ndb/test/src/NdbBackup.cpp: fixed bug in testBackup ndb/test/src/NdbSchemaCon.cpp: moved NdbError NdbSchema ndb/test/src/NdbSchemaOp.cpp: updated include file list
2004-06-07 17:31:32 +00:00
void createAttr(NdbDictionary::Column *column);
public:
class NdbDictionary::Table* m_dictTable;
TableS (Uint32 version, class NdbTableImpl* dictTable);
2004-06-10 01:38:38 +00:00
~TableS();
Uint32 getTableId() const {
ndb source tree cleanup, see respective file BitKeeper/deleted/.del-BinDist.sh~8ea6fee0be3de36: Delete: ndb/old_files/BinDist.sh BitKeeper/deleted/.del-Defs.mk~fab44ad996ed5499: Delete: ndb/old_files/Defs.mk BitKeeper/deleted/.del-Makefile~726e96331d4343ce: Delete: ndb/old_files/Makefile BitKeeper/deleted/.del-SrcDist.sh~ad4f1cd7aae4265b: Delete: ndb/old_files/SrcDist.sh BitKeeper/deleted/.del-configure~501239931f8bb1: Delete: ndb/old_files/configure BitKeeper/deleted/.del-Epilogue.mk~60f7edf886726154: Delete: ndb/old_files/Epilogue.mk BitKeeper/deleted/.del-README~b619a580720ec3d8: Delete: ndb/old_files/README BitKeeper/deleted/.del-env.sh~91075f1664ce8292: Delete: ndb/old_files/env.sh BitKeeper/deleted/.del-mysqlclusterenv.sh~f0d8a63e844255f5: Delete: ndb/old_files/mysqlclusterenv.sh BitKeeper/deleted/.del-Defs.DEBUG.mk~8ed7bb195181c74a: Delete: ndb/config/old_files/Defs.DEBUG.mk BitKeeper/deleted/.del-acinclude.m4~b1472f9faac0c71: Delete: ndb/config/old_files/acinclude.m4 BitKeeper/deleted/.del-Defs.HPUX.HPPA.GCC.mk~b50ab324c3ce07ce: Delete: ndb/config/old_files/Defs.HPUX.HPPA.GCC.mk BitKeeper/deleted/.del-Defs.IBMAIX.POWERPC.GCC.mk~76bea6928ca7b8f0: Delete: ndb/config/old_files/Defs.IBMAIX.POWERPC.GCC.mk BitKeeper/deleted/.del-Defs.LINUX.x86.GCC.mk~15f3c82665d141a0: Delete: ndb/config/old_files/Defs.LINUX.x86.GCC.mk BitKeeper/deleted/.del-Defs.LINUX.x86.ICC.mk~e51a6e19daeb353: Delete: ndb/config/old_files/Defs.LINUX.x86.ICC.mk BitKeeper/deleted/.del-Defs.LINUX.x86_64.GCC.mk~9e853e7e1142b2d7: Delete: ndb/config/old_files/Defs.LINUX.x86_64.GCC.mk BitKeeper/deleted/.del-Defs.MACOSX.POWERPC.GCC.mk~d661574b758ac911: Delete: ndb/config/old_files/Defs.MACOSX.POWERPC.GCC.mk BitKeeper/deleted/.del-Defs.OSE.PPC750.DIAB.mk~d5d7116c512290bc: Delete: ndb/config/old_files/Defs.OSE.PPC750.DIAB.mk BitKeeper/deleted/.del-Defs.RELEASE.mk~6c195617d8e1c8ec: Delete: ndb/config/old_files/Defs.RELEASE.mk BitKeeper/deleted/.del-Defs.RELEASE_TRACE.mk~e367d147bd3ad0bf: Delete: ndb/config/old_files/Defs.RELEASE_TRACE.mk BitKeeper/deleted/.del-Defs.SIMCELLO.SOFTOSE.GCC.mk~5acee8046e3dfd21: Delete: ndb/config/old_files/Defs.SIMCELLO.SOFTOSE.GCC.mk BitKeeper/deleted/.del-Defs.WIN32.x86.VC7.mk~582038c28dd89391: Delete: ndb/config/old_files/Defs.WIN32.x86.VC7.mk BitKeeper/deleted/.del-Defs.SOFTOSE.SPARC.GCC.mk~ebd0c4aab56c1202: Delete: ndb/config/old_files/Defs.SOFTOSE.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC.FORTE6.mk~4367e18b8246761e: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC.FORTE6.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC.GCC.mk~d781a20b8235525c: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS.SPARC_64.GCC.mk~76626f56dcd0e8e9: Delete: ndb/config/old_files/Defs.SOLARIS.SPARC_64.GCC.mk BitKeeper/deleted/.del-Defs.SOLARIS6.SPARC.GCC.mk~2b05903f79ce771: Delete: ndb/config/old_files/Defs.SOLARIS6.SPARC.GCC.mk BitKeeper/deleted/.del-Defs.TRU64X.ALPHA.GCC.mk~6ba3fc0cfaa37cb2: Delete: ndb/config/old_files/Defs.TRU64X.ALPHA.GCC.mk BitKeeper/deleted/.del-GuessConfig.sh~ebdb504ed6b7ab68: Delete: ndb/config/old_files/GuessConfig.sh BitKeeper/deleted/.del-Makefile.am~c28d15539f926269: Delete: ndb/config/old_files/Makefile.am BitKeeper/deleted/.del-configure.in~3e0ef32c155b79bc: Delete: ndb/config/old_files/configure.in BitKeeper/deleted/.del-config.h.in~b9209994763e30f8: Delete: ndb/config/old_files/config.h.in BitKeeper/deleted/.del-Makefile~71ad5c694da8711: Delete: ndb/src/old_files/Makefile BitKeeper/deleted/.del-Makefile~261cfb7897aa2259: Delete: ndb/test/newtonapi/Makefile BitKeeper/deleted/.del-Makefile~d46bb4a49ae611f9: Delete: ndb/test/odbc/Makefile BitKeeper/deleted/.del-Makefile_old~5ce89facf68772b: Delete: ndb/test/Makefile_old ndb/test/include/NdbSchemaCon.hpp: Rename: ndb/include/ndbapi/NdbSchemaCon.hpp -> ndb/test/include/NdbSchemaCon.hpp ndb/test/include/NdbSchemaOp.hpp: Rename: ndb/include/ndbapi/NdbSchemaOp.hpp -> ndb/test/include/NdbSchemaOp.hpp ndb/include/Makefile.am: removed NdbSchema from ndbapi ndb/include/ndbapi/NdbDictionary.hpp: added Column::getSize() and print function for Column::Type ndb/include/ndbapi/NdbRecAttr.hpp: made an operator<< friend to NdbRecAttr ndb/src/kernel/blocks/backup/restore/Restore.cpp: Rewritten restore to remove NdbSchema ndb/src/kernel/blocks/backup/restore/Restore.hpp: Rewritten restore to remove NdbSchema ndb/src/kernel/blocks/backup/restore/main.cpp: Rewritten restore to remove NdbSchema ndb/src/ndbapi/Makefile.am: removed NdbSchema from ndbapi ndb/src/ndbapi/NdbDictionary.cpp: added operator << for Column::Type ndb/src/ndbapi/NdbRecAttr.cpp: updated operator<< for NdbRecAttr ndb/src/ndbapi/Ndberr.cpp: removed NdbSchema from ndbapi ndb/test/src/Makefile.am: moved NdbSchema to test ndb/test/src/NDBT_ResultRow.cpp: use common print method for NDBT_ResultRow ndb/test/src/NdbBackup.cpp: fixed bug in testBackup ndb/test/src/NdbSchemaCon.cpp: moved NdbError NdbSchema ndb/test/src/NdbSchemaOp.cpp: updated include file list
2004-06-07 17:31:32 +00:00
return m_dictTable->getTableId();
}
/*
void setMysqlTableName(char * tableName) {
strpcpy(mysqlTableName, tableName);
}
char *
void setMysqlDatabaseName(char * databaseName) {
strpcpy(mysqlDatabaseName, databaseName);
}
table.setMysqlDatabaseName(database);
*/
void setBackupVersion(Uint32 version) {
backupVersion = version;
}
Uint32 getBackupVersion() const {
return backupVersion;
}
const char * getTableName() const {
return m_dictTable->getName();
}
int getNoOfAttributes() const {
return allAttributesDesc.size();
};
2004-10-01 02:38:03 +00:00
bool have_auto_inc() const {
return m_auto_val_id != ~(Uint32)0;
};
bool have_auto_inc(Uint32 id) const {
return m_auto_val_id == id;
};
Uint64 get_max_auto_val() const {
return m_max_auto_val;
};
void update_max_auto_val(const char *data, int size) {
2005-01-17 12:29:43 +01:00
union {
Uint8 u8;
Uint16 u16;
Uint32 u32;
} val;
Uint64 v;
2004-10-01 02:38:03 +00:00
switch(size){
2005-01-17 12:29:43 +01:00
case 64:
memcpy(&v,data,8);
2004-10-01 02:38:03 +00:00
break;
case 32:
2005-01-17 12:29:43 +01:00
memcpy(&val.u32,data,4);
v= val.u32;
2004-10-01 02:38:03 +00:00
break;
2005-01-17 12:29:43 +01:00
case 16:
memcpy(&val.u16,data,2);
v= val.u16;
break;
case 8:
memcpy(&val.u8,data,1);
v= val.u8;
2004-10-01 02:38:03 +00:00
break;
default:
return;
};
2005-01-17 12:29:43 +01:00
if(v > m_max_auto_val)
m_max_auto_val= v;
2004-10-01 02:38:03 +00:00
};
/**
* Get attribute descriptor
*/
const AttributeDesc * operator[](int attributeId) const {
return allAttributesDesc[attributeId];
}
TableS& operator=(TableS& org) ;
}; // TableS;
class BackupFile {
protected:
FILE * m_file;
char m_path[PATH_MAX];
char m_fileName[PATH_MAX];
bool m_hostByteOrder;
BackupFormat::FileHeader m_fileHeader;
BackupFormat::FileHeader m_expectedFileHeader;
Uint32 m_nodeId;
2004-06-10 01:38:38 +00:00
void * m_buffer;
void * m_buffer_ptr;
Uint32 m_buffer_sz;
Uint32 m_buffer_data_left;
void (* free_data_callback)();
bool openFile();
void setCtlFile(Uint32 nodeId, Uint32 backupId, const char * path);
void setDataFile(const BackupFile & bf, Uint32 no);
void setLogFile(const BackupFile & bf, Uint32 no);
2004-06-10 01:38:38 +00:00
Uint32 buffer_get_ptr(void **p_buf_ptr, Uint32 size, Uint32 nmemb);
Uint32 buffer_read(void *ptr, Uint32 size, Uint32 nmemb);
Uint32 buffer_get_ptr_ahead(void **p_buf_ptr, Uint32 size, Uint32 nmemb);
Uint32 buffer_read_ahead(void *ptr, Uint32 size, Uint32 nmemb);
void setName(const char * path, const char * name);
2004-06-10 01:38:38 +00:00
BackupFile(void (* free_data_callback)() = 0);
~BackupFile();
public:
bool readHeader();
bool validateFooter();
const char * getPath() const { return m_path;}
const char * getFilename() const { return m_fileName;}
Uint32 getNodeId() const { return m_nodeId;}
const BackupFormat::FileHeader & getFileHeader() const { return m_fileHeader;}
bool Twiddle(const AttributeDesc * attr_desc, AttributeData * attr_data, Uint32 arraySize = 0);
};
class RestoreMetaData : public BackupFile {
Vector<TableS *> allTables;
bool readMetaFileHeader();
bool readMetaTableDesc();
bool readGCPEntry();
Uint32 readMetaTableList();
Uint32 m_startGCP;
Uint32 m_stopGCP;
bool parseTableDescriptor(const Uint32 * data, Uint32 len);
public:
RestoreMetaData(const char * path, Uint32 nodeId, Uint32 bNo);
2004-06-10 01:38:38 +00:00
virtual ~RestoreMetaData();
int loadContent();
Uint32 getNoOfTables() const { return allTables.size();}
const TableS * operator[](int i) const { return allTables[i];}
2004-10-01 02:38:03 +00:00
TableS * getTable(Uint32 tableId) const;
Uint32 getStopGCP() const;
}; // RestoreMetaData
class RestoreDataIterator : public BackupFile {
const RestoreMetaData & m_metaData;
Uint32 m_count;
2004-10-01 02:38:03 +00:00
TableS* m_currentTable;
TupleS m_tuple;
public:
// Constructor
RestoreDataIterator(const RestoreMetaData &, void (* free_data_callback)());
2004-06-10 01:38:38 +00:00
~RestoreDataIterator() {};
// Read data file fragment header
bool readFragmentHeader(int & res);
bool validateFragmentFooter();
const TupleS *getNextTuple(int & res);
};
class LogEntry {
public:
enum EntryType {
LE_INSERT,
LE_DELETE,
LE_UPDATE
};
EntryType m_type;
2004-10-01 02:38:03 +00:00
TableS * m_table;
Vector<AttributeS*> m_values;
Vector<AttributeS*> m_values_e;
2004-06-10 01:38:38 +00:00
AttributeS *add_attr() {
AttributeS * attr;
if (m_values_e.size() > 0) {
attr = m_values_e[m_values_e.size()-1];
m_values_e.erase(m_values_e.size()-1);
2004-06-10 01:38:38 +00:00
}
else
{
attr = new AttributeS;
}
m_values.push_back(attr);
return attr;
}
void clear() {
for(Uint32 i= 0; i < m_values.size(); i++)
2004-06-10 01:38:38 +00:00
m_values_e.push_back(m_values[i]);
m_values.clear();
}
~LogEntry()
{
Uint32 i;
for(i= 0; i< m_values.size(); i++)
2004-06-10 01:38:38 +00:00
delete m_values[i];
for(i= 0; i< m_values_e.size(); i++)
2004-06-10 01:38:38 +00:00
delete m_values_e[i];
}
Uint32 size() const { return m_values.size(); }
2004-06-10 01:38:38 +00:00
const AttributeS * operator[](int i) const { return m_values[i];}
};
class RestoreLogIterator : public BackupFile {
private:
const RestoreMetaData & m_metaData;
Uint32 m_count;
LogEntry m_logEntry;
public:
RestoreLogIterator(const RestoreMetaData &);
2004-06-10 01:38:38 +00:00
virtual ~RestoreLogIterator() {};
const LogEntry * getNextLogEntry(int & res);
};
NdbOut& operator<<(NdbOut& ndbout, const TableS&);
NdbOut& operator<<(NdbOut& ndbout, const TupleS&);
NdbOut& operator<<(NdbOut& ndbout, const LogEntry&);
NdbOut& operator<<(NdbOut& ndbout, const RestoreMetaData&);
#endif