3173 Jonas Oreland 2008-12-12 [merge]
merge 63 to 64
added:
storage/ndb/test/run-test/conf-upgrade.cnf
storage/ndb/test/run-test/upgrade-tests.txt
modified:
sql/sql_yacc.yy
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
storage/ndb/src/kernel/vm/Configuration.cpp
storage/ndb/test/include/DbUtil.hpp
storage/ndb/test/ndbapi/testUpgrade.cpp
storage/ndb/test/run-test/Makefile.am
storage/ndb/test/run-test/atrt-gather-result.sh
storage/ndb/test/run-test/atrt.hpp
storage/ndb/test/run-test/autotest-boot.sh
storage/ndb/test/run-test/autotest-run.sh
storage/ndb/test/run-test/command.cpp
storage/ndb/test/run-test/files.cpp
storage/ndb/test/run-test/main.cpp
storage/ndb/test/run-test/setup.cpp
storage/ndb/test/src/DbUtil.cpp
3172 Jonas Oreland 2008-12-12
ndb - fix bunch of windows warnings
modified:
storage/ndb/include/kernel/signaldata/EventSubscribeReq.hpp
storage/ndb/src/common/util/ConfigValues.cpp
storage/ndb/src/common/util/File.cpp
storage/ndb/src/common/util/Properties.cpp
storage/ndb/src/common/util/SimpleProperties.cpp
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
storage/ndb/src/kernel/vm/Rope.cpp
storage/ndb/src/kernel/vm/Rope.hpp
storage/ndb/src/mgmapi/mgmapi.cpp
storage/ndb/src/mgmsrv/Config.cpp
storage/ndb/src/mgmsrv/ConfigInfo.cpp
storage/ndb/src/ndbapi/ClusterMgr.cpp
storage/ndb/src/ndbapi/DictCache.cpp
storage/ndb/src/ndbapi/Ndb.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
storage/ndb/src/ndbapi/NdbIndexStat.cpp
storage/ndb/src/ndbapi/NdbOperationExec.cpp
storage/ndb/src/ndbapi/NdbOperationSearch.cpp
storage/ndb/src/ndbapi/NdbReceiver.cpp
storage/ndb/src/ndbapi/NdbScanOperation.cpp
storage/ndb/src/ndbapi/TransporterFacade.cpp
3171 Leonard Zhou 2008-12-12 [merge]
Merge 63 to 64
modified:
storage/ndb/src/mgmclient/CommandInterpreter.cpp
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2008-12-10 15:35:47 +0000
+++ b/sql/sql_yacc.yy 2008-12-12 10:25:31 +0000
@@ -1639,8 +1639,9 @@ master_def:
if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD ||
Lex->mi.heartbeat_period < 0.0)
{
- char buf[sizeof(SLAVE_MAX_HEARTBEAT_PERIOD*4)];
- my_sprintf(buf, (buf, "%d seconds", SLAVE_MAX_HEARTBEAT_PERIOD));
+ const char format[]= "%d seconds";
+ char buf[sizeof(SLAVE_MAX_HEARTBEAT_PERIOD)*4 + sizeof(format)];
+ my_sprintf(buf, (buf, format, SLAVE_MAX_HEARTBEAT_PERIOD));
my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
MYF(0),
" is negative or exceeds the maximum ",
=== modified file 'storage/ndb/include/kernel/signaldata/EventSubscribeReq.hpp'
--- a/storage/ndb/include/kernel/signaldata/EventSubscribeReq.hpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/include/kernel/signaldata/EventSubscribeReq.hpp 2008-12-12 14:30:54 +0000
@@ -56,7 +56,7 @@ struct EventSubscribeReq {
EventSubscribeReq& operator= (const LogLevel& ll){
noOfEntries = LogLevel::LOGLEVEL_CATEGORIES;
for(size_t i = 0; i<noOfEntries; i++){
- theData[i] = (i << 16) | ll.getLogLevel((LogLevel::EventCategory)i);
+ theData[i] = Uint32(i << 16) | ll.getLogLevel((LogLevel::EventCategory)i);
}
return * this;
}
=== modified file 'storage/ndb/src/common/util/ConfigValues.cpp'
--- a/storage/ndb/src/common/util/ConfigValues.cpp 2008-11-13 08:02:28 +0000
+++ b/storage/ndb/src/common/util/ConfigValues.cpp 2008-12-12 14:30:54 +0000
@@ -629,7 +629,7 @@ ConfigValues::pack(void * _dst, Uint32 _
break;
case StringType:{
const char * str = * getString(val);
- Uint32 len = strlen(str) + 1;
+ Uint32 len = Uint32(strlen(str) + 1);
* (Uint32*)dst = htonl(key); dst += 4;
* (Uint32*)dst = htonl(len); dst += 4;
memcpy(dst, str, len);
@@ -645,7 +645,7 @@ ConfigValues::pack(void * _dst, Uint32 _
}
const Uint32 * sum = (Uint32*)_dst;
- const Uint32 len = ((Uint32*)dst) - sum;
+ const Uint32 len = Uint32(((Uint32*)dst) - sum);
Uint32 chk = 0;
for(i = 0; i<len; i++){
chk ^= htonl(sum[i]);
=== modified file 'storage/ndb/src/common/util/File.cpp'
--- a/storage/ndb/src/common/util/File.cpp 2008-12-10 17:55:10 +0000
+++ b/storage/ndb/src/common/util/File.cpp 2008-12-12 14:30:54 +0000
@@ -166,7 +166,7 @@ File_class::readChar(char* buf, long sta
int
File_class::readChar(char* buf)
{
- return readChar(buf, 0, strlen(buf));
+ return readChar(buf, 0, (long)strlen(buf));
}
int
@@ -184,7 +184,7 @@ File_class::writeChar(const char* buf, l
int
File_class::writeChar(const char* buf)
{
- return writeChar(buf, 0, ::strlen(buf));
+ return writeChar(buf, 0, (long)::strlen(buf));
}
off_t
=== modified file 'storage/ndb/src/common/util/Properties.cpp'
--- a/storage/ndb/src/common/util/Properties.cpp 2008-10-08 13:53:01 +0000
+++ b/storage/ndb/src/common/util/Properties.cpp 2008-12-12 14:30:54 +0000
@@ -434,7 +434,7 @@ Properties::pack(Uint32 * buf) const {
if(!res)
return res;
- * buf = htonl(computeChecksum(bufStart, (buf - bufStart)));
+ * buf = htonl(computeChecksum(bufStart, Uint32(buf - bufStart)));
return true;
}
@@ -587,7 +587,7 @@ PropertiesImpl::getProps(const char * na
* impl = this;
return ret;
} else {
- Uint32 sz = tmp - name;
+ Uint32 sz = Uint32(tmp - name);
char * tmp2 = (char*)malloc(sz + 1);
memcpy(tmp2, name, sz);
tmp2[sz] = 0;
@@ -617,7 +617,7 @@ PropertiesImpl::getPropsPut(const char *
* impl = this;
return ret;
} else {
- Uint32 sz = tmp - name;
+ Uint32 sz = Uint32(tmp - name);
char * tmp2 = (char*)malloc(sz + 1);
memcpy(tmp2, name, sz);
tmp2[sz] = 0;
@@ -654,7 +654,7 @@ PropertiesImpl::getPackedSize(Uint32 pLe
for(unsigned int i = 0; i<items; i++){
if(content[i]->valueType == PropertiesType_Properties){
Properties * p = (Properties*)content[i]->value;
- sz += p->impl->getPackedSize(pLen+strlen(content[i]->name)+1);
+ sz += p->impl->getPackedSize(pLen+(Uint32)strlen(content[i]->name)+1);
} else {
sz += 4; // Type
sz += 4; // Name Len
@@ -773,7 +773,7 @@ PropertiesImpl::pack(Uint32 *& buf, cons
valLenData = 8;
break;
case PropertiesType_char:
- valLenData = strlen((char *)content[i]->value);
+ valLenData = Uint32(strlen((char *)content[i]->value));
break;
case PropertiesType_Properties:
assert(0);
@@ -1005,7 +1005,7 @@ Properties::put64(const char * name, Uin
size_t tmp_len = strlen(name)+20;
char * tmp = (char*)malloc(tmp_len);
BaseString::snprintf(tmp, tmp_len, "%s_%d", name, no);
- bool res = put(tmp, val, replace);
+ bool res = put(tmp, Uint64(val), replace);
free(tmp);
return res;
}
=== modified file 'storage/ndb/src/common/util/SimpleProperties.cpp'
--- a/storage/ndb/src/common/util/SimpleProperties.cpp 2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/common/util/SimpleProperties.cpp 2008-12-12 14:30:54 +0000
@@ -65,7 +65,7 @@ SimpleProperties::Writer::add(Uint16 key
head += key;
if(!putWord(htonl(head)))
return false;
- Uint32 strLen = strlen(value) + 1; // Including NULL-byte
+ Uint32 strLen = Uint32(strlen(value) + 1); // Including NULL-byte
if(!putWord(htonl(strLen)))
return false;
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2008-12-02 14:25:58 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2008-12-12 14:30:54 +0000
@@ -4380,7 +4380,7 @@ void Dbdict::handleTabInfoInit(SimplePro
// Verify that table name is an allowed table name.
// TODO
/* ---------------------------------------------------------------- */
- const Uint32 tableNameLength = strlen(c_tableDesc.TableName) + 1;
+ const Uint32 tableNameLength = Uint32(strlen(c_tableDesc.TableName) + 1);
const Uint32 name_hash = Rope::hash(c_tableDesc.TableName, tableNameLength);
if(checkExist){
@@ -4642,7 +4642,7 @@ void Dbdict::handleTabInfo(SimplePropert
/**
* Check that attribute is not defined twice
*/
- const size_t len = strlen(attrDesc.AttributeName)+1;
+ const Uint32 len = Uint32(strlen(attrDesc.AttributeName)+1);
const Uint32 name_hash = Rope::hash(attrDesc.AttributeName, len);
{
AttributeRecord key;
@@ -14160,7 +14160,7 @@ void Dbdict::execCREATE_EVNT_CONF(Signal
LinearSectionPtr ptr[1];
ptr[0].p = (Uint32 *)evntRecPtr.p->m_eventRec.TABLE_NAME;
ptr[0].sz =
- (strlen(evntRecPtr.p->m_eventRec.TABLE_NAME)+4)/4; // to make sure we have a null
+ Uint32(strlen(evntRecPtr.p->m_eventRec.TABLE_NAME)+4)/4; // to make sure we have a null
createEvent_sendReply(signal, evntRecPtr, ptr, 1);
@@ -18494,7 +18494,7 @@ Dbdict::createFile_parse(Signal* signal,
return;
}
- Uint32 len = strlen(f.FileName) + 1;
+ Uint32 len = Uint32(strlen(f.FileName) + 1);
Uint32 hash = Rope::hash(f.FileName, len);
if(get_object(f.FileName, len, hash) != 0)
{
@@ -18821,7 +18821,7 @@ Dbdict::createFile_fromWriteObjInfo(Sign
tmp.copy(name);
LinearSectionPtr ptr[3];
ptr[0].p = (Uint32*)&name[0];
- ptr[0].sz = (strlen(name)+1+3)/4;
+ ptr[0].sz = Uint32(strlen(name)+1+3)/4;
sendSignal(ref, GSN_CREATE_FILE_IMPL_REQ, signal, len, JBB, ptr, 1);
Callback c = {
@@ -19127,7 +19127,7 @@ Dbdict::createFilegroup_parse(Signal* si
}
}
- Uint32 len = strlen(fg.FilegroupName) + 1;
+ Uint32 len = Uint32(strlen(fg.FilegroupName) + 1);
Uint32 hash = Rope::hash(fg.FilegroupName, len);
if(get_object(fg.FilegroupName, len, hash) != 0)
{
@@ -25825,7 +25825,7 @@ Dbdict::createHashMap_parse(Signal* sign
w.getPtr(objInfoPtr);
}
- Uint32 len = strlen(hm.HashMapName) + 1;
+ Uint32 len = Uint32(strlen(hm.HashMapName) + 1);
Uint32 hash = Rope::hash(hm.HashMapName, len);
if (ERROR_INSERTED(6205))
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2008-11-11 07:36:01 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2008-12-12 14:30:54 +0000
@@ -661,7 +661,7 @@ public:
// 1
DictObject * get_object(const char * name){
- return get_object(name, strlen(name) + 1);
+ return get_object(name, Uint32(strlen(name) + 1));
}
DictObject * get_object(const char * name, Uint32 len){
@@ -672,7 +672,7 @@ public:
//2
bool get_object(DictObjectPtr& obj_ptr, const char * name){
- return get_object(obj_ptr, name, strlen(name) + 1);
+ return get_object(obj_ptr, name, Uint32(strlen(name) + 1));
}
bool get_object(DictObjectPtr& obj_ptr, const char * name, Uint32 len){
=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2008-12-08 13:58:15 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2008-12-12 14:44:00 +0000
@@ -17140,10 +17140,16 @@ Dbdih::sendDictUnlockOrd(Signal* signal,
return;
}
}
-
+
+ Uint32 len = DictUnlockOrd::SignalLength;
+ if (unlikely(getNodeInfo(cmasterNodeId).m_version < NDB_MAKE_VERSION(6,3,0)))
+ {
+ jam();
+ len = 2;
+ }
+
BlockReference dictMasterRef = calcDictBlockRef(cmasterNodeId);
- sendSignal(dictMasterRef, GSN_DICT_UNLOCK_ORD, signal,
- DictUnlockOrd::SignalLength, JBB);
+ sendSignal(dictMasterRef, GSN_DICT_UNLOCK_ORD, signal, len, JBB);
}
#ifdef ERROR_INSERT
=== modified file 'storage/ndb/src/kernel/vm/Configuration.cpp'
--- a/storage/ndb/src/kernel/vm/Configuration.cpp 2008-11-13 15:22:59 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp 2008-12-12 14:44:00 +0000
@@ -458,20 +458,14 @@ Configuration::setupConfiguration(){
"TimeBetweenWatchDogCheck missing");
}
- if(iter.get(CFG_DB_SCHED_EXEC_TIME, &_schedulerExecutionTimer)){
- ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
- "SchedulerExecutionTimer missing");
- }
+ _schedulerExecutionTimer = 50;
+ iter.get(CFG_DB_SCHED_EXEC_TIME, &_schedulerExecutionTimer);
- if(iter.get(CFG_DB_SCHED_SPIN_TIME, &_schedulerSpinTimer)){
- ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
- "SchedulerSpinTimer missing");
- }
+ _schedulerSpinTimer = 0;
+ iter.get(CFG_DB_SCHED_SPIN_TIME, &_schedulerSpinTimer);
- if(iter.get(CFG_DB_REALTIME_SCHEDULER, &_realtimeScheduler)){
- ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
- "RealtimeScheduler missing");
- }
+ _realtimeScheduler = 0;
+ iter.get(CFG_DB_REALTIME_SCHEDULER, &_realtimeScheduler);
const char * mask;
if(iter.get(CFG_DB_EXECUTE_LOCK_CPU, &mask) == 0)
@@ -485,11 +479,12 @@ Configuration::setupConfiguration(){
_maintLockCPU = NO_LOCK_CPU;
iter.get(CFG_DB_MAINT_LOCK_CPU, &_maintLockCPU);
- if(iter.get(CFG_DB_WATCHDOG_INTERVAL_INITIAL, &_timeBetweenWatchDogCheckInitial)){
+ if(iter.get(CFG_DB_WATCHDOG_INTERVAL_INITIAL,
+ &_timeBetweenWatchDogCheckInitial)){
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
"TimeBetweenWatchDogCheckInitial missing");
}
-
+
/**
* Get paths
*/
@@ -504,14 +499,14 @@ Configuration::setupConfiguration(){
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
"RestartOnErrorInsert missing");
}
-
+
/**
* Create the watch dog thread
*/
{
if (_timeBetweenWatchDogCheckInitial < _timeBetweenWatchDogCheck)
_timeBetweenWatchDogCheckInitial = _timeBetweenWatchDogCheck;
-
+
Uint32 t = _timeBetweenWatchDogCheckInitial;
t = globalEmulatorData.theWatchDog ->setCheckInterval(t);
_timeBetweenWatchDogCheckInitial = t;
=== modified file 'storage/ndb/src/kernel/vm/Rope.cpp'
--- a/storage/ndb/src/kernel/vm/Rope.cpp 2006-12-31 01:29:11 +0000
+++ b/storage/ndb/src/kernel/vm/Rope.cpp 2008-12-12 14:30:54 +0000
@@ -43,7 +43,7 @@ ConstRope::copy(char* buf) const {
}
int
-ConstRope::compare(const char * str, size_t len) const {
+ConstRope::compare(const char * str, Uint32 len) const {
if(DEBUG_ROPE)
ndbout_c("ConstRope[ %d 0x%x 0x%x ]::compare(%s, %d)",
head.used, head.firstItem, head.lastItem, str, (int) len);
@@ -104,7 +104,7 @@ Rope::copy(char* buf) const {
}
int
-Rope::compare(const char * str, size_t len) const {
+Rope::compare(const char * str, Uint32 len) const {
if(DEBUG_ROPE)
ndbout_c("Rope::compare(%s, %d)", str, (int) len);
Uint32 left = head.used > len ? len : head.used;
@@ -140,7 +140,7 @@ Rope::compare(const char * str, size_t l
}
bool
-Rope::assign(const char * s, size_t len, Uint32 hash){
+Rope::assign(const char * s, Uint32 len, Uint32 hash){
if(DEBUG_ROPE)
ndbout_c("Rope::assign(%s, %d, 0x%x)", s, (int) len, hash);
m_hash = hash;
@@ -151,7 +151,7 @@ Rope::assign(const char * s, size_t len,
Uint32 buf = 0;
const char * src = (const char*)(((Uint32*)s)+(len >> 2));
char* dst = (char*)&buf;
- size_t left = len & 3;
+ Uint32 left = len & 3;
while(left){
* dst ++ = * src++;
left--;
=== modified file 'storage/ndb/src/kernel/vm/Rope.hpp'
--- a/storage/ndb/src/kernel/vm/Rope.hpp 2006-12-27 01:23:51 +0000
+++ b/storage/ndb/src/kernel/vm/Rope.hpp 2008-12-12 14:30:54 +0000
@@ -41,13 +41,13 @@ public:
~ConstRope(){
}
- size_t size() const;
+ Uint32 size() const;
bool empty() const;
void copy(char* buf) const;
int compare(const char * s) const { return compare(s, strlen(s) + 1); }
- int compare(const char *, size_t len) const;
+ int compare(const char *, Uint32 len) const;
private:
const RopeHandle & src;
@@ -67,17 +67,17 @@ public:
src.m_hash = m_hash;
}
- size_t size() const;
+ Uint32 size() const;
bool empty() const;
void copy(char* buf) const;
- int compare(const char * s) const { return compare(s, strlen(s) + 1); }
- int compare(const char *, size_t len) const;
+ int compare(const char * s) const { return compare(s, Uint32(strlen(s) + 1));}
+ int compare(const char *, Uint32 len) const;
- bool assign(const char * s) { return assign(s, strlen(s) + 1);}
- bool assign(const char * s, size_t l) { return assign(s, l, hash(s, l));}
- bool assign(const char *, size_t len, Uint32 hash);
+ bool assign(const char * s) { return assign(s, Uint32(strlen(s) + 1));}
+ bool assign(const char * s, Uint32 l) { return assign(s, l, hash(s, l));}
+ bool assign(const char *, Uint32 len, Uint32 hash);
void erase();
@@ -89,7 +89,7 @@ private:
};
inline
-size_t
+Uint32
Rope::size() const {
return head.used;
}
@@ -101,7 +101,7 @@ Rope::empty() const {
}
inline
-size_t
+Uint32
ConstRope::size() const {
return head.used;
}
=== modified file 'storage/ndb/src/mgmapi/mgmapi.cpp'
--- a/storage/ndb/src/mgmapi/mgmapi.cpp 2008-12-02 14:25:58 +0000
+++ b/storage/ndb/src/mgmapi/mgmapi.cpp 2008-12-12 14:30:54 +0000
@@ -3097,7 +3097,7 @@ ndb_mgm_set_configuration(NdbMgmHandle h
(void) base64_encode(buf.get_data(), buf.length(), (char*)encoded.c_str());
Properties args;
- args.put("Content-Length", strlen(encoded.c_str()));
+ args.put("Content-Length", (Uint32)strlen(encoded.c_str()));
args.put("Content-Type", "ndbconfig/octet-stream");
args.put("Content-Transfer-Encoding", "base64");
=== modified file 'storage/ndb/src/mgmsrv/Config.cpp'
--- a/storage/ndb/src/mgmsrv/Config.cpp 2008-11-13 07:57:54 +0000
+++ b/storage/ndb/src/mgmsrv/Config.cpp 2008-12-12 14:30:54 +0000
@@ -274,8 +274,8 @@ compare_value(const char* name, const ch
if (val != val2) {
Properties info(true);
info.put("Type", DT_DIFF);
- info.put("New", val2);
- info.put("Old", val);
+ info.put("New", Uint64(val2));
+ info.put("Old", Uint64(val));
add_diff(name, key,
diff,
pinfo->_fname, &info);
@@ -285,7 +285,7 @@ compare_value(const char* name, const ch
{
Properties info(true);
info.put("Type", DT_MISSING_VALUE);
- info.put("Old", val);
+ info.put("Old", Uint64(val));
add_diff(name, key,
diff,
pinfo->_fname, &info);
=== modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2008-12-02 13:10:49 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2008-12-12 14:30:54 +0000
@@ -2790,7 +2790,7 @@ ConfigInfo::ConfigInfo()
case CI_INT64:
{
require(InitConfigFileParser::convertStringToUint64(param._default, default_uint64));
- require(p->put(param._fname, default_uint64));
+ require(p->put(param._fname, Uint64(default_uint64)));
break;
}
}
@@ -3647,7 +3647,7 @@ fixPortNumber(InitConfigFileParser::Cont
if(!(ctx.m_userDefaults &&
ctx.m_userDefaults->get("PortNumber", &base)) &&
!ctx.m_systemDefaults->get("PortNumber", &base)) {
- base= strtoll(NDB_TCP_BASE_PORT,0,0);
+ base= (Uint32)strtoll(NDB_TCP_BASE_PORT,0,0);
}
ctx.m_userProperties.put("ServerPortBase", base);
}
=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.cpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.cpp 2008-11-12 08:17:14 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.cpp 2008-12-12 14:30:54 +0000
@@ -285,7 +285,7 @@ ClusterMgr::threadMain( ){
continue;
}
- theNode.hbCounter += timeSlept;
+ theNode.hbCounter += (Uint32)timeSlept;
if (theNode.hbCounter >= m_max_api_reg_req_interval ||
theNode.hbCounter >= theNode.hbFrequency) {
/**
=== modified file 'storage/ndb/src/ndbapi/DictCache.cpp'
--- a/storage/ndb/src/ndbapi/DictCache.cpp 2008-04-22 19:36:05 +0000
+++ b/storage/ndb/src/ndbapi/DictCache.cpp 2008-12-12 14:30:54 +0000
@@ -67,7 +67,7 @@ Ndb_local_table_info *
LocalDictCache::get(const char * name){
ASSERT_NOT_MYSQLD;
assert(! is_ndb_blob_table(name));
- const Uint32 len = strlen(name);
+ const Uint32 len = (Uint32)strlen(name);
return m_tableHash.getData(name, len);
}
@@ -76,14 +76,14 @@ LocalDictCache::put(const char * name, N
ASSERT_NOT_MYSQLD;
assert(! is_ndb_blob_table(name));
const Uint32 id = tab_info->m_table_impl->m_id;
- m_tableHash.insertKey(name, strlen(name), id, tab_info);
+ m_tableHash.insertKey(name, (Uint32)strlen(name), id, tab_info);
}
void
LocalDictCache::drop(const char * name){
ASSERT_NOT_MYSQLD;
assert(! is_ndb_blob_table(name));
- Ndb_local_table_info *info= m_tableHash.deleteKey(name, strlen(name));
+ Ndb_local_table_info *info= m_tableHash.deleteKey(name, (Uint32)strlen(name));
DBUG_ASSERT(info != 0);
Ndb_local_table_info::destroy(info);
}
@@ -180,7 +180,7 @@ GlobalDictCache::get(const char * name,
DBUG_PRINT("enter", ("name: %s", name));
assert(! is_ndb_blob_table(name));
- const Uint32 len = strlen(name);
+ const Uint32 len = (Uint32)strlen(name);
Vector<TableVersion> * versions = 0;
versions = m_tableHash.getData(name, len);
if(versions == 0){
@@ -256,7 +256,7 @@ GlobalDictCache::put(const char * name,
tab ? tab->m_version >> 24 : 0));
assert(! is_ndb_blob_table(name));
- const Uint32 len = strlen(name);
+ const Uint32 len = (Uint32)strlen(name);
Vector<TableVersion> * vers = m_tableHash.getData(name, len);
if(vers == 0){
// Should always tried to retreive it first
@@ -366,7 +366,7 @@ GlobalDictCache::release(const NdbTableI
assert(! is_ndb_blob_table(tab));
unsigned i;
- const Uint32 len = strlen(tab->m_internalName.c_str());
+ const Uint32 len = (Uint32)strlen(tab->m_internalName.c_str());
Vector<TableVersion> * vers =
m_tableHash.getData(tab->m_internalName.c_str(), len);
if(vers == 0){
@@ -426,7 +426,7 @@ GlobalDictCache::alter_table_rep(const c
{
DBUG_ENTER("GlobalDictCache::alter_table_rep");
assert(! is_ndb_blob_table(name));
- const Uint32 len = strlen(name);
+ const Uint32 len = (Uint32)strlen(name);
Vector<TableVersion> * vers =
m_tableHash.getData(name, len);
=== modified file 'storage/ndb/src/ndbapi/Ndb.cpp'
--- a/storage/ndb/src/ndbapi/Ndb.cpp 2008-11-13 15:30:02 +0000
+++ b/storage/ndb/src/ndbapi/Ndb.cpp 2008-12-12 14:30:54 +0000
@@ -382,7 +382,7 @@ Ndb::computeHash(Uint32 *retval,
UintPtr use = (org + 7) & ~(UintPtr)7;
buf = (void*)use;
- bufLen -= (use - org);
+ bufLen -= Uint32(use - org);
if (unlikely(sumlen > bufLen))
goto ebuftosmall;
@@ -440,7 +440,7 @@ Ndb::computeHash(Uint32 *retval,
pos += len;
}
}
- len = UintPtr(pos) - UintPtr(buf);
+ len = Uint32(UintPtr(pos) - UintPtr(buf));
assert((len & 3) == 0);
Uint32 values[4];
@@ -497,7 +497,7 @@ Ndb::computeHash(Uint32 *retval,
UintPtr use = (org + 7) & ~(UintPtr)7;
buf = (void*)use;
- bufLen -= (use - org);
+ bufLen -= Uint32(use - org);
}
for (Uint32 i = 0; i < parts; i++)
@@ -575,7 +575,7 @@ Ndb::computeHash(Uint32 *retval,
}
pos += len;
}
- len = UintPtr(pos) - UintPtr(buf);
+ len = Uint32(UintPtr(pos) - UintPtr(buf));
assert((len & 3) == 0);
Uint32 values[4];
=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2008-11-13 15:29:06 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2008-12-12 14:30:54 +0000
@@ -4866,7 +4866,7 @@ static int scanEventTable(Ndb* pNdb,
el.type = NdbDictionary::Object::TableEvent;
el.state = NdbDictionary::Object::StateOnline;
el.store = NdbDictionary::Object::StorePermanent;
- Uint32 len = strlen(event_name->aRef());
+ Uint32 len = (Uint32)strlen(event_name->aRef());
el.name = new char[len+1];
memcpy(el.name, event_name->aRef(), len);
el.name[len] = 0;
@@ -6919,7 +6919,7 @@ NdbDictInterface::get_filegroup(NdbFileg
NdbApiSignal tSignal(m_reference);
GetTabInfoReq * req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
- size_t strLen = strlen(name) + 1;
+ Uint32 strLen = (Uint32)strlen(name) + 1;
req->senderRef = m_reference;
req->senderData = 0;
@@ -7079,7 +7079,7 @@ NdbDictInterface::get_file(NdbFileImpl &
NdbApiSignal tSignal(m_reference);
GetTabInfoReq * req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
- size_t strLen = strlen(name) + 1;
+ Uint32 strLen = (Uint32)strlen(name) + 1;
req->senderRef = m_reference;
req->senderData = 0;
@@ -7228,7 +7228,7 @@ NdbDictInterface::get_hashmap(NdbHashMap
NdbApiSignal tSignal(m_reference);
GetTabInfoReq * req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
- size_t strLen = strlen(name) + 1;
+ Uint32 strLen = (Uint32)strlen(name) + 1;
req->senderRef = m_reference;
req->senderData = 0;
=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2008-11-11 12:54:17 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2008-12-12 14:30:54 +0000
@@ -1057,7 +1057,7 @@ inline
Uint32
Hash( const char* str ){
Uint32 h = 0;
- Uint32 len = strlen(str);
+ size_t len = strlen(str);
while(len >= 4){
h = (h << 5) + h + str[0];
h = (h << 5) + h + str[1];
=== modified file 'storage/ndb/src/ndbapi/NdbIndexStat.cpp'
--- a/storage/ndb/src/ndbapi/NdbIndexStat.cpp 2008-11-13 15:24:29 +0000
+++ b/storage/ndb/src/ndbapi/NdbIndexStat.cpp 2008-12-12 14:30:54 +0000
@@ -65,7 +65,7 @@ NdbIndexStat::alloc_cache(Uint32 entries
for (idir = 0; idir <= 1; idir++) {
Area& a = m_area[idir];
a.m_data = &m_cache[idir * areasize];
- a.m_offset = a.m_data - &m_cache[0];
+ a.m_offset = Uint32(a.m_data - &m_cache[0]);
a.m_free = areasize;
a.m_entries = 0;
a.m_idir = idir;
=== modified file 'storage/ndb/src/ndbapi/NdbOperationExec.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationExec.cpp 2008-12-09 17:25:55 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationExec.cpp 2008-12-12 14:30:54 +0000
@@ -154,10 +154,10 @@ NdbOperation::doSend(int aNodeId, Uint32
TransporterFacade *tp = theNdb->theImpl->m_transporter_facade;
TcKeyReq* tcKeyReq= (TcKeyReq*) theTCREQ->getDataPtrSend();
- const Uint32 inlineKIOffset= tcKeyReq->keyInfo - (Uint32*) tcKeyReq;
+ const Uint32 inlineKIOffset= Uint32(tcKeyReq->keyInfo - (Uint32*)tcKeyReq);
const Uint32 inlineKILength= MIN(TcKeyReq::MaxKeyInfo,
theTupKeyLen);
- const Uint32 inlineAIOffset = tcKeyReq->attrInfo - (Uint32*) tcKeyReq;
+ const Uint32 inlineAIOffset = Uint32(tcKeyReq->attrInfo -(Uint32*)tcKeyReq);
const Uint32 inlineAILength= MIN(TcKeyReq::MaxAttrInfo,
theTotalCurrAI_Len);
=== modified file 'storage/ndb/src/ndbapi/NdbOperationSearch.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2008-12-09 17:25:55 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2008-12-12 14:30:54 +0000
@@ -152,7 +152,7 @@ NdbOperation::equal_impl(const NdbColumn
const bool tDistrKey = tAttrInfo->m_distributionKey;
const int attributeSize = sizeInBytes;
const int slack = sizeInBytes & 3;
- const int align = UintPtr(aValue) & 7;
+ const int align = Uint32(UintPtr(aValue)) & 7;
if (((align & 3) != 0) || (slack != 0) || (tDistrKey && (align != 0)))
{
=== modified file 'storage/ndb/src/ndbapi/NdbReceiver.cpp'
--- a/storage/ndb/src/ndbapi/NdbReceiver.cpp 2008-10-01 07:59:05 +0000
+++ b/storage/ndb/src/ndbapi/NdbReceiver.cpp 2008-12-12 14:30:54 +0000
@@ -305,7 +305,7 @@ handle_packed_bit(const char* _src, Uint
/* Convert char* to aligned Uint32* and some byte offset */
UintPtr uiPtr= UintPtr((Uint32*)_dst);
- Uint32 dstByteOffset= uiPtr & 3;
+ Uint32 dstByteOffset= Uint32(uiPtr) & 3;
Uint32* dst= (Uint32*) (uiPtr - dstByteOffset);
BitmaskImpl::copyField(dst, dstByteOffset << 3,
=== modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2008-12-09 17:25:55 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2008-12-12 14:30:54 +0000
@@ -582,7 +582,7 @@ NdbIndexScanOperation::setDistKeyFromRan
const Uint32 MaxKeySizeInLongWords= (NDB_MAX_KEY_SIZE + 7) / 8;
Uint64 tmp[ MaxKeySizeInLongWords ];
char* tmpshrink = (char*)tmp;
- size_t tmplen = sizeof(tmp);
+ Uint32 tmplen = (Uint32)sizeof(tmp);
Ndb::Key_part_ptr ptrs[NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY+1];
Uint32 i;
=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp 2008-11-13 13:36:29 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp 2008-12-12 14:30:54 +0000
@@ -1849,7 +1849,7 @@ int PollGuard::wait_for_input_in_loop(in
#endif
continue;
}
- wait_time= max_time - NdbTick_CurrentMillisecond();
+ wait_time= int(max_time - NdbTick_CurrentMillisecond());
if (wait_time <= 0)
{
#ifdef VM_TRACE
=== modified file 'storage/ndb/test/include/DbUtil.hpp'
--- a/storage/ndb/test/include/DbUtil.hpp 2008-10-30 15:15:48 +0000
+++ b/storage/ndb/test/include/DbUtil.hpp 2008-12-12 14:14:52 +0000
@@ -104,7 +104,7 @@ public:
bool doQuery(BaseString& str, const Properties& args, SqlResultSet& result);
bool doQuery(BaseString& str, const Properties& args);
- bool waitConnected(int timeout);
+ bool waitConnected(int timeout = 120);
bool databaseLogin(const char * host,
const char * user,
=== modified file 'storage/ndb/test/ndbapi/testUpgrade.cpp'
--- a/storage/ndb/test/ndbapi/testUpgrade.cpp 2008-08-04 13:40:17 +0000
+++ b/storage/ndb/test/ndbapi/testUpgrade.cpp 2008-12-12 14:44:00 +0000
@@ -45,7 +45,7 @@ int runUpgrade_NR1(NDBT_Context* ctx, ND
g_err << "Cluster '" << clusters.column("name")
<< "@" << tmp_result.column("connectstring") << "'" << endl;
- if (restarter.waitClusterStarted(1))
+ if (restarter.waitClusterStarted())
return NDBT_FAILED;
// Restart ndb_mgmd(s)
@@ -65,7 +65,7 @@ int runUpgrade_NR1(NDBT_Context* ctx, ND
}
ndbout << "Waiting for started"<< endl;
- if (restarter.waitClusterStarted(1))
+ if (restarter.waitClusterStarted())
return NDBT_FAILED;
ndbout << "Started"<< endl;
@@ -126,7 +126,7 @@ int runUpgrade_NR2(NDBT_Context* ctx, ND
g_err << "Cluster '" << clusters.column("name")
<< "@" << tmp_result.column("connectstring") << "'" << endl;
- if(restarter.waitClusterStarted(1))
+ if(restarter.waitClusterStarted())
return NDBT_FAILED;
// Restart ndb_mgmd(s)
@@ -144,6 +144,8 @@ int runUpgrade_NR2(NDBT_Context* ctx, ND
return NDBT_FAILED;
}
+ NdbSleep_SecSleep(5); // TODO, handle arbitration
+
// Restart one ndbd in each node group
SqlResultSet ndbds;
if (!atrt.getNdbds(clusterId, ndbds))
@@ -239,7 +241,7 @@ int runUpgrade_NR3(NDBT_Context* ctx, ND
g_err << "Cluster '" << clusters.column("name")
<< "@" << tmp_result.column("connectstring") << "'" << endl;
- if(restarter.waitClusterStarted(1))
+ if(restarter.waitClusterStarted())
return NDBT_FAILED;
// Restart ndb_mgmd(s)
@@ -257,6 +259,8 @@ int runUpgrade_NR3(NDBT_Context* ctx, ND
return NDBT_FAILED;
}
+ NdbSleep_SecSleep(5); // TODO, handle arbitration
+
// Restart one ndbd in each node group
SqlResultSet ndbds;
if (!atrt.getNdbds(clusterId, ndbds))
@@ -338,14 +342,14 @@ int runCheckStarted(NDBT_Context* ctx, N
// Check cluster is started
NdbRestarter restarter;
- if(restarter.waitClusterStarted(1) != 0){
+ if(restarter.waitClusterStarted() != 0){
g_err << "All nodes was not started " << endl;
return NDBT_FAILED;
}
// Check atrtclient is started
AtrtClient atrt;
- if(!atrt.waitConnected(60)){
+ if(!atrt.waitConnected()){
g_err << "atrt server was not started " << endl;
return NDBT_FAILED;
}
@@ -357,7 +361,7 @@ int runCheckStarted(NDBT_Context* ctx, N
while (procs.next())
{
- if (procs.columnAsInt("node_id") == -1){
+ if (procs.columnAsInt("node_id") == (unsigned)-1){
ndbout << "Found one process with node_id -1, "
<< "use --fix-nodeid=1 to atrt to fix this" << endl;
return NDBT_FAILED;
@@ -367,118 +371,21 @@ int runCheckStarted(NDBT_Context* ctx, N
return NDBT_OK;
}
-
-int runRestoreProcs(NDBT_Context* ctx, NDBT_Step* step){
- AtrtClient atrt;
- g_err << "Starting to reset..." << endl;
-
- SqlResultSet clusters;
- if (!atrt.getClusters(clusters))
- return NDBT_FAILED;
-
- while (clusters.next())
- {
- uint clusterId= clusters.columnAsInt("id");
- SqlResultSet tmp_result;
- if (!atrt.getConnectString(clusterId, tmp_result))
- return NDBT_FAILED;
-
- NdbRestarter restarter(tmp_result.column("connectstring"));
- restarter.setReconnect(true); // Restarting mgmd
- g_err << "Cluster '" << clusters.column("name")
- << "@" << tmp_result.column("connectstring") << "'" << endl;
-
- if(restarter.waitClusterStarted(1))
- return NDBT_FAILED;
-
- // Reset ndb_mgmd(s)
- SqlResultSet mgmds;
- if (!atrt.getMgmds(clusterId, mgmds))
- return NDBT_FAILED;
-
- while (mgmds.next())
- {
- ndbout << "Reset mgmd" << mgmds.columnAsInt("node_id") << endl;
- if (!atrt.resetProc(mgmds.columnAsInt("id")))
- return NDBT_FAILED;
-
- if(restarter.waitConnected() != 0)
- return NDBT_FAILED;
- }
-
- if(restarter.waitClusterStarted(1))
- return NDBT_FAILED;
-
- // Reset ndbd(s)
- SqlResultSet ndbds;
- if (!atrt.getNdbds(clusterId, ndbds))
- return NDBT_FAILED;
-
- while(ndbds.next())
- {
- int nodeId = ndbds.columnAsInt("node_id");
- int processId = ndbds.columnAsInt("id");
- ndbout << "Reset node " << nodeId << endl;
-
- if (!atrt.resetProc(processId))
- return NDBT_FAILED;
-
- }
-
- if (restarter.waitClusterNoStart())
- return NDBT_FAILED;
-
- }
-
-
- // All nodes are in no start, start them up again
- clusters.reset();
- while (clusters.next())
- {
- uint clusterId= clusters.columnAsInt("id");
- SqlResultSet tmp_result;
- if (!atrt.getConnectString(clusterId, tmp_result))
- return NDBT_FAILED;
-
- NdbRestarter restarter(tmp_result.column("connectstring"));
- g_err << "Cluster '" << clusters.column("name")
- << "@" << tmp_result.column("connectstring") << "'" << endl;
-
- if (restarter.waitClusterNoStart())
- return NDBT_FAILED;
-
- ndbout << "Starting and wait for started..." << endl;
- if (restarter.startAll())
- return NDBT_FAILED;
-
- if (restarter.waitClusterStarted())
- return NDBT_FAILED;
- }
-
- ctx->stopTest();
- return NDBT_OK;
-}
-
-
-
NDBT_TESTSUITE(testUpgrade);
TESTCASE("Upgrade_NR1",
"Test that one node at a time can be upgraded"){
INITIALIZER(runCheckStarted);
STEP(runUpgrade_NR1);
- FINALIZER(runRestoreProcs);
}
TESTCASE("Upgrade_NR2",
"Test that one node in each nodegroup can be upgradde simultaneously"){
INITIALIZER(runCheckStarted);
STEP(runUpgrade_NR2);
- FINALIZER(runRestoreProcs);
}
TESTCASE("Upgrade_NR3",
"Test that one node in each nodegroup can be upgrade simultaneously"){
INITIALIZER(runCheckStarted);
STEP(runUpgrade_NR3);
- FINALIZER(runRestoreProcs);
}
NDBT_TESTSUITE_END(testUpgrade);
=== modified file 'storage/ndb/test/run-test/Makefile.am'
--- a/storage/ndb/test/run-test/Makefile.am 2008-10-21 12:41:59 +0000
+++ b/storage/ndb/test/run-test/Makefile.am 2008-12-12 14:44:00 +0000
@@ -23,8 +23,8 @@ include $(top_srcdir)/storage/ndb/config
test_PROGRAMS = atrt
test_DATA=daily-basic-tests.txt daily-devel-tests.txt 16node-tests.txt \
conf-ndbmaster.cnf \
- conf-fimafeng08.cnf conf-dl145a.cnf test-tests.txt conf-test.cnf db.sql
-# conf-dl145a.cnf test-tests.txt conf-test.cnf db.sql
+ conf-fimafeng08.cnf conf-dl145a.cnf test-tests.txt conf-test.cnf db.sql \
+ conf-upgrade.cnf upgrade-tests.txt
test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
autotest-run.sh atrt-backtrace.sh
=== modified file 'storage/ndb/test/run-test/atrt-gather-result.sh'
--- a/storage/ndb/test/run-test/atrt-gather-result.sh 2007-02-16 20:09:38 +0000
+++ b/storage/ndb/test/run-test/atrt-gather-result.sh 2008-12-12 09:40:06 +0000
@@ -12,5 +12,18 @@ do
shift
done
-
-
+#
+# clean tables...not to make results too large
+#
+lst=$(find . -name '*.frm')
+if [ "$lst" ]
+then
+ for i in $lst
+ do
+ basename=$(echo $i | sed 's!\.frm!!')
+ if [ "$basename" ]
+ then
+ rm -f $basename.*
+ fi
+ done
+fi
=== modified file 'storage/ndb/test/run-test/atrt.hpp'
--- a/storage/ndb/test/run-test/atrt.hpp 2008-11-26 12:26:00 +0000
+++ b/storage/ndb/test/run-test/atrt.hpp 2008-12-12 08:48:37 +0000
@@ -149,10 +149,17 @@ bool setup_hosts(atrt_config&);
bool do_command(atrt_config& config);
-bool
-start_process(atrt_process & proc);
-bool
-stop_process(atrt_process & proc);
+bool start_process(atrt_process & proc);
+bool stop_process(atrt_process & proc);
+
+/**
+ * check configuration if any changes has been
+ * done for the duration of the latest running test
+ * if so, return true, and reset those changes
+ * (true, indicates that a restart is needed to actually
+ * reset the running processes)
+ */
+bool reset_config(atrt_config&);
NdbOut&
operator<<(NdbOut& out, const atrt_process& proc);
=== modified file 'storage/ndb/test/run-test/autotest-boot.sh'
--- a/storage/ndb/test/run-test/autotest-boot.sh 2008-12-10 15:35:47 +0000
+++ b/storage/ndb/test/run-test/autotest-boot.sh 2008-12-12 14:14:52 +0000
@@ -171,9 +171,9 @@ fi
if [ -z "$tag1" ]
then
- dst_place1=${build_dir}/clone-$clone1-$DATE.$$
+ dst_place1=${build_dir}/clone1-$clone1-$DATE.$$
else
- dst_place1=${build_dir}/clone-$tag1-$DATE.$$
+ dst_place1=${build_dir}/clone1-$tag1-$DATE.$$
extra_args="$extra_args --clone1=$tag1"
extra_clone1="-r$tag1"
fi
=== modified file 'storage/ndb/test/run-test/autotest-run.sh'
--- a/storage/ndb/test/run-test/autotest-run.sh 2008-12-10 15:35:47 +0000
+++ b/storage/ndb/test/run-test/autotest-run.sh 2008-12-12 14:14:52 +0000
@@ -218,8 +218,9 @@ choose_conf(){
#########################################
count_hosts(){
- cnt=`grep "CHOOSE_host" $1 | awk '{for(i=1; i<=NF;i++) \
- if(index($i, "CHOOSE_host") > 0) print $i;}' | sort | uniq | wc -l`
+ ch="CHOOSE_host"
+ cnt=$(for i in `grep $ch $1 | sed 's!,! !g'` ; do echo $i; done\
+ | grep $ch | sort | uniq | wc -l)
echo $cnt
}
@@ -252,18 +253,22 @@ cd $run_dir
choose $conf $hosts > d.tmp.$$
sed -e s,CHOOSE_dir,"$run_dir/run",g < d.tmp.$$ > my.cnf
+prefix="--prefix=$install_dir0"
+if [ "$install_dir1" ]
+then
+ prefix="$prefix --prefix1=$install_dir1"
+fi
+
+
# Setup configuration
-$atrt Cdq my.cnf
+$atrt Cdq $prefix my.cnf
# Start...
args=""
args="--report-file=report.txt"
args="$args --log-file=log.txt"
args="$args --testcase-file=$test_dir/$RUN-tests.txt"
-if [ "$install_dir1" ]
-then
- args="$args --prefix=$install_dir0 --prefix1=$install_dir1"
-fi
+args="$args $prefix"
$atrt $args my.cnf
# Make tar-ball
=== modified file 'storage/ndb/test/run-test/command.cpp'
--- a/storage/ndb/test/run-test/command.cpp 2008-11-27 18:03:09 +0000
+++ b/storage/ndb/test/run-test/command.cpp 2008-12-12 08:48:37 +0000
@@ -83,10 +83,12 @@ do_change_version(atrt_config& config, S
atrt_process& proc= *config.m_processes[process_id];
// Save current proc state
- assert(proc.m_save.m_saved == false);
- proc.m_save.m_proc= proc.m_proc;
- proc.m_save.m_saved= true;
-
+ if (proc.m_save.m_saved == false)
+ {
+ proc.m_save.m_proc= proc.m_proc;
+ proc.m_save.m_saved= true;
+ }
+
g_logger.info("stopping process...");
if (!stop_process(proc))
return false;
@@ -145,7 +147,7 @@ do_reset_proc(atrt_config& config, SqlRe
{
ndbout << "process has not changed" << endl;
}
-
+
g_logger.info("starting process...");
if (!start_process(proc))
return false;
=== added file 'storage/ndb/test/run-test/conf-upgrade.cnf'
--- a/storage/ndb/test/run-test/conf-upgrade.cnf 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/test/run-test/conf-upgrade.cnf 2008-12-12 08:04:28 +0000
@@ -0,0 +1,28 @@
+[atrt]
+basedir = CHOOSE_dir
+baseport = 14000
+clusters = .4node
+mysqld = CHOOSE_host1
+fix-nodeid=1
+
+[ndb_mgmd]
+
+[mysqld]
+skip-innodb
+loose-skip-bdb
+
+[cluster_config.4node]
+ndb_mgmd = CHOOSE_host1,CHOOSE_host1
+ndbd = CHOOSE_host2,CHOOSE_host3,CHOOSE_host2,CHOOSE_host3
+ndbapi= CHOOSE_host1,CHOOSE_host1,CHOOSE_host1
+
+NoOfReplicas = 2
+IndexMemory = 50M
+DataMemory = 100M
+BackupMemory = 64M
+MaxNoOfConcurrentScans = 100
+MaxNoOfSavedMessages= 1000
+SendBufferMemory = 2M
+NoOfFragmentLogFiles = 4
+FragmentLogFileSize = 64M
+
=== modified file 'storage/ndb/test/run-test/files.cpp'
--- a/storage/ndb/test/run-test/files.cpp 2008-11-03 12:33:34 +0000
+++ b/storage/ndb/test/run-test/files.cpp 2008-12-12 14:44:00 +0000
@@ -116,6 +116,11 @@ setup_files(atrt_config& config, int set
BaseString mycnf;
mycnf.assfmt("%s/my.cnf", g_basedir);
+ if (!create_directory(g_basedir))
+ {
+ return false;
+ }
+
if (mycnf != g_my_cnf)
{
struct stat sbuf;
=== modified file 'storage/ndb/test/run-test/main.cpp'
--- a/storage/ndb/test/run-test/main.cpp 2008-09-25 10:39:40 +0000
+++ b/storage/ndb/test/run-test/main.cpp 2008-12-12 14:44:00 +0000
@@ -258,15 +258,19 @@ main(int argc, char ** argv)
/**
* Main loop
*/
- while(!feof(g_test_case_file)){
+ while(!feof(g_test_case_file))
+ {
/**
* Do we need to restart ndb
*/
- if(restart){
+ if(restart)
+ {
+ restart = false;
g_logger.info("(Re)starting server processes...");
+
if(!stop_processes(g_config, ~0))
goto end;
-
+
if (!setup_directories(g_config, 2))
goto end;
@@ -280,7 +284,7 @@ main(int argc, char ** argv)
{
g_logger.info("Failed to start server processes");
g_logger.info("Gathering logs and saving them as test %u", test_no);
-
+
int tmp;
if(!gather_result(g_config, &tmp))
goto end;
@@ -331,31 +335,37 @@ main(int argc, char ** argv)
const time_t start = time(0);
time_t now = start;
- do {
+ do
+ {
if(!update_status(g_config, atrt_process::AP_ALL))
goto end;
-
- if(is_running(g_config, p_ndb) != 2){
+
+ if(is_running(g_config, p_ndb) != 2)
+ {
result = ERR_NDB_FAILED;
break;
}
-
- if(is_running(g_config, p_servers) != 2){
+
+ if(is_running(g_config, p_servers) != 2)
+ {
result = ERR_SERVERS_FAILED;
break;
}
- if(is_running(g_config, p_clients) == 0){
+ if(is_running(g_config, p_clients) == 0)
+ {
break;
}
- if (!do_command(g_config)){
+ if (!do_command(g_config))
+ {
result = ERR_COMMAND_FAILED;
break;
}
now = time(0);
- if(now > (start + test_case.m_max_time)){
+ if(now > (start + test_case.m_max_time))
+ {
result = ERR_MAX_TIME_ELAPSED;
break;
}
@@ -375,18 +385,20 @@ main(int argc, char ** argv)
test_no,
(result == 0 ? "OK" : "FAILED"), result);
- if(g_report_file != 0){
+ if(g_report_file != 0)
+ {
fprintf(g_report_file, "%s ; %d ; %d ; %ld\n",
test_case.m_name.c_str(), test_no, result, elapsed);
fflush(g_report_file);
}
- if(g_mode == 0 && result){
+ if(g_mode == 0 && result)
+ {
g_logger.info
("Encountered failed test in interactive mode - terminating");
break;
}
-
+
BaseString resdir;
resdir.assfmt("result.%d", test_no);
remove_dir(resdir.c_str(), true);
@@ -404,11 +416,15 @@ main(int argc, char ** argv)
{
remove_dir("result", true);
}
+
+ if (reset_config(g_config))
+ {
+ restart = true;
+ }
- if(result != 0){
+ if(result != 0)
+ {
restart = true;
- } else {
- restart = false;
}
test_no++;
}
@@ -870,7 +886,8 @@ next:
bool
start_process(atrt_process & proc){
if(proc.m_proc.m_id != -1){
- g_logger.critical("starting already started process: %d", proc.m_index);
+ g_logger.critical("starting already started process: %u",
+ (unsigned)proc.m_index);
return false;
}
@@ -1141,13 +1158,23 @@ setup_test_case(atrt_config& config, con
if(proc.m_type == atrt_process::AP_NDB_API ||
proc.m_type == atrt_process::AP_CLIENT)
{
- proc.m_proc.m_path = "";
+ BaseString cmd;
if (tc.m_command.c_str()[0] != '/')
{
- proc.m_proc.m_path.appfmt("%s/bin/", g_prefix);
+ cmd.appfmt("%s/bin/", g_prefix);
+ }
+ cmd.append(tc.m_command.c_str());
+
+ if (0) // valgrind
+ {
+ proc.m_proc.m_path = "/usr/bin/valgrind";
+ proc.m_proc.m_args.appfmt("%s %s", cmd.c_str(), tc.m_args.c_str());
+ }
+ else
+ {
+ proc.m_proc.m_path = cmd;
+ proc.m_proc.m_args.assign(tc.m_args);
}
- proc.m_proc.m_path.append(tc.m_command.c_str());
- proc.m_proc.m_args.assign(tc.m_args);
if(!tc.m_run_all)
break;
}
@@ -1222,28 +1249,38 @@ setup_hosts(atrt_config& config){
return true;
}
+static
+bool
+do_rsync(const char *dir, const char *dst)
+{
+ BaseString tmp = g_setup_progname;
+ tmp.appfmt(" %s %s/ %s", dst, dir, dir);
+
+ g_logger.info("rsyncing %s to %s", dir, dst);
+ g_logger.debug("system(%s)", tmp.c_str());
+ const int r1 = system(tmp.c_str());
+ if(r1 != 0)
+ {
+ g_logger.critical("Failed to rsync %s to %s", dir, dst);
+ return false;
+ }
+
+ return true;
+}
+
bool
deploy(atrt_config & config)
{
for (size_t i = 0; i<config.m_hosts.size(); i++)
{
- BaseString tmp = g_setup_progname;
- tmp.appfmt(" %s %s/ %s",
- config.m_hosts[i]->m_hostname.c_str(),
- g_prefix,
- g_prefix);
-
- g_logger.info("rsyncing %s to %s", g_prefix,
- config.m_hosts[i]->m_hostname.c_str());
- g_logger.debug("system(%s)", tmp.c_str());
- const int r1 = system(tmp.c_str());
- if(r1 != 0)
- {
- g_logger.critical("Failed to rsync %s to %s",
- g_prefix,
- config.m_hosts[i]->m_hostname.c_str());
+ if (!do_rsync(g_basedir, config.m_hosts[i]->m_hostname.c_str()))
+ return false;
+
+ if (!do_rsync(g_prefix, config.m_hosts[i]->m_hostname.c_str()))
+ return false;
+
+ if (g_prefix1 && !do_rsync(g_prefix1, config.m_hosts[i]->m_hostname.c_str()))
return false;
- }
}
return true;
@@ -1342,6 +1379,27 @@ require(bool x)
abort();
}
+bool
+reset_config(atrt_config & config)
+{
+ bool changed = false;
+ for(size_t i = 0; i<config.m_processes.size(); i++)
+ {
+ atrt_process & proc = *config.m_processes[i];
+ if (proc.m_save.m_saved)
+ {
+ if (!stop_process(proc))
+ return false;
+
+ changed = true;
+ proc.m_save.m_saved = false;
+ proc.m_proc = proc.m_save.m_proc;
+ proc.m_proc.m_id = -1;
+ }
+ }
+ return changed;
+}
+
template class Vector<Vector<SimpleCpcClient::Process> >;
template class Vector<atrt_host*>;
template class Vector<atrt_cluster*>;
=== modified file 'storage/ndb/test/run-test/setup.cpp'
--- a/storage/ndb/test/run-test/setup.cpp 2008-12-05 09:58:51 +0000
+++ b/storage/ndb/test/run-test/setup.cpp 2008-12-12 14:44:00 +0000
@@ -52,14 +52,14 @@ bool
setup_config(atrt_config& config, const char* atrt_mysqld)
{
BaseString tmp(g_clusters);
- Vector<BaseString> clusters;
- tmp.split(clusters, ",");
-
+
if (atrt_mysqld)
{
- clusters.push_back(BaseString(".atrt"));
+ tmp.appfmt(",.atrt");
}
-
+ Vector<BaseString> clusters;
+ tmp.split(clusters, ",");
+
bool fqpn = clusters.size() > 1 || g_fqpn;
size_t j,k;
@@ -134,6 +134,7 @@ setup_config(atrt_config& config, const
proc_args[1].value = 0;
proc_args[2].value = 0;
proc_args[3].value = 0;
+ proc_args[4].value = atrt_mysqld;
}
/**
@@ -157,10 +158,11 @@ setup_config(atrt_config& config, const
/**
* Load cluster options
*/
-
- argc = 1;
+ int argc = 1;
+ const char * argv[] = { "atrt", 0, 0 };
argv[argc++] = buf.c_str();
const char *groups[] = { "mysql_cluster", 0 };
+ char ** tmp = (char**)argv;
ret = load_defaults(g_my_cnf, groups, &argc, &tmp);
if (ret)
@@ -204,7 +206,7 @@ load_process(atrt_config& config, atrt_c
{
atrt_host * host_ptr = find(hostname, config.m_hosts);
atrt_process *proc_ptr = new atrt_process;
-
+
config.m_processes.push_back(proc_ptr);
host_ptr->m_processes.push_back(proc_ptr);
cluster.m_processes.push_back(proc_ptr);
@@ -215,7 +217,11 @@ load_process(atrt_config& config, atrt_c
proc.m_index = idx;
proc.m_type = type;
proc.m_host = host_ptr;
- proc.m_nodeid= cluster.m_next_nodeid++;
+ proc.m_save.m_saved = false;
+ if (g_fix_nodeid)
+ proc.m_nodeid= cluster.m_next_nodeid++;
+ else
+ proc.m_nodeid= -1;
proc.m_cluster = &cluster;
proc.m_options.m_features = 0;
proc.m_rep_src = 0;
=== added file 'storage/ndb/test/run-test/upgrade-tests.txt'
--- a/storage/ndb/test/run-test/upgrade-tests.txt 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/test/run-test/upgrade-tests.txt 2008-12-12 08:56:22 +0000
@@ -0,0 +1,12 @@
+cmd: testUpgrade
+args: -n Upgrade_NR1 T1
+max-time: 600
+
+cmd: testUpgrade
+args: -n Upgrade_NR2 T1
+max-time: 600
+
+cmd: testUpgrade
+args: -n Upgrade_NR3 T1
+max-time: 600
+
=== modified file 'storage/ndb/test/src/DbUtil.cpp'
--- a/storage/ndb/test/src/DbUtil.cpp 2008-11-10 10:55:33 +0000
+++ b/storage/ndb/test/src/DbUtil.cpp 2008-12-12 14:14:52 +0000
@@ -360,7 +360,7 @@ DbUtil::runQuery(const char* sql,
MYSQL_BIND *bind_param = new MYSQL_BIND[params];
NdbAutoObjArrayPtr<MYSQL_BIND> _guard(bind_param);
- bzero(bind_param, sizeof(bind_param));
+ bzero(bind_param, params * sizeof(MYSQL_BIND));
for(uint i= 0; i < mysql_stmt_param_count(stmt); i++)
{
@@ -431,7 +431,7 @@ DbUtil::runQuery(const char* sql,
uint num_fields= mysql_num_fields(res);
MYSQL_BIND *bind_result = new MYSQL_BIND[num_fields];
NdbAutoObjArrayPtr<MYSQL_BIND> _guard1(bind_result);
- bzero(bind_result, sizeof(bind_result));
+ bzero(bind_result, num_fields * sizeof(MYSQL_BIND));
for (uint i= 0; i < num_fields; i++)
{
@@ -439,6 +439,8 @@ DbUtil::runQuery(const char* sql,
switch(fields[i].type){
case MYSQL_TYPE_STRING:
+ buf_len = fields[i].length + 1;
+ break;
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
buf_len= fields[i].max_length + 1;
@@ -446,14 +448,18 @@ DbUtil::runQuery(const char* sql,
case MYSQL_TYPE_LONGLONG:
buf_len= sizeof(long long);
break;
+ case MYSQL_TYPE_LONG:
+ buf_len = sizeof(long);
+ break;
default:
break;
}
-
+
bind_result[i].buffer_type= fields[i].type;
bind_result[i].buffer= malloc(buf_len);
bind_result[i].buffer_length= buf_len;
-
+ bind_result[i].is_null = (my_bool*)malloc(sizeof(my_bool));
+ * bind_result[i].is_null = 0;
}
if (mysql_stmt_bind_result(stmt, bind_result)){
@@ -466,8 +472,11 @@ DbUtil::runQuery(const char* sql,
{
Properties curr(true);
for (uint i= 0; i < num_fields; i++){
+ if (* bind_result[i].is_null)
+ continue;
switch(fields[i].type){
case MYSQL_TYPE_STRING:
+ ((char*)bind_result[i].buffer)[fields[i].max_length] = 0;
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
curr.put(fields[i].name, (char*)bind_result[i].buffer);
@@ -481,7 +490,7 @@ DbUtil::runQuery(const char* sql,
default:
curr.put(fields[i].name, *(int*)bind_result[i].buffer);
break;
- }
+ }
}
rows.put("row", row++, &curr);
}
@@ -489,8 +498,10 @@ DbUtil::runQuery(const char* sql,
mysql_free_result(res);
for (uint i= 0; i < num_fields; i++)
+ {
free(bind_result[i].buffer);
-
+ free(bind_result[i].is_null);
+ }
}
// Save stats in result set
| Thread |
|---|
| • bzr push into mysql-5.1 branch (jonas:3171 to 3173) | Jonas Oreland | 12 Dec |