/* 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; either version 2 of the License, or (at your option) any later version. 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 */ #include #include #include #include #include #include int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){ int records = ctx->getNumRecords(); HugoTransactions hugoTrans(*ctx->getTab()); if (hugoTrans.loadTable(GETNDB(step), records) != 0){ return NDBT_FAILED; } return NDBT_OK; } int runClearTable(NDBT_Context* ctx, NDBT_Step* step){ int records = ctx->getNumRecords(); UtilTransactions utilTrans(*ctx->getTab()); if (utilTrans.clearTable2(GETNDB(step), records) != 0){ return NDBT_FAILED; } return NDBT_OK; } #define CHECK(b) if (!(b)) { \ ndbout << "ERR: "<< step->getName() \ << " failed on line " << __LINE__ << endl; \ result = NDBT_FAILED; \ break; } int runTimeoutTrans(NDBT_Context* ctx, NDBT_Step* step){ int result = NDBT_OK; int loops = ctx->getNumLoops(); NdbConfig conf(GETNDB(step)->getNodeId()+1); unsigned int nodeId = conf.getMasterNodeId(); int stepNo = step->getStepNo(); Uint32 timeoutVal; if (!conf.getProperty(nodeId, NODE_TYPE_DB, CFG_DB_TRANSACTION_INACTIVE_TIMEOUT, &timeoutVal)){ return NDBT_FAILED; } int minSleep = (int)(timeoutVal * 1.5); int maxSleep = timeoutVal * 2; ndbout << "TransactionInactiveTimeout="<getNumLoops(); NdbConfig conf(GETNDB(step)->getNodeId()+1); unsigned int nodeId = conf.getMasterNodeId(); int stepNo = step->getStepNo(); int mul1 = ctx->getProperty("Op1", (Uint32)0); int mul2 = ctx->getProperty("Op2", (Uint32)0); int records = ctx->getNumRecords(); Uint32 timeoutVal; if (!conf.getProperty(nodeId, NODE_TYPE_DB, CFG_DB_TRANSACTION_INACTIVE_TIMEOUT, &timeoutVal)){ return NDBT_FAILED; } int minSleep = (int)(timeoutVal * 1.5); int maxSleep = timeoutVal * 2; HugoOperations hugoOps(*ctx->getTab()); Ndb* pNdb = GETNDB(step); for (int l = 0; l < loops && !ctx->isTestStopped(); l++){ int op1 = 0 + (l + stepNo) * mul1; int op2 = 0 + (l + stepNo) * mul2; op1 = (op1 % 5); op2 = (op2 % 5); ndbout << stepNo << ": TransactionInactiveTimeout="<getNumLoops(); int records = ctx->getNumRecords(); NdbConfig conf(GETNDB(step)->getNodeId()+1); unsigned int nodeId = conf.getMasterNodeId(); int stepNo = step->getStepNo(); Uint32 timeoutVal; if (!conf.getProperty(nodeId, NODE_TYPE_DB, CFG_DB_TRANSACTION_INACTIVE_TIMEOUT, &timeoutVal)){ return NDBT_FAILED; } int maxSleep = (int)(timeoutVal * 0.3); ndbout << "TransactionInactiveTimeout="<