Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1960 05/11/24 00:18:58 jonas@eel.(none) +4 -0
ndb - fix error handling of tupkeyreq
new testcase + added to autotest
storage/ndb/test/run-test/daily-basic-tests.txt
1.37 05/11/24 00:18:53 jonas@eel.(none) +4 -0
Add new testcase to autotest
storage/ndb/test/ndbapi/testBasic.cpp
1.10 05/11/24 00:18:53 jonas@eel.(none) +98 -0
New test case for TUPKEY errors
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
1.29 05/11/24 00:18:53 jonas@eel.(none) +34 -39
Fix lots of error cases
storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp
1.7 05/11/24 00:18:53 jonas@eel.(none) +9 -3
Fix error handling
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jonas
# Host: eel.(none)
# Root: /home/jonas/src/51-ndb
--- 1.36/storage/ndb/test/run-test/daily-basic-tests.txt 2005-11-23 14:45:47 +01:00
+++ 1.37/storage/ndb/test/run-test/daily-basic-tests.txt 2005-11-24 00:18:53 +01:00
@@ -208,6 +208,10 @@
args: -n MassiveRollback2 T1 T6 T13 D1 D2
max-time: 500
+cmd: testBasic
+args: -n TupError
+
+max-time: 500
cmd: testTimeout
args: T1
--- 1.6/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp 2005-11-23 07:57:33 +01:00
+++ 1.7/storage/ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp 2005-11-24 00:18:53 +01:00
@@ -338,9 +338,15 @@
c_lgman->free_log_space(fragPtr.p->m_logfile_group_id,
regOperPtr->m_undo_buffer_space);
}
-
- PagePtr tmp;
- Uint32 *ptr= get_ptr(&tmp, ®OperPtr->m_tuple_location, tabPtr.p);
+
+ Uint32 *ptr = 0;
+ if (!regOperPtr->m_tuple_location.isNull())
+ {
+ PagePtr tmp;
+ ptr= get_ptr(&tmp, ®OperPtr->m_tuple_location, tabPtr.p);
+ }
+
+
removeActiveOpList(regOperPtr, (Tuple_header*)ptr);
initOpConnection(regOperPtr);
send_TUPKEYREF(signal, regOperPtr);
--- 1.28/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp 2005-11-23 14:45:47 +01:00
+++ 1.29/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp 2005-11-24 00:18:53 +01:00
@@ -1264,7 +1264,7 @@
if (ERROR_INSERTED(4015))
{
terrorCode = 1501;
- goto logspace_error;
+ goto log_space_error;
}
res= c_lgman->alloc_log_space(regFragPtr->m_logfile_group_id,
@@ -1272,7 +1272,7 @@
if(unlikely(res))
{
terrorCode= res;
- goto logspace_error;
+ goto log_space_error;
}
}
@@ -1346,7 +1346,7 @@
if (ERROR_INSERTED(4019))
{
terrorCode = ZROWID_ALLOCATED;
- goto rowid_error;
+ goto alloc_rowid_error;
}
if (!varsize)
@@ -1368,7 +1368,7 @@
}
if (unlikely(ptr == 0))
{
- goto rowid_error;
+ goto alloc_rowid_error;
}
}
real_page_id = regOperPtr.p->m_tuple_location.m_page_no;
@@ -1387,7 +1387,6 @@
int ret;
if (ERROR_INSERTED(4020))
{
- terrorCode = ZMEM_NOMEM_ERROR;
goto size_change_error;
}
@@ -1449,49 +1448,45 @@
}
return 0;
-rowid_error:
- ndbrequire(false);
-
-logspace_error:
- ndbrequire(false);
-
-mem_error:
+size_change_error:
+ jam();
+ terrorCode = ZMEM_NOMEM_ERROR;
+ goto disk_prealloc_error;
+
+undo_buffer_error:
+ jam();
terrorCode= ZMEM_NOMEM_ERROR;
- ndbrequire(false);
- goto early_error;
+ regOperPtr.p->m_undo_buffer_space = 0;
+ if (mem_insert)
+ regOperPtr.p->m_tuple_location.setNull();
+ regOperPtr.p->m_copy_tuple_location.setNull();
+ tupkeyErrorLab(signal);
+ return -1;
null_check_error:
- ndbrequire(false);
+ jam();
terrorCode= ZNO_ILLEGAL_NULL_ATTR;
- goto early_error;
+ goto update_error;
-#if 0
-error:
- tupkeyErrorLab(signal);
- return -1;
-#endif
-
-size_change_error:
- ndbrequire(false);
-disk_prealloc_error:
- ndbrequire(false);
-
-update_error:
- ndbrequire(false);
-
-undo_buffer_error:
+mem_error:
+ jam();
terrorCode= ZMEM_NOMEM_ERROR;
-
-alloc_rowid_error:
- ndbrequire(false);
+ goto update_error;
log_space_error:
- regOperPtr.p->op_struct.in_active_list = false;
+ jam();
regOperPtr.p->m_undo_buffer_space = 0;
- ndbrequire(false);
-
-early_error:
- early_tupkey_error(signal);
+alloc_rowid_error:
+ jam();
+update_error:
+ jam();
+ if (mem_insert)
+ {
+ regOperPtr.p->op_struct.in_active_list = false;
+ regOperPtr.p->m_tuple_location.setNull();
+ }
+disk_prealloc_error:
+ tupkeyErrorLab(signal);
return -1;
}
--- 1.9/storage/ndb/test/ndbapi/testBasic.cpp 2005-04-08 02:44:24 +02:00
+++ 1.10/storage/ndb/test/ndbapi/testBasic.cpp 2005-11-24 00:18:53 +01:00
@@ -1034,6 +1034,100 @@
return result;
}
+/**
+ * TUP errors
+ */
+struct TupError
+{
+ enum Bits {
+ TE_VARSIZE = 0x1,
+ TE_MULTI_OP = 0x2,
+ TE_DISK = 0x4,
+ TE_REPLICA = 0x8
+ };
+ int op;
+ int error;
+ int bits;
+};
+
+static
+TupError
+f_tup_errors[] =
+{
+ { NdbOperation::InsertRequest, 4014, 0 }, // Out of undo buffer
+ { NdbOperation::InsertRequest, 4015, TupError::TE_DISK }, // Out of log space
+ { NdbOperation::InsertRequest, 4016, 0 }, // AI Inconsistency
+ { NdbOperation::InsertRequest, 4017, 0 }, // Out of memory
+ { NdbOperation::InsertRequest, 4018, 0 }, // Null check error
+ { NdbOperation::InsertRequest, 4019, TupError::TE_REPLICA }, //Alloc rowid error
+ { NdbOperation::InsertRequest, 4020, TupError::TE_MULTI_OP }, // Size change error
+ { NdbOperation::InsertRequest, 4021, TupError::TE_DISK }, // Out of disk space
+ { -1, 0, 0 }
+};
+
+int
+runTupErrors(NDBT_Context* ctx, NDBT_Step* step){
+
+ NdbRestarter restarter;
+ HugoTransactions hugoTrans(*ctx->getTab());
+ HugoOperations hugoOps(*ctx->getTab());
+ Ndb* pNdb = GETNDB(step);
+
+ const NdbDictionary::Table * tab = ctx->getTab();
+ Uint32 i;
+ int bits = TupError::TE_MULTI_OP;
+ for(i = 0; i<tab->getNoOfColumns(); i++)
+ {
+ if (tab->getColumn(i)->getArrayType() != NdbDictionary::Column::ArrayTypeFixed)
+ bits |= TupError::TE_VARSIZE;
+ if (tab->getColumn(i)->getStorageType()!= NdbDictionary::Column::StorageTypeMemory)
+ bits |= TupError::TE_DISK;
+ }
+
+ if (restarter.getNumDbNodes() >= 2)
+ {
+ bits |= TupError::TE_REPLICA;
+ }
+
+ /**
+ * Insert
+ */
+ for(i = 0; f_tup_errors[i].op != -1; i++)
+ {
+ if (f_tup_errors[i].op != NdbOperation::InsertRequest)
+ {
+ g_info << "Skipping " << f_tup_errors[i].error
+ << " - not insert" << endl;
+ continue;
+ }
+
+ if ((f_tup_errors[i].bits & bits) != f_tup_errors[i].bits)
+ {
+ g_info << "Skipping " << f_tup_errors[i].error
+ << " - req bits: " << hex << f_tup_errors[i].bits
+ << " bits: " << hex << bits << endl;
+ continue;
+ }
+
+ g_info << "Testing error insert: " << f_tup_errors[i].error << endl;
+ restarter.insertErrorInAllNodes(f_tup_errors[i].error);
+ if (f_tup_errors[i].bits & TupError::TE_MULTI_OP)
+ {
+
+ }
+ else
+ {
+ hugoTrans.loadTable(pNdb, 5);
+ }
+ restarter.insertErrorInAllNodes(0);
+ if (hugoTrans.clearTable(pNdb, 5) != 0)
+ {
+ return NDBT_FAILED;
+ }
+ }
+
+ return NDBT_OK;
+}
NDBT_TESTSUITE(testBasic);
TESTCASE("PkInsert",
@@ -1276,6 +1370,10 @@
INITIALIZER(runFillTable);
INITIALIZER(runPkRead);
FINALIZER(runClearTable2);
+}
+TESTCASE("TupError",
+ "Verify what happens when we fill the db" ){
+ INITIALIZER(runTupErrors);
}
NDBT_TESTSUITE_END(testBasic);
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.1960) | jonas | 24 Nov |