summaryrefslogtreecommitdiff
path: root/ndb/include
diff options
context:
space:
mode:
authorunknown <jonas@eel.(none)>2005-08-18 14:02:25 +0200
committerunknown <jonas@eel.(none)>2005-08-18 14:02:25 +0200
commitc7744c6df5c913f924fa02d0ec0ca6424105e336 (patch)
tree6f3c0b63f33e6dea6c70660522793c74ff935e53 /ndb/include
parentc8cd901b33e7c4b757bb3977d7920a22710dd68e (diff)
downloadmariadb-git-c7744c6df5c913f924fa02d0ec0ca6424105e336.tar.gz
bug#12118 - ndb alter table data loss
Split table version into 2 (major, minor) Impl. signaling to API when table has been altered Allow running transactions to use any minor number for transactions mysql-test/r/ndb_alter_table.result: Allow running transactions to use old table definition when possible. mysql-test/t/ndb_alter_table.test: Allow running transactions to use old table definition when possible. ndb/include/kernel/BlockNumbers.h: remove GREP ndb/include/kernel/GlobalSignalNumbers.h: Add ALTER_TABL_REP and API_BROADCAST_REP ndb/include/kernel/kernel_types.h: table_version_major ndb/include/kernel/signaldata/AlterTable.hpp: New error code for alter table during rolling upgrade ndb/include/ndbapi/NdbDictionary.hpp: Add state on table object to represent an altered but still valid table object ndb/src/common/debugger/BlockNames.cpp: remove GREP ndb/src/common/util/version.c: Fix upgrades ndb/src/kernel/SimBlockList.cpp: remove GREP ndb/src/kernel/blocks/Makefile.am: remove GREP ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: remove GREP ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Split tableSchemaVersion into 2 part 24 bit real version 8 bit for online alter table where old table definition is still usable ndb/src/kernel/blocks/dbdict/Dbdict.hpp: Check for same ndb versions ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp: Update schema printer ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: remove grep ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: 1) Use table_ version_major when checking table version 2) Dummy fix for BUG that tableSchemaVersion is only 16 bit in LQHKEYREQ ndb/src/kernel/blocks/dbtc/Dbtc.hpp: 1) Use table_ version_major when checking table version 2) Dummy fix for BUG that tableSchemaVersion is only 16 bit in LQHKEYREQ ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: 1) Use table_ version_major when checking table version 2) Dummy fix for BUG that tableSchemaVersion is only 16 bit in LQHKEYREQ ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp: remove GREP ndb/src/kernel/blocks/qmgr/Qmgr.hpp: Add support for sending REP to ALL api nodes ndb/src/kernel/blocks/qmgr/QmgrInit.cpp: Add support for sending REP to ALL api nodes ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: Add support for sending REP to ALL api nodes ndb/src/kernel/blocks/suma/Suma.cpp: remove GREP ndb/src/mgmsrv/MgmtSrvr.cpp: remove GREP ndb/src/ndbapi/DictCache.cpp: Add support for alter_table_rep by setting status to Altered NOTE special handling of tables in state RETREIVING ndb/src/ndbapi/DictCache.hpp: Add support for alter_table_rep by setting status to Altered NOTE special handling of tables in state RETREIVING ndb/src/ndbapi/NdbDictionaryImpl.cpp: Change alter table so that remove from global cache is used wo/ retreiving it from there first as ALTER_TABLE_REP might already have changed the table object... ndb/src/ndbapi/TransporterFacade.cpp: Add support for ALTER_TABLE_REP sql/ha_ndbcluster.cc: Allow running transactions to use tables in state ALTERED...but new transactions may not... ndb/include/kernel/signaldata/ApiBroadcast.hpp: New BitKeeper file ``ndb/include/kernel/signaldata/ApiBroadcast.hpp''
Diffstat (limited to 'ndb/include')
-rw-r--r--ndb/include/kernel/BlockNumbers.h4
-rw-r--r--ndb/include/kernel/GlobalSignalNumbers.h4
-rw-r--r--ndb/include/kernel/kernel_types.h7
-rw-r--r--ndb/include/kernel/signaldata/AlterTable.hpp25
-rw-r--r--ndb/include/kernel/signaldata/ApiBroadcast.hpp31
-rw-r--r--ndb/include/ndbapi/NdbDictionary.hpp5
6 files changed, 68 insertions, 8 deletions
diff --git a/ndb/include/kernel/BlockNumbers.h b/ndb/include/kernel/BlockNumbers.h
index cb3cc697eee..49b5842ac4e 100644
--- a/ndb/include/kernel/BlockNumbers.h
+++ b/ndb/include/kernel/BlockNumbers.h
@@ -44,8 +44,7 @@
#define TRIX 0xFF
#define DBUTIL 0x100
#define SUMA 0x101
-#define GREP 0x102
-#define DBTUX 0x103
+#define DBTUX 0x102
const BlockReference BACKUP_REF = numberToRef(BACKUP, 0);
const BlockReference DBTC_REF = numberToRef(DBTC, 0);
@@ -61,7 +60,6 @@ const BlockReference CMVMI_REF = numberToRef(CMVMI, 0);
const BlockReference TRIX_REF = numberToRef(TRIX, 0);
const BlockReference DBUTIL_REF = numberToRef(DBUTIL, 0);
const BlockReference SUMA_REF = numberToRef(SUMA, 0);
-const BlockReference GREP_REF = numberToRef(GREP, 0);
const BlockReference DBTUX_REF = numberToRef(DBTUX, 0);
const BlockNumber MIN_BLOCK_NO = BACKUP;
diff --git a/ndb/include/kernel/GlobalSignalNumbers.h b/ndb/include/kernel/GlobalSignalNumbers.h
index 9413f4ef56a..ff3690d60a5 100644
--- a/ndb/include/kernel/GlobalSignalNumbers.h
+++ b/ndb/include/kernel/GlobalSignalNumbers.h
@@ -777,8 +777,8 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
/**
* Grep signals
*/
-#define GSN_GREP_SUB_CREATE_REQ 606
-#define GSN_GREP_SUB_CREATE_REF 607
+#define GSN_ALTER_TABLE_REP 606
+#define GSN_API_BROADCAST_REP 607
#define GSN_GREP_SUB_CREATE_CONF 608
#define GSN_GREP_CREATE_REQ 609
#define GSN_GREP_CREATE_REF 610
diff --git a/ndb/include/kernel/kernel_types.h b/ndb/include/kernel/kernel_types.h
index b176d20798c..e16e61471e7 100644
--- a/ndb/include/kernel/kernel_types.h
+++ b/ndb/include/kernel/kernel_types.h
@@ -36,6 +36,13 @@ enum Operation_t {
#endif
};
+inline
+Uint32
+table_version_major(Uint32 ver)
+{
+ return ver & 0x00FFFFFF;
+}
+
#endif
diff --git a/ndb/include/kernel/signaldata/AlterTable.hpp b/ndb/include/kernel/signaldata/AlterTable.hpp
index 173a9acf9ed..16c9eb204c9 100644
--- a/ndb/include/kernel/signaldata/AlterTable.hpp
+++ b/ndb/include/kernel/signaldata/AlterTable.hpp
@@ -129,7 +129,8 @@ public:
InvalidPrimaryKeySize = 739,
NullablePrimaryKey = 740,
UnsupportedChange = 741,
- BackupInProgress = 762
+ BackupInProgress = 762,
+ IncompatibleVersions = 763
};
private:
@@ -177,4 +178,26 @@ private:
Uint32 tableVersion;
};
+/**
+ * Inform API about change of table definition
+ */
+struct AlterTableRep
+{
+ friend bool printALTER_TABLE_REP(FILE*, const Uint32*, Uint32, Uint16);
+
+ STATIC_CONST( SignalLength = 3 );
+
+ enum Change_type
+ {
+ CT_ALTERED = 0x1,
+ CT_DROPPED = 0x2
+ };
+
+ Uint32 tableId;
+ Uint32 tableVersion;
+ Uint32 changeType;
+
+ SECTION( TABLE_NAME = 0 );
+};
+
#endif
diff --git a/ndb/include/kernel/signaldata/ApiBroadcast.hpp b/ndb/include/kernel/signaldata/ApiBroadcast.hpp
new file mode 100644
index 00000000000..8050326ce78
--- /dev/null
+++ b/ndb/include/kernel/signaldata/ApiBroadcast.hpp
@@ -0,0 +1,31 @@
+/* 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 API_BROADCAST_HPP
+#define API_BROADCAST_HPP
+
+#include "SignalData.hpp"
+
+struct ApiBroadcastRep
+{
+ STATIC_CONST( SignalLength = 2 );
+
+ Uint32 gsn;
+ Uint32 minVersion;
+ Uint32 theData[1];
+};
+
+#endif
diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp
index 85615f3aa66..a541cd5190e 100644
--- a/ndb/include/ndbapi/NdbDictionary.hpp
+++ b/ndb/include/ndbapi/NdbDictionary.hpp
@@ -77,9 +77,10 @@ public:
///< changes to take effect
Retrieved, ///< The object exist and has been read
///< into main memory from NDB Kernel
- Invalid ///< The object has been invalidated
+ Invalid, ///< The object has been invalidated
///< and should not be used
-
+ Altered ///< Table has been altered in NDB kernel
+ ///< but is still valid for usage
};
/**