Commit 48d6d545 authored by pekka@mysql.com's avatar pekka@mysql.com

ndb - post merge 4.1->5.0

parent 850211eb
...@@ -10,7 +10,7 @@ Next DBTC 8035 ...@@ -10,7 +10,7 @@ Next DBTC 8035
Next CMVMI 9000 Next CMVMI 9000
Next BACKUP 10022 Next BACKUP 10022
Next DBUTIL 11002 Next DBUTIL 11002
Next DBTUX 12007 Next DBTUX 12008
Next SUMA 13001 Next SUMA 13001
TESTING NODE FAILURE, ARBITRATION TESTING NODE FAILURE, ARBITRATION
...@@ -443,6 +443,7 @@ Test routing of signals: ...@@ -443,6 +443,7 @@ Test routing of signals:
Ordered index: Ordered index:
-------------- --------------
12007: Make next alloc node fail with no memory error
Dbdict: Dbdict:
------- -------
......
...@@ -184,7 +184,6 @@ ErrorBundle ErrorCodes[] = { ...@@ -184,7 +184,6 @@ ErrorBundle ErrorCodes[] = {
{ 826, IS, "Too many tables and attributes (increase MaxNoOfAttributes or MaxNoOfTables)" }, { 826, IS, "Too many tables and attributes (increase MaxNoOfAttributes or MaxNoOfTables)" },
{ 827, IS, "Out of memory in Ndb Kernel, table data (increase DataMemory)" }, { 827, IS, "Out of memory in Ndb Kernel, table data (increase DataMemory)" },
{ 902, IS, "Out of memory in Ndb Kernel, ordered index data (increase DataMemory)" }, { 902, IS, "Out of memory in Ndb Kernel, ordered index data (increase DataMemory)" },
{ 902, IS, "Out of memory in Ndb Kernel, data part (increase DataMemory)" },
{ 903, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" }, { 903, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" },
{ 904, IS, "Out of fragment records (increase MaxNoOfOrderedIndexes)" }, { 904, IS, "Out of fragment records (increase MaxNoOfOrderedIndexes)" },
{ 905, IS, "Out of attribute records (increase MaxNoOfAttributes)" }, { 905, IS, "Out of attribute records (increase MaxNoOfAttributes)" },
......
...@@ -164,6 +164,16 @@ irandom(unsigned n) ...@@ -164,6 +164,16 @@ irandom(unsigned n)
return i; return i;
} }
static bool
randompct(unsigned pct)
{
if (pct == 0)
return false;
if (pct >= 100)
return true;
return urandom(100) < pct;
}
// log and error macros // log and error macros
static NdbMutex *ndbout_mutex = NULL; static NdbMutex *ndbout_mutex = NULL;
...@@ -1653,36 +1663,6 @@ createindex(Par par) ...@@ -1653,36 +1663,6 @@ createindex(Par par)
// data sets // data sets
static unsigned
urandom(unsigned n)
{
if (n == 0)
return 0;
unsigned i = random() % n;
return i;
}
static int
irandom(unsigned n)
{
if (n == 0)
return 0;
int i = random() % n;
if (random() & 0x1)
i = -i;
return i;
}
static bool
randompct(unsigned pct)
{
if (pct == 0)
return false;
if (pct >= 100)
return true;
return urandom(100) < pct;
}
// Val - typed column value // Val - typed column value
struct Val { struct Val {
...@@ -2659,26 +2639,30 @@ Set::pending(unsigned i, unsigned mask) const ...@@ -2659,26 +2639,30 @@ Set::pending(unsigned i, unsigned mask) const
} }
void void
Set::notpending(unsigned i) Set::notpending(unsigned i, ExecType et)
{ {
assert(m_row[i] != 0); assert(m_row[i] != 0);
Row& row = *m_row[i]; Row& row = *m_row[i];
if (row.m_pending == Row::InsOp) { if (et == Commit) {
row.m_exist = true; if (row.m_pending == Row::InsOp)
} else if (row.m_pending == Row::UpdOp) { row.m_exist = true;
; if (row.m_pending == Row::DelOp)
} else if (row.m_pending == Row::DelOp) { row.m_exist = false;
row.m_exist = false; } else {
if (row.m_pending == Row::InsOp)
row.m_exist = false;
if (row.m_pending == Row::DelOp)
row.m_exist = true;
} }
row.m_pending = Row::NoOp; row.m_pending = Row::NoOp;
} }
void void
Set::notpending(const Lst& lst) Set::notpending(const Lst& lst, ExecType et)
{ {
for (unsigned j = 0; j < lst.m_cnt; j++) { for (unsigned j = 0; j < lst.m_cnt; j++) {
unsigned i = lst.m_arr[j]; unsigned i = lst.m_arr[j];
notpending(i); notpending(i, et);
} }
} }
...@@ -2870,34 +2854,6 @@ Set::putval(unsigned i, bool force, unsigned n) ...@@ -2870,34 +2854,6 @@ Set::putval(unsigned i, bool force, unsigned n)
return 0; return 0;
} }
void
Set::notpending(unsigned i, ExecType et)
{
assert(m_row[i] != 0);
Row& row = *m_row[i];
if (et == Commit) {
if (row.m_pending == Row::InsOp)
row.m_exist = true;
if (row.m_pending == Row::DelOp)
row.m_exist = false;
} else {
if (row.m_pending == Row::InsOp)
row.m_exist = false;
if (row.m_pending == Row::DelOp)
row.m_exist = true;
}
row.m_pending = Row::NoOp;
}
void
Set::notpending(const Lst& lst, ExecType et)
{
for (unsigned j = 0; j < lst.m_cnt; j++) {
unsigned i = lst.m_arr[j];
notpending(i, et);
}
}
int int
Set::verify(Par par, const Set& set2) const Set::verify(Par par, const Set& set2) const
{ {
...@@ -3511,6 +3467,7 @@ hashindexupdate(Par par, const ITab& itab) ...@@ -3511,6 +3467,7 @@ hashindexupdate(Par par, const ITab& itab)
CHK(con.startTransaction() == 0); CHK(con.startTransaction() == 0);
Lst lst; Lst lst;
bool deadlock = false; bool deadlock = false;
bool nospace = false;
for (unsigned j = 0; j < par.m_rows; j++) { for (unsigned j = 0; j < par.m_rows; j++) {
unsigned j2 = ! par.m_randomkey ? j : urandom(par.m_rows); unsigned j2 = ! par.m_randomkey ? j : urandom(par.m_rows);
unsigned i = thrrow(par, j2); unsigned i = thrrow(par, j2);
...@@ -3528,7 +3485,7 @@ hashindexupdate(Par par, const ITab& itab) ...@@ -3528,7 +3485,7 @@ hashindexupdate(Par par, const ITab& itab)
lst.push(i); lst.push(i);
if (lst.cnt() == par.m_batch) { if (lst.cnt() == par.m_batch) {
deadlock = par.m_deadlock; deadlock = par.m_deadlock;
CHK(con.execute(Commit, deadlock) == 0); CHK(con.execute(Commit, deadlock, nospace) == 0);
if (deadlock) { if (deadlock) {
LL1("hashindexupdate: stop on deadlock [at 1]"); LL1("hashindexupdate: stop on deadlock [at 1]");
break; break;
...@@ -3544,9 +3501,9 @@ hashindexupdate(Par par, const ITab& itab) ...@@ -3544,9 +3501,9 @@ hashindexupdate(Par par, const ITab& itab)
} }
if (! deadlock && lst.cnt() != 0) { if (! deadlock && lst.cnt() != 0) {
deadlock = par.m_deadlock; deadlock = par.m_deadlock;
CHK(con.execute(Commit, deadlock) == 0); CHK(con.execute(Commit, deadlock, nospace) == 0);
if (deadlock) { if (deadlock) {
LL1("hashindexupdate: stop on deadlock [at 1]"); LL1("hashindexupdate: stop on deadlock [at 2]");
} else { } else {
set.lock(); set.lock();
set.notpending(lst); set.notpending(lst);
...@@ -3567,6 +3524,7 @@ hashindexdelete(Par par, const ITab& itab) ...@@ -3567,6 +3524,7 @@ hashindexdelete(Par par, const ITab& itab)
CHK(con.startTransaction() == 0); CHK(con.startTransaction() == 0);
Lst lst; Lst lst;
bool deadlock = false; bool deadlock = false;
bool nospace = false;
for (unsigned j = 0; j < par.m_rows; j++) { for (unsigned j = 0; j < par.m_rows; j++) {
unsigned j2 = ! par.m_randomkey ? j : urandom(par.m_rows); unsigned j2 = ! par.m_randomkey ? j : urandom(par.m_rows);
unsigned i = thrrow(par, j2); unsigned i = thrrow(par, j2);
...@@ -3581,7 +3539,7 @@ hashindexdelete(Par par, const ITab& itab) ...@@ -3581,7 +3539,7 @@ hashindexdelete(Par par, const ITab& itab)
lst.push(i); lst.push(i);
if (lst.cnt() == par.m_batch) { if (lst.cnt() == par.m_batch) {
deadlock = par.m_deadlock; deadlock = par.m_deadlock;
CHK(con.execute(Commit, deadlock) == 0); CHK(con.execute(Commit, deadlock, nospace) == 0);
if (deadlock) { if (deadlock) {
LL1("hashindexdelete: stop on deadlock [at 1]"); LL1("hashindexdelete: stop on deadlock [at 1]");
break; break;
...@@ -3596,7 +3554,7 @@ hashindexdelete(Par par, const ITab& itab) ...@@ -3596,7 +3554,7 @@ hashindexdelete(Par par, const ITab& itab)
} }
if (! deadlock && lst.cnt() != 0) { if (! deadlock && lst.cnt() != 0) {
deadlock = par.m_deadlock; deadlock = par.m_deadlock;
CHK(con.execute(Commit, deadlock) == 0); CHK(con.execute(Commit, deadlock, nospace) == 0);
if (deadlock) { if (deadlock) {
LL1("hashindexdelete: stop on deadlock [at 2]"); LL1("hashindexdelete: stop on deadlock [at 2]");
} else { } else {
...@@ -3968,6 +3926,7 @@ scanupdatetable(Par par) ...@@ -3968,6 +3926,7 @@ scanupdatetable(Par par)
CHK(con2.startTransaction() == 0); CHK(con2.startTransaction() == 0);
Lst lst; Lst lst;
bool deadlock = false; bool deadlock = false;
bool nospace = false;
while (1) { while (1) {
int ret; int ret;
deadlock = par.m_deadlock; deadlock = par.m_deadlock;
...@@ -4003,7 +3962,7 @@ scanupdatetable(Par par) ...@@ -4003,7 +3962,7 @@ scanupdatetable(Par par)
set.unlock(); set.unlock();
if (lst.cnt() == par.m_batch) { if (lst.cnt() == par.m_batch) {
deadlock = par.m_deadlock; deadlock = par.m_deadlock;
CHK(con2.execute(Commit, deadlock) == 0); CHK(con2.execute(Commit, deadlock, nospace) == 0);
if (deadlock) { if (deadlock) {
LL1("scanupdatetable: stop on deadlock [at 2]"); LL1("scanupdatetable: stop on deadlock [at 2]");
goto out; goto out;
...@@ -4020,7 +3979,7 @@ scanupdatetable(Par par) ...@@ -4020,7 +3979,7 @@ scanupdatetable(Par par)
CHK((ret = con.nextScanResult(false)) == 0 || ret == 1 || ret == 2); CHK((ret = con.nextScanResult(false)) == 0 || ret == 1 || ret == 2);
if (ret == 2 && lst.cnt() != 0) { if (ret == 2 && lst.cnt() != 0) {
deadlock = par.m_deadlock; deadlock = par.m_deadlock;
CHK(con2.execute(Commit, deadlock) == 0); CHK(con2.execute(Commit, deadlock, nospace) == 0);
if (deadlock) { if (deadlock) {
LL1("scanupdatetable: stop on deadlock [at 3]"); LL1("scanupdatetable: stop on deadlock [at 3]");
goto out; goto out;
...@@ -4067,6 +4026,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset) ...@@ -4067,6 +4026,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset)
CHK(con2.startTransaction() == 0); CHK(con2.startTransaction() == 0);
Lst lst; Lst lst;
bool deadlock = false; bool deadlock = false;
bool nospace = false;
while (1) { while (1) {
int ret; int ret;
deadlock = par.m_deadlock; deadlock = par.m_deadlock;
...@@ -4102,7 +4062,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset) ...@@ -4102,7 +4062,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset)
set.unlock(); set.unlock();
if (lst.cnt() == par.m_batch) { if (lst.cnt() == par.m_batch) {
deadlock = par.m_deadlock; deadlock = par.m_deadlock;
CHK(con2.execute(Commit, deadlock) == 0); CHK(con2.execute(Commit, deadlock, nospace) == 0);
if (deadlock) { if (deadlock) {
LL1("scanupdateindex: stop on deadlock [at 2]"); LL1("scanupdateindex: stop on deadlock [at 2]");
goto out; goto out;
...@@ -4119,7 +4079,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset) ...@@ -4119,7 +4079,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset)
CHK((ret = con.nextScanResult(false)) == 0 || ret == 1 || ret == 2); CHK((ret = con.nextScanResult(false)) == 0 || ret == 1 || ret == 2);
if (ret == 2 && lst.cnt() != 0) { if (ret == 2 && lst.cnt() != 0) {
deadlock = par.m_deadlock; deadlock = par.m_deadlock;
CHK(con2.execute(Commit, deadlock) == 0); CHK(con2.execute(Commit, deadlock, nospace) == 0);
if (deadlock) { if (deadlock) {
LL1("scanupdateindex: stop on deadlock [at 3]"); LL1("scanupdateindex: stop on deadlock [at 3]");
goto out; goto out;
......
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