summaryrefslogtreecommitdiff
path: root/storage/ndb/include
diff options
context:
space:
mode:
authorunknown <tomas@whalegate.ndb.mysql.com>2007-10-30 11:28:19 +0100
committerunknown <tomas@whalegate.ndb.mysql.com>2007-10-30 11:28:19 +0100
commitc84d4b213905f37fd0095456dcdd0bfcae51a4f1 (patch)
tree4110aa2d735ea23d41f6683de6895b0ba90e17a7 /storage/ndb/include
parent7d9c59b7be412210413fc93602ec4522eb1f368b (diff)
parent4ce44da3d5351b29e8dd0ed65bf49faeac21254b (diff)
downloadmariadb-git-c84d4b213905f37fd0095456dcdd0bfcae51a4f1.tar.gz
Merge whalegate.ndb.mysql.com:/home/tomas/cge-5.1
into whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb-merge mysql-test/suite/rpl/r/rpl_bug31076.result: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.cc: Auto merged sql/log_event.cc: Auto merged sql/sql_update.cc: Auto merged storage/ndb/include/ndbapi/Ndb.hpp: Auto merged mysql-test/suite/rpl/t/rpl_bug31076.test: manual merge
Diffstat (limited to 'storage/ndb/include')
-rw-r--r--storage/ndb/include/kernel/AttributeHeader.hpp10
-rw-r--r--storage/ndb/include/kernel/GlobalSignalNumbers.h8
-rw-r--r--storage/ndb/include/kernel/signaldata/AccScan.hpp1
-rw-r--r--storage/ndb/include/kernel/signaldata/CopyFrag.hpp41
-rw-r--r--storage/ndb/include/kernel/signaldata/ScanTab.hpp1
-rw-r--r--storage/ndb/include/kernel/signaldata/TcKeyConf.hpp2
-rw-r--r--storage/ndb/include/ndb_version.h.in47
-rw-r--r--storage/ndb/include/ndbapi/Ndb.hpp1
-rw-r--r--storage/ndb/include/ndbapi/NdbOperation.hpp5
-rw-r--r--storage/ndb/include/ndbapi/NdbPool.hpp3
-rw-r--r--storage/ndb/include/ndbapi/NdbScanFilter.hpp29
-rw-r--r--storage/ndb/include/ndbapi/NdbTransaction.hpp9
-rw-r--r--storage/ndb/include/ndbapi/ndbapi_limits.h2
-rw-r--r--storage/ndb/include/util/ndb_rand.h33
14 files changed, 179 insertions, 13 deletions
diff --git a/storage/ndb/include/kernel/AttributeHeader.hpp b/storage/ndb/include/kernel/AttributeHeader.hpp
index 613e3d19d1b..52f93b6cd05 100644
--- a/storage/ndb/include/kernel/AttributeHeader.hpp
+++ b/storage/ndb/include/kernel/AttributeHeader.hpp
@@ -52,8 +52,7 @@ public:
// NOTE: in 5.1 ctors and init take size in bytes
/** Initialize AttributeHeader at location aHeaderPtr */
- static AttributeHeader& init(void* aHeaderPtr, Uint32 anAttributeId,
- Uint32 aByteSize);
+ static void init(Uint32* aHeaderPtr, Uint32 anAttributeId, Uint32 aByteSize);
/** Returns size of AttributeHeader (usually one or two words) */
Uint32 getHeaderSize() const; // In 32-bit words
@@ -113,10 +112,11 @@ public:
*/
inline
-AttributeHeader& AttributeHeader::init(void* aHeaderPtr, Uint32 anAttributeId,
- Uint32 aByteSize)
+void AttributeHeader::init(Uint32* aHeaderPtr, Uint32 anAttributeId,
+ Uint32 aByteSize)
{
- return * new (aHeaderPtr) AttributeHeader(anAttributeId, aByteSize);
+ AttributeHeader ah(anAttributeId, aByteSize);
+ *aHeaderPtr = ah.m_value;
}
inline
diff --git a/storage/ndb/include/kernel/GlobalSignalNumbers.h b/storage/ndb/include/kernel/GlobalSignalNumbers.h
index aa0596f102a..9653c20260f 100644
--- a/storage/ndb/include/kernel/GlobalSignalNumbers.h
+++ b/storage/ndb/include/kernel/GlobalSignalNumbers.h
@@ -195,9 +195,11 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
/* 132 not unused */
/* 133 not unused */
#define GSN_CM_HEARTBEAT 134 /* distr. */
-/* 135 unused */
-/* 136 unused */
-/* 137 unused */
+
+#define GSN_PREPARE_COPY_FRAG_REQ 135
+#define GSN_PREPARE_COPY_FRAG_REF 136
+#define GSN_PREPARE_COPY_FRAG_CONF 137
+
#define GSN_CM_NODEINFOCONF 138 /* distr. */
#define GSN_CM_NODEINFOREF 139 /* distr. */
#define GSN_CM_NODEINFOREQ 140 /* distr. */
diff --git a/storage/ndb/include/kernel/signaldata/AccScan.hpp b/storage/ndb/include/kernel/signaldata/AccScan.hpp
index 73d69825069..a0aa38c8d8e 100644
--- a/storage/ndb/include/kernel/signaldata/AccScan.hpp
+++ b/storage/ndb/include/kernel/signaldata/AccScan.hpp
@@ -49,6 +49,7 @@ private:
Uint32 savePointId;
Uint32 gci;
};
+ Uint32 maxPage;
/**
* Previously there where also a scan type
diff --git a/storage/ndb/include/kernel/signaldata/CopyFrag.hpp b/storage/ndb/include/kernel/signaldata/CopyFrag.hpp
index 06dd4070264..d985358dce4 100644
--- a/storage/ndb/include/kernel/signaldata/CopyFrag.hpp
+++ b/storage/ndb/include/kernel/signaldata/CopyFrag.hpp
@@ -29,7 +29,7 @@ class CopyFragReq {
*/
friend class Dblqh;
public:
- STATIC_CONST( SignalLength = 9 );
+ STATIC_CONST( SignalLength = 10 );
private:
Uint32 userPtr;
@@ -42,6 +42,7 @@ private:
Uint32 gci;
Uint32 nodeCount;
Uint32 nodeList[1];
+ //Uint32 maxPage; is stored in nodeList[nodeCount]
};
class CopyFragConf {
@@ -95,4 +96,42 @@ struct UpdateFragDistKeyOrd
STATIC_CONST( SignalLength = 3 );
};
+struct PrepareCopyFragReq
+{
+ STATIC_CONST( SignalLength = 6 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 copyNodeId;
+ Uint32 startingNodeId;
+};
+
+struct PrepareCopyFragRef
+{
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 copyNodeId;
+ Uint32 startingNodeId;
+ Uint32 errorCode;
+
+ STATIC_CONST( SignalLength = 7 );
+};
+
+struct PrepareCopyFragConf
+{
+ STATIC_CONST( SignalLength = 7 );
+
+ Uint32 senderRef;
+ Uint32 senderData;
+ Uint32 tableId;
+ Uint32 fragId;
+ Uint32 copyNodeId;
+ Uint32 startingNodeId;
+ Uint32 maxPageNo;
+};
+
#endif
diff --git a/storage/ndb/include/kernel/signaldata/ScanTab.hpp b/storage/ndb/include/kernel/signaldata/ScanTab.hpp
index 0074078533f..3d2071ca019 100644
--- a/storage/ndb/include/kernel/signaldata/ScanTab.hpp
+++ b/storage/ndb/include/kernel/signaldata/ScanTab.hpp
@@ -46,6 +46,7 @@ public:
* Length of signal
*/
STATIC_CONST( StaticLength = 11 );
+ STATIC_CONST( MaxTotalAttrInfo = 0xFFFF );
private:
diff --git a/storage/ndb/include/kernel/signaldata/TcKeyConf.hpp b/storage/ndb/include/kernel/signaldata/TcKeyConf.hpp
index b8562875ef5..fd8932c3c87 100644
--- a/storage/ndb/include/kernel/signaldata/TcKeyConf.hpp
+++ b/storage/ndb/include/kernel/signaldata/TcKeyConf.hpp
@@ -46,7 +46,7 @@ public:
*/
STATIC_CONST( StaticLength = 5 );
STATIC_CONST( OperationLength = 2 );
- STATIC_CONST( SimpleReadBit = (((Uint32)1) << 31) );
+ STATIC_CONST( DirtyReadBit = (((Uint32)1) << 31) );
private:
diff --git a/storage/ndb/include/ndb_version.h.in b/storage/ndb/include/ndb_version.h.in
index 5405ad4d7aa..6a479433b3b 100644
--- a/storage/ndb/include/ndb_version.h.in
+++ b/storage/ndb/include/ndb_version.h.in
@@ -88,5 +88,52 @@ Uint32 ndbGetOwnVersion();
#define NDBD_NODE_VERSION_REP NDB_MAKE_VERSION(6,1,1)
+#define NDBD_PREPARE_COPY_FRAG_VERSION NDB_MAKE_VERSION(6,2,1)
+#define NDBD_PREPARE_COPY_FRAG_V2_51 NDB_MAKE_VERSION(5,1,23)
+#define NDBD_PREPARE_COPY_FRAG_V2_62 NDB_MAKE_VERSION(6,2,8)
+#define NDBD_PREPARE_COPY_FRAG_V2_63 NDB_MAKE_VERSION(6,3,6)
+
+/**
+ * 0 = NO PREP COPY FRAG SUPPORT
+ * 1 = NO MAX PAGE SUPPORT
+ * 2 = LATEST VERSION
+ */
+static
+inline
+int
+ndb_check_prep_copy_frag_version(Uint32 version)
+{
+ if (version == NDB_VERSION_D)
+ return 2;
+
+ const Uint32 major = (version >> 16) & 0xFF;
+ const Uint32 minor = (version >> 8) & 0xFF;
+ if (major >= 6)
+ {
+ if (minor == 2)
+ {
+ if (version >= NDBD_PREPARE_COPY_FRAG_V2_62)
+ return 2;
+ if (version >= NDBD_PREPARE_COPY_FRAG_VERSION)
+ return 1;
+ return 0;
+ }
+ else if (minor == 3)
+ {
+ if (version >= NDBD_PREPARE_COPY_FRAG_V2_63)
+ return 2;
+ return 1;
+ }
+ return 2;
+ }
+ else if (major == 5 && minor == 1)
+ {
+ if (version >= NDBD_PREPARE_COPY_FRAG_V2_51)
+ return 2;
+ }
+
+ return 0;
+}
+
#endif
diff --git a/storage/ndb/include/ndbapi/Ndb.hpp b/storage/ndb/include/ndbapi/Ndb.hpp
index 995ce67e61d..dca19c2ead0 100644
--- a/storage/ndb/include/ndbapi/Ndb.hpp
+++ b/storage/ndb/include/ndbapi/Ndb.hpp
@@ -1056,6 +1056,7 @@ class Ndb
friend class NdbBlob;
friend class NdbImpl;
friend class Ndb_internal;
+ friend class NdbScanFilterImpl;
#endif
public:
diff --git a/storage/ndb/include/ndbapi/NdbOperation.hpp b/storage/ndb/include/ndbapi/NdbOperation.hpp
index 06111941df4..78dbadfd7ab 100644
--- a/storage/ndb/include/ndbapi/NdbOperation.hpp
+++ b/storage/ndb/include/ndbapi/NdbOperation.hpp
@@ -93,8 +93,9 @@ public:
,LM_CommittedRead ///< Ignore locks, read last committed value
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
= 2,
- LM_Dirty = 2
+ LM_Dirty = 2,
#endif
+ LM_SimpleRead = 3 ///< Read with shared lock, but release lock directly
};
/**
@@ -842,8 +843,10 @@ protected:
virtual ~NdbOperation();
void next(NdbOperation*); // Set next pointer
NdbOperation* next(); // Get next pointer
+
public:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ NdbTransaction* getNdbTransaction();
const NdbOperation* next() const;
const NdbRecAttr* getFirstRecAttr() const;
#endif
diff --git a/storage/ndb/include/ndbapi/NdbPool.hpp b/storage/ndb/include/ndbapi/NdbPool.hpp
index 1963bf26448..44b6d7488f0 100644
--- a/storage/ndb/include/ndbapi/NdbPool.hpp
+++ b/storage/ndb/include/ndbapi/NdbPool.hpp
@@ -17,7 +17,8 @@ class Ndb;
class NdbPool;
bool
-create_instance(Uint32 max_ndb_objects,
+create_instance(Ndb_cluster_connection* cc,
+ Uint32 max_ndb_objects,
Uint32 no_conn_obj,
Uint32 init_no_ndb_objects);
diff --git a/storage/ndb/include/ndbapi/NdbScanFilter.hpp b/storage/ndb/include/ndbapi/NdbScanFilter.hpp
index 1ef62558560..4527012a6c4 100644
--- a/storage/ndb/include/ndbapi/NdbScanFilter.hpp
+++ b/storage/ndb/include/ndbapi/NdbScanFilter.hpp
@@ -17,6 +17,7 @@
#define NDB_SCAN_FILTER_HPP
#include <ndb_types.h>
+#include <ndbapi_limits.h>
/**
* @class NdbScanFilter
@@ -31,8 +32,13 @@ public:
/**
* Constructor
* @param op The NdbOperation that the filter belongs to (is applied to).
+ * @param abort_on_too_large abort transaction on filter too large
+ * default: true
+ * @param max_size Maximum size of generated filter in words
*/
- NdbScanFilter(class NdbOperation * op);
+ NdbScanFilter(class NdbOperation * op,
+ bool abort_on_too_large = true,
+ Uint32 max_size = NDB_MAX_SCANFILTER_SIZE_IN_WORDS);
~NdbScanFilter();
/**
@@ -166,6 +172,27 @@ public:
/** @} *********************************************************************/
#endif
+ enum Error {
+ FilterTooLarge = 4294
+ };
+
+ /**
+ * Get filter level error.
+ *
+ * Most errors are set only on operation level, and they abort the
+ * transaction. The error FilterTooLarge is set on filter level and
+ * by default it propagates to operation level and also aborts the
+ * transaction.
+ *
+ * If option abort_on_too_large is set to false, then FilterTooLarge
+ * does not propagate. One can then either ignore this error (in
+ * which case no filtering is done) or try to define a new filter
+ * immediately.
+ */
+ const class NdbError & getNdbError() const;
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ NdbOperation * getNdbOperation();
+#endif
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbScanFilterImpl;
diff --git a/storage/ndb/include/ndbapi/NdbTransaction.hpp b/storage/ndb/include/ndbapi/NdbTransaction.hpp
index 20c9c709e51..6a057655398 100644
--- a/storage/ndb/include/ndbapi/NdbTransaction.hpp
+++ b/storage/ndb/include/ndbapi/NdbTransaction.hpp
@@ -170,6 +170,15 @@ public:
#endif
};
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ /**
+ * Convenience method to fetch this transaction's Ndb* object
+ */
+ Ndb * getNdb() {
+ return theNdb;
+ }
+#endif
+
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/**
* Get an NdbOperation for a table.
diff --git a/storage/ndb/include/ndbapi/ndbapi_limits.h b/storage/ndb/include/ndbapi/ndbapi_limits.h
index 63399e4bd0a..e283913d059 100644
--- a/storage/ndb/include/ndbapi/ndbapi_limits.h
+++ b/storage/ndb/include/ndbapi/ndbapi_limits.h
@@ -26,4 +26,6 @@
#define NDB_MAX_TUPLE_SIZE (NDB_MAX_TUPLE_SIZE_IN_WORDS*4)
#define NDB_MAX_ACTIVE_EVENTS 100
+#define NDB_MAX_SCANFILTER_SIZE_IN_WORDS 50000
+
#endif
diff --git a/storage/ndb/include/util/ndb_rand.h b/storage/ndb/include/util/ndb_rand.h
new file mode 100644
index 00000000000..1521ca9c4ff
--- /dev/null
+++ b/storage/ndb/include/util/ndb_rand.h
@@ -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 */
+
+#ifndef NDB_RAND_H
+#define NDB_RAND_H
+
+#define NDB_RAND_MAX 32767
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int ndb_rand(void);
+
+void ndb_srand(unsigned seed);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif