Commit 97deac8b authored by unknown's avatar unknown

ndb - testBlobs 'perf test' fix


ndb/test/ndbapi/testBlobs.cpp:
  setValue buffer was not fullsize
parent 2cb45da8
...@@ -1488,13 +1488,16 @@ testperf() ...@@ -1488,13 +1488,16 @@ testperf()
// insert char (one trans) // insert char (one trans)
{ {
DBG("--- insert char ---"); DBG("--- insert char ---");
char b[20];
t1.on(); t1.on();
CHK((g_con = g_ndb->startTransaction()) != 0); CHK((g_con = g_ndb->startTransaction()) != 0);
for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) { for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) {
CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0); CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0);
CHK(g_opr->insertTuple() == 0); CHK(g_opr->insertTuple() == 0);
CHK(g_opr->equal(cA, (char*)&k) == 0); CHK(g_opr->equal(cA, (char*)&k) == 0);
CHK(g_opr->setValue(cB, "b") == 0); memset(b, 0x20, sizeof(b));
b[0] = 'b';
CHK(g_opr->setValue(cB, b) == 0);
CHK(g_con->execute(NoCommit) == 0); CHK(g_con->execute(NoCommit) == 0);
} }
t1.off(g_opt.m_rowsperf); t1.off(g_opt.m_rowsperf);
...@@ -1531,12 +1534,15 @@ testperf() ...@@ -1531,12 +1534,15 @@ testperf()
{ {
DBG("--- insert for read test ---"); DBG("--- insert for read test ---");
unsigned n = 0; unsigned n = 0;
char b[20];
CHK((g_con = g_ndb->startTransaction()) != 0); CHK((g_con = g_ndb->startTransaction()) != 0);
for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) { for (Uint32 k = 0; k < g_opt.m_rowsperf; k++) {
CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0); CHK((g_opr = g_con->getNdbOperation(tab.getName())) != 0);
CHK(g_opr->insertTuple() == 0); CHK(g_opr->insertTuple() == 0);
CHK(g_opr->equal(cA, (char*)&k) == 0); CHK(g_opr->equal(cA, (char*)&k) == 0);
CHK(g_opr->setValue(cB, "b") == 0); memset(b, 0x20, sizeof(b));
b[0] = 'b';
CHK(g_opr->setValue(cB, b) == 0);
CHK((g_bh1 = g_opr->getBlobHandle(cC)) != 0); CHK((g_bh1 = g_opr->getBlobHandle(cC)) != 0);
CHK((g_bh1->setValue("c", 1) == 0)); CHK((g_bh1->setValue("c", 1) == 0));
if (++n == g_opt.m_batch) { if (++n == g_opt.m_batch) {
...@@ -1570,7 +1576,7 @@ testperf() ...@@ -1570,7 +1576,7 @@ testperf()
a = (Uint32)-1; a = (Uint32)-1;
b[0] = 0; b[0] = 0;
CHK(g_con->execute(NoCommit) == 0); CHK(g_con->execute(NoCommit) == 0);
CHK(a == k && strcmp(b, "b") == 0); CHK(a == k && b[0] == 'b');
} }
CHK(g_con->execute(Commit) == 0); CHK(g_con->execute(Commit) == 0);
t1.off(g_opt.m_rowsperf); t1.off(g_opt.m_rowsperf);
...@@ -1596,7 +1602,7 @@ testperf() ...@@ -1596,7 +1602,7 @@ testperf()
CHK(g_con->execute(NoCommit) == 0); CHK(g_con->execute(NoCommit) == 0);
Uint32 m = 20; Uint32 m = 20;
CHK(g_bh1->readData(c, m) == 0); CHK(g_bh1->readData(c, m) == 0);
CHK(a == k && m == 1 && strcmp(c, "c") == 0); CHK(a == k && m == 1 && c[0] == 'c');
} }
CHK(g_con->execute(Commit) == 0); CHK(g_con->execute(Commit) == 0);
t2.off(g_opt.m_rowsperf); t2.off(g_opt.m_rowsperf);
...@@ -1629,7 +1635,7 @@ testperf() ...@@ -1629,7 +1635,7 @@ testperf()
CHK((ret = rs->nextResult(true)) == 0 || ret == 1); CHK((ret = rs->nextResult(true)) == 0 || ret == 1);
if (ret == 1) if (ret == 1)
break; break;
CHK(a < g_opt.m_rowsperf && strcmp(b, "b") == 0); CHK(a < g_opt.m_rowsperf && b[0] == 'b');
n++; n++;
} }
CHK(n == g_opt.m_rowsperf); CHK(n == g_opt.m_rowsperf);
...@@ -1661,7 +1667,7 @@ testperf() ...@@ -1661,7 +1667,7 @@ testperf()
break; break;
Uint32 m = 20; Uint32 m = 20;
CHK(g_bh1->readData(c, m) == 0); CHK(g_bh1->readData(c, m) == 0);
CHK(a < g_opt.m_rowsperf && m == 1 && strcmp(c, "c") == 0); CHK(a < g_opt.m_rowsperf && m == 1 && c[0] == 'c');
n++; n++;
} }
CHK(n == g_opt.m_rowsperf); CHK(n == g_opt.m_rowsperf);
......
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