Commit 6131fa09 authored by pekka@sama.ndb.mysql.com's avatar pekka@sama.ndb.mysql.com

Merge sama.ndb.mysql.com:/export/space/pekka/ndb/version/my51-ndb

into  sama.ndb.mysql.com:/export/space/pekka/ndb/version/my51-bug34118
parents 28dbbeed c81d4856
......@@ -501,6 +501,18 @@ f1 f2
111111 aaaaaa
222222 bbbbbb
drop table test.t1;
CREATE TABLE t1 (
id int unsigned NOT NULL,
c1 int unsigned NOT NULL,
c2 int DEFAULT NULL,
PRIMARY KEY using hash (id),
UNIQUE KEY c1 using hash (c1))
TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster;
insert into t1 values(1, 1, 3);
insert into t1 values(2, 2, 3);
update t1 set c1 = 1 where id = 2;
ERROR 23000: Duplicate entry '1' for key 'c1'
drop table t1;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE = NDB;
......
......@@ -439,6 +439,21 @@ select f2 from test.t1 order by f2;
select f1,f2 from test.t1 order by f1;
drop table test.t1;
# bug#34118 hash index trigger and do not update any disk attr
CREATE TABLE t1 (
id int unsigned NOT NULL,
c1 int unsigned NOT NULL,
c2 int DEFAULT NULL,
PRIMARY KEY using hash (id),
UNIQUE KEY c1 using hash (c1))
TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster;
insert into t1 values(1, 1, 3);
insert into t1 values(2, 2, 3);
--error ER_DUP_ENTRY
update t1 set c1 = 1 where id = 2;
drop table t1;
###################
# Test Cleanup
###################
......
......@@ -2202,17 +2202,20 @@ private:
void
checkImmediateTriggersAfterInsert(KeyReqStruct *req_struct,
Operationrec* regOperPtr,
Tablerec* tablePtr);
Tablerec* tablePtr,
bool disk);
void
checkImmediateTriggersAfterUpdate(KeyReqStruct *req_struct,
Operationrec* regOperPtr,
Tablerec* tablePtr);
Tablerec* tablePtr,
bool disk);
void
checkImmediateTriggersAfterDelete(KeyReqStruct *req_struct,
Operationrec* regOperPtr,
Tablerec* tablePtr);
Tablerec* tablePtr,
bool disk);
#if 0
void checkDeferredTriggers(Signal* signal,
......@@ -2226,7 +2229,8 @@ private:
void fireImmediateTriggers(KeyReqStruct *req_struct,
DLList<TupTriggerData>& triggerList,
Operationrec* regOperPtr);
Operationrec* regOperPtr,
bool disk);
void fireDeferredTriggers(KeyReqStruct *req_struct,
DLList<TupTriggerData>& triggerList,
......@@ -2239,12 +2243,13 @@ private:
void executeTriggers(KeyReqStruct *req_struct,
DLList<TupTriggerData>& triggerList,
Operationrec* regOperPtr);
Operationrec* regOperPtr,
bool disk);
void executeTrigger(KeyReqStruct *req_struct,
TupTriggerData* trigPtr,
Operationrec* regOperPtr,
bool disk = true);
bool disk);
bool readTriggerInfo(TupTriggerData* trigPtr,
Operationrec* regOperPtr,
......
......@@ -749,7 +749,8 @@ void Dbtup::execTUPKEYREQ(Signal* signal)
}
checkImmediateTriggersAfterInsert(&req_struct,
regOperPtr,
regTabPtr);
regTabPtr,
disk_page != RNIL);
set_change_mask_state(regOperPtr, SET_ALL_MASK);
sendTUPKEYCONF(signal, &req_struct, regOperPtr);
return;
......@@ -782,7 +783,8 @@ void Dbtup::execTUPKEYREQ(Signal* signal)
}
checkImmediateTriggersAfterUpdate(&req_struct,
regOperPtr,
regTabPtr);
regTabPtr,
disk_page != RNIL);
// XXX use terrorCode for now since all methods are void
if (terrorCode != 0)
{
......@@ -813,7 +815,8 @@ void Dbtup::execTUPKEYREQ(Signal* signal)
*/
checkImmediateTriggersAfterDelete(&req_struct,
regOperPtr,
regTabPtr);
regTabPtr,
disk_page != RNIL);
set_change_mask_state(regOperPtr, DELETE_CHANGES);
sendTUPKEYCONF(signal, &req_struct, regOperPtr);
return;
......
......@@ -369,7 +369,8 @@ Dbtup::dropTrigger(Tablerec* table, const DropTrigReq* req, BlockNumber sender)
void
Dbtup::checkImmediateTriggersAfterInsert(KeyReqStruct *req_struct,
Operationrec *regOperPtr,
Tablerec *regTablePtr)
Tablerec *regTablePtr,
bool disk)
{
if(refToBlock(req_struct->TC_ref) != DBTC) {
return;
......@@ -380,14 +381,16 @@ Dbtup::checkImmediateTriggersAfterInsert(KeyReqStruct *req_struct,
jam();
fireImmediateTriggers(req_struct,
regTablePtr->afterInsertTriggers,
regOperPtr);
regOperPtr,
disk);
}
}
void
Dbtup::checkImmediateTriggersAfterUpdate(KeyReqStruct *req_struct,
Operationrec* regOperPtr,
Tablerec* regTablePtr)
Tablerec* regTablePtr,
bool disk)
{
if(refToBlock(req_struct->TC_ref) != DBTC) {
return;
......@@ -398,21 +401,24 @@ Dbtup::checkImmediateTriggersAfterUpdate(KeyReqStruct *req_struct,
jam();
fireImmediateTriggers(req_struct,
regTablePtr->afterUpdateTriggers,
regOperPtr);
regOperPtr,
disk);
}
if ((regOperPtr->op_struct.primary_replica) &&
(!(regTablePtr->constraintUpdateTriggers.isEmpty()))) {
jam();
fireImmediateTriggers(req_struct,
regTablePtr->constraintUpdateTriggers,
regOperPtr);
regOperPtr,
disk);
}
}
void
Dbtup::checkImmediateTriggersAfterDelete(KeyReqStruct *req_struct,
Operationrec* regOperPtr,
Tablerec* regTablePtr)
Tablerec* regTablePtr,
bool disk)
{
if(refToBlock(req_struct->TC_ref) != DBTC) {
return;
......@@ -423,7 +429,8 @@ Dbtup::checkImmediateTriggersAfterDelete(KeyReqStruct *req_struct,
jam();
executeTriggers(req_struct,
regTablePtr->afterDeleteTriggers,
regOperPtr);
regOperPtr,
disk);
}
}
......@@ -547,7 +554,8 @@ end:
void
Dbtup::fireImmediateTriggers(KeyReqStruct *req_struct,
DLList<TupTriggerData>& triggerList,
Operationrec* const regOperPtr)
Operationrec* const regOperPtr,
bool disk)
{
TriggerPtr trigPtr;
triggerList.first(trigPtr);
......@@ -558,7 +566,8 @@ Dbtup::fireImmediateTriggers(KeyReqStruct *req_struct,
jam();
executeTrigger(req_struct,
trigPtr.p,
regOperPtr);
regOperPtr,
disk);
}//if
triggerList.next(trigPtr);
}//while
......@@ -621,7 +630,8 @@ Dbtup::fireDetachedTriggers(KeyReqStruct *req_struct,
void Dbtup::executeTriggers(KeyReqStruct *req_struct,
DLList<TupTriggerData>& triggerList,
Operationrec* regOperPtr)
Operationrec* regOperPtr,
bool disk)
{
TriggerPtr trigPtr;
triggerList.first(trigPtr);
......@@ -629,7 +639,8 @@ void Dbtup::executeTriggers(KeyReqStruct *req_struct,
jam();
executeTrigger(req_struct,
trigPtr.p,
regOperPtr);
regOperPtr,
disk);
triggerList.next(trigPtr);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment