Commit 2f182b3e authored by unknown's avatar unknown

compile fix for ndbapi test program on irix (variable scope)


ndb/test/include/NDBT_Test.hpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/ScanFunctions.hpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testDataBuffers.cpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testDeadlock.cpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testDict.cpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testIndex.cpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testLcp.cpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testNdbApi.cpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testOIBasic.cpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testReadPerf.cpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testRestartGci.cpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testScanPerf.cpp:
  compile fix for ndbapi test program on irix
ndb/test/ndbapi/testSystemRestart.cpp:
  compile fix for ndbapi test program on irix
parent 70663052
...@@ -392,10 +392,10 @@ C##suitname():NDBT_TestSuite(#suitname){ \ ...@@ -392,10 +392,10 @@ C##suitname():NDBT_TestSuite(#suitname){ \
// Add a number of equal steps to the testcase // Add a number of equal steps to the testcase
#define STEPS(stepfunc, num) \ #define STEPS(stepfunc, num) \
for (int i = 0; i < num; i++){ \ { int i; for (i = 0; i < num; i++){ \
pts = new NDBT_ParallelStep(pt, #stepfunc, stepfunc); \ pts = new NDBT_ParallelStep(pt, #stepfunc, stepfunc); \
pt->addStep(pts);\ pt->addStep(pts);\
} } }
#define VERIFIER(stepfunc) \ #define VERIFIER(stepfunc) \
ptv = new NDBT_Verifier(pt, #stepfunc, stepfunc); \ ptv = new NDBT_Verifier(pt, #stepfunc, stepfunc); \
......
...@@ -286,36 +286,36 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){ ...@@ -286,36 +286,36 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = 0; attr->numAttribs = 0;
attriblist.push_back(attr); attriblist.push_back(attr);
int i;
for(int i = 1; i < pTab->getNoOfColumns(); i++){ for(i = 1; i < pTab->getNoOfColumns(); i++){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = i; attr->numAttribs = i;
for(int a = 0; a<i; a++) for(int a = 0; a<i; a++)
attr->attribs[a] = a; attr->attribs[a] = a;
attriblist.push_back(attr); attriblist.push_back(attr);
} }
for(int i = pTab->getNoOfColumns()-1; i > 0; i--){ for(i = pTab->getNoOfColumns()-1; i > 0; i--){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = i; attr->numAttribs = i;
for(int a = 0; a<i; a++) for(int a = 0; a<i; a++)
attr->attribs[a] = a; attr->attribs[a] = a;
attriblist.push_back(attr); attriblist.push_back(attr);
} }
for(int i = pTab->getNoOfColumns(); i > 0; i--){ for(i = pTab->getNoOfColumns(); i > 0; i--){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = pTab->getNoOfColumns() - i; attr->numAttribs = pTab->getNoOfColumns() - i;
for(int a = 0; a<pTab->getNoOfColumns() - i; a++) for(int a = 0; a<pTab->getNoOfColumns() - i; a++)
attr->attribs[a] = pTab->getNoOfColumns()-a-1; attr->attribs[a] = pTab->getNoOfColumns()-a-1;
attriblist.push_back(attr); attriblist.push_back(attr);
} }
for(int i = 1; i < pTab->getNoOfColumns(); i++){ for(i = 1; i < pTab->getNoOfColumns(); i++){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = pTab->getNoOfColumns() - i; attr->numAttribs = pTab->getNoOfColumns() - i;
for(int a = 0; a<pTab->getNoOfColumns() - i; a++) for(int a = 0; a<pTab->getNoOfColumns() - i; a++)
attr->attribs[a] = pTab->getNoOfColumns()-a-1; attr->attribs[a] = pTab->getNoOfColumns()-a-1;
attriblist.push_back(attr); attriblist.push_back(attr);
} }
for(int i = 1; i < pTab->getNoOfColumns(); i++){ for(i = 1; i < pTab->getNoOfColumns(); i++){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = 2; attr->numAttribs = 2;
for(int a = 0; a<2; a++){ for(int a = 0; a<2; a++){
...@@ -345,11 +345,11 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){ ...@@ -345,11 +345,11 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
attriblist.push_back(attr); attriblist.push_back(attr);
#if 1 #if 1
for(size_t i = 0; i < attriblist.size(); i++){ for(size_t j = 0; j < attriblist.size(); j++){
g_info << attriblist[i]->numAttribs << ": " ; g_info << attriblist[j]->numAttribs << ": " ;
for(int a = 0; a < attriblist[i]->numAttribs; a++) for(int a = 0; a < attriblist[j]->numAttribs; a++)
g_info << attriblist[i]->attribs[a] << ", "; g_info << attriblist[j]->attribs[a] << ", ";
g_info << endl; g_info << endl;
} }
#endif #endif
......
...@@ -123,15 +123,15 @@ chkerror(char const* fmt, ...) ...@@ -123,15 +123,15 @@ chkerror(char const* fmt, ...)
// alignment of addresses and data sizes // alignment of addresses and data sizes
static bool isAligned(unsigned x) static bool isAligned(UintPtr x)
{ {
return ((x & 3) == 0); return ((x & 3) == 0);
} }
static bool isAligned(char* p) static bool isAligned(char* p)
{ {
return isAligned(unsigned(p)); return isAligned(UintPtr(p));
} }
static unsigned toAligned(unsigned x) static unsigned toAligned(UintPtr x)
{ {
while (! isAligned(x)) while (! isAligned(x))
x++; x++;
...@@ -223,10 +223,10 @@ testcase(int flag) ...@@ -223,10 +223,10 @@ testcase(int flag)
noRandom = ! (flag & 8); noRandom = ! (flag & 8);
ndbout << (noRandom ? "simple sizes" : "randomize sizes") << endl; ndbout << (noRandom ? "simple sizes" : "randomize sizes") << endl;
int smax = 0, stot = 0; int smax = 0, stot = 0, i;
if (xverbose) if (xverbose)
ndbout << "- define table " << tab << endl; ndbout << "- define table " << tab << endl;
for (int i = 0; i < attrcnt; i++) { for (i = 0; i < attrcnt; i++) {
col& c = ccol[i]; col& c = ccol[i];
memset(&c, 0, sizeof(c)); memset(&c, 0, sizeof(c));
sprintf(c.aAttrName, "C%d", i); sprintf(c.aAttrName, "C%d", i);
...@@ -266,7 +266,7 @@ testcase(int flag) ...@@ -266,7 +266,7 @@ testcase(int flag)
return ndberror("getNdbSchemaOp"); return ndberror("getNdbSchemaOp");
if (top->createTable(tab) < 0) if (top->createTable(tab) < 0)
return ndberror("createTable"); return ndberror("createTable");
for (int i = 0; i < attrcnt; i++) { for (i = 0; i < attrcnt; i++) {
col& c = ccol[i]; col& c = ccol[i];
if (top->createAttribute( if (top->createAttribute(
c.aAttrName, c.aAttrName,
...@@ -299,7 +299,7 @@ testcase(int flag) ...@@ -299,7 +299,7 @@ testcase(int flag)
return ndberror("getNdbOperation key=%d", key); return ndberror("getNdbOperation key=%d", key);
if (op->deleteTuple() < 0) if (op->deleteTuple() < 0)
return ndberror("deleteTuple key=%d", key); return ndberror("deleteTuple key=%d", key);
for (int i = 0; i < attrcnt; i++) { for (i = 0; i < attrcnt; i++) {
col& c = ccol[i]; col& c = ccol[i];
if (i == 0) { if (i == 0) {
if (op->equal(c.aAttrName, (char*)&key, sizeof(key)) < 0) if (op->equal(c.aAttrName, (char*)&key, sizeof(key)) < 0)
...@@ -329,7 +329,7 @@ testcase(int flag) ...@@ -329,7 +329,7 @@ testcase(int flag)
return ndberror("getNdbOperation key=%d", key); return ndberror("getNdbOperation key=%d", key);
if (op->insertTuple() < 0) if (op->insertTuple() < 0)
return ndberror("insertTuple key=%d", key); return ndberror("insertTuple key=%d", key);
for (int i = 0; i < attrcnt; i++) { for (i = 0; i < attrcnt; i++) {
col& c = ccol[i]; col& c = ccol[i];
if (i == 0) { if (i == 0) {
if (op->equal(c.aAttrName, (char*)&key, sizeof(key)) < 0) if (op->equal(c.aAttrName, (char*)&key, sizeof(key)) < 0)
...@@ -362,7 +362,7 @@ testcase(int flag) ...@@ -362,7 +362,7 @@ testcase(int flag)
return ndberror("getNdbOperation key=%d", key); return ndberror("getNdbOperation key=%d", key);
if (op->readTuple() < 0) if (op->readTuple() < 0)
return ndberror("readTuple key=%d", key); return ndberror("readTuple key=%d", key);
for (int i = 0; i < attrcnt; i++) { for (i = 0; i < attrcnt; i++) {
col& c = ccol[i]; col& c = ccol[i];
if (i == 0) { if (i == 0) {
if (op->equal(c.aAttrName, (char*)&key, sizeof(key)) < 0) if (op->equal(c.aAttrName, (char*)&key, sizeof(key)) < 0)
...@@ -371,7 +371,7 @@ testcase(int flag) ...@@ -371,7 +371,7 @@ testcase(int flag)
if (xverbose) { if (xverbose) {
char tmp[20]; char tmp[20];
if (useBuf) if (useBuf)
sprintf(tmp, "0x%x", int(c.buf + off)); sprintf(tmp, "0x%p", c.buf + off);
else else
strcpy(tmp, "ndbapi"); strcpy(tmp, "ndbapi");
ndbout << "--- column " << i << " addr=" << tmp << endl; ndbout << "--- column " << i << " addr=" << tmp << endl;
...@@ -388,23 +388,24 @@ testcase(int flag) ...@@ -388,23 +388,24 @@ testcase(int flag)
} }
if (con->execute(Commit) != 0) if (con->execute(Commit) != 0)
return ndberror("execute key=%d", key); return ndberror("execute key=%d", key);
for (int i = 0; i < attrcnt; i++) { for (i = 0; i < attrcnt; i++) {
col& c = ccol[i]; col& c = ccol[i];
if (i == 0) { if (i == 0) {
} else if (useBuf) { } else if (useBuf) {
for (int j = 0; j < off; j++) { int j;
for (j = 0; j < off; j++) {
if (c.buf[j] != 'B') { if (c.buf[j] != 'B') {
return chkerror("mismatch before key=%d col=%d pos=%d ok=%02x bad=%02x", return chkerror("mismatch before key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, 'B', c.buf[j]); key, i, j, 'B', c.buf[j]);
} }
} }
for (int j = 0; j < c.aArraySize; j++) { for (j = 0; j < c.aArraySize; j++) {
if (c.buf[j + off] != byteVal(key, i, j)) { if (c.buf[j + off] != byteVal(key, i, j)) {
return chkerror("mismatch key=%d col=%d pos=%d ok=%02x bad=%02x", return chkerror("mismatch key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, byteVal(key, i, j), c.buf[j]); key, i, j, byteVal(key, i, j), c.buf[j]);
} }
} }
for (int j = c.aArraySize + off; j < c.bufsiz; j++) { for (j = c.aArraySize + off; j < c.bufsiz; j++) {
if (c.buf[j] != 'B') { if (c.buf[j] != 'B') {
return chkerror("mismatch after key=%d col=%d pos=%d ok=%02x bad=%02x", return chkerror("mismatch after key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, 'B', c.buf[j]); key, i, j, 'B', c.buf[j]);
...@@ -431,7 +432,8 @@ testcase(int flag) ...@@ -431,7 +432,8 @@ testcase(int flag)
if (xverbose) if (xverbose)
ndbout << "- scan" << endl; ndbout << "- scan" << endl;
char found[MaxOper]; char found[MaxOper];
for (int k = 0; k < opercnt; k++) int k;
for (k = 0; k < opercnt; k++)
found[k] = 0; found[k] = 0;
for (key = 0; key < opercnt; key++) { for (key = 0; key < opercnt; key++) {
int off = makeOff(key); int off = makeOff(key);
...@@ -459,7 +461,7 @@ testcase(int flag) ...@@ -459,7 +461,7 @@ testcase(int flag)
if (op->interpret_exit_ok() < 0) if (op->interpret_exit_ok() < 0)
return ndberror("interpret_exit_ok"); return ndberror("interpret_exit_ok");
} }
for (int i = 0; i < attrcnt; i++) { for (i = 0; i < attrcnt; i++) {
col& c = ccol[i]; col& c = ccol[i];
if (i == 0) { if (i == 0) {
if (op->getValue(c.aAttrName, (char*)&newkey) < 0) if (op->getValue(c.aAttrName, (char*)&newkey) < 0)
...@@ -468,7 +470,7 @@ testcase(int flag) ...@@ -468,7 +470,7 @@ testcase(int flag)
if (xverbose) { if (xverbose) {
char tmp[20]; char tmp[20];
if (useBuf) if (useBuf)
sprintf(tmp, "0x%x", int(c.buf + off)); sprintf(tmp, "0x%p", c.buf + off);
else else
strcpy(tmp, "ndbapi"); strcpy(tmp, "ndbapi");
ndbout << "--- column " << i << " addr=" << tmp << endl; ndbout << "--- column " << i << " addr=" << tmp << endl;
...@@ -489,22 +491,23 @@ testcase(int flag) ...@@ -489,22 +491,23 @@ testcase(int flag)
while ((ret = rs->nextResult()) == 0) { while ((ret = rs->nextResult()) == 0) {
if (key != newkey) if (key != newkey)
return ndberror("unexpected key=%d newkey=%d", key, newkey); return ndberror("unexpected key=%d newkey=%d", key, newkey);
for (int i = 1; i < attrcnt; i++) { for (i = 1; i < attrcnt; i++) {
col& c = ccol[i]; col& c = ccol[i];
if (useBuf) { if (useBuf) {
for (int j = 0; j < off; j++) { int j;
for (j = 0; j < off; j++) {
if (c.buf[j] != 'C') { if (c.buf[j] != 'C') {
return chkerror("mismatch before key=%d col=%d pos=%d ok=%02x bad=%02x", return chkerror("mismatch before key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, 'C', c.buf[j]); key, i, j, 'C', c.buf[j]);
} }
} }
for (int j = 0; j < c.aArraySize; j++) { for (j = 0; j < c.aArraySize; j++) {
if (c.buf[j + off] != byteVal(key, i, j)) { if (c.buf[j + off] != byteVal(key, i, j)) {
return chkerror("mismatch key=%d col=%d pos=%d ok=%02x bad=%02x", return chkerror("mismatch key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, byteVal(key, i, j), c.buf[j]); key, i, j, byteVal(key, i, j), c.buf[j]);
} }
} }
for (int j = c.aArraySize + off; j < c.bufsiz; j++) { for (j = c.aArraySize + off; j < c.bufsiz; j++) {
if (c.buf[j] != 'C') { if (c.buf[j] != 'C') {
return chkerror("mismatch after key=%d col=%d pos=%d ok=%02x bad=%02x", return chkerror("mismatch after key=%d col=%d pos=%d ok=%02x bad=%02x",
key, i, j, 'C', c.buf[j]); key, i, j, 'C', c.buf[j]);
...@@ -533,7 +536,7 @@ testcase(int flag) ...@@ -533,7 +536,7 @@ testcase(int flag)
} }
con = 0; con = 0;
op = 0; op = 0;
for (int k = 0; k < opercnt; k++) for (k = 0; k < opercnt; k++)
if (! found[k]) if (! found[k])
return ndberror("key %d not found", k); return ndberror("key %d not found", k);
ndbout << "scanned " << key << endl; ndbout << "scanned " << key << endl;
...@@ -545,6 +548,7 @@ testcase(int flag) ...@@ -545,6 +548,7 @@ testcase(int flag)
NDB_COMMAND(testDataBuffers, "testDataBuffers", "testDataBuffers", "testDataBuffers", 65535) NDB_COMMAND(testDataBuffers, "testDataBuffers", "testDataBuffers", "testDataBuffers", 65535)
{ {
int i;
ndb_init(); ndb_init();
while (++argv, --argc > 0) { while (++argv, --argc > 0) {
char const* p = argv[0]; char const* p = argv[0];
...@@ -602,7 +606,7 @@ NDB_COMMAND(testDataBuffers, "testDataBuffers", "testDataBuffers", "testDataBuff ...@@ -602,7 +606,7 @@ NDB_COMMAND(testDataBuffers, "testDataBuffers", "testDataBuffers", "testDataBuff
} }
} }
unsigned ok = true; unsigned ok = true;
for (int i = 1; 0 == loopcnt || i <= loopcnt; i++) { for (i = 1; 0 == loopcnt || i <= loopcnt; i++) {
ndbout << "=== loop " << i << " ===" << endl; ndbout << "=== loop " << i << " ===" << endl;
for (int flag = 0; flag < (1<<testbits); flag++) { for (int flag = 0; flag < (1<<testbits); flag++) {
if (testcase(flag) < 0) { if (testcase(flag) < 0) {
......
...@@ -459,7 +459,8 @@ wl1822_main(char scantx) ...@@ -459,7 +459,8 @@ wl1822_main(char scantx)
static const unsigned thrcount = 2; static const unsigned thrcount = 2;
// create threads for tx1 and tx2 // create threads for tx1 and tx2
Thr* thrlist[2]; Thr* thrlist[2];
for (int n = 0; n < thrcount; n++) { int n;
for (n = 0; n < thrcount; n++) {
Thr& thr = *(thrlist[n] = new Thr(1 + n)); Thr& thr = *(thrlist[n] = new Thr(1 + n));
CHK(thr.m_ret == 0); CHK(thr.m_ret == 0);
} }
...@@ -472,7 +473,7 @@ wl1822_main(char scantx) ...@@ -472,7 +473,7 @@ wl1822_main(char scantx)
if (runstep != 0) if (runstep != 0)
thr.start(runstep); thr.start(runstep);
} }
for (int n = 0; n < thrcount; n++) { for (n = 0; n < thrcount; n++) {
Thr& thr = *thrlist[n]; Thr& thr = *thrlist[n];
Runstep runstep = wl1822_step[i][n]; Runstep runstep = wl1822_step[i][n];
if (runstep != 0) if (runstep != 0)
...@@ -480,7 +481,7 @@ wl1822_main(char scantx) ...@@ -480,7 +481,7 @@ wl1822_main(char scantx)
} }
} }
// delete threads // delete threads
for (int n = 0; n < thrcount; n++) { for (n = 0; n < thrcount; n++) {
Thr& thr = *thrlist[n]; Thr& thr = *thrlist[n];
thr.exit(); thr.exit();
thr.join(); thr.join();
......
...@@ -1431,11 +1431,12 @@ int ...@@ -1431,11 +1431,12 @@ int
runTestDictionaryPerf(NDBT_Context* ctx, NDBT_Step* step){ runTestDictionaryPerf(NDBT_Context* ctx, NDBT_Step* step){
Vector<char*> cols; Vector<char*> cols;
Vector<const NdbDictionary::Table*> tabs; Vector<const NdbDictionary::Table*> tabs;
int i;
Ndb* pNdb = GETNDB(step); Ndb* pNdb = GETNDB(step);
const Uint32 count = NDBT_Tables::getNumTables(); const Uint32 count = NDBT_Tables::getNumTables();
for (int i=0; i < count; i++){ for (i=0; i < count; i++){
const NdbDictionary::Table * tab = NDBT_Tables::getTable(i); const NdbDictionary::Table * tab = NDBT_Tables::getTable(i);
pNdb->getDictionary()->createTable(* tab); pNdb->getDictionary()->createTable(* tab);
...@@ -1458,7 +1459,7 @@ runTestDictionaryPerf(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1458,7 +1459,7 @@ runTestDictionaryPerf(NDBT_Context* ctx, NDBT_Step* step){
Uint32 size = cols.size() / 2; Uint32 size = cols.size() / 2;
char ** columns = &cols[0]; char ** columns = &cols[0];
Uint64 start = NdbTick_CurrentMillisecond(); Uint64 start = NdbTick_CurrentMillisecond();
for(int i = 0; i<times; i++){ for(i = 0; i<times; i++){
int j = 2 * (rand() % size); int j = 2 * (rand() % size);
const NdbDictionary::Table* tab = (const NdbDictionary::Table*)tcols[j]; const NdbDictionary::Table* tab = (const NdbDictionary::Table*)tcols[j];
const char * col = tcols[j+1]; const char * col = tcols[j+1];
......
...@@ -58,7 +58,9 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){ ...@@ -58,7 +58,9 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
// Build attrib definitions that describes which attributes to build index // Build attrib definitions that describes which attributes to build index
// Try to build strange combinations, not just "all" or all PK's // Try to build strange combinations, not just "all" or all PK's
for(int i = 1; i <= pTab->getNoOfColumns(); i++){ int i;
for(i = 1; i <= pTab->getNoOfColumns(); i++){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = i; attr->numAttribs = i;
for(int a = 0; a<i; a++) for(int a = 0; a<i; a++)
...@@ -66,7 +68,7 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){ ...@@ -66,7 +68,7 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
attriblist.push_back(attr); attriblist.push_back(attr);
} }
int b = 0; int b = 0;
for(int i = pTab->getNoOfColumns()-1; i > 0; i--){ for(i = pTab->getNoOfColumns()-1; i > 0; i--){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = i; attr->numAttribs = i;
b++; b++;
...@@ -74,21 +76,21 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){ ...@@ -74,21 +76,21 @@ void AttribList::buildAttribList(const NdbDictionary::Table* pTab){
attr->attribs[a] = a+b; attr->attribs[a] = a+b;
attriblist.push_back(attr); attriblist.push_back(attr);
} }
for(int i = pTab->getNoOfColumns(); i > 0; i--){ for(i = pTab->getNoOfColumns(); i > 0; i--){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = pTab->getNoOfColumns() - i; attr->numAttribs = pTab->getNoOfColumns() - i;
for(int a = 0; a<pTab->getNoOfColumns() - i; a++) for(int a = 0; a<pTab->getNoOfColumns() - i; a++)
attr->attribs[a] = pTab->getNoOfColumns()-a-1; attr->attribs[a] = pTab->getNoOfColumns()-a-1;
attriblist.push_back(attr); attriblist.push_back(attr);
} }
for(int i = 1; i < pTab->getNoOfColumns(); i++){ for(i = 1; i < pTab->getNoOfColumns(); i++){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = pTab->getNoOfColumns() - i; attr->numAttribs = pTab->getNoOfColumns() - i;
for(int a = 0; a<pTab->getNoOfColumns() - i; a++) for(int a = 0; a<pTab->getNoOfColumns() - i; a++)
attr->attribs[a] = pTab->getNoOfColumns()-a-1; attr->attribs[a] = pTab->getNoOfColumns()-a-1;
attriblist.push_back(attr); attriblist.push_back(attr);
} }
for(int i = 1; i < pTab->getNoOfColumns(); i++){ for(i = 1; i < pTab->getNoOfColumns(); i++){
attr = new Attrib; attr = new Attrib;
attr->numAttribs = 2; attr->numAttribs = 2;
for(int a = 0; a<2; a++){ for(int a = 0; a<2; a++){
...@@ -226,8 +228,8 @@ int runCreateIndexes(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -226,8 +228,8 @@ int runCreateIndexes(NDBT_Context* ctx, NDBT_Step* step){
while (l < loops && result == NDBT_OK){ while (l < loops && result == NDBT_OK){
unsigned int i;
for (unsigned int i = 0; i < attrList.attriblist.size(); i++){ for (i = 0; i < attrList.attriblist.size(); i++){
// Try to create index // Try to create index
if (create_index(ctx, i, pTab, pNdb, attrList.attriblist[i], logged) == NDBT_FAILED) if (create_index(ctx, i, pTab, pNdb, attrList.attriblist[i], logged) == NDBT_FAILED)
...@@ -235,7 +237,7 @@ int runCreateIndexes(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -235,7 +237,7 @@ int runCreateIndexes(NDBT_Context* ctx, NDBT_Step* step){
} }
// Now drop all indexes that where created // Now drop all indexes that where created
for (unsigned int i = 0; i < attrList.attriblist.size(); i++){ for (i = 0; i < attrList.attriblist.size(); i++){
// Try to drop index // Try to drop index
if (drop_index(i, pNdb, pTab, attrList.attriblist[i]) != NDBT_OK) if (drop_index(i, pNdb, pTab, attrList.attriblist[i]) != NDBT_OK)
...@@ -1083,8 +1085,8 @@ runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1083,8 +1085,8 @@ runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){
else else
pIdx.setType(NdbDictionary::Index::UniqueHashIndex); pIdx.setType(NdbDictionary::Index::UniqueHashIndex);
pIdx.setStoredIndex(logged); pIdx.setStoredIndex(logged);
int c;
for (int c = 0; c< pTab->getNoOfColumns(); c++){ for (c = 0; c< pTab->getNoOfColumns(); c++){
const NdbDictionary::Column * col = pTab->getColumn(c); const NdbDictionary::Column * col = pTab->getColumn(c);
if(col->getPrimaryKey()){ if(col->getPrimaryKey()){
pIdx.addIndexColumn(col->getName()); pIdx.addIndexColumn(col->getName());
...@@ -1093,7 +1095,7 @@ runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1093,7 +1095,7 @@ runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){
} }
int colId = -1; int colId = -1;
for (int c = 0; c< pTab->getNoOfColumns(); c++){ for (c = 0; c< pTab->getNoOfColumns(); c++){
const NdbDictionary::Column * col = pTab->getColumn(c); const NdbDictionary::Column * col = pTab->getColumn(c);
if(col->getNullable()){ if(col->getNullable()){
pIdx.addIndexColumn(col->getName()); pIdx.addIndexColumn(col->getName());
......
...@@ -85,7 +85,8 @@ main(int argc, char ** argv){ ...@@ -85,7 +85,8 @@ main(int argc, char ** argv){
g_info << " where ZLCP_OP_WRITE_RT_BREAK is finished before SAVE_PAGES" g_info << " where ZLCP_OP_WRITE_RT_BREAK is finished before SAVE_PAGES"
<< endl; << endl;
require(!pause_lcp()); require(!pause_lcp());
for(size_t j = 0; j<g_rows; j++){ size_t j;
for(j = 0; j<g_rows; j++){
require(!do_op(j)); require(!do_op(j));
} }
require(!continue_lcp(5900)); require(!continue_lcp(5900));
...@@ -98,7 +99,7 @@ main(int argc, char ** argv){ ...@@ -98,7 +99,7 @@ main(int argc, char ** argv){
<< endl; << endl;
require(!load_table()); require(!load_table());
require(!pause_lcp()); require(!pause_lcp());
for(size_t j = 0; j<g_rows; j++){ for(j = 0; j<g_rows; j++){
require(!do_op(j)); require(!do_op(j));
} }
require(!continue_lcp(5901)); require(!continue_lcp(5901));
...@@ -109,7 +110,7 @@ main(int argc, char ** argv){ ...@@ -109,7 +110,7 @@ main(int argc, char ** argv){
g_info << "Testing pre LCP operations, undo-ed at commit" << endl; g_info << "Testing pre LCP operations, undo-ed at commit" << endl;
require(!load_table()); require(!load_table());
require(!pause_lcp()); require(!pause_lcp());
for(size_t j = 0; j<g_rows; j++){ for(j = 0; j<g_rows; j++){
require(!do_op(j)); require(!do_op(j));
} }
require(!continue_lcp(5902)); require(!continue_lcp(5902));
......
...@@ -88,10 +88,10 @@ int runTestMaxNdb(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -88,10 +88,10 @@ int runTestMaxNdb(NDBT_Context* ctx, NDBT_Step* step){
oldi = i; oldi = i;
for(size_t i = 0; i < ndbVector.size(); i++){ for(size_t j = 0; j < ndbVector.size(); j++){
delete ndbVector[i]; delete ndbVector[j];
if(((i+1) % 250) == 0){ if(((j+1) % 250) == 0){
ndbout << "Deleted " << (Uint64) i << " ndb objects " << endl; ndbout << "Deleted " << (Uint64) j << " ndb objects " << endl;
} }
} }
ndbVector.clear(); ndbVector.clear();
...@@ -178,8 +178,8 @@ int runTestMaxTransaction(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -178,8 +178,8 @@ int runTestMaxTransaction(NDBT_Context* ctx, NDBT_Step* step){
oldi = i; oldi = i;
for(size_t i = 0; i < conVector.size(); i++){ for(size_t j = 0; j < conVector.size(); j++){
pNdb->closeTransaction(conVector[i]); pNdb->closeTransaction(conVector[j]);
} }
conVector.clear(); conVector.clear();
l++; l++;
...@@ -537,8 +537,8 @@ int runTestDeleteNdb(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -537,8 +537,8 @@ int runTestDeleteNdb(NDBT_Context* ctx, NDBT_Step* step){
} }
// Delete the ndb objects // Delete the ndb objects
for(size_t i = 0; i < ndbVector.size(); i++) for(size_t j = 0; j < ndbVector.size(); j++)
delete ndbVector[i]; delete ndbVector[j];
ndbVector.clear(); ndbVector.clear();
l++; l++;
} }
......
...@@ -407,10 +407,11 @@ Col::verify(const void* addr) const ...@@ -407,10 +407,11 @@ Col::verify(const void* addr) const
const unsigned char* p = (const unsigned char*)addr; const unsigned char* p = (const unsigned char*)addr;
unsigned n = (p[0] << 8) | p[1]; unsigned n = (p[0] << 8) | p[1];
assert(n <= m_length); assert(n <= m_length);
for (unsigned i = 0; i < n; i++) { unsigned i;
for (i = 0; i < n; i++) {
assert(p[2 + i] != 0); assert(p[2 + i] != 0);
} }
for (unsigned i = n; i < m_length; i++) { for (i = n; i < m_length; i++) {
assert(p[2 + i] == 0); assert(p[2 + i] == 0);
} }
} }
...@@ -3021,7 +3022,8 @@ runstep(Par par, const char* fname, TFunc func, unsigned mode) ...@@ -3021,7 +3022,8 @@ runstep(Par par, const char* fname, TFunc func, unsigned mode)
{ {
LL2(fname); LL2(fname);
const int threads = (mode & ST ? 1 : par.m_threads); const int threads = (mode & ST ? 1 : par.m_threads);
for (int n = 0; n < threads; n++) { int n;
for (n = 0; n < threads; n++) {
LL4("start " << n); LL4("start " << n);
Thr& thr = *g_thrlist[n]; Thr& thr = *g_thrlist[n];
thr.m_par.m_tab = par.m_tab; thr.m_par.m_tab = par.m_tab;
...@@ -3033,7 +3035,7 @@ runstep(Par par, const char* fname, TFunc func, unsigned mode) ...@@ -3033,7 +3035,7 @@ runstep(Par par, const char* fname, TFunc func, unsigned mode)
thr.start(); thr.start();
} }
unsigned errs = 0; unsigned errs = 0;
for (int n = threads - 1; n >= 0; n--) { for (n = threads - 1; n >= 0; n--) {
LL4("stop " << n); LL4("stop " << n);
Thr& thr = *g_thrlist[n]; Thr& thr = *g_thrlist[n];
thr.stopped(); thr.stopped();
...@@ -3301,10 +3303,11 @@ runtest(Par par) ...@@ -3301,10 +3303,11 @@ runtest(Par par)
CHK(con.connect() == 0); CHK(con.connect() == 0);
par.m_con = &con; par.m_con = &con;
g_thrlist = new Thr* [par.m_threads]; g_thrlist = new Thr* [par.m_threads];
for (unsigned n = 0; n < par.m_threads; n++) { unsigned n;
for (n = 0; n < par.m_threads; n++) {
g_thrlist[n] = 0; g_thrlist[n] = 0;
} }
for (unsigned n = 0; n < par.m_threads; n++) { for (n = 0; n < par.m_threads; n++) {
g_thrlist[n] = new Thr(par, n); g_thrlist[n] = new Thr(par, n);
Thr& thr = *g_thrlist[n]; Thr& thr = *g_thrlist[n];
assert(thr.m_thread != 0); assert(thr.m_thread != 0);
...@@ -3330,11 +3333,11 @@ runtest(Par par) ...@@ -3330,11 +3333,11 @@ runtest(Par par)
} }
} }
} }
for (unsigned n = 0; n < par.m_threads; n++) { for (n = 0; n < par.m_threads; n++) {
Thr& thr = *g_thrlist[n]; Thr& thr = *g_thrlist[n];
thr.exit(); thr.exit();
} }
for (unsigned n = 0; n < par.m_threads; n++) { for (n = 0; n < par.m_threads; n++) {
Thr& thr = *g_thrlist[n]; Thr& thr = *g_thrlist[n];
thr.join(); thr.join();
delete &thr; delete &thr;
......
...@@ -99,7 +99,8 @@ main(int argc, const char** argv){ ...@@ -99,7 +99,8 @@ main(int argc, const char** argv){
{ "verbose", 'v', arg_flag, &verbose, "Print verbose status", "verbose" } { "verbose", 'v', arg_flag, &verbose, "Print verbose status", "verbose" }
}; };
const int num_args = 1 + P_MAX; const int num_args = 1 + P_MAX;
for(int i = 0; i<P_MAX; i++){ int i;
for(i = 0; i<P_MAX; i++){
args[i+1].long_name = g_paramters[i].name; args[i+1].long_name = g_paramters[i].name;
args[i+1].short_name = * g_paramters[i].name; args[i+1].short_name = * g_paramters[i].name;
args[i+1].type = arg_integer; args[i+1].type = arg_integer;
...@@ -127,7 +128,7 @@ main(int argc, const char** argv){ ...@@ -127,7 +128,7 @@ main(int argc, const char** argv){
g_err << "Wait until ready failed" << endl; g_err << "Wait until ready failed" << endl;
goto error; goto error;
} }
for(int i = optind; i<argc; i++){ for(i = optind; i<argc; i++){
const char * T = argv[i]; const char * T = argv[i];
g_info << "Testing " << T << endl; g_info << "Testing " << T << endl;
BaseString::snprintf(g_table, sizeof(g_table), T); BaseString::snprintf(g_table, sizeof(g_table), T);
......
...@@ -132,7 +132,8 @@ int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -132,7 +132,8 @@ int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){
// RULE1: The vector with saved records should have exactly as many // RULE1: The vector with saved records should have exactly as many
// records with lower or same gci as there are in DB // records with lower or same gci as there are in DB
int recordsWithLowerOrSameGci = 0; int recordsWithLowerOrSameGci = 0;
for (unsigned i = 0; i < savedRecords.size(); i++){ unsigned i;
for (i = 0; i < savedRecords.size(); i++){
if (savedRecords[i].m_gci <= restartGCI) if (savedRecords[i].m_gci <= restartGCI)
recordsWithLowerOrSameGci++; recordsWithLowerOrSameGci++;
} }
...@@ -144,7 +145,7 @@ int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -144,7 +145,7 @@ int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){
// RULE2: The records found in db should have same or lower // RULE2: The records found in db should have same or lower
// gci as in the vector // gci as in the vector
for (unsigned i = 0; i < savedRecords.size(); i++){ for (i = 0; i < savedRecords.size(); i++){
CHECK(hugoOps.startTransaction(pNdb) == 0); CHECK(hugoOps.startTransaction(pNdb) == 0);
CHECK(hugoOps.pkReadRecord(pNdb, i) == 0); CHECK(hugoOps.pkReadRecord(pNdb, i) == 0);
if (hugoOps.execute_Commit(pNdb) != 0){ if (hugoOps.execute_Commit(pNdb) != 0){
......
...@@ -80,7 +80,8 @@ main(int argc, const char** argv){ ...@@ -80,7 +80,8 @@ main(int argc, const char** argv){
{ "verbose", 'v', arg_flag, &verbose, "Print verbose status", "verbose" } { "verbose", 'v', arg_flag, &verbose, "Print verbose status", "verbose" }
}; };
const int num_args = 1 + P_MAX; const int num_args = 1 + P_MAX;
for(int i = 0; i<P_MAX; i++){ int i;
for(i = 0; i<P_MAX; i++){
args[i+1].long_name = g_paramters[i].name; args[i+1].long_name = g_paramters[i].name;
args[i+1].short_name = * g_paramters[i].name; args[i+1].short_name = * g_paramters[i].name;
args[i+1].type = arg_integer; args[i+1].type = arg_integer;
...@@ -107,7 +108,7 @@ main(int argc, const char** argv){ ...@@ -107,7 +108,7 @@ main(int argc, const char** argv){
g_err << "Wait until ready failed" << endl; g_err << "Wait until ready failed" << endl;
goto error; goto error;
} }
for(int i = optind; i<argc; i++){ for(i = optind; i<argc; i++){
const char * T = argv[i]; const char * T = argv[i];
g_info << "Testing " << T << endl; g_info << "Testing " << T << endl;
BaseString::snprintf(g_tablename, sizeof(g_tablename), T); BaseString::snprintf(g_tablename, sizeof(g_tablename), T);
......
...@@ -452,7 +452,7 @@ int runSystemRestart3(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -452,7 +452,7 @@ int runSystemRestart3(NDBT_Context* ctx, NDBT_Step* step){
} }
Vector<int> nodeIds; Vector<int> nodeIds;
for(Uint32 i = 0; i<nodeCount; i++) for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i)); nodeIds.push_back(restarter.getDbNodeId(i));
Uint32 currentRestartNodeIndex = 0; Uint32 currentRestartNodeIndex = 0;
...@@ -561,7 +561,7 @@ int runSystemRestart4(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -561,7 +561,7 @@ int runSystemRestart4(NDBT_Context* ctx, NDBT_Step* step){
} }
Vector<int> nodeIds; Vector<int> nodeIds;
for(Uint32 i = 0; i<nodeCount; i++) for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i)); nodeIds.push_back(restarter.getDbNodeId(i));
Uint32 currentRestartNodeIndex = 0; Uint32 currentRestartNodeIndex = 0;
...@@ -691,7 +691,7 @@ int runSystemRestart5(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -691,7 +691,7 @@ int runSystemRestart5(NDBT_Context* ctx, NDBT_Step* step){
} }
Vector<int> nodeIds; Vector<int> nodeIds;
for(Uint32 i = 0; i<nodeCount; i++) for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i)); nodeIds.push_back(restarter.getDbNodeId(i));
Uint32 currentRestartNodeIndex = 0; Uint32 currentRestartNodeIndex = 0;
...@@ -821,7 +821,7 @@ int runSystemRestart6(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -821,7 +821,7 @@ int runSystemRestart6(NDBT_Context* ctx, NDBT_Step* step){
} }
Vector<int> nodeIds; Vector<int> nodeIds;
for(Uint32 i = 0; i<nodeCount; i++) for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i)); nodeIds.push_back(restarter.getDbNodeId(i));
Uint32 currentRestartNodeIndex = 0; Uint32 currentRestartNodeIndex = 0;
...@@ -877,7 +877,7 @@ int runSystemRestart7(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -877,7 +877,7 @@ int runSystemRestart7(NDBT_Context* ctx, NDBT_Step* step){
} }
Vector<int> nodeIds; Vector<int> nodeIds;
for(Uint32 i = 0; i<nodeCount; i++) for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i)); nodeIds.push_back(restarter.getDbNodeId(i));
int a_nodeIds[64]; int a_nodeIds[64];
...@@ -952,7 +952,7 @@ int runSystemRestart8(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -952,7 +952,7 @@ int runSystemRestart8(NDBT_Context* ctx, NDBT_Step* step){
} }
Vector<int> nodeIds; Vector<int> nodeIds;
for(Uint32 i = 0; i<nodeCount; i++) for(i = 0; i<nodeCount; i++)
nodeIds.push_back(restarter.getDbNodeId(i)); nodeIds.push_back(restarter.getDbNodeId(i));
int a_nodeIds[64]; int a_nodeIds[64];
......
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