Commit c0eba6c9 authored by pekka@mysql.com's avatar pekka@mysql.com

NDB dbtux compile fix for sol9x86

parent 7af65592
...@@ -240,7 +240,7 @@ private: ...@@ -240,7 +240,7 @@ private:
struct TreeNode { struct TreeNode {
TupLoc m_link[3]; // link to 0-left child 1-right child 2-parent TupLoc m_link[3]; // link to 0-left child 1-right child 2-parent
unsigned m_side : 2; // we are 0-left child 1-right child 2-root unsigned m_side : 2; // we are 0-left child 1-right child 2-root
int m_balance : 2; // balance -1, 0, +1 unsigned m_balance : 2; // balance -1, 0, +1 plus 1 for Solaris CC
unsigned pad1 : 4; unsigned pad1 : 4;
Uint8 m_occup; // current number of entries Uint8 m_occup; // current number of entries
Uint32 m_nodeScan; // list of scans at this node Uint32 m_nodeScan; // list of scans at this node
...@@ -927,7 +927,7 @@ Dbtux::TreeEnt::cmp(const TreeEnt ent) const ...@@ -927,7 +927,7 @@ Dbtux::TreeEnt::cmp(const TreeEnt ent) const
inline inline
Dbtux::TreeNode::TreeNode() : Dbtux::TreeNode::TreeNode() :
m_side(2), m_side(2),
m_balance(0), m_balance(0 + 1),
pad1(0), pad1(0),
m_occup(0), m_occup(0),
m_nodeScan(RNIL) m_nodeScan(RNIL)
...@@ -1156,7 +1156,7 @@ Dbtux::NodeHandle::getOccup() ...@@ -1156,7 +1156,7 @@ Dbtux::NodeHandle::getOccup()
inline int inline int
Dbtux::NodeHandle::getBalance() Dbtux::NodeHandle::getBalance()
{ {
return m_node->m_balance; return (int)m_node->m_balance - 1;
} }
inline Uint32 inline Uint32
...@@ -1191,7 +1191,7 @@ inline void ...@@ -1191,7 +1191,7 @@ inline void
Dbtux::NodeHandle::setBalance(int b) Dbtux::NodeHandle::setBalance(int b)
{ {
ndbrequire(abs(b) <= 1); ndbrequire(abs(b) <= 1);
m_node->m_balance = b; m_node->m_balance = (unsigned)(b + 1);
} }
inline void inline void
......
...@@ -283,7 +283,7 @@ operator<<(NdbOut& out, const Dbtux::TreeNode& node) ...@@ -283,7 +283,7 @@ operator<<(NdbOut& out, const Dbtux::TreeNode& node)
out << " [up " << node.m_link[2] << "]"; out << " [up " << node.m_link[2] << "]";
out << " [side " << dec << node.m_side << "]"; out << " [side " << dec << node.m_side << "]";
out << " [occup " << dec << node.m_occup << "]"; out << " [occup " << dec << node.m_occup << "]";
out << " [balance " << dec << (int)node.m_balance << "]"; out << " [balance " << dec << (int)node.m_balance - 1 << "]";
out << " [nodeScan " << hex << node.m_nodeScan << "]"; out << " [nodeScan " << hex << node.m_nodeScan << "]";
out << "]"; out << "]";
return out; return out;
......
...@@ -40,18 +40,20 @@ struct Opt { ...@@ -40,18 +40,20 @@ struct Opt {
bool m_core; bool m_core;
const char* m_csname; const char* m_csname;
CHARSET_INFO* m_cs; CHARSET_INFO* m_cs;
int m_die;
bool m_dups; bool m_dups;
NdbDictionary::Object::FragmentType m_fragtype; NdbDictionary::Object::FragmentType m_fragtype;
unsigned m_subsubloop; unsigned m_subsubloop;
const char* m_index; const char* m_index;
unsigned m_loop; unsigned m_loop;
bool m_nologging;
bool m_msglock; bool m_msglock;
bool m_nologging;
bool m_noverify;
unsigned m_pctnull; unsigned m_pctnull;
unsigned m_rows; unsigned m_rows;
unsigned m_samples; unsigned m_samples;
unsigned m_scanrd; unsigned m_scanbat;
unsigned m_scanex; unsigned m_scanpar;
unsigned m_seed; unsigned m_seed;
unsigned m_subloop; unsigned m_subloop;
const char* m_table; const char* m_table;
...@@ -64,22 +66,24 @@ struct Opt { ...@@ -64,22 +66,24 @@ struct Opt {
m_core(false), m_core(false),
m_csname("latin1_bin"), m_csname("latin1_bin"),
m_cs(0), m_cs(0),
m_die(0),
m_dups(false), m_dups(false),
m_fragtype(NdbDictionary::Object::FragUndefined), m_fragtype(NdbDictionary::Object::FragUndefined),
m_subsubloop(4), m_subsubloop(4),
m_index(0), m_index(0),
m_loop(1), m_loop(1),
m_nologging(false),
m_msglock(true), m_msglock(true),
m_nologging(false),
m_noverify(false),
m_pctnull(10), m_pctnull(10),
m_rows(1000), m_rows(1000),
m_samples(0), m_samples(0),
m_scanrd(240), m_scanbat(0),
m_scanex(240), m_scanpar(0),
m_seed(0), m_seed(0),
m_subloop(4), m_subloop(4),
m_table(0), m_table(0),
m_threads(6), // table + 5 indexes m_threads(10),
m_v(1) { m_v(1) {
} }
}; };
...@@ -100,16 +104,18 @@ printhelp() ...@@ -100,16 +104,18 @@ printhelp()
<< " -case abc only given test cases (letters a-z)" << endl << " -case abc only given test cases (letters a-z)" << endl
<< " -core core dump on error [" << d.m_core << "]" << endl << " -core core dump on error [" << d.m_core << "]" << endl
<< " -csname S charset (collation) of non-pk char column [" << d.m_csname << "]" << endl << " -csname S charset (collation) of non-pk char column [" << d.m_csname << "]" << endl
<< " -die nnn exit immediately on NDB error code nnn" << endl
<< " -dups allow duplicate tuples from index scan [" << d.m_dups << "]" << endl << " -dups allow duplicate tuples from index scan [" << d.m_dups << "]" << endl
<< " -fragtype T fragment type single/small/medium/large" << endl << " -fragtype T fragment type single/small/medium/large" << endl
<< " -index xyz only given index numbers (digits 1-9)" << endl << " -index xyz only given index numbers (digits 1-9)" << endl
<< " -loop N loop count full suite 0=forever [" << d.m_loop << "]" << endl << " -loop N loop count full suite 0=forever [" << d.m_loop << "]" << endl
<< " -nologging create tables in no-logging mode" << endl << " -nologging create tables in no-logging mode" << endl
<< " -noverify skip index verifications" << endl
<< " -pctnull N pct NULL values in nullable column [" << d.m_pctnull << "]" << endl << " -pctnull N pct NULL values in nullable column [" << d.m_pctnull << "]" << endl
<< " -rows N rows per thread [" << d.m_rows << "]" << endl << " -rows N rows per thread [" << d.m_rows << "]" << endl
<< " -samples N samples for some timings (0=all) [" << d.m_samples << "]" << endl << " -samples N samples for some timings (0=all) [" << d.m_samples << "]" << endl
<< " -scanrd N scan read parallelism [" << d.m_scanrd << "]" << endl << " -scanbat N scan batch per fragment (ignored by ndb api) [" << d.m_scanbat << "]" << endl
<< " -scanex N scan exclusive parallelism [" << d.m_scanex << "]" << endl << " -scanpar N scan parallelism [" << d.m_scanpar << "]" << endl
<< " -seed N srandom seed 0=loop number[" << d.m_seed << "]" << endl << " -seed N srandom seed 0=loop number[" << d.m_seed << "]" << endl
<< " -subloop N subtest loop count [" << d.m_subloop << "]" << endl << " -subloop N subtest loop count [" << d.m_subloop << "]" << endl
<< " -table xyz only given table numbers (digits 1-9)" << endl << " -table xyz only given table numbers (digits 1-9)" << endl
...@@ -695,8 +701,8 @@ struct Con { ...@@ -695,8 +701,8 @@ struct Con {
int setBound(int num, int type, const void* value); int setBound(int num, int type, const void* value);
int execute(ExecType t); int execute(ExecType t);
int execute(ExecType t, bool& deadlock); int execute(ExecType t, bool& deadlock);
int openScanRead(unsigned parallelism); int openScanRead(unsigned scanbat, unsigned scanpar);
int openScanExclusive(unsigned parallelism); int openScanExclusive(unsigned scanbat, unsigned scanpar);
int executeScan(); int executeScan();
int nextScanResult(bool fetchAllowed); int nextScanResult(bool fetchAllowed);
int nextScanResult(bool fetchAllowed, bool& deadlock); int nextScanResult(bool fetchAllowed, bool& deadlock);
...@@ -822,18 +828,20 @@ Con::execute(ExecType t, bool& deadlock) ...@@ -822,18 +828,20 @@ Con::execute(ExecType t, bool& deadlock)
} }
int int
Con::openScanRead(unsigned parallelism) Con::openScanRead(unsigned scanbat, unsigned scanpar)
{ {
assert(m_tx != 0 && m_op != 0); assert(m_tx != 0 && m_op != 0);
CHKCON((m_resultset = m_scanop->readTuples(parallelism)) != 0, *this); NdbOperation::LockMode lm = NdbOperation::LM_Read;
CHKCON((m_resultset = m_scanop->readTuples(lm, scanbat, scanpar)) != 0, *this);
return 0; return 0;
} }
int int
Con::openScanExclusive(unsigned parallelism) Con::openScanExclusive(unsigned scanbat, unsigned scanpar)
{ {
assert(m_tx != 0 && m_op != 0); assert(m_tx != 0 && m_op != 0);
CHKCON((m_resultset = m_scanop->readTuplesExclusive(parallelism)) != 0, *this); NdbOperation::LockMode lm = NdbOperation::LM_Exclusive;
CHKCON((m_resultset = m_scanop->readTuples(lm, scanbat, scanpar)) != 0, *this);
return 0; return 0;
} }
...@@ -900,27 +908,37 @@ Con::printerror(NdbOut& out) ...@@ -900,27 +908,37 @@ Con::printerror(NdbOut& out)
m_errtype = ErrOther; m_errtype = ErrOther;
unsigned any = 0; unsigned any = 0;
int code; int code;
int die = 0;
if (m_ndb) { if (m_ndb) {
if ((code = m_ndb->getNdbError().code) != 0) { if ((code = m_ndb->getNdbError().code) != 0) {
LL0(++any << " ndb: error " << m_ndb->getNdbError()); LL0(++any << " ndb: error " << m_ndb->getNdbError());
die += (code == g_opt.m_die);
} }
if (m_dic && (code = m_dic->getNdbError().code) != 0) { if (m_dic && (code = m_dic->getNdbError().code) != 0) {
LL0(++any << " dic: error " << m_dic->getNdbError()); LL0(++any << " dic: error " << m_dic->getNdbError());
die += (code == g_opt.m_die);
} }
if (m_tx) { if (m_tx) {
if ((code = m_tx->getNdbError().code) != 0) { if ((code = m_tx->getNdbError().code) != 0) {
LL0(++any << " con: error " << m_tx->getNdbError()); LL0(++any << " con: error " << m_tx->getNdbError());
die += (code == g_opt.m_die);
if (code == 266 || code == 274 || code == 296 || code == 297 || code == 499) if (code == 266 || code == 274 || code == 296 || code == 297 || code == 499)
m_errtype = ErrDeadlock; m_errtype = ErrDeadlock;
} }
if (m_op && m_op->getNdbError().code != 0) { if (m_op && m_op->getNdbError().code != 0) {
LL0(++any << " op : error " << m_op->getNdbError()); LL0(++any << " op : error " << m_op->getNdbError());
die += (code == g_opt.m_die);
} }
} }
} }
if (! any) { if (! any) {
LL0("failed but no NDB error code"); LL0("failed but no NDB error code");
} }
if (die) {
if (g_opt.m_core)
abort();
exit(1);
}
} }
// dictionary operations // dictionary operations
...@@ -2290,7 +2308,7 @@ scanreadtable(Par par) ...@@ -2290,7 +2308,7 @@ scanreadtable(Par par)
Set set2(tab, set.m_rows); Set set2(tab, set.m_rows);
CHK(con.startTransaction() == 0); CHK(con.startTransaction() == 0);
CHK(con.getNdbScanOperation(tab) == 0); CHK(con.getNdbScanOperation(tab) == 0);
CHK(con.openScanRead(par.m_scanrd) == 0); CHK(con.openScanRead(par.m_scanbat, par.m_scanpar) == 0);
set2.getval(par); set2.getval(par);
CHK(con.executeScan() == 0); CHK(con.executeScan() == 0);
while (1) { while (1) {
...@@ -2318,7 +2336,7 @@ scanreadtablefast(Par par, unsigned countcheck) ...@@ -2318,7 +2336,7 @@ scanreadtablefast(Par par, unsigned countcheck)
LL3("scanfast " << tab.m_name); LL3("scanfast " << tab.m_name);
CHK(con.startTransaction() == 0); CHK(con.startTransaction() == 0);
CHK(con.getNdbScanOperation(tab) == 0); CHK(con.getNdbScanOperation(tab) == 0);
CHK(con.openScanRead(par.m_scanrd) == 0); CHK(con.openScanRead(par.m_scanbat, par.m_scanpar) == 0);
// get 1st column // get 1st column
NdbRecAttr* rec; NdbRecAttr* rec;
CHK(con.getValue((Uint32)0, rec) == 0); CHK(con.getValue((Uint32)0, rec) == 0);
...@@ -2350,7 +2368,7 @@ scanreadindex(Par par, const ITab& itab, const BSet& bset) ...@@ -2350,7 +2368,7 @@ scanreadindex(Par par, const ITab& itab, const BSet& bset)
Set set2(tab, set.m_rows); Set set2(tab, set.m_rows);
CHK(con.startTransaction() == 0); CHK(con.startTransaction() == 0);
CHK(con.getNdbScanOperation(itab, tab) == 0); CHK(con.getNdbScanOperation(itab, tab) == 0);
CHK(con.openScanRead(par.m_scanrd) == 0); CHK(con.openScanRead(par.m_scanbat, par.m_scanpar) == 0);
CHK(bset.setbnd(par) == 0); CHK(bset.setbnd(par) == 0);
set2.getval(par); set2.getval(par);
CHK(con.executeScan() == 0); CHK(con.executeScan() == 0);
...@@ -2381,7 +2399,7 @@ scanreadindexfast(Par par, const ITab& itab, const BSet& bset, unsigned countche ...@@ -2381,7 +2399,7 @@ scanreadindexfast(Par par, const ITab& itab, const BSet& bset, unsigned countche
LL4(bset); LL4(bset);
CHK(con.startTransaction() == 0); CHK(con.startTransaction() == 0);
CHK(con.getNdbScanOperation(itab, tab) == 0); CHK(con.getNdbScanOperation(itab, tab) == 0);
CHK(con.openScanRead(par.m_scanrd) == 0); CHK(con.openScanRead(par.m_scanbat, par.m_scanpar) == 0);
CHK(bset.setbnd(par) == 0); CHK(bset.setbnd(par) == 0);
// get 1st column // get 1st column
NdbRecAttr* rec; NdbRecAttr* rec;
...@@ -2500,7 +2518,7 @@ scanupdatetable(Par par) ...@@ -2500,7 +2518,7 @@ scanupdatetable(Par par)
Set set2(tab, set.m_rows); Set set2(tab, set.m_rows);
CHK(con.startTransaction() == 0); CHK(con.startTransaction() == 0);
CHK(con.getNdbScanOperation(tab) == 0); CHK(con.getNdbScanOperation(tab) == 0);
CHK(con.openScanExclusive(par.m_scanex) == 0); CHK(con.openScanExclusive(par.m_scanbat, par.m_scanpar) == 0);
set2.getval(par); set2.getval(par);
CHK(con.executeScan() == 0); CHK(con.executeScan() == 0);
unsigned count = 0; unsigned count = 0;
...@@ -2579,7 +2597,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset) ...@@ -2579,7 +2597,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset)
Set set2(tab, set.m_rows); Set set2(tab, set.m_rows);
CHK(con.startTransaction() == 0); CHK(con.startTransaction() == 0);
CHK(con.getNdbScanOperation(itab, tab) == 0); CHK(con.getNdbScanOperation(itab, tab) == 0);
CHK(con.openScanExclusive(par.m_scanex) == 0); CHK(con.openScanExclusive(par.m_scanbat, par.m_scanpar) == 0);
CHK(bset.setbnd(par) == 0); CHK(bset.setbnd(par) == 0);
set2.getval(par); set2.getval(par);
CHK(con.executeScan() == 0); CHK(con.executeScan() == 0);
...@@ -2685,6 +2703,8 @@ scanupdateall(Par par) ...@@ -2685,6 +2703,8 @@ scanupdateall(Par par)
static int static int
readverify(Par par) readverify(Par par)
{ {
if (par.m_noverify)
return 0;
par.m_verify = true; par.m_verify = true;
CHK(pkread(par) == 0); CHK(pkread(par) == 0);
CHK(scanreadall(par) == 0); CHK(scanreadall(par) == 0);
...@@ -2694,6 +2714,8 @@ readverify(Par par) ...@@ -2694,6 +2714,8 @@ readverify(Par par)
static int static int
readverifyfull(Par par) readverifyfull(Par par)
{ {
if (par.m_noverify)
return 0;
par.m_verify = true; par.m_verify = true;
if (par.m_no == 0) if (par.m_no == 0)
CHK(scanreadtable(par) == 0); CHK(scanreadtable(par) == 0);
...@@ -3342,6 +3364,12 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535) ...@@ -3342,6 +3364,12 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535)
continue; continue;
} }
} }
if (strcmp(arg, "-die") == 0) {
if (++argv, --argc > 0) {
g_opt.m_die = atoi(argv[0]);
continue;
}
}
if (strcmp(arg, "-dups") == 0) { if (strcmp(arg, "-dups") == 0) {
g_opt.m_dups = true; g_opt.m_dups = true;
continue; continue;
...@@ -3382,6 +3410,10 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535) ...@@ -3382,6 +3410,10 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535)
g_opt.m_nologging = true; g_opt.m_nologging = true;
continue; continue;
} }
if (strcmp(arg, "-noverify") == 0) {
g_opt.m_noverify = true;
continue;
}
if (strcmp(arg, "-pctnull") == 0) { if (strcmp(arg, "-pctnull") == 0) {
if (++argv, --argc > 0) { if (++argv, --argc > 0) {
g_opt.m_pctnull = atoi(argv[0]); g_opt.m_pctnull = atoi(argv[0]);
...@@ -3400,15 +3432,15 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535) ...@@ -3400,15 +3432,15 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535)
continue; continue;
} }
} }
if (strcmp(arg, "-scanrd") == 0) { if (strcmp(arg, "-scanbat") == 0) {
if (++argv, --argc > 0) { if (++argv, --argc > 0) {
g_opt.m_scanrd = atoi(argv[0]); g_opt.m_scanbat = atoi(argv[0]);
continue; continue;
} }
} }
if (strcmp(arg, "-scanex") == 0) { if (strcmp(arg, "-scanpar") == 0) {
if (++argv, --argc > 0) { if (++argv, --argc > 0) {
g_opt.m_scanex = atoi(argv[0]); g_opt.m_scanpar = atoi(argv[0]);
continue; continue;
} }
} }
......
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