Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0-rpl

into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge
parents 38a450b4 6ad198e9
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_configs="$max_configs --with-ndb-test --with-ndb-ccflags='-DERROR_INSERT'"
if [ "$full_debug" ]
then
extra_flags="$debug_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$debug_configs $extra_configs"
else
extra_flags="$fast_cflags"
fi
extra_flags="$extra_flags $max_cflags -g"
. "$path/FINISH.sh"
This diff is collapsed.
......@@ -2892,3 +2892,127 @@ CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
drop table t1;
drop user mysqltest_1@localhost;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mysqldump_tables`;
DROP TABLE IF EXISTS `basetable`;
CREATE TABLE `basetable` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`tag` varchar(64) default NULL,
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `basetable` WRITE;
/*!40000 ALTER TABLE `basetable` DISABLE KEYS */;
/*!40000 ALTER TABLE `basetable` ENABLE KEYS */;
UNLOCK TABLES;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mysqldump_views`;
DROP TABLE IF EXISTS `nasishnasifu`;
/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/;
/*!50001 CREATE TABLE `nasishnasifu` (
`id` bigint(20) unsigned
) */;
/*!50001 DROP TABLE IF EXISTS `nasishnasifu`*/;
/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop view nasishnasifu;
drop database mysqldump_views;
drop table mysqldump_tables.basetable;
drop database mysqldump_tables;
USE test;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
"a b" int(11) NOT NULL default '0',
"c""d" int(11) NOT NULL default '0',
"e`f" int(11) NOT NULL default '0',
PRIMARY KEY ("a b","c""d","e`f")
);
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
INSERT INTO "t1" VALUES (815,4711,2006);
/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` int(11) NOT NULL default '0',
`c"d` int(11) NOT NULL default '0',
`e``f` int(11) NOT NULL default '0',
PRIMARY KEY (`a b`,`c"d`,`e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES (815,4711,2006);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE `t1`;
End of 5.0 tests
......@@ -1309,3 +1309,31 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
# Clean up
drop table t1;
drop user mysqltest_1@localhost;
--exec $MYSQL_DUMP --skip-comments --databases mysqldump_tables mysqldump_views;
drop view nasishnasifu;
drop database mysqldump_views;
drop table mysqldump_tables.basetable;
drop database mysqldump_tables;
USE test;
#
# BUG#13926: --order-by-primary fails if PKEY contains quote character
#
--disable_warnings
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1
--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1
DROP TABLE `t1`;
--enable_warnings
--echo End of 5.0 tests
......@@ -477,7 +477,7 @@ public:
/**
* Interpreted program instruction:
* Substract RegSource1 from RegSource2 and put the result in RegDest.
* Substract RegSource2 from RegSource1 and put the result in RegDest.
*
* @param RegSource1 First register.
* @param RegSource2 Second register.
......
......@@ -6,7 +6,7 @@ Next DBTUP 4014
Next DBLQH 5043
Next DBDICT 6007
Next DBDIH 7177
Next DBTC 8037
Next DBTC 8038
Next CMVMI 9000
Next BACKUP 10022
Next DBUTIL 11002
......@@ -283,6 +283,7 @@ ABORT OF TCKEYREQ
8032: No free TC records any more
8037 : Invalid schema version in TCINDXREQ
CMVMI
-----
......
......@@ -8252,11 +8252,21 @@ void Dbdih::openingTableErrorLab(Signal* signal, FileRecordPtr filePtr)
/* 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. */
/* ---------------------------------------------------------------------- */
ndbrequire(filePtr.i == tabPtr.p->tabFile[0]);
filePtr.i = tabPtr.p->tabFile[1];
ptrCheckGuard(filePtr, cfileFileSize, fileRecord);
openFileRw(signal, filePtr);
filePtr.p->reqStatus = FileRecord::OPENING_TABLE;
if (filePtr.i == tabPtr.p->tabFile[0])
{
filePtr.i = tabPtr.p->tabFile[1];
ptrCheckGuard(filePtr, cfileFileSize, fileRecord);
openFileRw(signal, filePtr);
filePtr.p->reqStatus = FileRecord::OPENING_TABLE;
}
else
{
char buf[256];
BaseString::snprintf(buf, sizeof(buf),
"Error opening DIH schema files for table: %d",
tabPtr.i);
progError(__LINE__, NDBD_EXIT_AFS_NO_SUCH_FILE, buf);
}
}//Dbdih::openingTableErrorLab()
void Dbdih::readingTableLab(Signal* signal, FileRecordPtr filePtr)
......@@ -8422,6 +8432,7 @@ Dbdih::resetReplicaSr(TabRecordPtr tabPtr){
}
replicaPtr.i = nextReplicaPtrI;
}//while
updateNodeInfo(fragPtr);
}
}
......
......@@ -6470,6 +6470,7 @@ void Dblqh::execACC_ABORTCONF(Signal* signal)
* A NORMAL EVENT DURING CREATION OF A FRAGMENT. WE NOW NEED TO CONTINUE
* WITH NORMAL COMMIT PROCESSING.
* ---------------------------------------------------------------------- */
regTcPtr->totSendlenAi = regTcPtr->totReclenAi;
if (regTcPtr->currTupAiLen == regTcPtr->totReclenAi) {
jam();
regTcPtr->abortState = TcConnectionrec::ABORT_IDLE;
......@@ -12579,19 +12580,17 @@ void Dblqh::lastWriteInFileLab(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)
{
jam();
logPartPtr.p->logPartState = LogPartRecord::IDLE;
ndbout_c("resetting logPartState to IDLE");
}
else
{
jam();
logPartPtr.p->logPartState = LogPartRecord::ACTIVE;
ndbout_c("resetting logPartState to ACTIVE");
}
}
......@@ -14623,6 +14622,8 @@ void Dblqh::execSr(Signal* signal)
LogFileRecordPtr nextLogFilePtr;
LogPageRecordPtr tmpLogPagePtr;
Uint32 logWord;
Uint32 line;
const char * crash_msg = 0;
jamEntry();
logPartPtr.i = signal->theData[0];
......@@ -14833,8 +14834,14 @@ void Dblqh::execSr(Signal* signal)
/* PLACE THAN IN THE FIRST PAGE OF A NEW FILE IN THE FIRST POSITION AFTER THE*/
/* HEADER. */
/*---------------------------------------------------------------------------*/
ndbrequire(logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] ==
(ZPAGE_HEADER_SIZE + ZPOS_NO_FD));
if (unlikely(logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] !=
(ZPAGE_HEADER_SIZE + ZPOS_NO_FD)))
{
line = __LINE__;
logWord = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX];
crash_msg = "ZFD_TYPE at incorrect position!";
goto crash;
}
{
Uint32 noFdDescriptors =
logPagePtr.p->logPageWord[ZPAGE_HEADER_SIZE + ZPOS_NO_FD];
......@@ -14871,19 +14878,10 @@ void Dblqh::execSr(Signal* signal)
/*---------------------------------------------------------------------------*/
/* SEND A SIGNAL TO THE SIGNAL LOG AND THEN CRASH THE SYSTEM. */
/*---------------------------------------------------------------------------*/
signal->theData[0] = RNIL;
signal->theData[1] = logPartPtr.i;
Uint32 tmp = logFilePtr.p->fileName[3];
tmp = (tmp >> 8) & 0xff;// To get the Directory, DXX.
signal->theData[2] = tmp;
signal->theData[3] = logFilePtr.p->fileNo;
signal->theData[4] = logFilePtr.p->currentFilepage;
signal->theData[5] = logFilePtr.p->currentMbyte;
signal->theData[6] = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX];
signal->theData[7] = ~0;
signal->theData[8] = __LINE__;
sendSignal(cownref, GSN_DEBUG_SIG, signal, 9, JBA);
return;
line = __LINE__;
logWord = ZNEXT_MBYTE_TYPE;
crash_msg = "end of log wo/ having found last GCI";
goto crash;
}//if
}//if
/*---------------------------------------------------------------------------*/
......@@ -14938,19 +14936,9 @@ void Dblqh::execSr(Signal* signal)
/*---------------------------------------------------------------------------*/
/* SEND A SIGNAL TO THE SIGNAL LOG AND THEN CRASH THE SYSTEM. */
/*---------------------------------------------------------------------------*/
signal->theData[0] = RNIL;
signal->theData[1] = logPartPtr.i;
Uint32 tmp = logFilePtr.p->fileName[3];
tmp = (tmp >> 8) & 0xff;// To get the Directory, DXX.
signal->theData[2] = tmp;
signal->theData[3] = logFilePtr.p->fileNo;
signal->theData[4] = logFilePtr.p->currentMbyte;
signal->theData[5] = logFilePtr.p->currentFilepage;
signal->theData[6] = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX];
signal->theData[7] = logWord;
signal->theData[8] = __LINE__;
sendSignal(cownref, GSN_DEBUG_SIG, signal, 9, JBA);
return;
line = __LINE__;
crash_msg = "Invalid logword";
goto crash;
break;
}//switch
/*---------------------------------------------------------------------------*/
......@@ -14958,6 +14946,35 @@ void Dblqh::execSr(Signal* signal)
// that we reach a new page.
/*---------------------------------------------------------------------------*/
} while (1);
return;
crash:
signal->theData[0] = RNIL;
signal->theData[1] = logPartPtr.i;
Uint32 tmp = logFilePtr.p->fileName[3];
tmp = (tmp >> 8) & 0xff;// To get the Directory, DXX.
signal->theData[2] = tmp;
signal->theData[3] = logFilePtr.p->fileNo;
signal->theData[4] = logFilePtr.p->currentMbyte;
signal->theData[5] = logFilePtr.p->currentFilepage;
signal->theData[6] = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX];
signal->theData[7] = logWord;
signal->theData[8] = line;
char buf[255];
BaseString::snprintf(buf, sizeof(buf),
"Error while reading REDO log. from %d\n"
"D=%d, F=%d Mb=%d FP=%d W1=%d W2=%d : %s",
signal->theData[8],
signal->theData[2],
signal->theData[3],
signal->theData[4],
signal->theData[5],
signal->theData[6],
signal->theData[7],
crash_msg ? crash_msg : "");
progError(__LINE__, NDBD_EXIT_SR_REDOLOG, buf);
}//Dblqh::execSr()
/*---------------------------------------------------------------------------*/
......@@ -14973,8 +14990,8 @@ void Dblqh::execDEBUG_SIG(Signal* signal)
UintR tdebug;
jamEntry();
logPagePtr.i = signal->theData[0];
tdebug = logPagePtr.p->logPageWord[0];
//logPagePtr.i = signal->theData[0];
//tdebug = logPagePtr.p->logPageWord[0];
char buf[100];
BaseString::snprintf(buf, 100,
......
......@@ -720,7 +720,7 @@ public:
// Index data
bool isIndexOp; // Used to mark on-going TcKeyReq as indx table access
Uint8 isIndexOp; // Used to mark on-going TcKeyReq as indx table access
bool indexOpReturn;
UintR noIndexOp; // No outstanding index ops
......@@ -808,7 +808,7 @@ public:
UintR savedState[LqhKeyConf::SignalLength];
// Index data
bool isIndexOp; // Used to mark on-going TcKeyReq as index table access
Uint8 isIndexOp; // Used to mark on-going TcKeyReq as index table access
UintR indexOp;
UintR currentIndexId;
UintR attrInfoLen;
......
......@@ -1775,8 +1775,7 @@ void Dbtc::execKEYINFO(Signal* signal)
apiConnectptr.i = signal->theData[0];
tmaxData = 20;
if (apiConnectptr.i >= capiConnectFilesize) {
jam();
warningHandlerLab(signal, __LINE__);
TCKEY_abort(signal, 18);
return;
}//if
ptrAss(apiConnectptr, apiConnectRecord);
......@@ -1785,9 +1784,7 @@ void Dbtc::execKEYINFO(Signal* signal)
compare_transid2 = apiConnectptr.p->transid[1] ^ signal->theData[2];
compare_transid1 = compare_transid1 | compare_transid2;
if (compare_transid1 != 0) {
jam();
printState(signal, 10);
sendSignalErrorRefuseLab(signal);
TCKEY_abort(signal, 19);
return;
}//if
switch (apiConnectptr.p->apiConnectstate) {
......@@ -2531,7 +2528,7 @@ void Dbtc::execTCKEYREQ(Signal* signal)
Uint32 TstartFlag = tcKeyReq->getStartFlag(Treqinfo);
Uint32 TexecFlag = TcKeyReq::getExecuteFlag(Treqinfo);
bool isIndexOp = regApiPtr->isIndexOp;
Uint8 isIndexOp = regApiPtr->isIndexOp;
bool isIndexOpReturn = regApiPtr->indexOpReturn;
regApiPtr->isIndexOp = false; // Reset marker
regApiPtr->m_exec_flag |= TexecFlag;
......@@ -3277,7 +3274,7 @@ void Dbtc::sendlqhkeyreq(Signal* signal,
sig1 = regCachePtr->fragmentid + (regTcPtr->tcNodedata[1] << 16);
sig2 = regApiPtr->transid[0];
sig3 = regApiPtr->transid[1];
sig4 = regApiPtr->ndbapiBlockref;
sig4 = (regTcPtr->isIndexOp == 2) ? reference() : regApiPtr->ndbapiBlockref;
sig5 = regTcPtr->clientData;
sig6 = regCachePtr->scanInfo;
......@@ -8619,6 +8616,7 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
// left over from simple/dirty read
} else {
jam();
jamLine(transP->apiConnectstate);
errCode = ZSTATE_ERROR;
goto SCAN_TAB_error_no_state_change;
}
......@@ -12036,14 +12034,18 @@ void Dbtc::readIndexTable(Signal* signal,
opType == ZREAD ? ZREAD : ZREAD_EX);
TcKeyReq::setAIInTcKeyReq(tcKeyRequestInfo, 1); // Allways send one AttrInfo
TcKeyReq::setExecutingTrigger(tcKeyRequestInfo, 0);
BlockReference originalReceiver = regApiPtr->ndbapiBlockref;
regApiPtr->ndbapiBlockref = reference(); // Send result to me
tcKeyReq->senderData = indexOp->indexOpId;
indexOp->indexOpState = IOS_INDEX_ACCESS;
regApiPtr->executingIndexOp = regApiPtr->accumulatingIndexOp;
regApiPtr->accumulatingIndexOp = RNIL;
regApiPtr->isIndexOp = true;
regApiPtr->isIndexOp = 2;
if (ERROR_INSERTED(8037))
{
ndbout_c("shifting index version");
tcKeyReq->tableSchemaVersion = ~(Uint32)indexOp->tcIndxReq.tableSchemaVersion;
}
Uint32 remainingKey = indexOp->keyInfo.getSize();
bool moreKeyData = indexOp->keyInfo.first(keyIter);
// *********** KEYINFO in TCKEYREQ ***********
......@@ -12062,21 +12064,13 @@ void Dbtc::readIndexTable(Signal* signal,
ndbassert(TcKeyReq::getDirtyFlag(tcKeyRequestInfo) == 0);
ndbassert(TcKeyReq::getSimpleFlag(tcKeyRequestInfo) == 0);
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
/**
* "Fool" TC not to start commiting transaction since it always will
* have one outstanding lqhkeyreq
* This is later decreased when the index read is complete
*/
regApiPtr->lqhkeyreqrec++;
jamEntry();
/**
* Remember ptr to index read operation
* (used to set correct save point id on index operation later)
*/
indexOp->indexReadTcConnect = regApiPtr->lastTcConnect;
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
goto err;
}
jamEntry();
// *********** KEYINFO ***********
if (moreKeyData) {
jam();
......@@ -12096,6 +12090,10 @@ void Dbtc::readIndexTable(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
goto err;
}
dataPos = 0;
dataPtr = (Uint32 *) &keyInfo->keyData;
}
......@@ -12106,10 +12104,32 @@ void Dbtc::readIndexTable(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + dataPos);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
goto err;
}
}
}
regApiPtr->ndbapiBlockref = originalReceiver; // reset original receiver
/**
* "Fool" TC not to start commiting transaction since it always will
* have one outstanding lqhkeyreq
* This is later decreased when the index read is complete
*/
regApiPtr->lqhkeyreqrec++;
/**
* Remember ptr to index read operation
* (used to set correct save point id on index operation later)
*/
indexOp->indexReadTcConnect = regApiPtr->lastTcConnect;
done:
return;
err:
jam();
goto done;
}
/**
......@@ -12160,7 +12180,7 @@ void Dbtc::executeIndexOperation(Signal* signal,
tcKeyReq->transId2 = regApiPtr->transid[1];
tcKeyReq->senderData = tcIndxReq->senderData; // Needed for TRANSID_AI to API
indexOp->indexOpState = IOS_INDEX_OPERATION;
regApiPtr->isIndexOp = true;
regApiPtr->isIndexOp = 1;
regApiPtr->executingIndexOp = indexOp->indexOpId;;
regApiPtr->noIndexOp++; // Increase count
......@@ -12233,9 +12253,16 @@ void Dbtc::executeIndexOperation(Signal* signal,
const Uint32 currSavePointId = regApiPtr->currSavePointId;
regApiPtr->currSavePointId = tmp.p->savePointId;
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
regApiPtr->currSavePointId = currSavePointId;
jamEntry();
// *********** KEYINFO ***********
if (moreKeyData) {
jam();
......@@ -12256,6 +12283,13 @@ void Dbtc::executeIndexOperation(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPos = 0;
dataPtr = (Uint32 *) &keyInfo->keyData;
}
......@@ -12266,6 +12300,12 @@ void Dbtc::executeIndexOperation(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_KEYINFO, signal,
KeyInfo::HeaderLength + dataPos);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
}
}
......@@ -12295,6 +12335,13 @@ void Dbtc::executeIndexOperation(Signal* signal,
EXECUTE_DIRECT(DBTC, GSN_ATTRINFO, signal,
AttrInfo::HeaderLength + AttrInfo::DataLength);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
attrInfoPos = 0;
dataPtr = (Uint32 *) &attrInfo->attrData;
}
......@@ -12694,9 +12741,16 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
const Uint32 currSavePointId = regApiPtr->currSavePointId;
regApiPtr->currSavePointId = opRecord->savePointId;
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
regApiPtr->currSavePointId = currSavePointId;
tcConnectptr.p->currentIndexId = indexData->indexId;
jamEntry();
// *********** KEYINFO ***********
if (moreKeyData) {
......@@ -12726,6 +12780,12 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
#endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0;
}
......@@ -12761,6 +12821,13 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
#endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0;
}
......@@ -12778,6 +12845,11 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
KeyInfo::HeaderLength + dataPos);
jamEntry();
#endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
}
}
......@@ -12813,6 +12885,12 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
AttrInfo::HeaderLength + AttrInfo::DataLength);
jamEntry();
#endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &attrInfo->attrData;
attrInfoPos = 0;
}
......@@ -12849,6 +12927,12 @@ void Dbtc::insertIntoIndexTable(Signal* signal,
AttrInfo::HeaderLength + AttrInfo::DataLength);
jamEntry();
#endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &attrInfo->attrData;
attrInfoPos = 0;
}
......@@ -12994,9 +13078,16 @@ void Dbtc::deleteFromIndexTable(Signal* signal,
const Uint32 currSavePointId = regApiPtr->currSavePointId;
regApiPtr->currSavePointId = opRecord->savePointId;
EXECUTE_DIRECT(DBTC, GSN_TCKEYREQ, signal, tcKeyLength);
jamEntry();
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
regApiPtr->currSavePointId = currSavePointId;
tcConnectptr.p->currentIndexId = indexData->indexId;
jamEntry();
// *********** KEYINFO ***********
if (moreKeyData) {
......@@ -13027,6 +13118,12 @@ void Dbtc::deleteFromIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
#endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0;
}
......@@ -13063,6 +13160,12 @@ void Dbtc::deleteFromIndexTable(Signal* signal,
KeyInfo::HeaderLength + KeyInfo::DataLength);
jamEntry();
#endif
if (unlikely(regApiPtr->apiConnectstate == CS_ABORTING))
{
jam();
return;
}
dataPtr = (Uint32 *) &keyInfo->keyData;
dataPos = 0;
}
......
......@@ -1113,14 +1113,16 @@ Dbtup::updateStartLab(Signal* signal,
regOperPtr->pageOffset,
&cinBuffer[0],
regOperPtr->attrinbufLen);
if (retValue == -1) {
tupkeyErrorLab(signal);
return -1;
}//if
} else {
jam();
retValue = interpreterStartLab(signal, pagePtr, regOperPtr->pageOffset);
}//if
if (retValue == -1) {
tupkeyErrorLab(signal);
return -1;
}//if
ndbrequire(regOperPtr->tupVersion != ZNIL);
pagePtr->pageWord[regOperPtr->pageOffset + 1] = regOperPtr->tupVersion;
if (regTabPtr->checksumIndicator) {
......
......@@ -184,24 +184,28 @@ void Dbtup::allocConsPages(Uint32 noOfPagesToAllocate,
/* PROPER AMOUNT OF PAGES WERE NOT FOUND. FIND AS MUCH AS */
/* POSSIBLE. */
/* ---------------------------------------------------------------- */
for (Uint32 j = firstListToCheck; (Uint32)~j; j--) {
if (firstListToCheck)
{
ljam();
if (cfreepageList[j] != RNIL) {
for (Uint32 j = firstListToCheck - 1; (Uint32)~j; j--) {
ljam();
if (cfreepageList[j] != RNIL) {
ljam();
/* ---------------------------------------------------------------- */
/* SOME AREA WAS FOUND, ALLOCATE ALL OF IT. */
/* ---------------------------------------------------------------- */
allocPageRef = cfreepageList[j];
removeCommonArea(allocPageRef, j);
noOfPagesAllocated = 1 << j;
findFreeLeftNeighbours(allocPageRef, noOfPagesAllocated,
noOfPagesToAllocate);
findFreeRightNeighbours(allocPageRef, noOfPagesAllocated,
noOfPagesToAllocate);
return;
}//if
}//for
allocPageRef = cfreepageList[j];
removeCommonArea(allocPageRef, j);
noOfPagesAllocated = 1 << j;
findFreeLeftNeighbours(allocPageRef, noOfPagesAllocated,
noOfPagesToAllocate);
findFreeRightNeighbours(allocPageRef, noOfPagesAllocated,
noOfPagesToAllocate);
return;
}//if
}//for
}
/* ---------------------------------------------------------------- */
/* NO FREE AREA AT ALL EXISTED. RETURN ZERO PAGES */
/* ---------------------------------------------------------------- */
......
......@@ -397,12 +397,12 @@ void Dbtup::allocMoreFragPages(Fragrecord* const regFragPtr)
Uint32 noAllocPages = regFragPtr->noOfPagesToGrow >> 3; // 12.5%
noAllocPages += regFragPtr->noOfPagesToGrow >> 4; // 6.25%
noAllocPages += 2;
regFragPtr->noOfPagesToGrow += noAllocPages;
/* -----------------------------------------------------------------*/
// We will grow by 18.75% plus two more additional pages to grow
// a little bit quicker in the beginning.
/* -----------------------------------------------------------------*/
allocFragPages(regFragPtr, noAllocPages);
Uint32 allocated = allocFragPages(regFragPtr, noAllocPages);
regFragPtr->noOfPagesToGrow += allocated;
}//Dbtup::allocMoreFragPages()
Uint32 Dbtup::leafPageRangeFull(Fragrecord* const regFragPtr, PageRangePtr currPageRangePtr)
......
......@@ -181,10 +181,9 @@ void Ndbcntr::execSYSTEM_ERROR(Signal* signal)
case SystemError::CopyFragRefError:
BaseString::snprintf(buf, sizeof(buf),
"Node %d killed this node because "
"it could not copy a fragment during node restart. "
"Copy fragment error code: %u.",
killingNode, data1);
"Killed by node %d as "
"copyfrag failed, error: %u",
killingNode, data1);
break;
default:
......@@ -2043,6 +2042,11 @@ void Ndbcntr::execSET_VAR_REQ(Signal* signal) {
void Ndbcntr::updateNodeState(Signal* signal, const NodeState& newState) const{
NodeStateRep * const stateRep = (NodeStateRep *)&signal->theData[0];
if (newState.startLevel == NodeState::SL_STARTED)
{
CRASH_INSERTION(1000);
}
stateRep->nodeState = newState;
stateRep->nodeState.masterNodeId = cmasterNodeId;
stateRep->nodeState.setNodeGroup(c_nodeGroup);
......@@ -2843,7 +2847,7 @@ void Ndbcntr::Missra::sendNextSTTOR(Signal* signal){
cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 3, JBB);
}
}
signal->theData[0] = NDB_LE_NDBStartCompleted;
signal->theData[1] = NDB_VERSION;
cntr.sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 2, JBB);
......
......@@ -67,6 +67,13 @@ ndb_mgm_create_logevent_handle(NdbMgmHandle mh,
return h;
}
extern "C"
int
ndb_logevent_get_fd(const NdbLogEventHandle h)
{
return h->socket;
}
extern "C"
void ndb_mgm_destroy_logevent_handle(NdbLogEventHandle * h)
{
......
......@@ -475,6 +475,8 @@ int NdbScanOperation::nextResultImpl(bool fetchAllowed, bool forceSend)
idx = m_current_api_receiver;
last = m_api_receivers_count;
Uint32 timeout = tp->m_waitfor_timeout;
do {
if(theError.code){
......@@ -502,7 +504,7 @@ int NdbScanOperation::nextResultImpl(bool fetchAllowed, bool forceSend)
*/
theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
int return_code = theNdb->receiveResponse(3*timeout);
if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) {
continue;
} else {
......@@ -1365,6 +1367,7 @@ NdbIndexScanOperation::next_result_ordered(bool fetchAllowed,
return -1;
Uint32 seq = theNdbCon->theNodeSequence;
Uint32 nodeId = theNdbCon->theDBnode;
Uint32 timeout = tp->m_waitfor_timeout;
if(seq == tp->getNodeSequence(nodeId) &&
!send_next_scan_ordered(s_idx, forceSend)){
Uint32 tmp = m_sent_receivers_count;
......@@ -1372,7 +1375,7 @@ NdbIndexScanOperation::next_result_ordered(bool fetchAllowed,
while(m_sent_receivers_count > 0 && !theError.code){
theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
int return_code = theNdb->receiveResponse(3*timeout);
if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) {
continue;
}
......@@ -1513,6 +1516,8 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){
return -1;
}
Uint32 timeout = tp->m_waitfor_timeout;
/**
* Wait for outstanding
*/
......@@ -1520,7 +1525,7 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){
{
theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
int return_code = theNdb->receiveResponse(3*timeout);
switch(return_code){
case 0:
break;
......@@ -1590,7 +1595,7 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){
{
theNdb->theImpl->theWaiter.m_node = nodeId;
theNdb->theImpl->theWaiter.m_state = WAIT_SCAN;
int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT);
int return_code = theNdb->receiveResponse(3*timeout);
switch(return_code){
case 0:
break;
......
......@@ -1199,6 +1199,48 @@ int runLQHKEYREF(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
int
runBug21384(NDBT_Context* ctx, NDBT_Step* step)
{
Ndb* pNdb = GETNDB(step);
HugoTransactions hugoTrans(*ctx->getTab());
NdbRestarter restarter;
int loops = ctx->getNumLoops();
const int rows = ctx->getNumRecords();
const int batchsize = ctx->getProperty("BatchSize", 50);
while (loops--)
{
if(restarter.insertErrorInAllNodes(8037) != 0)
{
g_err << "Failed to error insert(8037)" << endl;
return NDBT_FAILED;
}
if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchsize) == 0)
{
g_err << "Index succeded (it should have failed" << endl;
return NDBT_FAILED;
}
if(restarter.insertErrorInAllNodes(0) != 0)
{
g_err << "Failed to error insert(0)" << endl;
return NDBT_FAILED;
}
if (hugoTrans.indexReadRecords(pNdb, pkIdxName, rows, batchsize) != 0){
g_err << "Index read failed" << endl;
return NDBT_FAILED;
}
}
return NDBT_OK;
}
NDBT_TESTSUITE(testIndex);
TESTCASE("CreateAll",
"Test that we can create all various indexes on each table\n"
......@@ -1512,6 +1554,16 @@ TESTCASE("UniqueNull",
FINALIZER(createPkIndex_Drop);
FINALIZER(runClearTable);
}
TESTCASE("Bug21384",
"Test that unique indexes and nulls"){
TC_PROPERTY("LoggedIndexes", (unsigned)0);
INITIALIZER(runClearTable);
INITIALIZER(createPkIndex);
INITIALIZER(runLoadTable);
STEP(runBug21384);
FINALIZER(createPkIndex_Drop);
FINALIZER(runClearTable);
}
NDBT_TESTSUITE_END(testIndex);
int main(int argc, const char** argv){
......
......@@ -1121,6 +1121,46 @@ int runClearTable(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
int
runBug21536(NDBT_Context* ctx, NDBT_Step* step)
{
NdbRestarter restarter;
const Uint32 nodeCount = restarter.getNumDbNodes();
if(nodeCount != 2){
g_info << "Bug21536 - 2 nodes to test" << endl;
return NDBT_OK;
}
int node1 = restarter.getDbNodeId(rand() % nodeCount);
int node2 = restarter.getRandomNodeSameNodeGroup(node1, rand());
if (node1 == -1 || node2 == -1)
return NDBT_OK;
int result = NDBT_OK;
do {
CHECK(restarter.restartOneDbNode(node1, false, true, true) == 0);
CHECK(restarter.waitNodesNoStart(&node1, 1) == 0);
CHECK(restarter.insertErrorInNode(node1, 1000) == 0);
int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
CHECK(restarter.dumpStateOneNode(node1, val2, 2) == 0);
CHECK(restarter.startNodes(&node1, 1) == 0);
restarter.waitNodesStartPhase(&node1, 1, 3, 120);
CHECK(restarter.waitNodesNoStart(&node1, 1) == 0);
CHECK(restarter.restartOneDbNode(node2, true, true, true) == 0);
CHECK(restarter.waitNodesNoStart(&node2, 1) == 0);
CHECK(restarter.startNodes(&node1, 1) == 0);
CHECK(restarter.waitNodesStarted(&node1, 1) == 0);
CHECK(restarter.startNodes(&node2, 1) == 0);
CHECK(restarter.waitClusterStarted() == 0);
} while(0);
g_info << "Bug21536 finished" << endl;
return result;
}
NDBT_TESTSUITE(testSystemRestart);
TESTCASE("SR1",
......@@ -1287,6 +1327,13 @@ TESTCASE("Bug18385",
STEP(runBug18385);
FINALIZER(runClearTable);
}
TESTCASE("Bug21536",
"Perform partition system restart with other nodes with higher GCI"){
INITIALIZER(runWaitStarted);
INITIALIZER(runClearTable);
STEP(runBug21536);
FINALIZER(runClearTable);
}
NDBT_TESTSUITE_END(testSystemRestart);
int main(int argc, const char** argv){
......
......@@ -449,6 +449,10 @@ max-time: 1000
cmd: testNodeRestart
args: -n Bug20185 T1
max-time: 1000
cmd: testIndex
args: -n Bug21384
# OLD FLEX
max-time: 500
cmd: flexBench
......
......@@ -35,6 +35,7 @@
// options from from mysqld.cc
extern my_bool opt_ndb_optimized_node_selection;
extern const char *opt_ndbcluster_connectstring;
extern ulong opt_ndb_cache_check_time;
// Default value for parallelism
static const int parallelism= 0;
......@@ -5238,6 +5239,7 @@ bool ndbcluster_init()
pthread_cond_init(&COND_ndb_util_thread, NULL);
ndb_cache_check_time = opt_ndb_cache_check_time;
// Create utility thread
pthread_t tmp;
if (pthread_create(&tmp, &connection_attrib, ndb_util_thread_func, 0))
......
......@@ -723,13 +723,18 @@ shutdown the MySQL server and restart it.", name, errno);
int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
{
pthread_mutex_lock(&LOCK_log);
int ret = raw_get_current_log(linfo);
pthread_mutex_unlock(&LOCK_log);
return ret;
}
int MYSQL_LOG::raw_get_current_log(LOG_INFO* linfo)
{
strmake(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name)-1);
linfo->pos = my_b_tell(&log_file);
pthread_mutex_unlock(&LOCK_log);
return 0;
}
/*
Move all data up in a file in an filename index file
......
......@@ -342,6 +342,7 @@ class MYSQL_LOG: public TC_LOG
bool need_mutex);
int find_next_log(LOG_INFO* linfo, bool need_mutex);
int get_current_log(LOG_INFO* linfo);
int raw_get_current_log(LOG_INFO* linfo);
uint next_file_id();
inline bool is_open() { return log_type != LOG_CLOSED; }
inline char* get_index_fname() { return index_file_name;}
......
......@@ -1494,10 +1494,14 @@ bool show_binlogs(THD* thd)
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
pthread_mutex_lock(mysql_bin_log.get_log_lock());
mysql_bin_log.lock_index();
index_file=mysql_bin_log.get_index_file();
mysql_bin_log.get_current_log(&cur);
mysql_bin_log.raw_get_current_log(&cur); // dont take mutex
pthread_mutex_unlock(mysql_bin_log.get_log_lock()); // lockdep, OK
cur_dir_len= dirname_length(cur.log_file_name);
reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0);
......
......@@ -6892,6 +6892,9 @@ load: LOAD DATA_SYM
YYABORT;
}
lex->sql_command = SQLCOM_LOAD_MASTER_TABLE;
WARN_DEPRECATED("LOAD TABLE FROM MASTER",
"mysqldump or future "
"BACKUP/RESTORE DATABASE facility");
if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING))
YYABORT;
};
......@@ -6930,6 +6933,9 @@ load_data:
FROM MASTER_SYM
{
Lex->sql_command = SQLCOM_LOAD_MASTER_DATA;
WARN_DEPRECATED("LOAD DATA FROM MASTER",
"mysqldump or future "
"BACKUP/RESTORE DATABASE facility");
};
opt_local:
......
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