Merge poseidon.ndb.mysql.com:/home/tomas/mysql-5.0

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new


mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/ndb_basic.result:
  Auto merged
mysql-test/t/ndb_basic.test:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  Auto merged
sql/ha_ndbcluster.cc:
  SCCS merged
sql/ha_ndbcluster.h:
  SCCS merged
This commit is contained in:
unknown 2006-02-10 18:04:46 +01:00
commit 36bfd749a3
12 changed files with 170 additions and 41 deletions

View File

@ -702,11 +702,11 @@ insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd
ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' 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

View File

@ -25,7 +25,7 @@ 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;
select get_lock("a", 10);
get_lock("a", 10)

View File

@ -678,6 +678,61 @@ 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;
create table atablewithareallylongandirritatingname (a int);
insert into atablewithareallylongandirritatingname values (2);
select * from atablewithareallylongandirritatingname;

View File

@ -440,10 +440,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;

View File

@ -84,7 +84,7 @@ select ((@id := kill_id) - kill_id) from t3;
kill @id;
connection conn1;
-- error 1053
-- error 1053,2013
reap;
connection default;

View File

@ -625,6 +625,72 @@ 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
#

View File

@ -97,8 +97,6 @@ static uint ndbcluster_alter_table_flags(uint flags)
}
#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
#define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0
#define NDB_AUTO_INCREMENT_RETRIES 10
@ -952,7 +950,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);
}
@ -2551,13 +2549,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_share->fields;
const 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
@ -2664,11 +2659,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_share->fields;
const 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
@ -3242,17 +3234,15 @@ void ha_ndbcluster::position(const byte *record)
{
// No primary key, get hidden key
DBUG_PRINT("info", ("Getting hidden key"));
int hidden_no= table_share->fields;
const NdbRecAttr* rec= m_value[hidden_no].rec;
memcpy(ref, (const void*)rec->aRef(), ref_length);
#ifndef DBUG_OFF
int hidden_no= table->s->fields;
const NDBTAB *tab= (const NDBTAB *) m_table;
const NDBCOL *hidden_col= tab->getColumn(hidden_no);
DBUG_ASSERT(hidden_col->getPrimaryKey() &&
hidden_col->getAutoIncrement() &&
rec != NULL &&
ref_length == NDB_HIDDEN_PRIMARY_KEY_LENGTH);
#endif
memcpy(ref, m_ref, ref_length);
}
DBUG_DUMP("ref", (char*)ref, ref_length);

View File

@ -31,6 +31,8 @@
#include <NdbApi.hpp>
#include <ndbapi_limits.h>
#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
class Ndb; // Forward declaration
class NdbOperation; // Forward declaration
class NdbTransaction; // Forward declaration
@ -818,6 +820,7 @@ private:
NDB_INDEX_DATA m_index[MAX_KEY];
// NdbRecAttr has no reference to blob
NdbValue m_value[NDB_MAX_ATTRIBUTES_IN_TABLE];
byte m_ref[NDB_HIDDEN_PRIMARY_KEY_LENGTH];
partition_info *m_part_info;
byte *m_rec0;
Field **m_part_field_array;

View File

@ -411,7 +411,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

View File

@ -775,7 +775,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 *);
@ -1300,7 +1300,7 @@ private:
}
Uint32 lcpStart;
Uint32 lcpStartGcp;
Uint32 lcpStopGcp;
Uint32 keepGci; /* USED TO CALCULATE THE GCI TO KEEP AFTER A LCP */
Uint32 oldestRestorableGci;
@ -1369,7 +1369,8 @@ private:
Uint32 cstarttype;
Uint32 csystemnodes;
Uint32 currentgcp;
Uint32 c_newest_restorable_gci;
enum GcpMasterTakeOverState {
GMTOS_IDLE = 0,
GMTOS_INITIAL = 1,

View File

@ -685,6 +685,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;
@ -703,6 +704,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
@ -8039,6 +8041,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;
@ -9522,7 +9526,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
@ -9605,7 +9609,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. */
/* ----------------------------------------------------------------------- */
@ -9677,7 +9680,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();
@ -10537,6 +10540,7 @@ void Dbdih::allNodesLcpCompletedLab(Signal* signal)
signal->theData[0] = NDB_LE_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
@ -10971,7 +10975,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;
@ -10993,7 +10998,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
@ -11287,7 +11291,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];
@ -11409,7 +11413,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;
@ -11446,6 +11450,7 @@ void Dbdih::initCommonData()
csystemnodes = 0;
c_updateToLock = RNIL;
currentgcp = 0;
c_newest_restorable_gci = 0;
cverifyQueueCounter = 0;
cwaitLcpSr = false;
c_nextLogPart = 0;
@ -11522,6 +11527,7 @@ void Dbdih::initRestartInfo()
currentgcp = 2;
cnewgcp = 2;
crestartGci = 1;
c_newest_restorable_gci = 1;
SYSFILE->keepGCI = 1;
SYSFILE->oldestRestorableGCI = 1;
@ -13494,9 +13500,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
@ -13677,8 +13683,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

View File

@ -14738,7 +14738,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
@ -14804,7 +14806,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
@ -14833,8 +14836,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]);
@ -15417,6 +15421,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()