Commit f43058b8 authored by stewart@mysql.com's avatar stewart@mysql.com

Merge mysql.com:/home/stewart/Documents/MySQL/5.1/new

into  mysql.com:/home/stewart/Documents/MySQL/5.1/2868
parents fb25dc11 d88e5766
...@@ -139,21 +139,11 @@ class StartBackupReq { ...@@ -139,21 +139,11 @@ class StartBackupReq {
friend bool printSTART_BACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16); friend bool printSTART_BACKUP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
public: public:
STATIC_CONST( MaxTableTriggers = 4 ); STATIC_CONST( SignalLength = 2 );
STATIC_CONST( HeaderLength = 5 );
STATIC_CONST( TableTriggerLength = 4);
private: private:
Uint32 backupId; Uint32 backupId;
Uint32 backupPtr; Uint32 backupPtr;
Uint32 signalNo;
Uint32 noOfSignals;
Uint32 noOfTableTriggers;
struct TableTriggers {
Uint32 tableId;
Uint32 triggerIds[3];
} tableTriggers[MaxTableTriggers];
}; };
class StartBackupRef { class StartBackupRef {
...@@ -169,7 +159,7 @@ class StartBackupRef { ...@@ -169,7 +159,7 @@ class StartBackupRef {
friend bool printSTART_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16); friend bool printSTART_BACKUP_REF(FILE *, const Uint32 *, Uint32, Uint16);
public: public:
STATIC_CONST( SignalLength = 5 ); STATIC_CONST( SignalLength = 4 );
enum ErrorCode { enum ErrorCode {
FailedToAllocateTriggerRecord = 1 FailedToAllocateTriggerRecord = 1
...@@ -177,7 +167,6 @@ public: ...@@ -177,7 +167,6 @@ public:
private: private:
Uint32 backupId; Uint32 backupId;
Uint32 backupPtr; Uint32 backupPtr;
Uint32 signalNo;
Uint32 errorCode; Uint32 errorCode;
Uint32 nodeId; Uint32 nodeId;
}; };
...@@ -195,12 +184,11 @@ class StartBackupConf { ...@@ -195,12 +184,11 @@ class StartBackupConf {
friend bool printSTART_BACKUP_CONF(FILE *, const Uint32 *, Uint32, Uint16); friend bool printSTART_BACKUP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
public: public:
STATIC_CONST( SignalLength = 3 ); STATIC_CONST( SignalLength = 2 );
private: private:
Uint32 backupId; Uint32 backupId;
Uint32 backupPtr; Uint32 backupPtr;
Uint32 signalNo;
}; };
class BackupFragmentReq { class BackupFragmentReq {
......
...@@ -48,16 +48,8 @@ printDEFINE_BACKUP_CONF(FILE * out, const Uint32 * data, Uint32 l, Uint16 bno){ ...@@ -48,16 +48,8 @@ printDEFINE_BACKUP_CONF(FILE * out, const Uint32 * data, Uint32 l, Uint16 bno){
bool bool
printSTART_BACKUP_REQ(FILE * out, const Uint32 * data, Uint32 l, Uint16 bno){ printSTART_BACKUP_REQ(FILE * out, const Uint32 * data, Uint32 l, Uint16 bno){
StartBackupReq* sig = (StartBackupReq*)data; StartBackupReq* sig = (StartBackupReq*)data;
fprintf(out, " backupPtr: %d backupId: %d signalNo: %d of %d\n", fprintf(out, " backupPtr: %d backupId: %d\n",
sig->backupPtr, sig->backupId, sig->backupPtr, sig->backupId);
sig->signalNo + 1, sig->noOfSignals);
for(Uint32 i = 0; i<sig->noOfTableTriggers; i++)
fprintf(out,
" Table: %d Triggers = [ insert: %d update: %d delete: %d ]\n",
sig->tableTriggers[i].tableId,
sig->tableTriggers[i].triggerIds[TriggerEvent::TE_INSERT],
sig->tableTriggers[i].triggerIds[TriggerEvent::TE_UPDATE],
sig->tableTriggers[i].triggerIds[TriggerEvent::TE_DELETE]);
return true; return true;
} }
......
...@@ -96,8 +96,6 @@ protected: ...@@ -96,8 +96,6 @@ protected:
void execGET_TABINFO_CONF(Signal* signal); void execGET_TABINFO_CONF(Signal* signal);
void execCREATE_TRIG_REF(Signal* signal); void execCREATE_TRIG_REF(Signal* signal);
void execCREATE_TRIG_CONF(Signal* signal); void execCREATE_TRIG_CONF(Signal* signal);
void execALTER_TRIG_REF(Signal* signal);
void execALTER_TRIG_CONF(Signal* signal);
void execDROP_TRIG_REF(Signal* signal); void execDROP_TRIG_REF(Signal* signal);
void execDROP_TRIG_CONF(Signal* signal); void execDROP_TRIG_CONF(Signal* signal);
...@@ -426,6 +424,7 @@ public: ...@@ -426,6 +424,7 @@ public:
Uint32 clientRef; Uint32 clientRef;
Uint32 clientData; Uint32 clientData;
Uint32 flags; Uint32 flags;
Uint32 signalNo;
Uint32 backupId; Uint32 backupId;
Uint32 backupKey[2]; Uint32 backupKey[2];
Uint32 masterRef; Uint32 masterRef;
...@@ -451,7 +450,18 @@ public: ...@@ -451,7 +450,18 @@ public:
Uint32 backupDataLen; // Used for (un)packing backup request Uint32 backupDataLen; // Used for (un)packing backup request
Array<Page32> pages; // Used for (un)packing backup request Array<Page32> pages; // Used for (un)packing backup request
SimpleProperties props;// Used for (un)packing backup request SimpleProperties props;// Used for (un)packing backup request
struct SlaveData {
SignalCounter trigSendCounter;
Uint32 gsn;
struct {
Uint32 tableId;
} createTrig;
struct {
Uint32 tableId;
} dropTrig;
} slaveData;
struct MasterData { struct MasterData {
MasterData(Backup & b) MasterData(Backup & b)
{ {
...@@ -462,15 +472,6 @@ public: ...@@ -462,15 +472,6 @@ public:
Uint32 gsn; Uint32 gsn;
SignalCounter sendCounter; SignalCounter sendCounter;
Uint32 errorCode; Uint32 errorCode;
struct {
Uint32 tableId;
} createTrig;
struct {
Uint32 tableId;
} dropTrig;
struct {
Uint32 tableId;
} alterTrig;
union { union {
struct { struct {
Uint32 startBackup; Uint32 startBackup;
...@@ -563,7 +564,7 @@ public: ...@@ -563,7 +564,7 @@ public:
void defineBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId); void defineBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId);
void createTrigReply(Signal* signal, BackupRecordPtr ptr); void createTrigReply(Signal* signal, BackupRecordPtr ptr);
void alterTrigReply(Signal* signal, BackupRecordPtr ptr); void alterTrigReply(Signal* signal, BackupRecordPtr ptr);
void startBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32, Uint32); void startBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32);
void stopBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId); void stopBackupReply(Signal* signal, BackupRecordPtr ptr, Uint32 nodeId);
void defineBackupRef(Signal*, BackupRecordPtr, Uint32 errCode = 0); void defineBackupRef(Signal*, BackupRecordPtr, Uint32 errCode = 0);
......
...@@ -25,15 +25,12 @@ BACKUP_REQ ...@@ -25,15 +25,12 @@ BACKUP_REQ
<------------------------------- <-------------------------------
BACKUP_CONF BACKUP_CONF
<---------------- <----------------
CREATE_TRIG
--------------> (If master crashes here -> rouge triggers/memory leak)
<--------------
START_BACKUP START_BACKUP
------------------------------> ------------------------------>
CREATE_TRIG
-------------->
<--------------
<------------------------------ <------------------------------
ALTER_TRIG
-------------->
<--------------
WAIT_GCP WAIT_GCP
--------------> -------------->
<-------------- <--------------
...@@ -46,11 +43,11 @@ BACKUP_CONF ...@@ -46,11 +43,11 @@ BACKUP_CONF
WAIT_GCP WAIT_GCP
--------------> -------------->
<-------------- <--------------
DROP_TRIG
-------------->
<--------------
STOP_BACKUP STOP_BACKUP
------------------------------> ------------------------------>
DROP_TRIG
-------------->
<--------------
<------------------------------ <------------------------------
BACKUP_COMPLETE_REP BACKUP_COMPLETE_REP
<---------------- <----------------
......
...@@ -62,9 +62,6 @@ Backup::Backup(const Configuration & conf) : ...@@ -62,9 +62,6 @@ Backup::Backup(const Configuration & conf) :
addRecSignal(GSN_CREATE_TRIG_REF, &Backup::execCREATE_TRIG_REF); addRecSignal(GSN_CREATE_TRIG_REF, &Backup::execCREATE_TRIG_REF);
addRecSignal(GSN_CREATE_TRIG_CONF, &Backup::execCREATE_TRIG_CONF); addRecSignal(GSN_CREATE_TRIG_CONF, &Backup::execCREATE_TRIG_CONF);
addRecSignal(GSN_ALTER_TRIG_REF, &Backup::execALTER_TRIG_REF);
addRecSignal(GSN_ALTER_TRIG_CONF, &Backup::execALTER_TRIG_CONF);
addRecSignal(GSN_DROP_TRIG_REF, &Backup::execDROP_TRIG_REF); addRecSignal(GSN_DROP_TRIG_REF, &Backup::execDROP_TRIG_REF);
addRecSignal(GSN_DROP_TRIG_CONF, &Backup::execDROP_TRIG_CONF); addRecSignal(GSN_DROP_TRIG_CONF, &Backup::execDROP_TRIG_CONF);
......
...@@ -777,6 +777,10 @@ struct TupTriggerData { ...@@ -777,6 +777,10 @@ struct TupTriggerData {
/** /**
* Trigger id, used by DICT/TRIX to identify the trigger * Trigger id, used by DICT/TRIX to identify the trigger
*
* trigger Ids are unique per block for SUBSCRIPTION triggers.
* This is so that BACKUP can use TUP triggers directly and delete them
* properly.
*/ */
Uint32 triggerId; Uint32 triggerId;
...@@ -2012,7 +2016,9 @@ private: ...@@ -2012,7 +2016,9 @@ private:
bool createTrigger(Tablerec* table, const CreateTrigReq* req); bool createTrigger(Tablerec* table, const CreateTrigReq* req);
Uint32 dropTrigger(Tablerec* table, const DropTrigReq* req); Uint32 dropTrigger(Tablerec* table,
const DropTrigReq* req,
BlockNumber sender);
void void
checkImmediateTriggersAfterInsert(KeyReqStruct *req_struct, checkImmediateTriggersAfterInsert(KeyReqStruct *req_struct,
......
...@@ -186,7 +186,7 @@ Dbtup::execDROP_TRIG_REQ(Signal* signal) ...@@ -186,7 +186,7 @@ Dbtup::execDROP_TRIG_REQ(Signal* signal)
ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec); ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
// Drop trigger // Drop trigger
Uint32 r = dropTrigger(tabPtr.p, req); Uint32 r = dropTrigger(tabPtr.p, req, refToBlock(senderRef));
if (r == 0){ if (r == 0){
// Send conf // Send conf
DropTrigConf* const conf = (DropTrigConf*)signal->getDataPtrSend(); DropTrigConf* const conf = (DropTrigConf*)signal->getDataPtrSend();
...@@ -318,7 +318,7 @@ Dbtup::primaryKey(Tablerec* const regTabPtr, Uint32 attrId) ...@@ -318,7 +318,7 @@ Dbtup::primaryKey(Tablerec* const regTabPtr, Uint32 attrId)
/* */ /* */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
Uint32 Uint32
Dbtup::dropTrigger(Tablerec* table, const DropTrigReq* req) Dbtup::dropTrigger(Tablerec* table, const DropTrigReq* req, BlockNumber sender)
{ {
if (ERROR_INSERTED(4004)) { if (ERROR_INSERTED(4004)) {
CLEAR_ERROR_INSERT_VALUE; CLEAR_ERROR_INSERT_VALUE;
...@@ -330,7 +330,7 @@ Dbtup::dropTrigger(Tablerec* table, const DropTrigReq* req) ...@@ -330,7 +330,7 @@ Dbtup::dropTrigger(Tablerec* table, const DropTrigReq* req)
TriggerActionTime::Value ttime = req->getTriggerActionTime(); TriggerActionTime::Value ttime = req->getTriggerActionTime();
TriggerEvent::Value tevent = req->getTriggerEvent(); TriggerEvent::Value tevent = req->getTriggerEvent();
// ndbout_c("Drop TupTrigger %u = %u %u %u %u", triggerId, table, ttype, ttime, tevent); // ndbout_c("Drop TupTrigger %u = %u %u %u %u by %u", triggerId, table, ttype, ttime, tevent, sender);
ArrayList<TupTriggerData>* tlist = findTriggerList(table, ttype, ttime, tevent); ArrayList<TupTriggerData>* tlist = findTriggerList(table, ttype, ttime, tevent);
ndbrequire(tlist != NULL); ndbrequire(tlist != NULL);
...@@ -339,6 +339,19 @@ Dbtup::dropTrigger(Tablerec* table, const DropTrigReq* req) ...@@ -339,6 +339,19 @@ Dbtup::dropTrigger(Tablerec* table, const DropTrigReq* req)
for (tlist->first(ptr); !ptr.isNull(); tlist->next(ptr)) { for (tlist->first(ptr); !ptr.isNull(); tlist->next(ptr)) {
ljam(); ljam();
if (ptr.p->triggerId == triggerId) { if (ptr.p->triggerId == triggerId) {
if(ttype==TriggerType::SUBSCRIPTION && sender != ptr.p->m_receiverBlock)
{
/**
* You can only drop your own triggers for subscription triggers.
* Trigger IDs are private for each block.
*
* SUMA encodes information in the triggerId
*
* Backup doesn't really care about the Ids though.
*/
ljam();
continue;
}
ljam(); ljam();
tlist->release(ptr.i); tlist->release(ptr.i);
return 0; return 0;
......
...@@ -193,7 +193,7 @@ runDDL(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -193,7 +193,7 @@ runDDL(NDBT_Context* ctx, NDBT_Step* step){
} }
int runRestartInitial(NDBT_Context* ctx, NDBT_Step* step){ int runDropTablesRestart(NDBT_Context* ctx, NDBT_Step* step){
NdbRestarter restarter; NdbRestarter restarter;
Ndb* pNdb = GETNDB(step); Ndb* pNdb = GETNDB(step);
...@@ -201,7 +201,7 @@ int runRestartInitial(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -201,7 +201,7 @@ int runRestartInitial(NDBT_Context* ctx, NDBT_Step* step){
const NdbDictionary::Table *tab = ctx->getTab(); const NdbDictionary::Table *tab = ctx->getTab();
pNdb->getDictionary()->dropTable(tab->getName()); pNdb->getDictionary()->dropTable(tab->getName());
if (restarter.restartAll(true) != 0) if (restarter.restartAll(false) != 0)
return NDBT_FAILED; return NDBT_FAILED;
if (restarter.waitClusterStarted() != 0) if (restarter.waitClusterStarted() != 0)
...@@ -406,6 +406,7 @@ int runRestoreBankAndVerify(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -406,6 +406,7 @@ int runRestoreBankAndVerify(NDBT_Context* ctx, NDBT_Step* step){
// TEMPORARY FIX // TEMPORARY FIX
// To erase all tables from cache(s) // To erase all tables from cache(s)
// To be removed, maybe replaced by ndb.invalidate(); // To be removed, maybe replaced by ndb.invalidate();
runDropTable(ctx,step);
{ {
Bank bank(ctx->m_cluster_connection); Bank bank(ctx->m_cluster_connection);
...@@ -416,8 +417,8 @@ int runRestoreBankAndVerify(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -416,8 +417,8 @@ int runRestoreBankAndVerify(NDBT_Context* ctx, NDBT_Step* step){
} }
// END TEMPORARY FIX // END TEMPORARY FIX
ndbout << "Performing initial restart" << endl; ndbout << "Performing restart" << endl;
if (restarter.restartAll(true) != 0) if (restarter.restartAll(false) != 0)
return NDBT_FAILED; return NDBT_FAILED;
if (restarter.waitClusterStarted() != 0) if (restarter.waitClusterStarted() != 0)
...@@ -465,12 +466,12 @@ TESTCASE("BackupOne", ...@@ -465,12 +466,12 @@ TESTCASE("BackupOne",
"Test that backup and restore works on one table \n" "Test that backup and restore works on one table \n"
"1. Load table\n" "1. Load table\n"
"2. Backup\n" "2. Backup\n"
"3. Restart -i\n" "3. Drop tables and restart \n"
"4. Restore\n" "4. Restore\n"
"5. Verify count and content of table\n"){ "5. Verify count and content of table\n"){
INITIALIZER(runLoadTable); INITIALIZER(runLoadTable);
INITIALIZER(runBackupOne); INITIALIZER(runBackupOne);
INITIALIZER(runRestartInitial); INITIALIZER(runDropTablesRestart);
INITIALIZER(runRestoreOne); INITIALIZER(runRestoreOne);
VERIFIER(runVerifyOne); VERIFIER(runVerifyOne);
FINALIZER(runClearTable); FINALIZER(runClearTable);
......
...@@ -199,7 +199,6 @@ int ...@@ -199,7 +199,6 @@ int
NFDuringBackupM_codes[] = { NFDuringBackupM_codes[] = {
10003, 10003,
10004, 10004,
10005,
10007, 10007,
10008, 10008,
10009, 10009,
...@@ -349,6 +348,7 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz, ...@@ -349,6 +348,7 @@ NdbBackup::NF(NdbRestarter& _restarter, int *NFDuringBackup_codes, const int sz,
int int
FailS_codes[] = { FailS_codes[] = {
10025,
10027, 10027,
10033 10033
}; };
......
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