Commit 8029838f authored by unknown's avatar unknown

Merge perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb

into  perch.ndb.mysql.com:/home/jonas/src/51-work


storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Auto merged
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
  Auto merged
storage/ndb/test/include/HugoTransactions.hpp:
  Auto merged
storage/ndb/test/src/HugoTransactions.cpp:
  Auto merged
parents d0baba61 785de403
...@@ -8529,11 +8529,20 @@ void Dbdih::openingTableErrorLab(Signal* signal, FileRecordPtr filePtr) ...@@ -8529,11 +8529,20 @@ void Dbdih::openingTableErrorLab(Signal* signal, FileRecordPtr filePtr)
/* WE FAILED IN OPENING A FILE. IF THE FIRST FILE THEN TRY WITH THE */ /* WE FAILED IN OPENING A FILE. IF THE FIRST FILE THEN TRY WITH THE */
/* DUPLICATE FILE, OTHERWISE WE REPORT AN ERROR IN THE SYSTEM RESTART. */ /* DUPLICATE FILE, OTHERWISE WE REPORT AN ERROR IN THE SYSTEM RESTART. */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ndbrequire(filePtr.i == tabPtr.p->tabFile[0]); if (filePtr.i == tabPtr.p->tabFile[0])
filePtr.i = tabPtr.p->tabFile[1]; {
ptrCheckGuard(filePtr, cfileFileSize, fileRecord); filePtr.i = tabPtr.p->tabFile[1];
openFileRw(signal, filePtr); ptrCheckGuard(filePtr, cfileFileSize, fileRecord);
filePtr.p->reqStatus = FileRecord::OPENING_TABLE; openFileRw(signal, filePtr);
filePtr.p->reqStatus = FileRecord::OPENING_TABLE;
}
else
{
char buf[256];
BaseString::snprintf(buf, "Error opening DIH schema files for table: %d",
tabPtr.i);
progError(__LINE__, NDBD_EXIT_AFS_NO_SUCH_FILE, buf);
}
}//Dbdih::openingTableErrorLab() }//Dbdih::openingTableErrorLab()
void Dbdih::readingTableLab(Signal* signal, FileRecordPtr filePtr) void Dbdih::readingTableLab(Signal* signal, FileRecordPtr filePtr)
......
...@@ -12789,19 +12789,17 @@ void Dblqh::lastWriteInFileLab(Signal* signal) ...@@ -12789,19 +12789,17 @@ void Dblqh::lastWriteInFileLab(Signal* signal)
void Dblqh::writePageZeroLab(Signal* signal) void Dblqh::writePageZeroLab(Signal* signal)
{ {
if (false && logPartPtr.p->logPartState == LogPartRecord::FILE_CHANGE_PROBLEM) if (logPartPtr.p->logPartState == LogPartRecord::FILE_CHANGE_PROBLEM)
{ {
if (logPartPtr.p->firstLogQueue == RNIL) if (logPartPtr.p->firstLogQueue == RNIL)
{ {
jam(); jam();
logPartPtr.p->logPartState = LogPartRecord::IDLE; logPartPtr.p->logPartState = LogPartRecord::IDLE;
ndbout_c("resetting logPartState to IDLE");
} }
else else
{ {
jam(); jam();
logPartPtr.p->logPartState = LogPartRecord::ACTIVE; logPartPtr.p->logPartState = LogPartRecord::ACTIVE;
ndbout_c("resetting logPartState to ACTIVE");
} }
} }
......
This diff is collapsed.
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef DYNARR256_HPP
#define DYNARR256_HPP
#include "Pool.hpp"
class DynArr256;
struct DA256Page;
class DynArr256Pool
{
friend class DynArr256;
public:
DynArr256Pool();
void init(Uint32 type_id, const Pool_context& pc);
protected:
Uint32 m_type_id;
Uint32 m_first_free;
Pool_context m_ctx;
struct DA256Page* m_memroot;
private:
Uint32 seize();
void release(Uint32);
};
class DynArr256
{
public:
struct Head
{
Head() { m_ptr_i = RNIL; m_sz = 0;}
Uint32 m_ptr_i;
Uint32 m_sz;
};
DynArr256(DynArr256Pool & pool, Head& head) :
m_head(head), m_pool(pool){}
Uint32* set(Uint32 pos);
Uint32* get(Uint32 pos) const ;
struct ReleaseIterator
{
Uint32 m_sz;
Uint32 m_pos;
Uint32 m_ptr_i[4];
};
void init(ReleaseIterator&);
bool release(ReleaseIterator&);
protected:
Head & m_head;
DynArr256Pool & m_pool;
bool expand(Uint32 pos);
void handle_invalid_ptr(Uint32 pos, Uint32 ptrI, Uint32 p0);
};
#endif
...@@ -20,7 +20,8 @@ libkernel_a_SOURCES = \ ...@@ -20,7 +20,8 @@ libkernel_a_SOURCES = \
Mutex.cpp SafeCounter.cpp \ Mutex.cpp SafeCounter.cpp \
Rope.cpp \ Rope.cpp \
ndbd_malloc.cpp ndbd_malloc_impl.cpp \ ndbd_malloc.cpp ndbd_malloc_impl.cpp \
Pool.cpp WOPool.cpp RWPool.cpp Pool.cpp WOPool.cpp RWPool.cpp \
DynArr256.cpp
INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/src/mgmapi INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/src/mgmapi
...@@ -44,7 +45,7 @@ libkernel.dsp: Makefile \ ...@@ -44,7 +45,7 @@ libkernel.dsp: Makefile \
@$(top_srcdir)/storage/ndb/config/win-sources $@ $(libkernel_a_SOURCES) @$(top_srcdir)/storage/ndb/config/win-sources $@ $(libkernel_a_SOURCES)
@$(top_srcdir)/storage/ndb/config/win-libraries $@ LIB $(LDADD) @$(top_srcdir)/storage/ndb/config/win-libraries $@ LIB $(LDADD)
EXTRA_PROGRAMS = ndbd_malloc_impl_test bench_pool EXTRA_PROGRAMS = ndbd_malloc_impl_test bench_pool testDynArr256
ndbd_malloc_impl_test_CXXFLAGS = -DUNIT_TEST ndbd_malloc_impl_test_CXXFLAGS = -DUNIT_TEST
ndbd_malloc_impl_test_SOURCES = ndbd_malloc_impl.cpp ndbd_malloc_impl_test_SOURCES = ndbd_malloc_impl.cpp
ndbd_malloc_impl_test_LDFLAGS = @ndb_bin_am_ldflags@ \ ndbd_malloc_impl_test_LDFLAGS = @ndb_bin_am_ldflags@ \
...@@ -54,9 +55,19 @@ ndbd_malloc_impl_test_LDFLAGS = @ndb_bin_am_ldflags@ \ ...@@ -54,9 +55,19 @@ ndbd_malloc_impl_test_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/strings/libmystrings.a $(top_builddir)/strings/libmystrings.a
bench_pool_SOURCES = bench_pool.cpp bench_pool_SOURCES = bench_pool.cpp
bench_pool_LDFLAGS = @ndb_bin_am_ldflags@ ../SimBlockList.o \ bench_pool_LDFLAGS = @ndb_bin_am_ldflags@\
libkernel.a ../error/liberror.a \ libkernel.a ../error/liberror.a \
$(top_builddir)/storage/ndb/src/libndbclient.la \ $(top_builddir)/storage/ndb/src/libndbclient.la \
$(top_builddir)/mysys/libmysys.a \ $(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \ $(top_builddir)/dbug/libdbug.a \
$(top_builddir)/strings/libmystrings.a $(top_builddir)/strings/libmystrings.a
testDynArr256_CXXFLAGS = -DUNIT_TEST
testDynArr256_SOURCES = DynArr256.cpp
testDynArr256_LDFLAGS = @ndb_bin_am_ldflags@ \
libkernel.a ../error/liberror.a \
$(top_builddir)/storage/ndb/src/libndbclient.la \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/strings/libmystrings.a
...@@ -60,7 +60,7 @@ Uint32 sizes = 7; ...@@ -60,7 +60,7 @@ Uint32 sizes = 7;
unsigned int seed; unsigned int seed;
Ndbd_mem_manager mm; Ndbd_mem_manager mm;
Configuration cfg; Configuration cfg;
Block_context ctx = { cfg, mm }; Block_context ctx(cfg, mm);
struct BB : public SimulatedBlock struct BB : public SimulatedBlock
{ {
BB(int no, Block_context& ctx) : SimulatedBlock(no, ctx) {} BB(int no, Block_context& ctx) : SimulatedBlock(no, ctx) {}
...@@ -548,6 +548,8 @@ main(int argc, char **argv) ...@@ -548,6 +548,8 @@ main(int argc, char **argv)
} }
Uint32 g_currentStartPhase; Uint32 g_currentStartPhase;
Uint32 g_start_type;
NdbNodeBitmask g_nowait_nodes;
void childExit(int code, Uint32 currentStartPhase) void childExit(int code, Uint32 currentStartPhase)
{ {
......
...@@ -34,7 +34,8 @@ public: ...@@ -34,7 +34,8 @@ public:
bool allowConstraintViolation = true, bool allowConstraintViolation = true,
int doSleep = 0, int doSleep = 0,
bool oneTrans = false, bool oneTrans = false,
int updateValue = 0); int updateValue = 0,
bool abort = false);
int scanReadRecords(Ndb*, int scanReadRecords(Ndb*,
int records, int records,
......
...@@ -519,7 +519,8 @@ HugoTransactions::loadTable(Ndb* pNdb, ...@@ -519,7 +519,8 @@ HugoTransactions::loadTable(Ndb* pNdb,
bool allowConstraintViolation, bool allowConstraintViolation,
int doSleep, int doSleep,
bool oneTrans, bool oneTrans,
int value){ int value,
bool abort){
int check, a; int check, a;
int retryAttempt = 0; int retryAttempt = 0;
int retryMax = 5; int retryMax = 5;
...@@ -585,10 +586,22 @@ HugoTransactions::loadTable(Ndb* pNdb, ...@@ -585,10 +586,22 @@ HugoTransactions::loadTable(Ndb* pNdb,
if (!oneTrans || (c + batch) >= records) { if (!oneTrans || (c + batch) >= records) {
// closeTrans = true; // closeTrans = true;
closeTrans = false; closeTrans = false;
check = pTrans->execute( Commit ); if (!abort)
if(check != -1) {
m_latest_gci = pTrans->getGCI(); check = pTrans->execute( Commit );
pTrans->restart(); if(check != -1)
m_latest_gci = pTrans->getGCI();
pTrans->restart();
}
else
{
check = pTrans->execute( NoCommit );
if (check != -1)
{
check = pTrans->execute( Rollback );
closeTransaction(pNdb);
}
}
} else { } else {
closeTrans = false; closeTrans = false;
check = pTrans->execute( NoCommit ); check = pTrans->execute( NoCommit );
......
...@@ -31,6 +31,8 @@ int main(int argc, const char** argv){ ...@@ -31,6 +31,8 @@ int main(int argc, const char** argv){
int _batch = 512; int _batch = 512;
int _loops = -1; int _loops = -1;
int _rand = 0; int _rand = 0;
int _onetrans = 0;
int _abort = 0;
const char* db = 0; const char* db = 0;
struct getargs args[] = { struct getargs args[] = {
...@@ -39,7 +41,9 @@ int main(int argc, const char** argv){ ...@@ -39,7 +41,9 @@ int main(int argc, const char** argv){
{ "loops", 'l', arg_integer, &_loops, "Number of loops", "" }, { "loops", 'l', arg_integer, &_loops, "Number of loops", "" },
{ "database", 'd', arg_string, &db, "Database", "" }, { "database", 'd', arg_string, &db, "Database", "" },
{ "usage", '?', arg_flag, &_help, "Print help", "" }, { "usage", '?', arg_flag, &_help, "Print help", "" },
{ "rnd-rows", 0, arg_flag, &_rand, "Rand number of records", "recs" } { "rnd-rows", 0, arg_flag, &_rand, "Rand number of records", "recs" },
{ "one-trans", 0, arg_flag, &_onetrans, "Insert as 1 trans", "" },
{ "abort", 0, arg_integer, &_abort, "Abort probability", "" }
}; };
int num_args = sizeof(args) / sizeof(args[0]); int num_args = sizeof(args) / sizeof(args[0]);
int optind = 0; int optind = 0;
...@@ -92,10 +96,13 @@ int main(int argc, const char** argv){ ...@@ -92,10 +96,13 @@ int main(int argc, const char** argv){
HugoTransactions hugoTrans(*pTab); HugoTransactions hugoTrans(*pTab);
loop: loop:
int rows = (_rand ? rand() % _records : _records); int rows = (_rand ? rand() % _records : _records);
int abort = (rand() % 100) < _abort ? 1 : 0;
if (abort)
ndbout << "load+abort" << endl;
if (hugoTrans.loadTable(&MyNdb, if (hugoTrans.loadTable(&MyNdb,
rows, rows,
_batch, _batch,
true, 0, false, _loops) != 0){ true, 0, _onetrans, _loops, abort) != 0){
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
} }
......
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