Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1

into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-single-user
This commit is contained in:
unknown 2007-05-22 23:21:32 +02:00
commit b8dc4b6306
38 changed files with 1224 additions and 528 deletions

View File

@ -28,6 +28,7 @@ EXTRA_DIST = FINISH.sh \
compile-alpha-debug \
compile-amd64-debug-max \
compile-amd64-max \
compile-amd64-max-sci \
compile-darwin-mwcc \
compile-dist \
compile-hpux11-parisc2-aCC \
@ -52,6 +53,7 @@ EXTRA_DIST = FINISH.sh \
compile-pentium-valgrind-max \
compile-pentium64-debug \
compile-pentium64-debug-max \
compile-pentium64-max-sci \
compile-pentium64-valgrind-max \
compile-ppc \
compile-ppc-debug \

View File

@ -0,0 +1,8 @@
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $fast_cflags -g"
extra_configs="$amd64_configs $max_configs --with-ndb-sci=/opt/DIS"
. "$path/FINISH.sh"

View File

@ -0,0 +1,9 @@
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $fast_cflags -g"
extra_configs="$pentium_configs $max_configs --with-ndb-sci=/opt/DIS"
. "$path/FINISH.sh"

View File

@ -43,7 +43,7 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
if test -f "$mysql_sci_dir/lib/libsisci.a" -a \
-f "$mysql_sci_dir/include/sisci_api.h"; then
NDB_SCI_INCLUDES="-I$mysql_sci_dir/include"
NDB_SCI_LIBS="-L$mysql_sci_dir/lib -lsisci"
NDB_SCI_LIBS="$mysql_sci_dir/lib/libsisci.a"
AC_MSG_RESULT([-- including sci transporter])
AC_DEFINE([NDB_SCI_TRANSPORTER], [1],
[Including Ndb Cluster DB sci transporter])

View File

@ -95,6 +95,7 @@ INC_LIB= $(top_builddir)/regex/libregex.a \
$(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/vio/libvio.a \
@NDB_SCI_LIBS@ \
@mysql_plugin_libs@ \
$(yassl_inc_libs)

View File

@ -36,7 +36,8 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
$(openssl_includes)
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS)
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \
@NDB_SCI_LIBS@
mysqltest_embedded_LINK = $(CXXLINK)
mysqltest_embedded_SOURCES = mysqltest.c

View File

@ -0,0 +1,4 @@
-- require r/have_log_bin.require
disable_query_log;
show variables like "log_bin";
enable_query_log;

View File

@ -0,0 +1,2 @@
Variable_name Value
have_log_bin ON

View File

@ -1,4 +1,5 @@
-- source include/have_ndb.inc
-- source include/have_log_bin.inc
--error ER_NDB_CANT_SWITCH_BINLOG_FORMAT
set session binlog_format=row;

View File

@ -33,7 +33,7 @@ SUPPORTING_LIBS = $(top_builddir)/vio/libvio.a \
$(top_builddir)/regex/libregex.a \
$(top_builddir)/strings/libmystrings.a
mysqld_DEPENDENCIES= @mysql_plugin_libs@ $(SUPPORTING_LIBS)
LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@
LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@
mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \
@pstack_libs@ \
@mysql_plugin_libs@ \

View File

