Commit c96275aa authored by unknown's avatar unknown

Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.1

into  mysql.com:/home/kent/bk/tmp/mysql-5.1-build

parents 793a137d 8dfbc1b6
...@@ -172,6 +172,7 @@ max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server" ...@@ -172,6 +172,7 @@ max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server"
alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag" alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
amd64_cflags="$check_cpu_cflags" amd64_cflags="$check_cpu_cflags"
amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES" amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES"
pentium_cflags="$check_cpu_cflags"
pentium64_cflags="$check_cpu_cflags -m64" pentium64_cflags="$check_cpu_cflags -m64"
ppc_cflags="$check_cpu_cflags" ppc_cflags="$check_cpu_cflags"
sparc_cflags="" sparc_cflags=""
......
...@@ -506,6 +506,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) ...@@ -506,6 +506,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share->data_file_type = DYNAMIC_RECORD; share->data_file_type = DYNAMIC_RECORD;
my_afree((gptr) disk_cache); my_afree((gptr) disk_cache);
mi_setup_functions(share); mi_setup_functions(share);
#ifdef HAVE_MMAP
if (open_flags & HA_OPEN_MMAP) if (open_flags & HA_OPEN_MMAP)
{ {
info.s= share; info.s= share;
...@@ -522,6 +523,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) ...@@ -522,6 +523,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share->file_write= mi_mmap_pwrite; share->file_write= mi_mmap_pwrite;
} }
} }
#endif /* HAVE_MMAP */
share->is_log_table= FALSE; share->is_log_table= FALSE;
#ifdef THREAD #ifdef THREAD
thr_lock_init(&share->lock); thr_lock_init(&share->lock);
......
...@@ -963,7 +963,7 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = { ...@@ -963,7 +963,7 @@ const EventLoggerBase::EventRepLogLevelMatrix EventLoggerBase::matrix[] = {
ROW(NDBStopCompleted, LogLevel::llStartUp, 1, Logger::LL_INFO ), ROW(NDBStopCompleted, LogLevel::llStartUp, 1, Logger::LL_INFO ),
ROW(NDBStopForced, LogLevel::llStartUp, 1, Logger::LL_ALERT ), ROW(NDBStopForced, LogLevel::llStartUp, 1, Logger::LL_ALERT ),
ROW(NDBStopAborted, LogLevel::llStartUp, 1, Logger::LL_INFO ), ROW(NDBStopAborted, LogLevel::llStartUp, 1, Logger::LL_INFO ),
ROW(StartREDOLog, LogLevel::llStartUp, 10, Logger::LL_INFO ), ROW(StartREDOLog, LogLevel::llStartUp, 4, Logger::LL_INFO ),
ROW(StartLog, LogLevel::llStartUp, 10, Logger::LL_INFO ), ROW(StartLog, LogLevel::llStartUp, 10, Logger::LL_INFO ),
ROW(UNDORecordsExecuted, LogLevel::llStartUp, 15, Logger::LL_INFO ), ROW(UNDORecordsExecuted, LogLevel::llStartUp, 15, Logger::LL_INFO ),
ROW(StartReport, LogLevel::llStartUp, 4, Logger::LL_INFO ), ROW(StartReport, LogLevel::llStartUp, 4, Logger::LL_INFO ),
......
...@@ -441,6 +441,7 @@ void Dblqh::execCONTINUEB(Signal* signal) ...@@ -441,6 +441,7 @@ void Dblqh::execCONTINUEB(Signal* signal)
else else
{ {
jam(); jam();
cstartRecReq = 2;
ndbrequire(c_redo_complete_fragments.isEmpty()); ndbrequire(c_redo_complete_fragments.isEmpty());
StartRecConf * conf = (StartRecConf*)signal->getDataPtrSend(); StartRecConf * conf = (StartRecConf*)signal->getDataPtrSend();
conf->startingNodeId = getOwnNodeId(); conf->startingNodeId = getOwnNodeId();
...@@ -11936,7 +11937,7 @@ void Dblqh::execGCP_SAVEREQ(Signal* signal) ...@@ -11936,7 +11937,7 @@ void Dblqh::execGCP_SAVEREQ(Signal* signal)
return; return;
} }
if (getNodeState().getNodeRestartInProgress() && cstartRecReq == ZFALSE) if (getNodeState().getNodeRestartInProgress() && cstartRecReq < 2)
{ {
GCPSaveRef * const saveRef = (GCPSaveRef*)&signal->theData[0]; GCPSaveRef * const saveRef = (GCPSaveRef*)&signal->theData[0];
saveRef->dihPtr = dihPtr; saveRef->dihPtr = dihPtr;
...@@ -12248,6 +12249,10 @@ void Dblqh::execFSCLOSECONF(Signal* signal) ...@@ -12248,6 +12249,10 @@ void Dblqh::execFSCLOSECONF(Signal* signal)
// Set the prev file to check if we shall close it. // Set the prev file to check if we shall close it.
logFilePtr.i = logFilePtr.p->prevLogFile; logFilePtr.i = logFilePtr.p->prevLogFile;
ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord);
logPartPtr.i = logFilePtr.p->logPartRec;
ptrCheckGuard(logPartPtr, clogPartFileSize, logPartRecord);
exitFromInvalidate(signal); exitFromInvalidate(signal);
return; return;
case LogFileRecord::CLOSING_INIT: case LogFileRecord::CLOSING_INIT:
...@@ -14017,7 +14022,7 @@ void Dblqh::execRESTORE_LCP_CONF(Signal* signal) ...@@ -14017,7 +14022,7 @@ void Dblqh::execRESTORE_LCP_CONF(Signal* signal)
return; return;
} }
if (c_lcp_restoring_fragments.isEmpty() && cstartRecReq == ZTRUE) if (c_lcp_restoring_fragments.isEmpty() && cstartRecReq == 1)
{ {
jam(); jam();
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
...@@ -14058,7 +14063,7 @@ void Dblqh::execSTART_RECREQ(Signal* signal) ...@@ -14058,7 +14063,7 @@ void Dblqh::execSTART_RECREQ(Signal* signal)
ndbrequire(req->receivingNodeId == cownNodeid); ndbrequire(req->receivingNodeId == cownNodeid);
cnewestCompletedGci = cnewestGci; cnewestCompletedGci = cnewestGci;
cstartRecReq = ZTRUE; cstartRecReq = 1;
for (logPartPtr.i = 0; logPartPtr.i < 4; logPartPtr.i++) { for (logPartPtr.i = 0; logPartPtr.i < 4; logPartPtr.i++) {
ptrAss(logPartPtr, logPartRecord); ptrAss(logPartPtr, logPartRecord);
logPartPtr.p->logPartNewestCompletedGCI = cnewestCompletedGci; logPartPtr.p->logPartNewestCompletedGCI = cnewestCompletedGci;
...@@ -14072,6 +14077,7 @@ void Dblqh::execSTART_RECREQ(Signal* signal) ...@@ -14072,6 +14077,7 @@ void Dblqh::execSTART_RECREQ(Signal* signal)
*------------------------------------------------------------------------ */ *------------------------------------------------------------------------ */
if(cstartType == NodeState::ST_INITIAL_NODE_RESTART){ if(cstartType == NodeState::ST_INITIAL_NODE_RESTART){
jam(); jam();
cstartRecReq = 2;
StartRecConf * conf = (StartRecConf*)signal->getDataPtrSend(); StartRecConf * conf = (StartRecConf*)signal->getDataPtrSend();
conf->startingNodeId = getOwnNodeId(); conf->startingNodeId = getOwnNodeId();
sendSignal(cmasterDihBlockref, GSN_START_RECCONF, signal, sendSignal(cmasterDihBlockref, GSN_START_RECCONF, signal,
...@@ -15893,6 +15899,7 @@ void Dblqh::srFourthComp(Signal* signal) ...@@ -15893,6 +15899,7 @@ void Dblqh::srFourthComp(Signal* signal)
return; return;
} }
} }
cstartRecReq = 2;
StartRecConf * conf = (StartRecConf*)signal->getDataPtrSend(); StartRecConf * conf = (StartRecConf*)signal->getDataPtrSend();
conf->startingNodeId = getOwnNodeId(); conf->startingNodeId = getOwnNodeId();
sendSignal(cmasterDihBlockref, GSN_START_RECCONF, signal, sendSignal(cmasterDihBlockref, GSN_START_RECCONF, signal,
...@@ -16761,7 +16768,7 @@ void Dblqh::initialiseRecordsLab(Signal* signal, Uint32 data, ...@@ -16761,7 +16768,7 @@ void Dblqh::initialiseRecordsLab(Signal* signal, Uint32 data,
cnoActiveCopy = 0; cnoActiveCopy = 0;
ccurrentGcprec = RNIL; ccurrentGcprec = RNIL;
caddNodeState = ZFALSE; caddNodeState = ZFALSE;
cstartRecReq = ZFALSE; cstartRecReq = 0;
cnewestGci = 0; cnewestGci = 0;
cnewestCompletedGci = 0; cnewestCompletedGci = 0;
crestartOldestGci = 0; crestartOldestGci = 0;
......
...@@ -1840,6 +1840,7 @@ Tsman::execALLOC_PAGE_REQ(Signal* signal) ...@@ -1840,6 +1840,7 @@ Tsman::execALLOC_PAGE_REQ(Signal* signal)
ndbrequire(m_file_hash.find(file_ptr, file_key)); ndbrequire(m_file_hash.find(file_ptr, file_key));
struct req val = lookup_extent(req.key.m_page_no, file_ptr.p); struct req val = lookup_extent(req.key.m_page_no, file_ptr.p);
Uint32 page_no_in_extent = calc_page_no_in_extent(req.key.m_page_no, &val);
Page_cache_client::Request preq; Page_cache_client::Request preq;
preq.m_page.m_page_no = val.m_extent_page_no; preq.m_page.m_page_no = val.m_extent_page_no;
...@@ -1865,7 +1866,6 @@ Tsman::execALLOC_PAGE_REQ(Signal* signal) ...@@ -1865,7 +1866,6 @@ Tsman::execALLOC_PAGE_REQ(Signal* signal)
ndbrequire(header->m_table == req.request.table_id); ndbrequire(header->m_table == req.request.table_id);
Uint32 page_no_in_extent = calc_page_no_in_extent(req.key.m_page_no, &val);
Uint32 word = header->get_free_word_offset(page_no_in_extent); Uint32 word = header->get_free_word_offset(page_no_in_extent);
Uint32 shift = SZ * (page_no_in_extent & 7); Uint32 shift = SZ * (page_no_in_extent & 7);
...@@ -1925,8 +1925,7 @@ Tsman::execALLOC_PAGE_REQ(Signal* signal) ...@@ -1925,8 +1925,7 @@ Tsman::execALLOC_PAGE_REQ(Signal* signal)
found: found:
header->update_free_bits(page_no, src_bits | UNCOMMITTED_MASK); header->update_free_bits(page_no, src_bits | UNCOMMITTED_MASK);
rep->bits= (src_bits & UNCOMMITTED_MASK) >> UNCOMMITTED_SHIFT; rep->bits= (src_bits & UNCOMMITTED_MASK) >> UNCOMMITTED_SHIFT;
rep->key.m_page_no= rep->key.m_page_no = req.key.m_page_no + page_no - page_no_in_extent;
val.m_extent_pages + val.m_extent_no * val.m_extent_size + page_no;
rep->reply.errorCode= 0; rep->reply.errorCode= 0;
return; return;
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
RWPool::RWPool() RWPool::RWPool()
{ {
bzero(this, sizeof(* this)); bzero(this, sizeof(* this));
m_current_pos = GLOBAL_PAGE_SIZE_WORDS; m_current_pos = RWPage::RWPAGE_WORDS;
m_current_first_free = REC_NIL; m_current_first_free = REC_NIL;
m_first_free_page = RNIL; m_first_free_page = RNIL;
} }
...@@ -57,7 +57,7 @@ seize_free: ...@@ -57,7 +57,7 @@ seize_free:
m_current_first_free = pageP->m_data[pos+m_record_info.m_offset_next_pool]; m_current_first_free = pageP->m_data[pos+m_record_info.m_offset_next_pool];
return true; return true;
} }
else if (pos + size < GLOBAL_PAGE_SIZE_WORDS) else if (pos + size < RWPage::RWPAGE_WORDS)
{ {
seize_first: seize_first:
ptr.i = (m_current_page_no << POOL_RECORD_BITS) + pos; ptr.i = (m_current_page_no << POOL_RECORD_BITS) + pos;
...@@ -81,11 +81,14 @@ seize_first: ...@@ -81,11 +81,14 @@ seize_first:
{ {
pageP = m_current_page = m_memroot + m_first_free_page; pageP = m_current_page = m_memroot + m_first_free_page;
m_current_page_no = m_first_free_page; m_current_page_no = m_first_free_page;
m_current_pos = GLOBAL_PAGE_SIZE_WORDS; m_current_pos = RWPage::RWPAGE_WORDS;
m_current_first_free = m_current_page->m_first_free; m_current_first_free = m_current_page->m_first_free;
m_first_free_page = m_current_page->m_next_page; m_first_free_page = m_current_page->m_next_page;
m_current_ref_count = m_current_page->m_ref_count; m_current_ref_count = m_current_page->m_ref_count;
if (m_first_free_page != RNIL)
{
(m_memroot + m_first_free_page)->m_prev_page = RNIL; (m_memroot + m_first_free_page)->m_prev_page = RNIL;
}
goto seize_free; goto seize_free;
} }
...@@ -105,7 +108,7 @@ seize_first: ...@@ -105,7 +108,7 @@ seize_first:
m_current_page = 0; m_current_page = 0;
m_current_page_no = RNIL; m_current_page_no = RNIL;
m_current_pos = GLOBAL_PAGE_SIZE_WORDS; m_current_pos = RWPage::RWPAGE_WORDS;
m_current_first_free = REC_NIL; m_current_first_free = REC_NIL;
return false; return false;
...@@ -154,6 +157,7 @@ RWPool::release(Ptr<void> ptr) ...@@ -154,6 +157,7 @@ RWPool::release(Ptr<void> ptr)
} }
page->m_next_page = ffp; page->m_next_page = ffp;
page->m_prev_page = RNIL; page->m_prev_page = RNIL;
m_first_free_page = ptr_page;
return; return;
} }
else if(ref_cnt == 1) else if(ref_cnt == 1)
......
...@@ -20,12 +20,14 @@ ...@@ -20,12 +20,14 @@
struct RWPage struct RWPage
{ {
STATIC_CONST( RWPAGE_WORDS = GLOBAL_PAGE_SIZE_WORDS - 4 );
Uint32 m_type_id; Uint32 m_type_id;
Uint16 m_first_free; Uint16 m_first_free;
Uint16 m_ref_count; Uint16 m_ref_count;
Uint32 m_next_page; Uint32 m_next_page;
Uint32 m_prev_page; Uint32 m_prev_page;
Uint32 m_data[GLOBAL_PAGE_SIZE_WORDS - 4]; Uint32 m_data[RWPAGE_WORDS];
}; };
/** /**
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
WOPool::WOPool() WOPool::WOPool()
{ {
bzero(this, sizeof(* this)); bzero(this, sizeof(* this));
m_current_pos = GLOBAL_PAGE_SIZE_WORDS; m_current_pos = WOPage::WOPAGE_WORDS;
} }
void void
......
...@@ -20,9 +20,11 @@ ...@@ -20,9 +20,11 @@
struct WOPage struct WOPage
{ {
STATIC_CONST( WOPAGE_WORDS = GLOBAL_PAGE_SIZE_WORDS - 2 );
Uint32 m_type_id; Uint32 m_type_id;
Uint32 m_ref_count; Uint32 m_ref_count;
Uint32 m_data[GLOBAL_PAGE_SIZE_WORDS - 2]; Uint32 m_data[WOPAGE_WORDS];
}; };
/** /**
...@@ -61,7 +63,7 @@ WOPool::seize(Ptr<void>& ptr) ...@@ -61,7 +63,7 @@ WOPool::seize(Ptr<void>& ptr)
Uint32 pos = m_current_pos; Uint32 pos = m_current_pos;
Uint32 size = m_record_info.m_size; Uint32 size = m_record_info.m_size;
WOPage *pageP = m_current_page; WOPage *pageP = m_current_page;
if (likely(pos + size < GLOBAL_PAGE_SIZE_WORDS)) if (likely(pos + size < WOPage::WOPAGE_WORDS))
{ {
ptr.i = (m_current_page_no << POOL_RECORD_BITS) + pos; ptr.i = (m_current_page_no << POOL_RECORD_BITS) + pos;
ptr.p = (pageP->m_data + pos); ptr.p = (pageP->m_data + pos);
......
...@@ -343,24 +343,24 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) ...@@ -343,24 +343,24 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
} }
break; break;
case NdbDictionary::Column::Blob: case NdbDictionary::Column::Blob:
{
const NdbBlob::Head* h = (const NdbBlob::Head*)r.aRef();
out << h->length << ":";
const unsigned char* p = (const unsigned char*)(h + 1);
unsigned n = r.get_size_in_bytes() - sizeof(*h);
for (unsigned k = 0; k < n && k < h->length; k++)
out.print("%02X", (int)p[k]);
j = length;
}
break;
case NdbDictionary::Column::Text: case NdbDictionary::Column::Text:
{ {
const NdbBlob::Head* h = (const NdbBlob::Head*)r.aRef(); // user defined aRef() may not be aligned to Uint64
out << h->length << ":"; NdbBlob::Head head;
const unsigned char* p = (const unsigned char*)(h + 1); memcpy(&head, r.aRef(), sizeof(head));
unsigned n = r.get_size_in_bytes() - sizeof(*h); out << head.length << ":";
for (unsigned k = 0; k < n && k < h->length; k++) const unsigned char* p = (const unsigned char*)r.aRef() + sizeof(head);
if (r.get_size_in_bytes() < sizeof(head))
out << "***error***"; // really cannot happen
else {
unsigned n = r.get_size_in_bytes() - sizeof(head);
for (unsigned k = 0; k < n && k < head.length; k++) {
if (r.getType() == NdbDictionary::Column::Blob)
out.print("%02X", (int)p[k]);
else
out.print("%c", (int)p[k]); out.print("%c", (int)p[k]);
}
}
j = length; j = length;
} }
break; break;
......
...@@ -1353,6 +1353,68 @@ runBug26481(NDBT_Context* ctx, NDBT_Step* step) ...@@ -1353,6 +1353,68 @@ runBug26481(NDBT_Context* ctx, NDBT_Step* step)
return NDBT_OK; return NDBT_OK;
} }
int
runBug26450(NDBT_Context* ctx, NDBT_Step* step)
{
Uint32 i;
int result = NDBT_OK;
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
NdbRestarter res;
Ndb* pNdb = GETNDB(step);
int node = res.getRandomNotMasterNodeId(rand());
Vector<int> nodes;
for (unsigned i = 0; i<res.getNumDbNodes(); i++)
{
if (res.getDbNodeId(i) != node)
nodes.push_back(res.getDbNodeId(i));
}
if (res.restartAll())
return NDBT_FAILED;
if (res.waitClusterStarted())
return NDBT_FAILED;
ndbout_c("node: %d", node);
if (res.restartOneDbNode(node, false, true, true))
return NDBT_FAILED;
if (res.waitNodesNoStart(&node, 1))
return NDBT_FAILED;
if (runClearTable(ctx, step))
return NDBT_FAILED;
for (i = 0; i < 2; i++)
{
if (res.restartAll(false, true, i > 0))
return NDBT_FAILED;
if (res.waitClusterNoStart())
return NDBT_FAILED;
if (res.startNodes(nodes.getBase(), nodes.size()))
return NDBT_FAILED;
if (res.waitNodesStarted(nodes.getBase(), nodes.size()))
return NDBT_FAILED;
}
if (res.startNodes(&node, 1))
return NDBT_FAILED;
if (res.waitNodesStarted(&node, 1))
return NDBT_FAILED;
HugoTransactions trans (* ctx->getTab());
if (trans.selectCount(pNdb) != 0)
return NDBT_FAILED;
return NDBT_OK;
}
NDBT_TESTSUITE(testNodeRestart); NDBT_TESTSUITE(testNodeRestart);
TESTCASE("NoLoad", TESTCASE("NoLoad",
"Test that one node at a time can be stopped and then restarted "\ "Test that one node at a time can be stopped and then restarted "\
...@@ -1697,6 +1759,10 @@ TESTCASE("Bug26457", ""){ ...@@ -1697,6 +1759,10 @@ TESTCASE("Bug26457", ""){
TESTCASE("Bug26481", ""){ TESTCASE("Bug26481", ""){
INITIALIZER(runBug26481); INITIALIZER(runBug26481);
} }
TESTCASE("Bug26450", ""){
INITIALIZER(runLoadTable);
INITIALIZER(runBug26450);
}
NDBT_TESTSUITE_END(testNodeRestart); NDBT_TESTSUITE_END(testNodeRestart);
int main(int argc, const char** argv){ int main(int argc, const char** argv){
......
...@@ -59,7 +59,12 @@ BackupFile::Twiddle(const AttributeDesc* attr_desc, AttributeData* attr_data, Ui ...@@ -59,7 +59,12 @@ BackupFile::Twiddle(const AttributeDesc* attr_desc, AttributeData* attr_data, Ui
return true; return true;
case 64: case 64:
for(i = 0; i<arraySize; i++){ for(i = 0; i<arraySize; i++){
attr_data->u_int64_value[i] = Twiddle64(attr_data->u_int64_value[i]); // allow unaligned
char* p = (char*)&attr_data->u_int64_value[i];
Uint64 x;
memcpy(&x, p, sizeof(Uint64));
x = Twiddle64(x);
memcpy(p, &x, sizeof(Uint64));
} }
return true; return true;
default: default:
......
...@@ -18,13 +18,18 @@ ...@@ -18,13 +18,18 @@
#include <tap.h> #include <tap.h>
#include <string.h> #include <string.h>
#define BASE64_LOOP_COUNT 500
#define BASE64_ROWS 4 /* Number of ok(..) */
int int
main(void) main(void)
{ {
int i, cmp; int i, cmp;
size_t j, k, l, dst_len, needed_length; size_t j, k, l, dst_len, needed_length;
for (i= 0; i < 500; i++) plan(BASE64_LOOP_COUNT * BASE64_ROWS);
for (i= 0; i < BASE64_LOOP_COUNT; i++)
{ {
/* Create source data */ /* Create source data */
const size_t src_len= rand() % 1000 + 1; const size_t src_len= rand() % 1000 + 1;
......
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