Bug #9249 NDBD crashes when mapping SHM segment w/o correct permission

parent d9b59517
......@@ -100,6 +100,7 @@ typedef ndbd_exit_classification_enum ndbd_exit_classification;
#define NDBD_EXIT_SIGNAL_LOST 6051
#define NDBD_EXIT_SIGNAL_LOST_SEND_BUFFER_FULL 6052
#define NDBD_EXIT_ILLEGAL_SIGNAL 6053
#define NDBD_EXIT_CONNECTION_SETUP_FAILED 6054
/* NDBCNTR 6100-> */
#define NDBD_EXIT_RESTART_TIMEOUT 6100
......
......@@ -81,7 +81,9 @@ reportConnect(void * callbackObj, NodeId nodeId);
void
reportDisconnect(void * callbackObj,
NodeId nodeId, Uint32 errNo);
#define TE_DO_DISCONNECT 0x8000
enum TransporterError {
TE_NO_ERROR = 0,
/**
......@@ -111,7 +113,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisconnect)
*/
TE_INVALID_MESSAGE_LENGTH = 0x8003,
TE_INVALID_MESSAGE_LENGTH = 0x3 | TE_DO_DISCONNECT,
/**
* TE_INVALID_CHECKSUM
......@@ -120,7 +122,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
TE_INVALID_CHECKSUM = 0x8004,
TE_INVALID_CHECKSUM = 0x4 | TE_DO_DISCONNECT,
/**
* TE_COULD_NOT_CREATE_SOCKET
......@@ -129,7 +131,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
TE_COULD_NOT_CREATE_SOCKET = 0x8005,
TE_COULD_NOT_CREATE_SOCKET = 0x5,
/**
* TE_COULD_NOT_BIND_SOCKET
......@@ -138,7 +140,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
TE_COULD_NOT_BIND_SOCKET = 0x8006,
TE_COULD_NOT_BIND_SOCKET = 0x6,
/**
* TE_LISTEN_FAILED
......@@ -147,7 +149,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
TE_LISTEN_FAILED = 0x8007,
TE_LISTEN_FAILED = 0x7,
/**
* TE_ACCEPT_RETURN_ERROR
......@@ -158,7 +160,7 @@ enum TransporterError {
* Recommended behavior: Ignore
* (or possible do setPerformState(PerformDisconnect)
*/
TE_ACCEPT_RETURN_ERROR = 0x8008
TE_ACCEPT_RETURN_ERROR = 0x8
/**
* TE_SHM_DISCONNECT
......@@ -167,7 +169,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SHM_DISCONNECT = 0x800b
,TE_SHM_DISCONNECT = 0xb | TE_DO_DISCONNECT
/**
* TE_SHM_IPC_STAT
......@@ -178,7 +180,12 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SHM_IPC_STAT = 0x800c
,TE_SHM_IPC_STAT = 0xc | TE_DO_DISCONNECT
/**
* Permanent error
*/
,TE_SHM_IPC_PERMANENT = 0x21
/**
* TE_SHM_UNABLE_TO_CREATE_SEGMENT
......@@ -188,7 +195,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SHM_UNABLE_TO_CREATE_SEGMENT = 0x800d
,TE_SHM_UNABLE_TO_CREATE_SEGMENT = 0xd
/**
* TE_SHM_UNABLE_TO_ATTACH_SEGMENT
......@@ -198,7 +205,7 @@ enum TransporterError {
*
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SHM_UNABLE_TO_ATTACH_SEGMENT = 0x800e
,TE_SHM_UNABLE_TO_ATTACH_SEGMENT = 0xe
/**
* TE_SHM_UNABLE_TO_REMOVE_SEGMENT
......@@ -208,12 +215,12 @@ enum TransporterError {
* Recommended behavior: Ignore (not much to do)
* Print warning to logfile
*/
,TE_SHM_UNABLE_TO_REMOVE_SEGMENT = 0x800f
,TE_SHM_UNABLE_TO_REMOVE_SEGMENT = 0xf
,TE_TOO_SMALL_SIGID = 0x0010
,TE_TOO_LARGE_SIGID = 0x0011
,TE_WAIT_STACK_FULL = 0x8012
,TE_RECEIVE_BUFFER_FULL = 0x8013
,TE_TOO_SMALL_SIGID = 0x10
,TE_TOO_LARGE_SIGID = 0x11
,TE_WAIT_STACK_FULL = 0x12 | TE_DO_DISCONNECT
,TE_RECEIVE_BUFFER_FULL = 0x13 | TE_DO_DISCONNECT
/**
* TE_SIGNAL_LOST_SEND_BUFFER_FULL
......@@ -222,7 +229,7 @@ enum TransporterError {
* a signal is dropped!! very bad very bad
*
*/
,TE_SIGNAL_LOST_SEND_BUFFER_FULL = 0x8014
,TE_SIGNAL_LOST_SEND_BUFFER_FULL = 0x14 | TE_DO_DISCONNECT
/**
* TE_SIGNAL_LOST
......@@ -231,14 +238,14 @@ enum TransporterError {
* a signal is dropped!! very bad very bad
*
*/
,TE_SIGNAL_LOST = 0x8015
,TE_SIGNAL_LOST = 0x15
/**
* TE_SEND_BUFFER_FULL
*
* The send buffer was full, but sleeping for a while solved it
*/
,TE_SEND_BUFFER_FULL = 0x0016
,TE_SEND_BUFFER_FULL = 0x16
/**
* TE_SCI_UNABLE_TO_CLOSE_CHANNEL
......@@ -246,7 +253,7 @@ enum TransporterError {
* Unable to close the sci channel and the resources allocated by
* the sisci api.
*/
,TE_SCI_UNABLE_TO_CLOSE_CHANNEL = 0x8016
,TE_SCI_UNABLE_TO_CLOSE_CHANNEL = 0x22
/**
* TE_SCI_LINK_ERROR
......@@ -255,7 +262,7 @@ enum TransporterError {
* No point in continuing. Must check the connections.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SCI_LINK_ERROR = 0x8017
,TE_SCI_LINK_ERROR = 0x0017
/**
* TE_SCI_UNABLE_TO_START_SEQUENCE
......@@ -264,14 +271,14 @@ enum TransporterError {
* are exumed or no sequence has been created.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SCI_UNABLE_TO_START_SEQUENCE = 0x8018
,TE_SCI_UNABLE_TO_START_SEQUENCE = 0x18 | TE_DO_DISCONNECT
/**
* TE_SCI_UNABLE_TO_REMOVE_SEQUENCE
*
* Could not remove a sequence
*/
,TE_SCI_UNABLE_TO_REMOVE_SEQUENCE = 0x8019
,TE_SCI_UNABLE_TO_REMOVE_SEQUENCE = 0x19 | TE_DO_DISCONNECT
/**
* TE_SCI_UNABLE_TO_CREATE_SEQUENCE
......@@ -280,7 +287,7 @@ enum TransporterError {
* exempted. Must reboot.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SCI_UNABLE_TO_CREATE_SEQUENCE = 0x801a
,TE_SCI_UNABLE_TO_CREATE_SEQUENCE = 0x1a | TE_DO_DISCONNECT
/**
* TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR
......@@ -288,7 +295,7 @@ enum TransporterError {
* Tried to send data on redundant link but failed.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR = 0x801b
,TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR = 0x1b | TE_DO_DISCONNECT
/**
* TE_SCI_CANNOT_INIT_LOCALSEGMENT
......@@ -297,7 +304,7 @@ enum TransporterError {
* gone wrong (no system resources). Must reboot.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SCI_CANNOT_INIT_LOCALSEGMENT = 0x801c
,TE_SCI_CANNOT_INIT_LOCALSEGMENT = 0x1c | TE_DO_DISCONNECT
/**
* TE_SCI_CANNOT_MAP_REMOTESEGMENT
......@@ -306,7 +313,7 @@ enum TransporterError {
* Must reboot system.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SCI_CANNOT_MAP_REMOTESEGMENT = 0x801d
,TE_SCI_CANNOT_MAP_REMOTESEGMENT = 0x1d | TE_DO_DISCONNECT
/**
* TE_SCI_UNABLE_TO_UNMAP_SEGMENT
......@@ -314,7 +321,7 @@ enum TransporterError {
* Cannot free the resources used by this segment (step 1).
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SCI_UNABLE_TO_UNMAP_SEGMENT = 0x801e
,TE_SCI_UNABLE_TO_UNMAP_SEGMENT = 0x1e | TE_DO_DISCONNECT
/**
* TE_SCI_UNABLE_TO_REMOVE_SEGMENT
......@@ -324,7 +331,7 @@ enum TransporterError {
* to map more segment
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SCI_UNABLE_TO_REMOVE_SEGMENT = 0x801f
,TE_SCI_UNABLE_TO_REMOVE_SEGMENT = 0x1f | TE_DO_DISCONNECT
/**
* TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT
......@@ -332,15 +339,18 @@ enum TransporterError {
* Cannot disconnect from a remote segment.
* Recommended behavior: setPerformState(PerformDisonnect)
*/
,TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT = 0x8020
,TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT = 0x20 | TE_DO_DISCONNECT
/* Used 0x21 */
/* Used 0x22 */
};
/**
* Report error
*/
void
reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode);
reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode,
const char *info = 0);
void
transporter_recv_from(void* callbackObj, NodeId node);
......
......@@ -47,6 +47,9 @@ SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
shmKey(_shmKey),
shmSize(_shmSize)
{
#ifndef NDB_WIN32
shmId= 0;
#endif
_shmSegCreated = false;
_attached = false;
......@@ -202,7 +205,8 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
// Create
if(!_shmSegCreated){
if (!ndb_shm_create()) {
report_error(TE_SHM_UNABLE_TO_CREATE_SEGMENT);
make_error_info(buf, sizeof(buf));
report_error(TE_SHM_UNABLE_TO_CREATE_SEGMENT, buf);
NDB_CLOSE_SOCKET(sockfd);
DBUG_RETURN(false);
}
......@@ -212,7 +216,8 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
// Attach
if(!_attached){
if (!ndb_shm_attach()) {
report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT);
make_error_info(buf, sizeof(buf));
report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT, buf);
NDB_CLOSE_SOCKET(sockfd);
DBUG_RETURN(false);
}
......@@ -224,7 +229,8 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
m_transporter_registry.m_shm_own_pid);
// Wait for ok from client
if (s_input.gets(buf, 256) == 0)
DBUG_PRINT("info", ("Wait for ok from client"));
if (s_input.gets(buf, sizeof(buf)) == 0)
{
NDB_CLOSE_SOCKET(sockfd);
DBUG_RETURN(false);
......@@ -262,10 +268,8 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
SocketOutputStream s_output(sockfd);
char buf[256];
#if 1
#endif
// Wait for server to create and attach
DBUG_PRINT("info", ("Wait for server to create and attach"));
if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd);
DBUG_PRINT("error", ("Server id %d did not attach",
......@@ -293,7 +297,8 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
// Attach
if(!_attached){
if (!ndb_shm_attach()) {
report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT);
make_error_info(buf, sizeof(buf));
report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT, buf);
NDB_CLOSE_SOCKET(sockfd);
DBUG_PRINT("error", ("Failed attach of shm seg to node %d",
remoteNodeId));
......@@ -310,6 +315,7 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
if (r) {
// Wait for ok from server
DBUG_PRINT("info", ("Wait for ok from server"));
if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd);
DBUG_PRINT("error", ("No ok from server node %d",
......@@ -330,8 +336,6 @@ bool
SHM_Transporter::connect_common(NDB_SOCKET_TYPE sockfd)
{
if (!checkConnected()) {
DBUG_PRINT("error", ("Already connected to node %d",
remoteNodeId));
return false;
}
......
......@@ -170,6 +170,8 @@ private:
bool hasDataToRead() const {
return reader->empty() == false;
}
void make_error_info(char info[], int sz);
};
#endif
......@@ -26,6 +26,12 @@
#include <sys/ipc.h>
#include <sys/shm.h>
void SHM_Transporter::make_error_info(char info[], int sz)
{
snprintf(info,sz,"Shm key=%d sz=%d id=%d",
shmKey, shmSize, shmId);
}
bool
SHM_Transporter::ndb_shm_create()
{
......@@ -64,12 +70,30 @@ SHM_Transporter::checkConnected(){
struct shmid_ds info;
const int res = shmctl(shmId, IPC_STAT, &info);
if(res == -1){
report_error(TE_SHM_IPC_STAT);
char buf[128];
int r= snprintf(buf, sizeof(buf),
"shmctl(%d, IPC_STAT) errno: %d(%s). ", shmId,
errno, strerror(errno));
make_error_info(buf+r, sizeof(buf)-r);
DBUG_PRINT("error",(buf));
switch (errno)
{
case EACCES:
report_error(TE_SHM_IPC_PERMANENT, buf);
break;
default:
report_error(TE_SHM_IPC_STAT, buf);
break;
}
return false;
}
if(info.shm_nattch != 2){
char buf[128];
make_error_info(buf, sizeof(buf));
report_error(TE_SHM_DISCONNECT);
DBUG_PRINT("error", ("Already connected to node %d",
remoteNodeId));
return false;
}
return true;
......@@ -91,6 +115,8 @@ SHM_Transporter::disconnectImpl(){
if(isServer && _shmSegCreated){
const int res = shmctl(shmId, IPC_RMID, 0);
if(res == -1){
char buf[64];
make_error_info(buf, sizeof(buf));
report_error(TE_SHM_UNABLE_TO_REMOVE_SEGMENT);
return;
}
......
......@@ -26,6 +26,12 @@
#include <windows.h>
void SHM_Transporter::make_error_info(char info[], int sz)
{
snprintf(info,sz,"Shm key=%d sz=%d",
shmKey, shmSize);
}
bool
SHM_Transporter::connectServer(Uint32 timeOutMillis){
if(!_shmSegCreated)
......
......@@ -161,7 +161,8 @@ protected:
TransporterRegistry &m_transporter_registry;
void *get_callback_obj() { return m_transporter_registry.callbackObj; };
void report_disconnect(int err){m_transporter_registry.report_disconnect(remoteNodeId,err);};
void report_error(enum TransporterError err){reportError(get_callback_obj(),remoteNodeId,err);};
void report_error(enum TransporterError err, const char *info = 0)
{ reportError(get_callback_obj(), remoteNodeId, err, info); };
};
inline
......
......@@ -1508,8 +1508,8 @@ TransporterRegistry::startReceiving()
{
DBUG_PRINT("error",("Install failed"));
g_eventLogger.error("Failed to install signal handler for"
" SHM transporter errno: %d (%s)", errno,
strerror(errno));
" SHM transporter, signum %d, errno: %d (%s)",
g_ndb_shm_signum, errno, strerror(errno));
}
}
#endif // NDB_SHM_TRANSPORTER
......
......@@ -1823,11 +1823,14 @@ void Qmgr::execNDB_FAILCONF(Signal* signal)
/*******************************/
/* DISCONNECT_REP */
/*******************************/
const char *lookupConnectionError(Uint32 err);
void Qmgr::execDISCONNECT_REP(Signal* signal)
{
jamEntry();
const DisconnectRep * const rep = (DisconnectRep *)&signal->theData[0];
const Uint32 nodeId = rep->nodeId;
const Uint32 err = rep->err;
c_connectedNodes.clear(nodeId);
NodeRecPtr nodePtr;
......@@ -1838,10 +1841,17 @@ void Qmgr::execDISCONNECT_REP(Signal* signal)
jam();
break;
case ZINIT:
ndbrequire(false);
case ZSTARTING:
progError(__LINE__, NDBD_EXIT_CONNECTION_SETUP_FAILED,
lookupConnectionError(err));
ndbrequire(false);
case ZPREPARE_FAIL:
ndbrequire(false);
case ZFAIL_CLOSING:
ndbrequire(false);
case ZAPI_ACTIVE:
ndbrequire(false);
case ZAPI_INACTIVE:
ndbrequire(false);
}
......
......@@ -95,6 +95,7 @@ static const ErrStruct errArray[] =
{NDBD_EXIT_SIGNAL_LOST, XIE, "Signal lost (unknown reason)"},
{NDBD_EXIT_ILLEGAL_SIGNAL, XIE,
"Illegal signal (version mismatch a possibility)"},
{NDBD_EXIT_CONNECTION_SETUP_FAILED, XCE, "Connection setup failed"},
/* Ndbcntr */
{NDBD_EXIT_RESTART_TIMEOUT, XCE,
......
......@@ -394,7 +394,8 @@ void print_restart(FILE * output, Signal* signal, Uint32 aLevel);
void FastScheduler::dumpSignalMemory(FILE * output)
{
Signal signal;
SignalT<25> signalT;
Signal &signal= *(Signal*)&signalT;
Uint32 ReadPtr[5];
Uint32 tJob;
Uint32 tLastJob;
......@@ -483,17 +484,17 @@ print_restart(FILE * output, Signal* signal, Uint32 aLevel)
*/
void
FastScheduler::reportDoJobStatistics(Uint32 tMeanLoopCount) {
Signal signal;
SignalT<2> signalT;
Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
signal.header.theLength = 2;
signal.header.theSendersSignalId = 0;
signal.header.theSendersBlockRef = numberToRef(0, 0);
signal.theData[0] = NDB_LE_JobStatistic;
signal.theData[1] = tMeanLoopCount;
memset(&signal.header, 0, sizeof(SignalHeader));
signal.header.theLength = 2;
signal.header.theSendersSignalId = 0;
signal.header.theSendersBlockRef = numberToRef(0, 0);
execute(&signal, JBA, CMVMI, GSN_EVENT_REP);
}
......@@ -39,6 +39,26 @@
*/
SectionSegmentPool g_sectionSegmentPool;
struct ConnectionError
{
enum TransporterError err;
const char *text;
};
static const ConnectionError connectionError[] =
{
{ TE_NO_ERROR, "No error"},
{ TE_SHM_UNABLE_TO_CREATE_SEGMENT, "Unable to create shared memory segment"},
{ (enum TransporterError) -1, "No connection error message available (please report a bug)"}
};
const char *lookupConnectionError(Uint32 err)
{
int i= 0;
while ((Uint32)connectionError[i].err != err && (Uint32)connectionError[i].err != -1);
return connectionError[i].text;
}
bool
import(Ptr<SectionSegment> & first, const Uint32 * src, Uint32 len){
/**
......@@ -306,30 +326,54 @@ checkJobBuffer() {
}
void
reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode){
reportError(void * callbackObj, NodeId nodeId,
TransporterError errorCode, const char *info)
{
#ifdef DEBUG_TRANSPORTER
char buf[255];
sprintf(buf, "reportError (%d, 0x%x)", nodeId, errorCode);
ndbout << buf << endl;
ndbout_c("reportError (%d, 0x%x) %s", nodeId, errorCode, info ? info : "")
#endif
if(errorCode == TE_SIGNAL_LOST_SEND_BUFFER_FULL){
DBUG_ENTER("reportError");
DBUG_PRINT("info",("nodeId %d errorCode: 0x%x info: %s",
nodeId, errorCode, info));
switch (errorCode)
{
case TE_SIGNAL_LOST_SEND_BUFFER_FULL:
{
char msg[64];
snprintf(msg, sizeof(msg), "Remote note id %d.%s%s", nodeId,
info ? " " : "", info ? info : "");
ErrorReporter::handleError(NDBD_EXIT_SIGNAL_LOST_SEND_BUFFER_FULL,
"", __FILE__,
NST_ErrorHandler);
msg, __FILE__, NST_ErrorHandler);
}
if(errorCode == TE_SIGNAL_LOST){
case TE_SIGNAL_LOST:
{
char msg[64];
snprintf(msg, sizeof(msg), "Remote node id %d,%s%s", nodeId,
info ? " " : "", info ? info : "");
ErrorReporter::handleError(NDBD_EXIT_SIGNAL_LOST,
"", __FILE__,
NST_ErrorHandler);
msg, __FILE__, NST_ErrorHandler);
}
if(errorCode & 0x8000){
case TE_SHM_IPC_PERMANENT:
{
char msg[128];
snprintf(msg, sizeof(msg),
"Remote node id %d.%s%s",
nodeId, info ? " " : "", info ? info : "");
ErrorReporter::handleError(NDBD_EXIT_CONNECTION_SETUP_FAILED,
msg, __FILE__, NST_ErrorHandler);
}
default:
break;
}
if(errorCode & & TE_DO_DISCONNECT){
reportDisconnect(callbackObj, nodeId, errorCode);
}
Signal signal;
SignalT<3> signalT;
Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
......@@ -345,6 +389,8 @@ reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode){
signal.header.theSendersSignalId = 0;
signal.header.theSendersBlockRef = numberToRef(0, globalData.ownId);
globalScheduler.execute(&signal, JBA, CMVMI, GSN_EVENT_REP);
DBUG_VOID_RETURN;
}
/**
......@@ -354,7 +400,8 @@ void
reportSendLen(void * callbackObj,
NodeId nodeId, Uint32 count, Uint64 bytes){
Signal signal;
SignalT<3> signalT;
Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
signal.header.theLength = 3;
......@@ -373,7 +420,8 @@ void
reportReceiveLen(void * callbackObj,
NodeId nodeId, Uint32 count, Uint64 bytes){
Signal signal;
SignalT<3> signalT;
Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
signal.header.theLength = 3;
......@@ -392,7 +440,8 @@ reportReceiveLen(void * callbackObj,
void
reportConnect(void * callbackObj, NodeId nodeId){
Signal signal;
SignalT<1> signalT;
Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
signal.header.theLength = 1;
......@@ -409,7 +458,10 @@ reportConnect(void * callbackObj, NodeId nodeId){
void
reportDisconnect(void * callbackObj, NodeId nodeId, Uint32 errNo){
Signal signal;
DBUG_ENTER("reportDisconnect");
SignalT<sizeof(DisconnectRep)/4> signalT;
Signal &signal= *(Signal*)&signalT;
memset(&signal.header, 0, sizeof(signal.header));
signal.header.theLength = DisconnectRep::SignalLength;
......@@ -422,6 +474,8 @@ reportDisconnect(void * callbackObj, NodeId nodeId, Uint32 errNo){
rep->err = errNo;
globalScheduler.execute(&signal, JBA, CMVMI, GSN_DISCONNECT_REP);
DBUG_VOID_RETURN;
}
void
......
......@@ -42,6 +42,16 @@ struct NodeReceiverGroup {
NodeBitmask m_nodes;
};
template <unsigned T> struct SignalT
{
SignalHeader header;
SegmentedSectionPtr m_sectionPtr[3];
union {
Uint32 theData[T];
Uint64 dummyAlign;
};
};
/**
* class used for passing argumentes to blocks
*/
......
......@@ -150,7 +150,6 @@ ConfigInfo::m_SectionRules[] = {
{ "TCP", fixPortNumber, 0 }, // has to come after fixHostName
{ "SHM", fixPortNumber, 0 }, // has to come after fixHostName
{ "SCI", fixPortNumber, 0 }, // has to come after fixHostName
{ "SHM", fixShmKey, 0 },
/**
* fixExtConnection must be after fixNodeId
......@@ -164,6 +163,8 @@ ConfigInfo::m_SectionRules[] = {
{ "*", fixDepricated, 0 },
{ "*", applyDefaultValues, "system" },
{ "SHM", fixShmKey, 0 }, // has to come after apply default values
{ DB_TOKEN, checkLocalhostHostnameMix, 0 },
{ API_TOKEN, checkLocalhostHostnameMix, 0 },
{ MGM_TOKEN, checkLocalhostHostnameMix, 0 },
......@@ -1798,7 +1799,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
"0",
UNDEFINED,
"0",
STR_VALUE(MAX_INT_RNIL) },
......
......@@ -63,13 +63,16 @@ TransporterFacade* TransporterFacade::theFacadeInstance = NULL;
*****************************************************************************/
void
reportError(void * callbackObj, NodeId nodeId, TransporterError errorCode){
reportError(void * callbackObj, NodeId nodeId,
TransporterError errorCode, const char *info)
{
#ifdef REPORT_TRANSPORTER
ndbout_c("REPORT_TRANSP: reportError (nodeId=%d, errorCode=%d)",
(int)nodeId, (int)errorCode);
ndbout_c("REPORT_TRANSP: reportError (nodeId=%d, errorCode=%d) %s",
(int)nodeId, (int)errorCode, info ? info : "");
#endif
if(errorCode & 0x8000) {
ndbout_c("reportError (%d, %d)\n", (int)nodeId, (int)errorCode);
if(errorCode & TE_DO_DISCONNECT) {
ndbout_c("reportError (%d, %d) %s", (int)nodeId, (int)errorCode,
info ? info : "");
((TransporterFacade*)(callbackObj))->doDisconnect(nodeId);
}
}
......
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