@ -2731,18 +2731,25 @@ int ha_ndbcluster::write_row(byte *record)
{
// Table has hidden primary key
Ndb *ndb= get_ndb();
int ret;
Uint64 auto_value;
uint retries= NDB_AUTO_INCREMENT_RETRIES;
do {
int retry_sleep= 30; /* 30 milliseconds, transaction */
for (;;)
{
Ndb_tuple_id_range_guard g(m_share);
ret= ndb->getAutoIncrementValue(m_table, g.range, auto_value, 1);
} while (ret == -1 &&
--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
if (ret == -1)
ERR_RETURN(ndb->getNdbError());
if (set_hidden_key(op, table_share->fields, (const byte*)&auto_value))
if (ndb->getAutoIncrementValue(m_table, g.range, auto_value, 1) == -1)
{
if (--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
{
my_sleep(retry_sleep);
continue;
}
ERR_RETURN(ndb->getNdbError());
}
break;
}
if (set_hidden_key(op, table->s->fields, (const byte*)&auto_value))
ERR_RETURN(op->getNdbError());
}
else
@ -6064,24 +6071,28 @@ void ha_ndbcluster::get_auto_increment(ulonglong offset, ulonglong increment,
m_rows_to_insert - m_rows_inserted :
((m_rows_to_insert > m_autoincrement_prefetch) ?
m_rows_to_insert : m_autoincrement_prefetch));
int ret;
uint retries= NDB_AUTO_INCREMENT_RETRIES;
do {
Ndb_tuple_id_range_guard g(m_share);
ret=
m_skip_auto_increment ?
ndb->readAutoIncrementValue(m_table, g.range, auto_value) :
ndb->getAutoIncrementValue(m_table, g.range, auto_value, cache_size);
} while (ret == -1 &&
--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
if (ret == -1)
int retry_sleep= 30; /* 30 milliseconds, transaction */
for (;;)
{
const NdbError err= ndb->getNdbError();
sql_print_error("Error %lu in ::get_auto_increment(): %s",
(ulong) err.code, err.message);
*first_value= ~(ulonglong) 0;
DBUG_VOID_RETURN;
Ndb_tuple_id_range_guard g(m_share);
if (m_skip_auto_increment &&
ndb->readAutoIncrementValue(m_table, g.range, auto_value) ||
ndb->getAutoIncrementValue(m_table, g.range, auto_value, cache_size))
{
if (--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
{
my_sleep(retry_sleep);
continue;
}
const NdbError err= ndb->getNdbError();
sql_print_error("Error %lu in ::get_auto_increment(): %s",
(ulong) err.code, err.message);
*first_value= ~(ulonglong) 0;
DBUG_VOID_RETURN;
}
break;
}
*first_value= (longlong)auto_value;
/* From the point of view of MySQL, NDB reserves one row at a time */
@ -6263,23 +6274,23 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked)
set_dbname(name);
set_tabname(name);
if (check_ndb_connection())
if ((res= check_ndb_connection()) ||
(res= get_metadata(name)))
{
/* ndb_share reference handler free */
DBUG_PRINT("NDB_SHARE", ("%s handler free use_count: %u",
m_share->key, m_share->use_count));
free_share(&m_share);
m_share= 0;
DBUG_RETURN(HA_ERR_NO_CONNECTION);
DBUG_RETURN(res);
}
res= get_metadata(name);
if (!res)
while (1)
{
Ndb *ndb= get_ndb();
if (ndb->setDatabaseName(m_dbname))
{
ERR_RETURN(ndb->getNdbError());
res= ndb_to_mysql_error(&ndb->getNdbError());
break;
}
struct Ndb_statistics stat;
res= ndb_get_table_statistics(NULL, FALSE, ndb, m_table, &stat);
@ -6288,14 +6299,20 @@ int ha_ndbcluster::open(const char *name, int mode, uint test_if_locked)
stats.records= stat.row_count;
if(!res)
res= info(HA_STATUS_CONST);
break;
}
if (res)
{
free_share(&m_share);
m_share= 0;
release_metadata(current_thd, get_ndb());
DBUG_RETURN(res);
}
#ifdef HAVE_NDB_BINLOG
if (!ndb_binlog_tables_inited && ndb_binlog_running)
table->db_stat|= HA_READ_ONLY;
#endif
DBUG_RETURN(res);
DBUG_RETURN(0);
}
/*

View File

@ -44,6 +44,8 @@ class FsOpenReq {
friend class Restore;
friend class Dblqh;
friend class Dbtup;
/**
* For printing
*/

View File

@ -78,8 +78,9 @@ typedef ndbd_exit_classification_enum ndbd_exit_classification;
#define NDBD_EXIT_SR_RESTARTCONFLICT 2311
#define NDBD_EXIT_NO_MORE_UNDOLOG 2312
#define NDBD_EXIT_SR_UNDOLOG 2313
#define NDBD_EXIT_SR_SCHEMAFILE 2310
#define NDBD_EXIT_SINGLE_USER_MODE 2314
#define NDBD_EXIT_NODE_DECLARED_DEAD 2315
#define NDBD_EXIT_SR_SCHEMAFILE 2316
#define NDBD_EXIT_MEMALLOC 2327
#define NDBD_EXIT_BLOCK_JBUFCONGESTION 2334
#define NDBD_EXIT_TIME_QUEUE_SHORT 2335

View File

@ -621,6 +621,14 @@ const GsnName SignalNames [] = {
,{ GSN_LCP_PREPARE_REF, "LCP_PREPARE_REF" }
,{ GSN_LCP_PREPARE_CONF, "LCP_PREPARE_CONF" }
,{ GSN_DICT_ABORT_REQ, "DICT_ABORT_REQ" }
,{ GSN_DICT_ABORT_REF, "DICT_ABORT_REF" }
,{ GSN_DICT_ABORT_CONF, "DICT_ABORT_CONF" }
,{ GSN_DICT_COMMIT_REQ, "DICT_COMMIT_REQ" }
,{ GSN_DICT_COMMIT_REF, "DICT_COMMIT_REF" }
,{ GSN_DICT_COMMIT_CONF, "DICT_COMMIT_CONF" }
/* DICT LOCK */
,{ GSN_DICT_LOCK_REQ, "DICT_LOCK_REQ" }
,{ GSN_DICT_LOCK_CONF, "DICT_LOCK_CONF" }

View File

@ -20,7 +20,12 @@
#include <TransporterCallback.hpp>
#include <RefConvert.hpp>
#ifdef ERROR_INSERT
Uint32 MAX_RECEIVED_SIGNALS = 1024;
#else
#define MAX_RECEIVED_SIGNALS 1024
#endif
Uint32
TransporterRegistry::unpack(Uint32 * readPtr,
Uint32 sizeOfData,

View File

@ -65,13 +65,10 @@ SCI_Transporter::SCI_Transporter(TransporterRegistry &t_reg,
m_initLocal=false;
m_swapCounter=0;
m_failCounter=0;
m_remoteNodes[0]=remoteSciNodeId0;
m_remoteNodes[1]=remoteSciNodeId1;
m_adapters = nAdapters;
// The maximum number of times to try and create,
// start and destroy a sequence
m_ActiveAdapterId=0;
m_StandbyAdapterId=1;
@ -102,8 +99,6 @@ SCI_Transporter::SCI_Transporter(TransporterRegistry &t_reg,
DBUG_VOID_RETURN;
}
void SCI_Transporter::disconnectImpl()
{
DBUG_ENTER("SCI_Transporter::disconnectImpl");
@ -129,7 +124,8 @@ void SCI_Transporter::disconnectImpl()
if(err != SCI_ERR_OK) {
report_error(TE_SCI_UNABLE_TO_CLOSE_CHANNEL);
DBUG_PRINT("error", ("Cannot close channel to the driver. Error code 0x%x",
DBUG_PRINT("error",
("Cannot close channel to the driver. Error code 0x%x",
err));
}
}
@ -164,19 +160,18 @@ bool SCI_Transporter::initTransporter() {
m_sendBuffer.m_buffer = new Uint32[m_sendBuffer.m_sendBufferSize / 4];
m_sendBuffer.m_dataSize = 0;
DBUG_PRINT("info", ("Created SCI Send Buffer with buffer size %d and packet size %d",
DBUG_PRINT("info",
("Created SCI Send Buffer with buffer size %d and packet size %d",
m_sendBuffer.m_sendBufferSize, m_PacketSize * 4));
if(!getLinkStatus(m_ActiveAdapterId) ||
(m_adapters > 1 &&
!getLinkStatus(m_StandbyAdapterId))) {
DBUG_PRINT("error", ("The link is not fully operational. Check the cables and the switches"));
//reportDisconnect(remoteNodeId, 0);
//doDisconnect();
DBUG_PRINT("error",
("The link is not fully operational. Check the cables and the switches"));
//NDB should terminate
report_error(TE_SCI_LINK_ERROR);
DBUG_RETURN(false);
}
DBUG_RETURN(true);
} // initTransporter()
@ -235,7 +230,8 @@ sci_error_t SCI_Transporter::initLocalSegment() {
DBUG_PRINT("info", ("SCInode iD %d adapter %d\n",
sciAdapters[i].localSciNodeId, i));
if(err != SCI_ERR_OK) {
DBUG_PRINT("error", ("Cannot open an SCI virtual device. Error code 0x%x",
DBUG_PRINT("error",
("Cannot open an SCI virtual device. Error code 0x%x",
err));
DBUG_RETURN(err);
}
@ -269,7 +265,8 @@ sci_error_t SCI_Transporter::initLocalSegment() {
&err);
if(err != SCI_ERR_OK) {
DBUG_PRINT("error", ("Local Segment is not accessible by an SCI adapter. Error code 0x%x\n",
DBUG_PRINT("error",
("Local Segment is not accessible by an SCI adapter. Error code 0x%x\n",
err));
DBUG_RETURN(err);
}
@ -303,15 +300,13 @@ sci_error_t SCI_Transporter::initLocalSegment() {
&err);
if(err != SCI_ERR_OK) {
DBUG_PRINT("error", ("Local Segment is not available for remote connections. Error code 0x%x\n",
DBUG_PRINT("error",
("Local Segment is not available for remote connections. Error code 0x%x\n",
err));
DBUG_RETURN(err);
}
}
setupLocalSegment();
DBUG_RETURN(err);
} // initLocalSegment()
@ -343,12 +338,6 @@ bool SCI_Transporter::doSend() {
if(sizeToSend==4097)
i4097++;
#endif
if(startSequence(m_ActiveAdapterId)!=SCI_ERR_OK) {
DBUG_PRINT("error", ("Start sequence failed"));
report_error(TE_SCI_UNABLE_TO_START_SEQUENCE);
return false;
}
tryagain:
retry++;
@ -374,119 +363,36 @@ bool SCI_Transporter::doSend() {
SCI_FLAG_ERROR_CHECK,
&err);
if (err != SCI_ERR_OK) {
if(err == SCI_ERR_OUT_OF_RANGE) {
DBUG_PRINT("error", ("Data transfer : out of range error"));
goto tryagain;
}
if(err == SCI_ERR_SIZE_ALIGNMENT) {
DBUG_PRINT("error", ("Data transfer : alignment error"));
DBUG_PRINT("info", ("sendPtr 0x%x, sizeToSend = %d", sendPtr, sizeToSend));
goto tryagain;
}
if(err == SCI_ERR_OFFSET_ALIGNMENT) {
DBUG_PRINT("error", ("Data transfer : offset alignment"));
goto tryagain;
}
if(err == SCI_ERR_TRANSFER_FAILED) {
//(m_TargetSegm[m_StandbyAdapterId].writer)->heavyLock();
if(getLinkStatus(m_ActiveAdapterId)) {
goto tryagain;
}
if (m_adapters == 1) {
DBUG_PRINT("error", ("SCI Transfer failed"));
if (err == SCI_ERR_OUT_OF_RANGE ||
err == SCI_ERR_SIZE_ALIGNMENT ||
err == SCI_ERR_OFFSET_ALIGNMENT) {
DBUG_PRINT("error", ("Data transfer error = %d", err));
report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
return false;
}
m_failCounter++;
Uint32 temp=m_ActiveAdapterId;
switch(m_swapCounter) {
case 0:
/**swap from active (0) to standby (1)*/
if(getLinkStatus(m_StandbyAdapterId)) {
DBUG_PRINT("error", ("Swapping from adapter 0 to 1"));
}
if(err == SCI_ERR_TRANSFER_FAILED) {
if(getLinkStatus(m_ActiveAdapterId))
goto tryagain;
if (m_adapters == 1) {
DBUG_PRINT("error", ("SCI Transfer failed"));
report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
return false;
}
m_failCounter++;
Uint32 temp=m_ActiveAdapterId;
if (getLinkStatus(m_StandbyAdapterId)) {
failoverShmWriter();
SCIStoreBarrier(m_TargetSegm[m_StandbyAdapterId].sequence,0);
m_ActiveAdapterId=m_StandbyAdapterId;
m_StandbyAdapterId=temp;
SCIRemoveSequence((m_TargetSegm[m_StandbyAdapterId].sequence),
FLAGS,
&err);
if(err!=SCI_ERR_OK) {
report_error(TE_SCI_UNABLE_TO_REMOVE_SEQUENCE);
DBUG_PRINT("error", ("Unable to remove sequence"));
return false;
}
if(startSequence(m_ActiveAdapterId)!=SCI_ERR_OK) {
DBUG_PRINT("error", ("Start sequence failed"));
report_error(TE_SCI_UNABLE_TO_START_SEQUENCE);
return false;
}
m_swapCounter++;
DBUG_PRINT("info", ("failover complete"));
goto tryagain;
} else {
DBUG_PRINT("error", ("Swapping from adapter %u to %u",
m_StandbyAdapterId, m_ActiveAdapterId));
} else {
report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
DBUG_PRINT("error", ("SCI Transfer failed"));
return false;
}
return false;
break;
case 1:
/** swap back from 1 to 0
must check that the link is up */
if(getLinkStatus(m_StandbyAdapterId)) {
failoverShmWriter();
m_ActiveAdapterId=m_StandbyAdapterId;
m_StandbyAdapterId=temp;
DBUG_PRINT("info", ("Swapping from 1 to 0"));
if(createSequence(m_ActiveAdapterId)!=SCI_ERR_OK) {
DBUG_PRINT("error", ("Unable to create sequence"));
report_error(TE_SCI_UNABLE_TO_CREATE_SEQUENCE);
return false;
}
if(startSequence(m_ActiveAdapterId)!=SCI_ERR_OK) {
DBUG_PRINT("error", ("startSequence failed... disconnecting"));
report_error(TE_SCI_UNABLE_TO_START_SEQUENCE);
return false;
}
SCIRemoveSequence((m_TargetSegm[m_StandbyAdapterId].sequence)
, FLAGS,
&err);
if(err!=SCI_ERR_OK) {
DBUG_PRINT("error", ("Unable to remove sequence"));
report_error(TE_SCI_UNABLE_TO_REMOVE_SEQUENCE);
return false;
}
if(createSequence(m_StandbyAdapterId)!=SCI_ERR_OK) {
DBUG_PRINT("error", ("Unable to create sequence on standby"));
report_error(TE_SCI_UNABLE_TO_CREATE_SEQUENCE);
return false;
}
m_swapCounter=0;
DBUG_PRINT("info", ("failover complete.."));
goto tryagain;
} else {
DBUG_PRINT("error", ("Unrecoverable data transfer error"));
report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
return false;
}
break;
default:
DBUG_PRINT("error", ("Unrecoverable data transfer error"));
report_error(TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR);
return false;
break;
}
}
}
} else {
SHM_Writer * writer = (m_TargetSegm[m_ActiveAdapterId].writer);
writer->updateWritePtr(sizeToSend);
@ -497,7 +403,6 @@ bool SCI_Transporter::doSend() {
m_sendBuffer.m_dataSize = 0;
m_sendBuffer.m_forceSendLimit = sendLimit;
}
} else {
/**
* If we end up here, the SCI segment is full.
@ -552,15 +457,12 @@ void SCI_Transporter::setupLocalSegment()
DBUG_VOID_RETURN;
} //setupLocalSegment
void SCI_Transporter::setupRemoteSegment()
{
DBUG_ENTER("SCI_Transporter::setupRemoteSegment");
Uint32 sharedSize = 0;
sharedSize =4096; //start of the buffer is page aligned
Uint32 sizeOfBuffer = m_BufferSize;
const Uint32 slack = MAX_MESSAGE_SIZE;
sizeOfBuffer -= sharedSize;
@ -666,7 +568,6 @@ SCI_Transporter::init_remote()
DBUG_PRINT("error", ("Error connecting segment, err 0x%x", err));
DBUG_RETURN(false);
}
}
// Map the remote memory segment into program space
for(Uint32 i=0; i < m_adapters ; i++) {
@ -679,13 +580,14 @@ SCI_Transporter::init_remote()
FLAGS,
&err);
if(err!= SCI_ERR_OK) {
DBUG_PRINT("error", ("Cannot map a segment to the remote node %d. Error code 0x%x",m_RemoteSciNodeId, err));
//NDB SHOULD TERMINATE AND COMPUTER REBOOTED!
report_error(TE_SCI_CANNOT_MAP_REMOTESEGMENT);
DBUG_RETURN(false);
}
if(err!= SCI_ERR_OK) {
DBUG_PRINT("error",
("Cannot map a segment to the remote node %d. Error code 0x%x",
m_RemoteSciNodeId, err));
//NDB SHOULD TERMINATE AND COMPUTER REBOOTED!
report_error(TE_SCI_CANNOT_MAP_REMOTESEGMENT);
DBUG_RETURN(false);
}
}
m_mapped=true;
setupRemoteSegment();
@ -713,7 +615,6 @@ SCI_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
NDB_CLOSE_SOCKET(sockfd);
DBUG_RETURN(false);
}
if (!init_local()) {
NDB_CLOSE_SOCKET(sockfd);
DBUG_RETURN(false);
@ -788,29 +689,9 @@ sci_error_t SCI_Transporter::createSequence(Uint32 adapterid) {
&(m_TargetSegm[adapterid].sequence),
SCI_FLAG_FAST_BARRIER,
&err);
return err;
} // createSequence()
sci_error_t SCI_Transporter::startSequence(Uint32 adapterid) {
sci_error_t err;
/** Perform preliminary error check on an SCI adapter before starting a
* sequence of read and write operations on the mapped segment.
*/
m_SequenceStatus = SCIStartSequence(
(m_TargetSegm[adapterid].sequence),
FLAGS, &err);
// If there still is an error then data cannot be safely send
return err;
} // startSequence()
bool SCI_Transporter::disconnectLocal()
{
DBUG_ENTER("SCI_Transporter::disconnectLocal");
@ -878,9 +759,6 @@ SCI_Transporter::~SCI_Transporter() {
DBUG_VOID_RETURN;
} // ~SCI_Transporter()
void SCI_Transporter::closeSCI() {
// Termination of SCI
sci_error_t err;
@ -897,8 +775,9 @@ void SCI_Transporter::closeSCI() {
SCIClose(activeSCIDescriptor, FLAGS, &err);
if(err != SCI_ERR_OK) {
DBUG_PRINT("error", ("Cannot close SCI channel to the driver. Error code 0x%x",
err));
DBUG_PRINT("error",
("Cannot close SCI channel to the driver. Error code 0x%x",
err));
}
SCITerminate();
DBUG_VOID_RETURN;
@ -973,7 +852,6 @@ SCI_Transporter::getConnectionStatus() {
return false;
}
void
SCI_Transporter::setConnected() {
*m_remoteStatusFlag = SCICONNECTED;
@ -983,7 +861,6 @@ SCI_Transporter::setConnected() {
*m_localStatusFlag = SCICONNECTED;
}
void
SCI_Transporter::setDisconnect() {
if(getLinkStatus(m_ActiveAdapterId))
@ -994,7 +871,6 @@ SCI_Transporter::setDisconnect() {
}
}
bool
SCI_Transporter::checkConnected() {
if (*m_localStatusFlag == SCIDISCONNECT) {
@ -1015,8 +891,9 @@ SCI_Transporter::initSCI() {
SCIInitialize(0, &error);
if(error != SCI_ERR_OK) {
DBUG_PRINT("error", ("Cannot initialize SISCI library."));
DBUG_PRINT("error", ("Inconsistency between SISCI library and SISCI driver. Error code 0x%x",
error));
DBUG_PRINT("error",
("Inconsistency between SISCI library and SISCI driver. Error code 0x%x",
error));
DBUG_RETURN(false);
}
init = true;
@ -1029,3 +906,4 @@ SCI_Transporter::get_free_buffer() const
{
return (m_TargetSegm[m_ActiveAdapterId].writer)->get_free_buffer();
}

View File

@ -54,12 +54,12 @@
* local segment, the SCI transporter connects to a segment created by another
* transporter at a remote node, and the maps the remote segment into its
* virtual address space. However, since NDB Cluster relies on redundancy
* at the network level, by using dual SCI adapters communica
*
* at the network level, by using dual SCI adapters communication can be
* maintained even if one of the adapter cards fails (or anything on the
* network this adapter card exists in e.g. an SCI switch failure).
*
*/
/**
* class SCITransporter
* @brief - main class for the SCI transporter.
@ -84,16 +84,6 @@ public:
sci_error_t createSequence(Uint32 adapterid);
/**
* starts a sequence for error checking.
* The actual checking that a sequence is correct is done implicitly
* in SCIMemCpy (in doSend).
* @param adapterid the adapter on which to start the sequence.
* @return SCI_ERR_OK if ok, otherwize something else.
*/
sci_error_t startSequence(Uint32 adapterid);
/** Initiate Local Segment: create a memory segment,
* prepare a memory segment, map the local segment
* into memory space and make segment available.
@ -159,7 +149,6 @@ private:
bool m_mapped;
bool m_initLocal;
bool m_sciinit;
Uint32 m_swapCounter;
Uint32 m_failCounter;
/**
* For statistics on transfered packets
@ -195,7 +184,6 @@ private:
*/
Uint32 m_reportFreq;
Uint32 m_adapters;
Uint32 m_numberOfRemoteNodes;

View File

@ -102,6 +102,10 @@ private:
virtual void updateReceiveDataPtr(Uint32 bytesRead);
virtual Uint32 get_free_buffer() const;
inline bool hasReceiveData () const {
return receiveBuffer.sizeOfData > 0;
}
protected:
/**
* Setup client/server and perform connect/accept

View File

@ -739,16 +739,13 @@ TransporterRegistry::poll_SHM(Uint32 timeOutMillis)
Uint32
TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
{
bool hasdata = false;
if (false && nTCPTransporters == 0)
{
tcpReadSelectReply = 0;
return 0;
}
struct timeval timeout;
timeout.tv_sec = timeOutMillis / 1000;
timeout.tv_usec = (timeOutMillis % 1000) * 1000;
NDB_SOCKET_TYPE maxSocketValue = -1;
// Needed for TCP/IP connections
@ -771,8 +768,15 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
// Put the connected transporters in the socket read-set
FD_SET(socket, &tcpReadset);
}
hasdata |= t->hasReceiveData();
}
timeOutMillis = hasdata ? 0 : timeOutMillis;
struct timeval timeout;
timeout.tv_sec = timeOutMillis / 1000;
timeout.tv_usec = (timeOutMillis % 1000) * 1000;
// The highest socket value plus one
maxSocketValue++;
@ -787,7 +791,7 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
}
#endif
return tcpReadSelectReply;
return tcpReadSelectReply || hasdata;
}
#endif
@ -796,26 +800,26 @@ void
TransporterRegistry::performReceive()
{
#ifdef NDB_TCP_TRANSPORTER
if(tcpReadSelectReply > 0)
for (int i=0; i<nTCPTransporters; i++)
{
for (int i=0; i<nTCPTransporters; i++)
{
checkJobBuffer();
TCP_Transporter *t = theTCPTransporters[i];
const NodeId nodeId = t->getRemoteNodeId();
const NDB_SOCKET_TYPE socket = t->getSocket();
if(is_connected(nodeId)){
if(t->isConnected() && FD_ISSET(socket, &tcpReadset))
checkJobBuffer();
TCP_Transporter *t = theTCPTransporters[i];
const NodeId nodeId = t->getRemoteNodeId();
const NDB_SOCKET_TYPE socket = t->getSocket();
if(is_connected(nodeId)){
if(t->isConnected())
{
if (FD_ISSET(socket, &tcpReadset))
{
const int receiveSize = t->doReceive();
if(receiveSize > 0)
{
Uint32 * ptr;
Uint32 sz = t->getReceiveData(&ptr);
transporter_recv_from(callbackObj, nodeId);
Uint32 szUsed = unpack(ptr, sz, nodeId, ioStates[nodeId]);
t->updateReceiveDataPtr(szUsed);
}
t->doReceive();
}
if (t->hasReceiveData())
{
Uint32 * ptr;
Uint32 sz = t->getReceiveData(&ptr);
Uint32 szUsed = unpack(ptr, sz, nodeId, ioStates[nodeId]);
t->updateReceiveDataPtr(szUsed);
}
}
}

View File

@ -3553,10 +3553,10 @@ Backup::execBACKUP_FRAGMENT_REQ(Signal* signal)
ScanFragReq::setHoldLockFlag(req->requestInfo, 0);
ScanFragReq::setKeyinfoFlag(req->requestInfo, 0);
ScanFragReq::setAttrLen(req->requestInfo,attrLen);
ScanFragReq::setTupScanFlag(req->requestInfo, 1);
if (ptr.p->is_lcp())
{
ScanFragReq::setScanPrio(req->requestInfo, 1);
ScanFragReq::setTupScanFlag(req->requestInfo, 1);
ScanFragReq::setNoDiskFlag(req->requestInfo, 1);
ScanFragReq::setLcpScanFlag(req->requestInfo, 1);
}

View File

@ -133,6 +133,7 @@ Cmvmi::~Cmvmi()
#ifdef ERROR_INSERT
NodeBitmask c_error_9000_nodes_mask;
extern Uint32 MAX_RECEIVED_SIGNALS;
#endif
void Cmvmi::execNDB_TAMPER(Signal* signal)
@ -162,6 +163,22 @@ void Cmvmi::execNDB_TAMPER(Signal* signal)
kill(getpid(), SIGABRT);
}
#endif
#ifdef ERROR_INSERT
if (signal->theData[0] == 9003)
{
if (MAX_RECEIVED_SIGNALS < 1024)
{
MAX_RECEIVED_SIGNALS = 1024;
}
else
{
MAX_RECEIVED_SIGNALS = 1 + (rand() % 128);
}
ndbout_c("MAX_RECEIVED_SIGNALS: %d", MAX_RECEIVED_SIGNALS);
CLEAR_ERROR_INSERT_VALUE;
}
#endif
}//execNDB_TAMPER()
void Cmvmi::execSET_LOGLEVELORD(Signal* signal)

View File

@ -5200,9 +5200,9 @@ void Dbacc::execEXPANDCHECK2(Signal* signal)
{
jamEntry();
if(refToBlock(signal->getSendersBlockRef()) == DBLQH){
if(refToBlock(signal->getSendersBlockRef()) == DBLQH)
{
jam();
reenable_expand_after_redo_log_exection_complete(signal);
return;
}

File diff suppressed because it is too large Load Diff

View File

@ -2565,6 +2565,12 @@ private:
const SchemaFile::TableEntry *,
const SchemaFile::TableEntry *);
void restartDropTab_complete(Signal*, Uint32 callback, Uint32);
void restartDropObj(Signal*, Uint32, const SchemaFile::TableEntry *);
void restartDropObj_prepare_start_done(Signal*, Uint32, Uint32);
void restartDropObj_prepare_complete_done(Signal*, Uint32, Uint32);
void restartDropObj_commit_start_done(Signal*, Uint32, Uint32);
void restartDropObj_commit_complete_done(Signal*, Uint32, Uint32);
void restart_checkSchemaStatusComplete(Signal*, Uint32 callback, Uint32);
void restart_writeSchemaConf(Signal*, Uint32 callbackData, Uint32);
@ -2657,7 +2663,8 @@ public:
void send_drop_fg(Signal*, SchemaOp*, DropFilegroupImplReq::RequestInfo);
void drop_undofile_prepare_start(Signal* signal, SchemaOp*);
void drop_undofile_commit_complete(Signal* signal, SchemaOp*);
int checkSingleUserMode(Uint32 senderRef);
};

View File

@ -8507,9 +8507,32 @@ void Dblqh::continueAfterReceivingAllAiLab(Signal* signal)
AccScanReq::setLockMode(req->requestInfo, scanptr.p->scanLockMode);
AccScanReq::setReadCommittedFlag(req->requestInfo, scanptr.p->readCommitted);
AccScanReq::setDescendingFlag(req->requestInfo, scanptr.p->descending);
AccScanReq::setNoDiskScanFlag(req->requestInfo,
!tcConnectptr.p->m_disk_table);
AccScanReq::setLcpScanFlag(req->requestInfo, scanptr.p->lcpScan);
if (refToBlock(tcConnectptr.p->clientBlockref) == BACKUP)
{
if (scanptr.p->lcpScan)
{
AccScanReq::setNoDiskScanFlag(req->requestInfo, 1);
AccScanReq::setLcpScanFlag(req->requestInfo, 1);
}
else
{
/* If backup scan disktables in disk order */
AccScanReq::setNoDiskScanFlag(req->requestInfo,
!tcConnectptr.p->m_disk_table);
AccScanReq::setLcpScanFlag(req->requestInfo, 0);
}
}
else
{
#if BUG_27776_FIXED
AccScanReq::setNoDiskScanFlag(req->requestInfo,
!tcConnectptr.p->m_disk_table);
#else
AccScanReq::setNoDiskScanFlag(req->requestInfo, 1);
#endif
AccScanReq::setLcpScanFlag(req->requestInfo, 0);
}
req->transId1 = tcConnectptr.p->transid[0];
req->transId2 = tcConnectptr.p->transid[1];

View File

@ -1053,6 +1053,8 @@ ArrayPool<TupTriggerData> c_triggerPool;
struct {
Uint32 tabUserPtr;
Uint32 tabUserRef;
Uint32 m_lcpno;
Uint32 m_fragPtrI;
} m_dropTable;
State tableStatus;
};
@ -1614,6 +1616,11 @@ private:
void execACCKEYREF(Signal* signal);
void execACC_ABORTCONF(Signal* signal);
// Drop table
void execFSREMOVEREF(Signal*);
void execFSREMOVECONF(Signal*);
//------------------------------------------------------------------
//------------------------------------------------------------------
// Methods to handle execution of TUPKEYREQ + ATTRINFO.
@ -2505,7 +2512,9 @@ private:
void drop_fragment_free_extent_log_buffer_callback(Signal*, Uint32, Uint32);
void drop_fragment_unmap_pages(Signal*, TablerecPtr, FragrecordPtr, Uint32);
void drop_fragment_unmap_page_callback(Signal* signal, Uint32, Uint32);
void drop_fragment_fsremove(Signal*, TablerecPtr, FragrecordPtr);
void drop_fragment_fsremove_done(Signal*, TablerecPtr, FragrecordPtr);
// Initialisation
void initData();
void initRecords();

View File

@ -317,6 +317,7 @@ Dbtup::restart_setup_page(Disk_alloc_info& alloc, PagePtr pagePtr)
unsigned uncommitted, committed;
uncommitted = committed = ~(unsigned)0;
(void) tsman.get_page_free_bits(&page, &uncommitted, &committed);
jamEntry();
idx = alloc.calc_page_free_bits(real_free);
ddassert(idx == committed);
@ -427,12 +428,12 @@ Dbtup::disk_page_prealloc(Signal* signal,
c_extent_pool.getPtr(ext);
if ((pageBits= tsman.alloc_page_from_extent(&ext.p->m_key, bits)) >= 0)
{
jam();
jamEntry();
found= true;
}
else
{
jam();
jamEntry();
/**
* The current extent is not in a free list
* and since it couldn't accomadate the request
@ -489,7 +490,7 @@ Dbtup::disk_page_prealloc(Signal* signal,
if ((err= tsman.alloc_extent(&ext.p->m_key)) < 0)
{
jam();
jamEntry();
#if NOT_YET_UNDO_ALLOC_EXTENT
c_lgman->free_log_space(logfile_group_id,
sizeof(Disk_undo::AllocExtent)>>2);
@ -541,6 +542,7 @@ Dbtup::disk_page_prealloc(Signal* signal,
alloc.m_curr_extent_info_ptr_i= ext.i;
ext.p->m_free_matrix_pos= RNIL;
pageBits= tsman.alloc_page_from_extent(&ext.p->m_key, bits);
jamEntry();
ddassert(pageBits >= 0);
}
@ -600,6 +602,7 @@ Dbtup::disk_page_prealloc(Signal* signal,
}
int res= m_pgman.get_page(signal, preq, flags);
jamEntry();
switch(res)
{
case 0:
@ -896,6 +899,7 @@ Dbtup::disk_page_set_dirty(PagePtr pagePtr)
// Make sure no one will allocate it...
tsman.unmap_page(&key, MAX_FREE_LIST - 1);
jamEntry();
}
void
@ -947,6 +951,7 @@ Dbtup::disk_page_unmap_callback(Uint32 page_id, Uint32 dirty_count)
fragPtr.p->m_tablespace_id);
tsman.unmap_page(&key, idx);
jamEntry();
pagePtr.p->list_index = idx | 0x8000;
}
@ -995,6 +1000,7 @@ Dbtup::disk_page_alloc(Signal* signal,
fragPtrP->m_tablespace_id);
tsman.update_page_free_bits(key, new_bits, lsn);
jamEntry();
}
}
@ -1047,6 +1053,7 @@ Dbtup::disk_page_free(Signal *signal,
fragPtrP->m_tablespace_id);
tsman.update_page_free_bits(key, new_bits, lsn);
jamEntry();
}
Uint32 ext = pagePtr.p->m_extent_info_ptr;
@ -1100,6 +1107,7 @@ Dbtup::disk_page_abort_prealloc(Signal *signal, Fragrecord* fragPtrP,
memcpy(&req.m_page, key, sizeof(Local_key));
int res= m_pgman.get_page(signal, req, flags);
jamEntry();
switch(res)
{
case 0:
@ -1228,6 +1236,7 @@ Dbtup::disk_page_alloc_extent_log_buffer_callback(Signal* signal,
Uint64 lsn= lgman.add_entry(c, 1);
tsman.update_lsn(&key, lsn);
jamEntry();
}
#endif
@ -1246,6 +1255,7 @@ Dbtup::disk_page_undo_alloc(Page* page, const Local_key* key,
Uint64 lsn= lgman.add_entry(c, 1);
m_pgman.update_lsn(* key, lsn);
jamEntry();
return lsn;
}
@ -1275,6 +1285,7 @@ Dbtup::disk_page_undo_update(Page* page, const Local_key* key,
Uint64 lsn= lgman.add_entry(c, 3);
m_pgman.update_lsn(* key, lsn);
jamEntry();
return lsn;
}
@ -1304,6 +1315,7 @@ Dbtup::disk_page_undo_free(Page* page, const Local_key* key,
Uint64 lsn= lgman.add_entry(c, 3);
m_pgman.update_lsn(* key, lsn);
jamEntry();
return lsn;
}
@ -1398,6 +1410,7 @@ Dbtup::disk_restart_undo(Signal* signal, Uint64 lsn,
int flags = 0;
int res= m_pgman.get_page(signal, preq, flags);
jamEntry();
switch(res)
{
case 0:
@ -1541,6 +1554,7 @@ Dbtup::disk_restart_undo_callback(Signal* signal,
lsn = undo->m_lsn - 1; // make sure undo isn't run again...
m_pgman.update_lsn(undo->m_key, lsn);
jamEntry();
}
else if (DBG_UNDO)
{
@ -1633,6 +1647,7 @@ Dbtup::disk_restart_undo_page_bits(Signal* signal, Apply_undo* undo)
fragPtrP->m_tablespace_id);
tsman.restart_undo_page_free_bits(&undo->m_key, new_bits, undo->m_lsn, lsn);
jamEntry();
}
int

View File

@ -99,6 +99,10 @@ Dbtup::Dbtup(Block_context& ctx, Pgman* pgman)
addRecSignal(GSN_ACCKEYREF, &Dbtup::execACCKEYREF);
addRecSignal(GSN_ACC_ABORTCONF, &Dbtup::execACC_ABORTCONF);
// Drop table
addRecSignal(GSN_FSREMOVEREF, &Dbtup::execFSREMOVEREF, true);
addRecSignal(GSN_FSREMOVECONF, &Dbtup::execFSREMOVECONF, true);
attrbufrec = 0;
fragoperrec = 0;
fragrecord = 0;

View File

@ -21,6 +21,7 @@
#include <ndb_limits.h>
#include <pc.hpp>
#include <signaldata/TupFrag.hpp>
#include <signaldata/FsRef.hpp>
#include <signaldata/FsConf.hpp>
#include <signaldata/FsRemoveReq.hpp>
#include <signaldata/DropTab.hpp>
@ -1283,6 +1284,24 @@ Dbtup::drop_fragment_free_var_pages(Signal* signal)
sendSignal(cownref, GSN_CONTINUEB, signal, 3, JBB);
return;
}
/**
* Remove LCP's for fragment
*/
tabPtr.p->m_dropTable.m_lcpno = 0;
tabPtr.p->m_dropTable.m_fragPtrI = fragPtr.i;
drop_fragment_fsremove(signal, tabPtr, fragPtr);
}
void
Dbtup::drop_fragment_fsremove_done(Signal* signal,
TablerecPtr tabPtr,
FragrecordPtr fragPtr)
{
/**
* LCP's removed...
* now continue with "next"
*/
Uint32 logfile_group_id = fragPtr.p->m_logfile_group_id ;
releaseFragPages(fragPtr.p);
Uint32 i;
@ -1302,6 +1321,74 @@ Dbtup::drop_fragment_free_var_pages(Signal* signal)
return;
}
// Remove LCP
void
Dbtup::drop_fragment_fsremove(Signal* signal,
TablerecPtr tabPtr,
FragrecordPtr fragPtr)
{
FsRemoveReq* req = (FsRemoveReq*)signal->getDataPtrSend();
req->userReference = reference();
req->userPointer = tabPtr.i;
req->directory = 0;
req->ownDirectory = 0;
Uint32 lcpno = tabPtr.p->m_dropTable.m_lcpno;
Uint32 fragId = fragPtr.p->fragmentId;
Uint32 tableId = fragPtr.p->fragTableId;
FsOpenReq::setVersion(req->fileNumber, 5);
FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_DATA);
FsOpenReq::v5_setLcpNo(req->fileNumber, lcpno);
FsOpenReq::v5_setTableId(req->fileNumber, tableId);
FsOpenReq::v5_setFragmentId(req->fileNumber, fragId);
sendSignal(NDBFS_REF, GSN_FSREMOVEREQ, signal,
FsRemoveReq::SignalLength, JBB);
}
void
Dbtup::execFSREMOVEREF(Signal* signal)
{
jamEntry();
FsRef* ref = (FsRef*)signal->getDataPtr();
Uint32 userPointer = ref->userPointer;
FsConf* conf = (FsConf*)signal->getDataPtrSend();
conf->userPointer = userPointer;
execFSREMOVECONF(signal);
}
void
Dbtup::execFSREMOVECONF(Signal* signal)
{
jamEntry();
FsConf* conf = (FsConf*)signal->getDataPtrSend();
TablerecPtr tabPtr;
FragrecordPtr fragPtr;
tabPtr.i = conf->userPointer;
ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
ndbrequire(tabPtr.p->tableStatus == DROPPING);
fragPtr.i = tabPtr.p->m_dropTable.m_fragPtrI;
ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
tabPtr.p->m_dropTable.m_lcpno++;
if (tabPtr.p->m_dropTable.m_lcpno < 3)
{
jam();
drop_fragment_fsremove(signal, tabPtr, fragPtr);
}
else
{
jam();
drop_fragment_fsremove_done(signal, tabPtr, fragPtr);
}
}
// End remove LCP
void
Dbtup::start_restore_lcp(Uint32 tableId, Uint32 fragId)
{

View File

@ -63,13 +63,11 @@ Dbtup::execACC_SCANREQ(Signal* signal)
break;
}
#if BUG_27776_FIXED
if (!AccScanReq::getNoDiskScanFlag(req->requestInfo)
&& tablePtr.p->m_no_of_disk_attributes)
{
bits |= ScanOp::SCAN_DD;
}
#endif
bool mm = (bits & ScanOp::SCAN_DD);
if (tablePtr.p->m_attributes[mm].m_no_of_varsize > 0) {

View File

@ -436,7 +436,6 @@ Lgman::drop_filegroup_drop_files(Signal* signal,
{
jam();
ndbrequire(! (ptr.p->m_state & Logfile_group::LG_THREAD_MASK));
ndbrequire(ptr.p->m_meta_files.isEmpty());
ndbrequire(ptr.p->m_outstanding_fs == 0);
Local_undofile_list list(m_file_pool, ptr.p->m_files);
@ -452,6 +451,18 @@ Lgman::drop_filegroup_drop_files(Signal* signal,
return;
}
Local_undofile_list metalist(m_file_pool, ptr.p->m_meta_files);
if (metalist.first(file_ptr))
{
jam();
metalist.remove(file_ptr);
list.add(file_ptr);
file_ptr.p->m_create.m_senderRef = ref;
file_ptr.p->m_create.m_senderData = data;
create_file_abort(signal, ptr, file_ptr);
return;
}
free_logbuffer_memory(ptr);
m_logfile_group_hash.release(ptr);
DropFilegroupImplConf *conf = (DropFilegroupImplConf*)signal->getDataPtr();
@ -462,7 +473,8 @@ Lgman::drop_filegroup_drop_files(Signal* signal,
}
void
Lgman::execCREATE_FILE_REQ(Signal* signal){
Lgman::execCREATE_FILE_REQ(Signal* signal)
{
jamEntry();
CreateFileImplReq* req= (CreateFileImplReq*)signal->getDataPtr();
@ -491,6 +503,7 @@ Lgman::execCREATE_FILE_REQ(Signal* signal){
switch(requestInfo){
case CreateFileImplReq::Commit:
{
jam();
ndbrequire(find_file_by_id(file_ptr, ptr.p->m_meta_files, req->file_id));
file_ptr.p->m_create.m_senderRef = req->senderRef;
file_ptr.p->m_create.m_senderData = req->senderData;
@ -503,6 +516,7 @@ Lgman::execCREATE_FILE_REQ(Signal* signal){
Uint32 senderData = req->senderData;
if (find_file_by_id(file_ptr, ptr.p->m_meta_files, req->file_id))
{
jam();
file_ptr.p->m_create.m_senderRef = senderRef;
file_ptr.p->m_create.m_senderData = senderData;
create_file_abort(signal, ptr, file_ptr);
@ -510,11 +524,11 @@ Lgman::execCREATE_FILE_REQ(Signal* signal){
else
{
CreateFileImplConf* conf= (CreateFileImplConf*)signal->getDataPtr();
jam();
conf->senderData = senderData;
conf->senderRef = reference();
sendSignal(senderRef, GSN_CREATE_FILE_CONF, signal,
CreateFileImplConf::SignalLength, JBB);
return;
}
return;
}

View File

@ -1559,6 +1559,7 @@ Pgman::execFSWRITEREF(Signal* signal)
int
Pgman::get_page(Signal* signal, Ptr<Page_entry> ptr, Page_request page_req)
{
jamEntry();
#ifdef VM_TRACE
Ptr<Page_request> tmp = { &page_req, RNIL};
debugOut << "PGMAN: >get_page" << endl;
@ -1706,6 +1707,7 @@ Pgman::get_page(Signal* signal, Ptr<Page_entry> ptr, Page_request page_req)
void
Pgman::update_lsn(Ptr<Page_entry> ptr, Uint32 block, Uint64 lsn)
{
jamEntry();
#ifdef VM_TRACE
const char* bname = getBlockName(block, "?");
debugOut << "PGMAN: >update_lsn: block=" << bname << " lsn=" << lsn << endl;

View File

@ -3052,7 +3052,7 @@ void Qmgr::failReportLab(Signal* signal, Uint16 aFailedNode,
if (failedNodePtr.i == getOwnNodeId()) {
jam();
Uint32 code = 0;
Uint32 code = NDBD_EXIT_NODE_DECLARED_DEAD;
const char * msg = 0;
char extra[100];
switch(aFailCause){

View File

@ -1309,6 +1309,12 @@ Tsman::execDROP_FILE_REQ(Signal* signal)
Local_datafile_list free(m_file_pool, fg_ptr.p->m_free_files);
free.remove(file_ptr);
}
else if(find_file_by_id(file_ptr, fg_ptr.p->m_meta_files, req.file_id))
{
jam();
Local_datafile_list meta(m_file_pool, fg_ptr.p->m_meta_files);
meta.remove(file_ptr);
}
else
{
errorCode = DropFileImplRef::NoSuchFile;

View File

@ -57,6 +57,8 @@ static const ErrStruct errArray[] =
"error(s) on other node(s)"},
{NDBD_EXIT_PARTITIONED_SHUTDOWN, XAE, "Partitioned cluster detected. "
"Please check if cluster is already running"},
{NDBD_EXIT_NODE_DECLARED_DEAD, XAE,
"Node declared dead. See error log for details"},
{NDBD_EXIT_POINTER_NOTINRANGE, XIE, "Pointer too large"},
{NDBD_EXIT_SR_OTHERNODEFAILED, XRE, "Another node failed during system "
"restart, please investigate error(s) on other node(s)"},

View File

@ -2204,6 +2204,159 @@ runBug21755(NDBT_Context* ctx, NDBT_Step* step)
return NDBT_OK;
}
static
int
create_tablespace(NdbDictionary::Dictionary* pDict,
const char * lgname,
const char * tsname,
const char * dfname)
{
NdbDictionary::Tablespace ts;
ts.setName(tsname);
ts.setExtentSize(1024*1024);
ts.setDefaultLogfileGroup(lgname);
if(pDict->createTablespace(ts) != 0)
{
g_err << "Failed to create tablespace:"
<< endl << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
NdbDictionary::Datafile df;
df.setPath(dfname);
df.setSize(1*1024*1024);
df.setTablespace(tsname);
if(pDict->createDatafile(df) != 0)
{
g_err << "Failed to create datafile:"
<< endl << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
return 0;
}
int
runBug24631(NDBT_Context* ctx, NDBT_Step* step)
{
char tsname[256];
char dfname[256];
char lgname[256];
char ufname[256];
NdbRestarter res;
if (res.getNumDbNodes() < 2)
return NDBT_OK;
Ndb* pNdb = GETNDB(step);
NdbDictionary::Dictionary* pDict = pNdb->getDictionary();
NdbDictionary::Dictionary::List list;
if (pDict->listObjects(list) == -1)
return NDBT_FAILED;
const char * lgfound = 0;
for (Uint32 i = 0; i<list.count; i++)
{
switch(list.elements[i].type){
case NdbDictionary::Object::LogfileGroup:
lgfound = list.elements[i].name;
break;
default:
break;
}
if (lgfound)
break;
}
if (lgfound == 0)
{
BaseString::snprintf(lgname, sizeof(lgname), "LG-%u", rand());
NdbDictionary::LogfileGroup lg;
lg.setName(lgname);
lg.setUndoBufferSize(8*1024*1024);
if(pDict->createLogfileGroup(lg) != 0)
{
g_err << "Failed to create logfilegroup:"
<< endl << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
NdbDictionary::Undofile uf;
BaseString::snprintf(ufname, sizeof(ufname), "%s-%u", lgname, rand());
uf.setPath(ufname);
uf.setSize(2*1024*1024);
uf.setLogfileGroup(lgname);
if(pDict->createUndofile(uf) != 0)
{
g_err << "Failed to create undofile:"
<< endl << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
}
else
{
BaseString::snprintf(lgname, sizeof(lgname), "%s", lgfound);
}
BaseString::snprintf(tsname, sizeof(tsname), "TS-%u", rand());
BaseString::snprintf(dfname, sizeof(dfname), "%s-%u.dat", tsname, rand());
if (create_tablespace(pDict, lgname, tsname, dfname))
return NDBT_FAILED;
int node = res.getRandomNotMasterNodeId(rand());
res.restartOneDbNode(node, false, true, true);
NdbSleep_SecSleep(3);
if (pDict->dropDatafile(pDict->getDatafile(0, dfname)) != 0)
{
g_err << "Failed to drop datafile: " << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
if (pDict->dropTablespace(pDict->getTablespace(tsname)) != 0)
{
g_err << "Failed to drop tablespace: " << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
if (res.waitNodesNoStart(&node, 1))
return NDBT_FAILED;
res.startNodes(&node, 1);
if (res.waitClusterStarted())
return NDBT_FAILED;
if (create_tablespace(pDict, lgname, tsname, dfname))
return NDBT_FAILED;
if (pDict->dropDatafile(pDict->getDatafile(0, dfname)) != 0)
{
g_err << "Failed to drop datafile: " << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
if (pDict->dropTablespace(pDict->getTablespace(tsname)) != 0)
{
g_err << "Failed to drop tablespace: " << pDict->getNdbError() << endl;
return NDBT_FAILED;
}
if (lgfound == 0)
{
if (pDict->dropLogfileGroup(pDict->getLogfileGroup(lgname)) != 0)
return NDBT_FAILED;
}
return NDBT_OK;
}
struct RandSchemaOp
{
struct Obj
@ -2707,6 +2860,10 @@ TESTCASE("DictRestart",
""){
INITIALIZER(runDictRestart);
}
TESTCASE("Bug24631",
""){
INITIALIZER(runBug24631);
}
NDBT_TESTSUITE_END(testDict);
int main(int argc, const char** argv){

View File

@ -1588,6 +1588,36 @@ int runTestExecuteAsynch(NDBT_Context* ctx, NDBT_Step* step){
template class Vector<NdbScanOperation*>;
int
runBug28443(NDBT_Context* ctx, NDBT_Step* step)
{
int result = NDBT_OK;
int records = ctx->getNumRecords();
NdbRestarter restarter;
restarter.insertErrorInAllNodes(9003);
for (Uint32 i = 0; i<ctx->getNumLoops(); i++)
{
HugoTransactions hugoTrans(*ctx->getTab());
if (hugoTrans.loadTable(GETNDB(step), records, 2048) != 0)
{
result = NDBT_FAILED;
goto done;
}
if (runClearTable(ctx, step) != 0)
{
result = NDBT_FAILED;
goto done;
}
}
done:
restarter.insertErrorInAllNodes(9003);
return result;
}
NDBT_TESTSUITE(testNdbApi);
TESTCASE("MaxNdb",
@ -1689,6 +1719,10 @@ TESTCASE("ExecuteAsynch",
"Check that executeAsync() works (BUG#27495)\n"){
INITIALIZER(runTestExecuteAsynch);
}
TESTCASE("Bug28443",
""){
INITIALIZER(runBug28443);
}
NDBT_TESTSUITE_END(testNdbApi);
int main(int argc, const char** argv){

View File

@ -619,6 +619,10 @@ max-time: 1500
cmd: testDict
args: -l 25 -n DictRestart T1
max-time: 500
cmd: testDict
args: -n Bug24631 T1
#
# TEST NDBAPI
#
@ -700,6 +704,10 @@ max-time: 500
cmd: testNdbApi
args: -n ExecuteAsynch T1
max-time: 1000
cmd: testNdbApi
args: -n BugBug28443
#max-time: 500
#cmd: testInterpreter
#args: T1