From a08c0a10229e5bc942e299b08902cc771770945c Mon Sep 17 00:00:00 2001 From: "ramil@mysql.com" <> Date: Thu, 26 Jan 2006 13:15:47 +0400 Subject: [PATCH 1/7] Fix for bug #16511: Decimal data types broken with prepared statements. --- sql/sql_prepare.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 68f033f78fe..098608ee43f 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -405,7 +405,7 @@ static void set_param_decimal(Item_param *param, uchar **pos, ulong len) { ulong length= get_param_length(pos, len); param->set_decimal((char*)*pos, length); - *pos+= len; + *pos+= length; } #ifndef EMBEDDED_LIBRARY From 5923d505331d7bf8f386eb9d3767f39a1dbb2b31 Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Tue, 7 Feb 2006 13:45:16 +0200 Subject: [PATCH 2/7] kill.test fixed for kill on Mac OS X (which do not send OK) --- mysql-test/r/kill.result | 2 +- mysql-test/t/kill.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result index 828c7fcf9b0..239f9d24e9e 100644 --- a/mysql-test/r/kill.result +++ b/mysql-test/r/kill.result @@ -27,5 +27,5 @@ select ((@id := kill_id) - kill_id) from t3; ((@id := kill_id) - kill_id) 0 kill @id; -ERROR 08S01: Server shutdown in progress +Got one of the listed errors drop table t1, t2, t3; diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index ebe4673beb3..9ef5e272d46 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -78,7 +78,7 @@ select ((@id := kill_id) - kill_id) from t3; kill @id; connection conn1; --- error 1053 +-- error 1053,2013 reap; disconnect conn1; From 34abab41db808f587721e3810ce548eb07b99915 Mon Sep 17 00:00:00 2001 From: "ramil@mysql.com" <> Date: Wed, 8 Feb 2006 16:00:39 +0400 Subject: [PATCH 3/7] Removed 'delayed' to make the test deterministic (as the bug itself has nothing to do with 'delayed'). --- mysql-test/r/heap.result | 4 ++-- mysql-test/t/heap.test | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index e3b9f7db984..6bb9d0c87ee 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -297,11 +297,11 @@ insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1 drop table t1; CREATE TABLE t1 (a int, key(a)) engine=heap; -insert delayed into t1 values (0); +insert into t1 values (0); delete from t1; select * from t1; a -insert delayed into t1 values (0), (1); +insert into t1 values (0), (1); select * from t1 where a = 0; a 0 diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index a8128b79e3b..50147b4182d 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -238,10 +238,10 @@ drop table t1; # Bug 12796: Record doesn't show when selecting through index # CREATE TABLE t1 (a int, key(a)) engine=heap; -insert delayed into t1 values (0); +insert into t1 values (0); delete from t1; select * from t1; -insert delayed into t1 values (0), (1); +insert into t1 values (0), (1); select * from t1 where a = 0; drop table t1; From d9e402ef524ec347cc7447b0bd0f1f53120f6627 Mon Sep 17 00:00:00 2001 From: "jonas@perch.ndb.mysql.com" <> Date: Fri, 10 Feb 2006 09:17:53 +0100 Subject: [PATCH 4/7] bug#17295 - ndb - error while reading REDO log fix corruption due to page 0, file 0 gets released --- ndb/src/kernel/blocks/dblqh/DblqhMain.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index 80a8805697e..fb6aa026b3b 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -14767,7 +14767,9 @@ void Dblqh::execSr(Signal* signal) signal->theData[4] = logFilePtr.p->currentFilepage; signal->theData[5] = logFilePtr.p->currentMbyte; signal->theData[6] = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX]; - sendSignal(cownref, GSN_DEBUG_SIG, signal, 7, JBA); + signal->theData[7] = ~0; + signal->theData[8] = __LINE__; + sendSignal(cownref, GSN_DEBUG_SIG, signal, 9, JBA); return; }//if }//if @@ -14833,7 +14835,8 @@ void Dblqh::execSr(Signal* signal) signal->theData[5] = logFilePtr.p->currentFilepage; signal->theData[6] = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX]; signal->theData[7] = logWord; - sendSignal(cownref, GSN_DEBUG_SIG, signal, 8, JBA); + signal->theData[8] = __LINE__; + sendSignal(cownref, GSN_DEBUG_SIG, signal, 9, JBA); return; break; }//switch @@ -14862,8 +14865,9 @@ void Dblqh::execDEBUG_SIG(Signal* signal) char buf[100]; BaseString::snprintf(buf, 100, - "Error while reading REDO log.\n" + "Error while reading REDO log. from %d\n" "D=%d, F=%d Mb=%d FP=%d W1=%d W2=%d", + signal->theData[8], signal->theData[2], signal->theData[3], signal->theData[4], signal->theData[5], signal->theData[6], signal->theData[7]); @@ -15439,6 +15443,10 @@ void Dblqh::readSrFourthZeroLab(Signal* signal) // to read a page from file. lfoPtr.p->lfoState = LogFileOperationRecord::WRITE_SR_INVALIDATE_PAGES; + /** + * Make sure we dont release zero page + */ + seizeLogpage(signal); invalidateLogAfterLastGCI(signal); return; }//Dblqh::readSrFourthZeroLab() From 088c7d4268ea10e89e1d70bbfb0d4293c215b5ec Mon Sep 17 00:00:00 2001 From: "jonas@perch.ndb.mysql.com" <> Date: Fri, 10 Feb 2006 09:37:36 +0100 Subject: [PATCH 5/7] bug#10987 - ndb - unable to find restorable replica Introduce new variable c_newest_restorable_gci which is set _after_ both GCP_SAVE and COPY_GCI This variable is used when cutting redo (calcKeepGci) Also make sure complete GCI is run inbetween LCP's --- ndb/src/kernel/blocks/dbdih/Dbdih.hpp | 7 +++--- ndb/src/kernel/blocks/dbdih/DbdihMain.cpp | 28 ++++++++++++++--------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/ndb/src/kernel/blocks/dbdih/Dbdih.hpp b/ndb/src/kernel/blocks/dbdih/Dbdih.hpp index ee67bf47d7b..0c107e35603 100644 --- a/ndb/src/kernel/blocks/dbdih/Dbdih.hpp +++ b/ndb/src/kernel/blocks/dbdih/Dbdih.hpp @@ -774,7 +774,7 @@ private: //------------------------------------ // Methods for LCP functionality //------------------------------------ - void checkKeepGci(Uint32 replicaStartIndex); + void checkKeepGci(TabRecordPtr, Uint32, Fragmentstore*, Uint32); void checkLcpStart(Signal *, Uint32 lineNo); void checkStartMoreLcp(Signal *, Uint32 nodeId); bool reportLcpCompletion(const class LcpFragRep *); @@ -1292,7 +1292,7 @@ private: } Uint32 lcpStart; - Uint32 lcpStartGcp; + Uint32 lcpStopGcp; Uint32 keepGci; /* USED TO CALCULATE THE GCI TO KEEP AFTER A LCP */ Uint32 oldestRestorableGci; @@ -1361,7 +1361,8 @@ private: Uint32 cstarttype; Uint32 csystemnodes; Uint32 currentgcp; - + Uint32 c_newest_restorable_gci; + enum GcpMasterTakeOverState { GMTOS_IDLE = 0, GMTOS_INITIAL = 1, diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index 97cd8c374c6..1d2124e1b32 100644 --- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -674,6 +674,7 @@ void Dbdih::execCOPY_GCIREQ(Signal* signal) jam(); coldgcp = SYSFILE->newestRestorableGCI; crestartGci = SYSFILE->newestRestorableGCI; + c_newest_restorable_gci = SYSFILE->newestRestorableGCI; Sysfile::setRestartOngoing(SYSFILE->systemRestartBits); currentgcp = coldgcp + 1; cnewgcp = coldgcp + 1; @@ -692,6 +693,7 @@ void Dbdih::execCOPY_GCIREQ(Signal* signal) ok = true; jam(); cgcpParticipantState = GCP_PARTICIPANT_COPY_GCI_RECEIVED; + c_newest_restorable_gci = SYSFILE->newestRestorableGCI; setNodeInfo(signal); break; }//if @@ -7749,6 +7751,8 @@ void Dbdih::execCOPY_GCICONF(Signal* signal) signal->theData[1] = coldgcp; sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB); + c_newest_restorable_gci = coldgcp; + CRASH_INSERTION(7004); emptyWaitGCPMasterQueue(signal); cgcpStatus = GCP_READY; @@ -9155,7 +9159,7 @@ void Dbdih::checkTcCounterLab(Signal* signal) }//if c_lcpState.ctimer += 32; if ((c_nodeStartMaster.blockLcp == true) || - ((c_lcpState.lcpStartGcp + 1) > currentgcp)) { + (c_lcpState.lcpStopGcp >= c_newest_restorable_gci)) { jam(); /* --------------------------------------------------------------------- */ // No reason to start juggling the states and checking for start of LCP if @@ -9238,7 +9242,6 @@ void Dbdih::execTCGETOPSIZECONF(Signal* signal) /* ----------------------------------------------------------------------- */ c_lcpState.ctimer = 0; c_lcpState.keepGci = coldgcp; - c_lcpState.lcpStartGcp = currentgcp; /* ----------------------------------------------------------------------- */ /* UPDATE THE NEW LATEST LOCAL CHECKPOINT ID. */ /* ----------------------------------------------------------------------- */ @@ -9310,7 +9313,7 @@ void Dbdih::calculateKeepGciLab(Signal* signal, Uint32 tableId, Uint32 fragId) cnoOfActiveTables++; FragmentstorePtr fragPtr; getFragstore(tabPtr.p, fragId, fragPtr); - checkKeepGci(fragPtr.p->storedReplicas); + checkKeepGci(tabPtr, fragId, fragPtr.p, fragPtr.p->storedReplicas); fragId++; if (fragId >= tabPtr.p->totalfragments) { jam(); @@ -10168,6 +10171,7 @@ void Dbdih::allNodesLcpCompletedLab(Signal* signal) signal->theData[0] = EventReport::LocalCheckpointCompleted; //Event type signal->theData[1] = SYSFILE->latestLCP_ID; sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB); + c_lcpState.lcpStopGcp = c_newest_restorable_gci; /** * Start checking for next LCP @@ -10522,7 +10526,8 @@ void Dbdih::checkEscalation() /* DESCRIPTION: CHECK FOR MINIMUM GCI RESTORABLE WITH NEW LOCAL */ /* CHECKPOINT. */ /*************************************************************************/ -void Dbdih::checkKeepGci(Uint32 replicaStartIndex) +void Dbdih::checkKeepGci(TabRecordPtr tabPtr, Uint32 fragId, Fragmentstore*, + Uint32 replicaStartIndex) { ReplicaRecordPtr ckgReplicaPtr; ckgReplicaPtr.i = replicaStartIndex; @@ -10544,7 +10549,6 @@ void Dbdih::checkKeepGci(Uint32 replicaStartIndex) if (oldestRestorableGci > c_lcpState.oldestRestorableGci) { jam(); c_lcpState.oldestRestorableGci = oldestRestorableGci; - ndbrequire(((int)c_lcpState.oldestRestorableGci) >= 0); }//if ckgReplicaPtr.i = ckgReplicaPtr.p->nextReplica; }//while @@ -10838,7 +10842,7 @@ void Dbdih::findMinGci(ReplicaRecordPtr fmgReplicaPtr, do { ndbrequire(lcpNo < MAX_LCP_STORED); if (fmgReplicaPtr.p->lcpStatus[lcpNo] == ZVALID && - fmgReplicaPtr.p->maxGciStarted[lcpNo] <= coldgcp) + fmgReplicaPtr.p->maxGciStarted[lcpNo] < c_newest_restorable_gci) { jam(); keepGci = fmgReplicaPtr.p->maxGciCompleted[lcpNo]; @@ -10960,7 +10964,7 @@ void Dbdih::initCommonData() c_lcpState.clcpDelay = 0; c_lcpState.lcpStart = ZIDLE; - c_lcpState.lcpStartGcp = 0; + c_lcpState.lcpStopGcp = 0; c_lcpState.setLcpStatus(LCP_STATUS_IDLE, __LINE__); c_lcpState.currentFragment.tableId = 0; c_lcpState.currentFragment.fragmentId = 0; @@ -10996,6 +11000,7 @@ void Dbdih::initCommonData() csystemnodes = 0; c_updateToLock = RNIL; currentgcp = 0; + c_newest_restorable_gci = 0; cverifyQueueCounter = 0; cwaitLcpSr = false; @@ -11067,6 +11072,7 @@ void Dbdih::initRestartInfo() currentgcp = 2; cnewgcp = 2; crestartGci = 1; + c_newest_restorable_gci = 1; SYSFILE->keepGCI = 1; SYSFILE->oldestRestorableGCI = 1; @@ -13038,9 +13044,9 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) if (signal->theData[0] == 7001) { infoEvent("c_lcpState.keepGci = %d", c_lcpState.keepGci); - infoEvent("c_lcpState.lcpStatus = %d, clcpStartGcp = %d", + infoEvent("c_lcpState.lcpStatus = %d, clcpStopGcp = %d", c_lcpState.lcpStatus, - c_lcpState.lcpStartGcp); + c_lcpState.lcpStopGcp); infoEvent("cgcpStartCounter = %d, cimmediateLcpStart = %d", cgcpStartCounter, c_lcpState.immediateLcpStart); }//if @@ -13221,8 +13227,8 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) infoEvent("lcpStatus = %d (update place = %d) ", c_lcpState.lcpStatus, c_lcpState.lcpStatusUpdatedPlace); infoEvent - ("lcpStart = %d lcpStartGcp = %d keepGci = %d oldestRestorable = %d", - c_lcpState.lcpStart, c_lcpState.lcpStartGcp, + ("lcpStart = %d lcpStopGcp = %d keepGci = %d oldestRestorable = %d", + c_lcpState.lcpStart, c_lcpState.lcpStopGcp, c_lcpState.keepGci, c_lcpState.oldestRestorableGci); infoEvent From 0c559223edd6ac6727ed5f5406e5ae07c6e8cd1c Mon Sep 17 00:00:00 2001 From: "jonas@perch.ndb.mysql.com" <> Date: Fri, 10 Feb 2006 10:10:52 +0100 Subject: [PATCH 6/7] merge --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 2 +- ndb/src/kernel/blocks/dblqh/DblqhMain.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 0052ec0588f..ca9daca428b 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -2584,7 +2584,7 @@ Dbdict::restartCreateTab_readTableConf(Signal* signal, c_readTableRecord.tableId, parseRecord.errorCode); progError(__LINE__, - ERR_INVALID_CONFIG, + NDBD_EXIT_INVALID_CONFIG, buf); ndbrequire(parseRecord.errorCode == 0); } diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index fdb99719643..b75263b747d 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -16176,7 +16176,7 @@ error: "Unable to restart, failed while reading redo." " Likely invalid change of configuration"); progError(__LINE__, - ERR_INVALID_CONFIG, + NDBD_EXIT_INVALID_CONFIG, buf); }//Dblqh::findLogfile() From 7050a7586e05f37ea7e9afcb7fca7ff1e100cb55 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Fri, 10 Feb 2006 17:40:22 +0100 Subject: [PATCH 7/7] Bug #17249 ndb, delete statement with join where clause fails when table do not have pk Bug #17257 ndb, update fails for inner joins if tables do not have Primary Key change: the allocated area by setValue may not be around for later, store hidden key in special member variable instead --- mysql-test/r/ndb_basic.result | 55 +++++++++++++++++++++++++++++ mysql-test/t/ndb_basic.test | 66 +++++++++++++++++++++++++++++++++++ sql/ha_ndbcluster.cc | 20 ++++------- sql/ha_ndbcluster.h | 3 ++ 4 files changed, 130 insertions(+), 14 deletions(-) diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index 42b5a39d3d8..68c8bc01a14 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -671,3 +671,58 @@ CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb; select * from t1; b drop table t1; +create table t1 (a int) engine=ndb; +create table t2 (a int) engine=ndb; +insert into t1 values (1); +insert into t2 values (1); +delete t1.* from t1, t2 where t1.a = t2.a; +select * from t1; +a +select * from t2; +a +1 +drop table t1; +drop table t2; +CREATE TABLE t1 ( +i INT, +j INT, +x INT, +y INT, +z INT +) engine=ndb; +CREATE TABLE t2 ( +i INT, +k INT, +x INT, +y INT, +z INT +) engine=ndb; +CREATE TABLE t3 ( +j INT, +k INT, +x INT, +y INT, +z INT +) engine=ndb; +INSERT INTO t1 VALUES ( 1, 2,13,14,15); +INSERT INTO t2 VALUES ( 1, 3,23,24,25); +INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36); +UPDATE t1 AS a +INNER JOIN t2 AS b +ON a.i = b.i +INNER JOIN t3 AS c +ON a.j = c.j AND b.k = c.k +SET a.x = b.x, +a.y = b.y, +a.z = ( +SELECT sum(z) +FROM t3 +WHERE y = 34 +) +WHERE b.x = 23; +select * from t1; +i j x y z +1 2 23 24 71 +drop table t1; +drop table t2; +drop table t3; diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index c8cf5823500..fdc87382308 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -614,4 +614,70 @@ CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb; select * from t1; drop table t1; +# +# Bug #17249 delete statement with join where clause fails +# when table do not have pk +# + +create table t1 (a int) engine=ndb; +create table t2 (a int) engine=ndb; +insert into t1 values (1); +insert into t2 values (1); +delete t1.* from t1, t2 where t1.a = t2.a; +select * from t1; +select * from t2; +drop table t1; +drop table t2; + +# +# Bug #17257 update fails for inner joins if tables +# do not have Primary Key +# + +CREATE TABLE t1 ( + i INT, + j INT, + x INT, + y INT, + z INT +) engine=ndb; + +CREATE TABLE t2 ( + i INT, + k INT, + x INT, + y INT, + z INT +) engine=ndb; + +CREATE TABLE t3 ( + j INT, + k INT, + x INT, + y INT, + z INT +) engine=ndb; + +INSERT INTO t1 VALUES ( 1, 2,13,14,15); +INSERT INTO t2 VALUES ( 1, 3,23,24,25); +INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36); + +UPDATE t1 AS a +INNER JOIN t2 AS b + ON a.i = b.i +INNER JOIN t3 AS c + ON a.j = c.j AND b.k = c.k +SET a.x = b.x, + a.y = b.y, + a.z = ( + SELECT sum(z) + FROM t3 + WHERE y = 34 + ) +WHERE b.x = 23; +select * from t1; +drop table t1; +drop table t2; +drop table t3; + # End of 4.1 tests diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 6a80ba83017..876d5d2f8fd 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -45,8 +45,6 @@ static const int max_transactions= 256; static const char *ha_ndb_ext=".ndb"; -#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8 - #define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0 #define NDB_AUTO_INCREMENT_RETRIES 10 @@ -747,7 +745,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, } // Used for hidden key only - m_value[fieldnr].rec= ndb_op->getValue(fieldnr, NULL); + m_value[fieldnr].rec= ndb_op->getValue(fieldnr, m_ref); DBUG_RETURN(m_value[fieldnr].rec == NULL); } @@ -2098,13 +2096,10 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) DBUG_PRINT("info", ("Using hidden key")); // Require that the PK for this record has previously been - // read into m_value - uint no_fields= table->fields; - NdbRecAttr* rec= m_value[no_fields].rec; - DBUG_ASSERT(rec); - DBUG_DUMP("key", (char*)rec->aRef(), NDB_HIDDEN_PRIMARY_KEY_LENGTH); + // read into m_ref + DBUG_DUMP("key", m_ref, NDB_HIDDEN_PRIMARY_KEY_LENGTH); - if (set_hidden_key(op, no_fields, rec->aRef())) + if (set_hidden_key(op, table->fields, m_ref)) ERR_RETURN(op->getNdbError()); } else @@ -2181,11 +2176,8 @@ int ha_ndbcluster::delete_row(const byte *record) { // This table has no primary key, use "hidden" primary key DBUG_PRINT("info", ("Using hidden key")); - uint no_fields= table->fields; - NdbRecAttr* rec= m_value[no_fields].rec; - DBUG_ASSERT(rec != NULL); - if (set_hidden_key(op, no_fields, rec->aRef())) + if (set_hidden_key(op, table->fields, m_ref)) ERR_RETURN(op->getNdbError()); } else @@ -2792,7 +2784,7 @@ void ha_ndbcluster::position(const byte *record) hidden_col->getAutoIncrement() && rec != NULL && ref_length == NDB_HIDDEN_PRIMARY_KEY_LENGTH); - memcpy(ref, (const void*)rec->aRef(), ref_length); + memcpy(ref, m_ref, ref_length); } DBUG_DUMP("ref", (char*)ref, ref_length); diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 90d5d59cabe..83d9d87777a 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -27,6 +27,8 @@ #include +#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8 + class Ndb; // Forward declaration class NdbOperation; // Forward declaration class NdbConnection; // Forward declaration @@ -226,6 +228,7 @@ class ha_ndbcluster: public handler // NdbRecAttr has no reference to blob typedef union { NdbRecAttr *rec; NdbBlob *blob; void *ptr; } NdbValue; NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE]; + byte m_ref[NDB_HIDDEN_PRIMARY_KEY_LENGTH]; bool m_use_write; bool m_ignore_dup_key; bool m_primary_key_update;