Commit 4ef4272e authored by pekka@mysql.com's avatar pekka@mysql.com

ndb: small fixes (error codes, debug stuff)

parent 5fe332db
...@@ -104,9 +104,9 @@ public: ...@@ -104,9 +104,9 @@ public:
STATIC_CONST( SignalLength = 2 ); STATIC_CONST( SignalLength = 2 );
enum ErrorCode { enum ErrorCode {
NoError = 0, NoError = 0,
InvalidRequest = 800, InvalidRequest = 903,
NoFreeFragment = 604, NoFreeFragment = 904,
NoFreeAttributes = 827 NoFreeAttributes = 905
}; };
private: private:
Uint32 userPtr; Uint32 userPtr;
...@@ -186,9 +186,9 @@ public: ...@@ -186,9 +186,9 @@ public:
STATIC_CONST( SignalLength = 2 ); STATIC_CONST( SignalLength = 2 );
enum ErrorCode { enum ErrorCode {
NoError = 0, NoError = 0,
InvalidAttributeType = 742, InvalidAttributeType = 906,
InvalidCharset = 743, InvalidCharset = 907,
InvalidNodeSize = 832 InvalidNodeSize = 908
}; };
private: private:
Uint32 userPtr; Uint32 userPtr;
......
...@@ -36,8 +36,8 @@ public: ...@@ -36,8 +36,8 @@ public:
}; };
enum ErrorCode { enum ErrorCode {
NoError = 0, // must be zero NoError = 0, // must be zero
SearchError = 895, // add + found or remove + not found SearchError = 901, // add + found or remove + not found
NoMemError = 827 NoMemError = 902
}; };
STATIC_CONST( SignalLength = 8 ); STATIC_CONST( SignalLength = 8 );
private: private:
......
...@@ -202,7 +202,7 @@ public: ...@@ -202,7 +202,7 @@ public:
// "Error in blob head update forced rollback of transaction" // "Error in blob head update forced rollback of transaction"
STATIC_CONST( ErrAbort = 4268 ); STATIC_CONST( ErrAbort = 4268 );
// "Unknown blob error" // "Unknown blob error"
STATIC_CONST( ErrUnknown = 4269 ); STATIC_CONST( ErrUnknown = 4270 );
/** /**
* Return info about all blobs in this operation. * Return info about all blobs in this operation.
*/ */
......
...@@ -1088,7 +1088,7 @@ void Dbacc::execACCFRAGREQ(Signal* signal) ...@@ -1088,7 +1088,7 @@ void Dbacc::execACCFRAGREQ(Signal* signal)
// config mismatch - do not crash if release compiled // config mismatch - do not crash if release compiled
if (tabptr.i >= ctablesize) { if (tabptr.i >= ctablesize) {
jam(); jam();
addFragRefuse(signal, 800); addFragRefuse(signal, 640);
return; return;
} }
#endif #endif
...@@ -1837,7 +1837,7 @@ Dbacc::xfrmKeyData(Signal* signal) ...@@ -1837,7 +1837,7 @@ Dbacc::xfrmKeyData(Signal* signal)
tabptr.i = fragrecptr.p->myTableId; tabptr.i = fragrecptr.p->myTableId;
ptrCheckGuard(tabptr, ctablesize, tabrec); ptrCheckGuard(tabptr, ctablesize, tabrec);
Uint32 dst[1024]; Uint32 dst[1024 * MAX_XFRM_MULTIPLY];
Uint32 dstSize = (sizeof(dst) >> 2); Uint32 dstSize = (sizeof(dst) >> 2);
Uint32* src = &signal->theData[7]; Uint32* src = &signal->theData[7];
const Uint32 noOfKeyAttr = tabptr.p->noOfKeyAttr; const Uint32 noOfKeyAttr = tabptr.p->noOfKeyAttr;
......
...@@ -1724,7 +1724,7 @@ NdbDictionaryImpl::dropTable(const char * name) ...@@ -1724,7 +1724,7 @@ NdbDictionaryImpl::dropTable(const char * name)
DBUG_PRINT("enter",("name: %s", name)); DBUG_PRINT("enter",("name: %s", name));
NdbTableImpl * tab = getTable(name); NdbTableImpl * tab = getTable(name);
if(tab == 0){ if(tab == 0){
return -1; DBUG_RETURN(-1);
} }
int ret = dropTable(* tab); int ret = dropTable(* tab);
// If table stored in cache is incompatible with the one in the kernel // If table stored in cache is incompatible with the one in the kernel
......
...@@ -69,6 +69,7 @@ static const char* empty_string = ""; ...@@ -69,6 +69,7 @@ static const char* empty_string = "";
* 600 - ACC * 600 - ACC
* 700 - DICT * 700 - DICT
* 800 - TUP * 800 - TUP
* 900 - TUX
* 1200 - LQH * 1200 - LQH
* 1300 - BACKUP * 1300 - BACKUP
* 4000 - API * 4000 - API
...@@ -176,10 +177,13 @@ ErrorBundle ErrorCodes[] = { ...@@ -176,10 +177,13 @@ ErrorBundle ErrorCodes[] = {
{ 623, IS, "623" }, { 623, IS, "623" },
{ 624, IS, "624" }, { 624, IS, "624" },
{ 625, IS, "Out of memory in Ndb Kernel, index part (increase IndexMemory)" }, { 625, IS, "Out of memory in Ndb Kernel, index part (increase IndexMemory)" },
{ 800, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" }, { 640, IS, "Too many hash indexes (should not happen)" },
{ 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, data part (increase DataMemory)" }, { 827, IS, "Out of memory in Ndb Kernel, data part (increase DataMemory)" },
{ 832, IS, "832" }, { 902, IS, "Out of memory in Ndb Kernel, data part (increase DataMemory)" },
{ 903, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" },
{ 904, IS, "Out of fragment records (increase MaxNoOfOrderedIndexes)" },
{ 905, IS, "Out of attribute records (increase MaxNoOfAttributes)" },
/** /**
* TimeoutExpired * TimeoutExpired
...@@ -205,8 +209,8 @@ ErrorBundle ErrorCodes[] = { ...@@ -205,8 +209,8 @@ ErrorBundle ErrorCodes[] = {
* Internal errors * Internal errors
*/ */
{ 892, IE, "Inconsistent hash index. The index needs to be dropped and recreated" }, { 892, IE, "Inconsistent hash index. The index needs to be dropped and recreated" },
{ 895, IE, "Inconsistent ordered index. The index needs to be dropped and recreated" },
{ 896, IE, "Tuple corrupted - wrong checksum or column data in invalid format" }, { 896, IE, "Tuple corrupted - wrong checksum or column data in invalid format" },
{ 901, IE, "Inconsistent ordered index. The index needs to be dropped and recreated" },
{ 202, IE, "202" }, { 202, IE, "202" },
{ 203, IE, "203" }, { 203, IE, "203" },
{ 207, IE, "207" }, { 207, IE, "207" },
...@@ -310,7 +314,6 @@ ErrorBundle ErrorCodes[] = { ...@@ -310,7 +314,6 @@ ErrorBundle ErrorCodes[] = {
{ 739, SE, "Unsupported primary key length" }, { 739, SE, "Unsupported primary key length" },
{ 740, SE, "Nullable primary key not supported" }, { 740, SE, "Nullable primary key not supported" },
{ 741, SE, "Unsupported alter table" }, { 741, SE, "Unsupported alter table" },
{ 742, SE, "Unsupported attribute type in index" },
{ 743, SE, "Unsupported character set in table or index" }, { 743, SE, "Unsupported character set in table or index" },
{ 744, SE, "Character string is invalid for given character set" }, { 744, SE, "Character string is invalid for given character set" },
{ 745, SE, "Distribution key not supported for char attribute (use binary attribute)" }, { 745, SE, "Distribution key not supported for char attribute (use binary attribute)" },
...@@ -319,6 +322,9 @@ ErrorBundle ErrorCodes[] = { ...@@ -319,6 +322,9 @@ ErrorBundle ErrorCodes[] = {
{ 284, SE, "Table not defined in transaction coordinator" }, { 284, SE, "Table not defined in transaction coordinator" },
{ 285, SE, "Unknown table error in transaction coordinator" }, { 285, SE, "Unknown table error in transaction coordinator" },
{ 881, SE, "Unable to create table, out of data pages (increase DataMemory) " }, { 881, SE, "Unable to create table, out of data pages (increase DataMemory) " },
{ 906, SE, "Unsupported attribute type in index" },
{ 907, SE, "Unsupported character set in table or index" },
{ 908, IS, "Invalid ordered index tree node size" },
{ 1225, SE, "Table not defined in local query handler" }, { 1225, SE, "Table not defined in local query handler" },
{ 1226, SE, "Table is being dropped" }, { 1226, SE, "Table is being dropped" },
{ 1228, SE, "Cannot use drop table for drop index" }, { 1228, SE, "Cannot use drop table for drop index" },
...@@ -482,8 +488,8 @@ ErrorBundle ErrorCodes[] = { ...@@ -482,8 +488,8 @@ ErrorBundle ErrorCodes[] = {
{ 4266, AE, "Invalid blob seek position" }, { 4266, AE, "Invalid blob seek position" },
{ 4267, IE, "Corrupted blob value" }, { 4267, IE, "Corrupted blob value" },
{ 4268, IE, "Error in blob head update forced rollback of transaction" }, { 4268, IE, "Error in blob head update forced rollback of transaction" },
{ 4268, IE, "Unknown blob error" },
{ 4269, IE, "No connection to ndb management server" }, { 4269, IE, "No connection to ndb management server" },
{ 4270, IE, "Unknown blob error" },
{ 4335, AE, "Only one autoincrement column allowed per table. Having a table without primary key uses an autoincremented hidden key, i.e. a table without a primary key can not have an autoincremented column" } { 4335, AE, "Only one autoincrement column allowed per table. Having a table without primary key uses an autoincremented hidden key, i.e. a table without a primary key can not have an autoincremented column" }
}; };
......
...@@ -464,7 +464,7 @@ wl1822_main(char scantx) ...@@ -464,7 +464,7 @@ wl1822_main(char scantx)
// run the steps // run the steps
for (unsigned i = 0; i < wl1822_stepcount; i++) { for (unsigned i = 0; i < wl1822_stepcount; i++) {
DBG("step " << i << " start"); DBG("step " << i << " start");
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)
......
...@@ -2143,32 +2143,36 @@ void ha_ndbcluster::print_results() ...@@ -2143,32 +2143,36 @@ void ha_ndbcluster::print_results()
DBUG_ENTER("print_results"); DBUG_ENTER("print_results");
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (!_db_on_) if (!_db_on_)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
for (uint f=0; f<table->fields;f++) for (uint f=0; f<table->fields;f++)
{ {
// Use DBUG_PRINT since DBUG_FILE cannot be filtered out
char buf[2000];
Field *field; Field *field;
const NDBCOL *col; const NDBCOL *col;
NdbValue value; NdbValue value;
NdbBlob *ndb_blob;
buf[0] = 0;
if (!(value= m_value[f]).ptr) if (!(value= m_value[f]).ptr)
{ {
fprintf(DBUG_FILE, "Field %d was not read\n", f); my_snprintf(buf, sizeof(buf), "not read");
continue; goto print_value;
} }
field= table->field[f]; field= table->field[f];
DBUG_DUMP("field->ptr", (char*)field->ptr, field->pack_length()); DBUG_DUMP("field->ptr", (char*)field->ptr, field->pack_length());
col= tab->getColumn(f); col= tab->getColumn(f);
fprintf(DBUG_FILE, "%d: %s\t", f, col->getName());
NdbBlob *ndb_blob= NULL;
if (! (field->flags & BLOB_FLAG)) if (! (field->flags & BLOB_FLAG))
{ {
ndb_blob= NULL;
if (value.rec->isNULL()) if (value.rec->isNULL())
{ {
fprintf(DBUG_FILE, "NULL\n"); my_snprintf(buf, sizeof(buf), "NULL");
continue; goto print_value;
} }
} }
else else
...@@ -2177,124 +2181,124 @@ void ha_ndbcluster::print_results() ...@@ -2177,124 +2181,124 @@ void ha_ndbcluster::print_results()
bool isNull= TRUE; bool isNull= TRUE;
ndb_blob->getNull(isNull); ndb_blob->getNull(isNull);
if (isNull) { if (isNull) {
fprintf(DBUG_FILE, "NULL\n"); my_snprintf(buf, sizeof(buf), "NULL");
continue; goto print_value;
} }
} }
switch (col->getType()) { switch (col->getType()) {
case NdbDictionary::Column::Tinyint: { case NdbDictionary::Column::Tinyint: {
char value= *field->ptr; char value= *field->ptr;
fprintf(DBUG_FILE, "Tinyint\t%d", value); my_snprintf(buf, sizeof(buf), "Tinyint %d", value);
break; break;
} }
case NdbDictionary::Column::Tinyunsigned: { case NdbDictionary::Column::Tinyunsigned: {
unsigned char value= *field->ptr; unsigned char value= *field->ptr;
fprintf(DBUG_FILE, "Tinyunsigned\t%u", value); my_snprintf(buf, sizeof(buf), "Tinyunsigned %u", value);
break; break;
} }
case NdbDictionary::Column::Smallint: { case NdbDictionary::Column::Smallint: {
short value= *field->ptr; short value= *field->ptr;
fprintf(DBUG_FILE, "Smallint\t%d", value); my_snprintf(buf, sizeof(buf), "Smallint %d", value);
break; break;
} }
case NdbDictionary::Column::Smallunsigned: { case NdbDictionary::Column::Smallunsigned: {
unsigned short value= *field->ptr; unsigned short value= *field->ptr;
fprintf(DBUG_FILE, "Smallunsigned\t%u", value); my_snprintf(buf, sizeof(buf), "Smallunsigned %u", value);
break; break;
} }
case NdbDictionary::Column::Mediumint: { case NdbDictionary::Column::Mediumint: {
byte value[3]; byte value[3];
memcpy(value, field->ptr, 3); memcpy(value, field->ptr, 3);
fprintf(DBUG_FILE, "Mediumint\t%d,%d,%d", value[0], value[1], value[2]); my_snprintf(buf, sizeof(buf), "Mediumint %d,%d,%d", value[0], value[1], value[2]);
break; break;
} }
case NdbDictionary::Column::Mediumunsigned: { case NdbDictionary::Column::Mediumunsigned: {
byte value[3]; byte value[3];
memcpy(value, field->ptr, 3); memcpy(value, field->ptr, 3);
fprintf(DBUG_FILE, "Mediumunsigned\t%u,%u,%u", value[0], value[1], value[2]); my_snprintf(buf, sizeof(buf), "Mediumunsigned %u,%u,%u", value[0], value[1], value[2]);
break; break;
} }
case NdbDictionary::Column::Int: { case NdbDictionary::Column::Int: {
fprintf(DBUG_FILE, "Int\t%lld", field->val_int()); my_snprintf(buf, sizeof(buf), "Int %d", value);
break; break;
} }
case NdbDictionary::Column::Unsigned: { case NdbDictionary::Column::Unsigned: {
Uint32 value= (Uint32) *field->ptr; Uint32 value= (Uint32) *field->ptr;
fprintf(DBUG_FILE, "Unsigned\t%u", value); my_snprintf(buf, sizeof(buf), "Unsigned %u", value);
break; break;
} }
case NdbDictionary::Column::Bigint: { case NdbDictionary::Column::Bigint: {
Int64 value= (Int64) *field->ptr; Int64 value= (Int64) *field->ptr;
fprintf(DBUG_FILE, "Bigint\t%lld", value); my_snprintf(buf, sizeof(buf), "Bigint %lld", value);
break; break;
} }
case NdbDictionary::Column::Bigunsigned: { case NdbDictionary::Column::Bigunsigned: {
Uint64 value= (Uint64) *field->ptr; Uint64 value= (Uint64) *field->ptr;
fprintf(DBUG_FILE, "Bigunsigned\t%llu", value); my_snprintf(buf, sizeof(buf), "Bigunsigned %llu", value);
break; break;
} }
case NdbDictionary::Column::Float: { case NdbDictionary::Column::Float: {
float value= (float) *field->ptr; float value= (float) *field->ptr;
fprintf(DBUG_FILE, "Float\t%f", value); my_snprintf(buf, sizeof(buf), "Float %f", (double)value);
break; break;
} }
case NdbDictionary::Column::Double: { case NdbDictionary::Column::Double: {
double value= (double) *field->ptr; double value= (double) *field->ptr;
fprintf(DBUG_FILE, "Double\t%f", value); my_snprintf(buf, sizeof(buf), "Double %f", value);
break; break;
} }
case NdbDictionary::Column::Decimal: { case NdbDictionary::Column::Decimal: {
char *value= field->ptr; char *value= field->ptr;
my_snprintf(buf, sizeof(buf), "Decimal '%-*s'", field->pack_length(), value);
fprintf(DBUG_FILE, "Decimal\t'%-*s'", field->pack_length(), value);
break; break;
} }
case NdbDictionary::Column::Char:{ case NdbDictionary::Column::Char:{
const char *value= (char *) field->ptr; const char *value= (char *) field->ptr;
fprintf(DBUG_FILE, "Char\t'%.*s'", field->pack_length(), value); my_snprintf(buf, sizeof(buf), "Char '%.*s'", field->pack_length(), value);
break; break;
} }
case NdbDictionary::Column::Varchar: case NdbDictionary::Column::Varchar:
case NdbDictionary::Column::Binary: case NdbDictionary::Column::Binary:
case NdbDictionary::Column::Varbinary: { case NdbDictionary::Column::Varbinary: {
const char *value= (char *) field->ptr; const char *value= (char *) field->ptr;
fprintf(DBUG_FILE, "Var\t'%.*s'", field->pack_length(), value); my_snprintf(buf, sizeof(buf), "Var '%.*s'", field->pack_length(), value);
break; break;
} }
case NdbDictionary::Column::Bit: { case NdbDictionary::Column::Bit: {
const char *value= (char *) field->ptr; const char *value= (char *) field->ptr;
fprintf(DBUG_FILE, "Bit\t'%.*s'", field->pack_length(), value); my_snprintf(buf, sizeof(buf), "Bit '%.*s'", field->pack_length(), value);
break; break;
} }
case NdbDictionary::Column::Datetime: { case NdbDictionary::Column::Datetime: {
Uint64 value= (Uint64) *field->ptr; Uint64 value= (Uint64) *field->ptr;
fprintf(DBUG_FILE, "Datetime\t%llu", value); my_snprintf(buf, sizeof(buf), "Datetime %llu", value);
break; break;
} }
case NdbDictionary::Column::Timespec: { case NdbDictionary::Column::Timespec: {
Uint64 value= (Uint64) *field->ptr; Uint64 value= (Uint64) *field->ptr;
fprintf(DBUG_FILE, "Timespec\t%llu", value); my_snprintf(buf, sizeof(buf), "Timespec %llu", value);
break; break;
} }
case NdbDictionary::Column::Blob: { case NdbDictionary::Column::Blob: {
Uint64 len= 0; Uint64 len= 0;
ndb_blob->getLength(len); ndb_blob->getLength(len);
fprintf(DBUG_FILE, "Blob\t[len=%u]", (unsigned)len); my_snprintf(buf, sizeof(buf), "Blob [len=%u]", (unsigned)len);
break; break;
} }
case NdbDictionary::Column::Text: { case NdbDictionary::Column::Text: {
Uint64 len= 0; Uint64 len= 0;
ndb_blob->getLength(len); ndb_blob->getLength(len);
fprintf(DBUG_FILE, "Text\t[len=%u]", (unsigned)len); my_snprintf(buf, sizeof(buf), "Text [len=%u]", (unsigned)len);
break; break;
} }
case NdbDictionary::Column::Undefined: case NdbDictionary::Column::Undefined:
fprintf(DBUG_FILE, "Unknown type: %d", col->getType()); my_snprintf(buf, sizeof(buf), "Unknown type: %d", col->getType());
break; break;
} }
fprintf(DBUG_FILE, "\n");
print_value:
DBUG_PRINT("value", ("%u,%s: %s", f, col->getName(), buf));
} }
#endif #endif
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
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