Commit ae26e002 authored by unknown's avatar unknown

Merge jonas@perch:src/51-work/

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new


storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Auto merged
parents c662fccd de513b18
...@@ -171,7 +171,7 @@ Backup::execREAD_CONFIG_REQ(Signal* signal) ...@@ -171,7 +171,7 @@ Backup::execREAD_CONFIG_REQ(Signal* signal)
c_defaults.m_logBufferSize = szLogBuf; c_defaults.m_logBufferSize = szLogBuf;
c_defaults.m_dataBufferSize = szDataBuf; c_defaults.m_dataBufferSize = szDataBuf;
c_defaults.m_minWriteSize = szWrite; c_defaults.m_minWriteSize = szWrite;
c_defaults.m_maxWriteSize = szWrite; c_defaults.m_maxWriteSize = 256*1024;
c_defaults.m_lcp_buffer_size = szDataBuf; c_defaults.m_lcp_buffer_size = szDataBuf;
......
...@@ -118,7 +118,8 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) ...@@ -118,7 +118,8 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal)
PagePtr page; PagePtr page;
Tuple_header *tuple_ptr= (Tuple_header*) Tuple_header *tuple_ptr= (Tuple_header*)
get_ptr(&page, &regOperPtr.p->m_tuple_location, regTabPtr.p); get_ptr(&page, &regOperPtr.p->m_tuple_location, regTabPtr.p);
Uint32 bits= tuple_ptr->m_header_bits;
if(regOperPtr.p->op_struct.op_type != ZDELETE) if(regOperPtr.p->op_struct.op_type != ZDELETE)
{ {
Tuple_header *copy= (Tuple_header*) Tuple_header *copy= (Tuple_header*)
...@@ -132,7 +133,7 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) ...@@ -132,7 +133,7 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal)
disk_page_abort_prealloc(signal, regFragPtr.p, &key, key.m_page_idx); disk_page_abort_prealloc(signal, regFragPtr.p, &key, key.m_page_idx);
} }
Uint32 bits= tuple_ptr->m_header_bits;
Uint32 copy_bits= copy->m_header_bits; Uint32 copy_bits= copy->m_header_bits;
if(! (bits & Tuple_header::ALLOC)) if(! (bits & Tuple_header::ALLOC))
{ {
...@@ -174,6 +175,15 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) ...@@ -174,6 +175,15 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal)
tuple_ptr->m_header_bits |= Tuple_header::FREED; tuple_ptr->m_header_bits |= Tuple_header::FREED;
} }
} }
else if (regOperPtr.p->is_first_operation() &&
regOperPtr.p->is_last_operation())
{
if (bits & Tuple_header::ALLOC)
{
tuple_ptr->m_header_bits &= ~(Uint32)Tuple_header::ALLOC;
tuple_ptr->m_header_bits |= Tuple_header::FREED;
}
}
if(regOperPtr.p->is_first_operation() && regOperPtr.p->is_last_operation()) if(regOperPtr.p->is_first_operation() && regOperPtr.p->is_last_operation())
{ {
......
...@@ -1053,7 +1053,6 @@ Dbtup::disk_page_abort_prealloc_callback(Signal* signal, ...@@ -1053,7 +1053,6 @@ Dbtup::disk_page_abort_prealloc_callback(Signal* signal,
Ptr<Fragrecord> fragPtr; Ptr<Fragrecord> fragPtr;
getFragmentrec(fragPtr, pagePtr.p->m_fragment_id, tabPtr.p); getFragmentrec(fragPtr, pagePtr.p->m_fragment_id, tabPtr.p);
disk_page_set_dirty(pagePtr);
disk_page_abort_prealloc_callback_1(signal, fragPtr.p, pagePtr, sz); disk_page_abort_prealloc_callback_1(signal, fragPtr.p, pagePtr, sz);
} }
...@@ -1063,6 +1062,9 @@ Dbtup::disk_page_abort_prealloc_callback_1(Signal* signal, ...@@ -1063,6 +1062,9 @@ Dbtup::disk_page_abort_prealloc_callback_1(Signal* signal,
PagePtr pagePtr, PagePtr pagePtr,
Uint32 sz) Uint32 sz)
{ {
jam();
disk_page_set_dirty(pagePtr);
Disk_alloc_info& alloc= fragPtrP->m_disk_alloc_info; Disk_alloc_info& alloc= fragPtrP->m_disk_alloc_info;
Uint32 page_idx = pagePtr.p->list_index; Uint32 page_idx = pagePtr.p->list_index;
Uint32 used = pagePtr.p->uncommitted_used_space; Uint32 used = pagePtr.p->uncommitted_used_space;
...@@ -1075,13 +1077,6 @@ Dbtup::disk_page_abort_prealloc_callback_1(Signal* signal, ...@@ -1075,13 +1077,6 @@ Dbtup::disk_page_abort_prealloc_callback_1(Signal* signal,
ddassert(alloc.calc_page_free_bits(free - used) == old_idx); ddassert(alloc.calc_page_free_bits(free - used) == old_idx);
Uint32 new_idx = alloc.calc_page_free_bits(free - used + sz); Uint32 new_idx = alloc.calc_page_free_bits(free - used + sz);
#ifdef VM_TRACE
Local_key key;
key.m_page_no = pagePtr.p->m_page_no;
key.m_file_no = pagePtr.p->m_file_no;
ndbout << "disk_page_abort_prealloc_callback_1" << key << endl;
#endif
Ptr<Extent_info> extentPtr; Ptr<Extent_info> extentPtr;
c_extent_pool.getPtr(extentPtr, ext); c_extent_pool.getPtr(extentPtr, ext);
if (old_idx != new_idx) if (old_idx != new_idx)
......
...@@ -1408,8 +1408,6 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1408,8 +1408,6 @@ int Dbtup::handleInsertReq(Signal* signal,
} }
req_struct->m_use_rowid = false; req_struct->m_use_rowid = false;
base->m_header_bits &= ~(Uint32)Tuple_header::FREE; base->m_header_bits &= ~(Uint32)Tuple_header::FREE;
base->m_header_bits |= Tuple_header::ALLOC &
(regOperPtr.p->is_first_operation() ? ~0 : 1);
} }
else else
{ {
...@@ -1418,8 +1416,6 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1418,8 +1416,6 @@ int Dbtup::handleInsertReq(Signal* signal,
{ {
ndbout_c("no mem insert but rowid (same)"); ndbout_c("no mem insert but rowid (same)");
base->m_header_bits &= ~(Uint32)Tuple_header::FREE; base->m_header_bits &= ~(Uint32)Tuple_header::FREE;
base->m_header_bits |= Tuple_header::ALLOC &
(regOperPtr.p->is_first_operation() ? ~0 : 1);
} }
else else
{ {
...@@ -1427,6 +1423,9 @@ int Dbtup::handleInsertReq(Signal* signal, ...@@ -1427,6 +1423,9 @@ int Dbtup::handleInsertReq(Signal* signal,
ndbrequire(false); ndbrequire(false);
} }
} }
base->m_header_bits |= Tuple_header::ALLOC &
(regOperPtr.p->is_first_operation() ? ~0 : 1);
if (disk_insert) if (disk_insert)
{ {
...@@ -2888,7 +2887,7 @@ Dbtup::handle_size_change_after_update(KeyReqStruct* req_struct, ...@@ -2888,7 +2887,7 @@ Dbtup::handle_size_change_after_update(KeyReqStruct* req_struct,
if(needed <= alloc) if(needed <= alloc)
{ {
ndbassert(!regOperPtr->is_first_operation()); //ndbassert(!regOperPtr->is_first_operation());
ndbout_c(" no grow"); ndbout_c(" no grow");
return 0; return 0;
} }
......
...@@ -547,9 +547,10 @@ Restore::restore_next(Signal* signal, FilePtr file_ptr) ...@@ -547,9 +547,10 @@ Restore::restore_next(Signal* signal, FilePtr file_ptr)
parse_gcp_entry(signal, file_ptr, data, len); parse_gcp_entry(signal, file_ptr, data, len);
break; break;
case 0x4e444242: // 'NDBB' case 0x4e444242: // 'NDBB'
if(ntohl(* (data+2)) != NDB_VERSION) if (check_file_version(signal, ntohl(* (data+2))) == 0)
parse_error(signal, file_ptr, __LINE__, ntohl(* (data+2))); {
break; break;
}
default: default:
parse_error(signal, file_ptr, __LINE__, ntohl(* data)); parse_error(signal, file_ptr, __LINE__, ntohl(* data));
} }
...@@ -719,7 +720,7 @@ Restore::parse_file_header(Signal* signal, ...@@ -719,7 +720,7 @@ Restore::parse_file_header(Signal* signal,
return; return;
} }
if(ntohl(fh->NdbVersion) != NDB_VERSION) if (check_file_version(signal, ntohl(fh->NdbVersion)))
{ {
parse_error(signal, file_ptr, __LINE__, ntohl(fh->NdbVersion)); parse_error(signal, file_ptr, __LINE__, ntohl(fh->NdbVersion));
return; return;
...@@ -1227,3 +1228,23 @@ operator << (NdbOut& ndbout, const Restore::Column& col) ...@@ -1227,3 +1228,23 @@ operator << (NdbOut& ndbout, const Restore::Column& col)
return ndbout; return ndbout;
} }
int
Restore::check_file_version(Signal* signal, Uint32 file_version)
{
if (file_version < MAKE_VERSION(5,1,6))
{
char buf[255];
char verbuf[255];
getVersionString(file_version, 0, verbuf, sizeof(verbuf));
BaseString::snprintf(buf, sizeof(buf),
"Unsupported version of LCP files found on disk, "
" found: %s", verbuf);
progError(__LINE__,
NDBD_EXIT_SR_RESTARTCONFLICT,
buf);
return -1;
}
return 0;
}
...@@ -140,6 +140,7 @@ private: ...@@ -140,6 +140,7 @@ private:
Uint32 calulate_hash(Uint32 tableId, const Uint32 *src); Uint32 calulate_hash(Uint32 tableId, const Uint32 *src);
void parse_error(Signal*, FilePtr, Uint32 line, Uint32 extra); void parse_error(Signal*, FilePtr, Uint32 line, Uint32 extra);
int check_file_version(Signal*, Uint32 file_version);
public: public:
private: private:
......
...@@ -1041,6 +1041,38 @@ runMassiveRollback3(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1041,6 +1041,38 @@ runMassiveRollback3(NDBT_Context* ctx, NDBT_Step* step){
HugoOperations hugoOps(*ctx->getTab()); HugoOperations hugoOps(*ctx->getTab());
Ndb* pNdb = GETNDB(step); Ndb* pNdb = GETNDB(step);
const Uint32 BATCH = 10;
const Uint32 OPS_TOTAL = 50;
const Uint32 LOOPS = 100;
for(Uint32 loop = 0; loop<LOOPS; loop++)
{
CHECK(hugoOps.startTransaction(pNdb) == 0);
bool ok = true;
for (Uint32 i = 0; i<OPS_TOTAL; i+= BATCH)
{
CHECK(hugoOps.pkInsertRecord(pNdb, i, BATCH, 0) == 0);
if (hugoOps.execute_NoCommit(pNdb) != 0)
{
ok = false;
break;
}
}
hugoOps.execute_Rollback(pNdb);
CHECK(hugoOps.closeTransaction(pNdb) == 0);
}
hugoOps.closeTransaction(pNdb);
return result;
}
int
runMassiveRollback4(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
HugoOperations hugoOps(*ctx->getTab());
Ndb* pNdb = GETNDB(step);
const Uint32 BATCH = 10; const Uint32 BATCH = 10;
const Uint32 OPS_TOTAL = 20; const Uint32 OPS_TOTAL = 20;
const Uint32 LOOPS = 100; const Uint32 LOOPS = 100;
...@@ -1052,6 +1084,12 @@ runMassiveRollback3(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1052,6 +1084,12 @@ runMassiveRollback3(NDBT_Context* ctx, NDBT_Step* step){
for (Uint32 i = 0; i<OPS_TOTAL; i+= BATCH) for (Uint32 i = 0; i<OPS_TOTAL; i+= BATCH)
{ {
CHECK(hugoOps.pkInsertRecord(pNdb, i, BATCH, 0) == 0); CHECK(hugoOps.pkInsertRecord(pNdb, i, BATCH, 0) == 0);
CHECK(hugoOps.pkDeleteRecord(pNdb, i, BATCH) == 0);
if (hugoOps.execute_NoCommit(pNdb) != 0)
{
ok = false;
break;
}
if (hugoOps.execute_NoCommit(pNdb) != 0) if (hugoOps.execute_NoCommit(pNdb) != 0)
{ {
ok = false; ok = false;
...@@ -1399,6 +1437,13 @@ TESTCASE("MassiveRollback3", ...@@ -1399,6 +1437,13 @@ TESTCASE("MassiveRollback3",
STEP(runMassiveRollback3); STEP(runMassiveRollback3);
FINALIZER(runClearTable2); FINALIZER(runClearTable2);
} }
TESTCASE("MassiveRollback4",
"Test rollback of 4096 operations"){
INITIALIZER(runClearTable2);
STEP(runMassiveRollback4);
STEP(runMassiveRollback4);
FINALIZER(runClearTable2);
}
TESTCASE("MassiveTransaction", TESTCASE("MassiveTransaction",
"Test very large insert transaction"){ "Test very large insert transaction"){
INITIALIZER(runLoadTable2); INITIALIZER(runLoadTable2);
......
...@@ -201,15 +201,19 @@ args: -n PkDeleteAsynch ...@@ -201,15 +201,19 @@ args: -n PkDeleteAsynch
max-time: 500 max-time: 500
cmd: testBasic cmd: testBasic
args: -n MassiveRollback T1 T6 T13 D1 D2 args: -n MassiveRollback T1 T7 D1 D2
max-time: 500 max-time: 500
cmd: testBasic cmd: testBasic
args: -n MassiveRollback2 T1 T6 T13 D1 D2 args: -n MassiveRollback2 T1 T7 D1 D2
max-time: 500 max-time: 500
cmd: testBasic cmd: testBasic
args: -n MassiveRollback3 T1 D1 args: -n MassiveRollback3 T1 T7 D1 D2
max-time: 500
cmd: testBasic
args: -n MassiveRollback4 T1 T7 D1 D2
max-time: 500 max-time: 500
cmd: testBasic cmd: testBasic
......
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