bug#7693 - ndb
when using shm transporter, set sigmask on each thread using pthread_sigmask
This commit is contained in:
parent
06f60f6d65
commit
b0b8f9115a
@ -1924,7 +1924,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
|
|||||||
pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
|
pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
|
||||||
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
|
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
|
||||||
realpath rename rint rwlock_init setupterm \
|
realpath rename rint rwlock_init setupterm \
|
||||||
shmget shmat shmdt shmctl sigaction \
|
shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
|
||||||
sighold sigset sigthreadmask \
|
sighold sigset sigthreadmask \
|
||||||
snprintf socket stpcpy strcasecmp strerror strnlen strpbrk strstr strtol \
|
snprintf socket stpcpy strcasecmp strerror strnlen strpbrk strstr strtol \
|
||||||
strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr)
|
strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr)
|
||||||
@ -3098,7 +3098,10 @@ if test "$ac_cv_func_shmget" = "yes" &&
|
|||||||
test "$ac_cv_func_shmat" = "yes" &&
|
test "$ac_cv_func_shmat" = "yes" &&
|
||||||
test "$ac_cv_func_shmdt" = "yes" &&
|
test "$ac_cv_func_shmdt" = "yes" &&
|
||||||
test "$ac_cv_func_shmctl" = "yes" &&
|
test "$ac_cv_func_shmctl" = "yes" &&
|
||||||
test "$ac_cv_func_sigaction" = "yes"
|
test "$ac_cv_func_sigaction" = "yes" &&
|
||||||
|
test "$ac_cv_func_sigemptyset" = "yes" &&
|
||||||
|
test "$ac_cv_func_sigaddset" = "yes" &&
|
||||||
|
test "$ac_cv_func_pthread_sigmask" = "yes"
|
||||||
then
|
then
|
||||||
AC_DEFINE([NDB_SHM_TRANSPORTER], [1],
|
AC_DEFINE([NDB_SHM_TRANSPORTER], [1],
|
||||||
[Including Ndb Cluster DB shared memory transporter])
|
[Including Ndb Cluster DB shared memory transporter])
|
||||||
|
@ -28,8 +28,24 @@ struct NdbThread
|
|||||||
{
|
{
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
char thread_name[MAX_THREAD_NAME];
|
char thread_name[MAX_THREAD_NAME];
|
||||||
|
NDB_THREAD_FUNC * func;
|
||||||
|
void * object;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static
|
||||||
|
void*
|
||||||
|
ndb_thread_wrapper(void* _ss){
|
||||||
|
void * ret;
|
||||||
|
struct NdbThread * ss = (struct NdbThread *)_ss;
|
||||||
|
#ifdef NDB_SHM_TRANSPORTER
|
||||||
|
sigset_t mask;
|
||||||
|
sigemptyset(&mask);
|
||||||
|
sigaddset(&mask, SIGUSR1);
|
||||||
|
pthread_sigmask(SIG_BLOCK, &mask, 0);
|
||||||
|
#endif
|
||||||
|
ret= (* ss->func)(ss->object);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
|
struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
|
||||||
@ -67,10 +83,12 @@ struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
|
|||||||
#ifdef PTHREAD_CREATE_JOINABLE /* needed on SCO */
|
#ifdef PTHREAD_CREATE_JOINABLE /* needed on SCO */
|
||||||
pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE);
|
pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_JOINABLE);
|
||||||
#endif
|
#endif
|
||||||
|
tmpThread->func= p_thread_func;
|
||||||
|
tmpThread->object= p_thread_arg;
|
||||||
result = pthread_create(&tmpThread->thread,
|
result = pthread_create(&tmpThread->thread,
|
||||||
&thread_attr,
|
&thread_attr,
|
||||||
p_thread_func,
|
ndb_thread_wrapper,
|
||||||
p_thread_arg);
|
tmpThread);
|
||||||
assert(result==0);
|
assert(result==0);
|
||||||
|
|
||||||
pthread_attr_destroy(&thread_attr);
|
pthread_attr_destroy(&thread_attr);
|
||||||
|
@ -153,8 +153,17 @@ TransporterRegistry::init(NodeId nodeId) {
|
|||||||
|
|
||||||
DEBUG("TransporterRegistry started node: " << localNodeId);
|
DEBUG("TransporterRegistry started node: " << localNodeId);
|
||||||
|
|
||||||
// return allocateLongSignalMemoryPool(nLargeSegments);
|
#ifdef NDB_SHM_TRANSPORTER
|
||||||
return true;
|
/**
|
||||||
|
* Make sure to block SIGUSR1
|
||||||
|
* TransporterRegistry::init is run from "main" thread
|
||||||
|
*/
|
||||||
|
sigset_t mask;
|
||||||
|
sigemptyset(&mask);
|
||||||
|
sigaddset(&mask, SIGUSR1);
|
||||||
|
pthread_sigmask(SIG_BLOCK, &mask, 0);
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -1321,6 +1330,9 @@ TransporterRegistry::startReceiving()
|
|||||||
#ifdef NDB_SHM_TRANSPORTER
|
#ifdef NDB_SHM_TRANSPORTER
|
||||||
m_shm_own_pid = getpid();
|
m_shm_own_pid = getpid();
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
sigemptyset(&sa.sa_mask);
|
||||||
|
sigaddset(&sa.sa_mask, SIGUSR1);
|
||||||
|
pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, 0);
|
||||||
sa.sa_handler = shm_sig_handler;
|
sa.sa_handler = shm_sig_handler;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = 0;
|
||||||
|
@ -583,7 +583,7 @@ int ha_ndbcluster::get_ndb_blobs_value(NdbBlob *last_ndb_blob)
|
|||||||
char *buf= m_blobs_buffer + offset;
|
char *buf= m_blobs_buffer + offset;
|
||||||
uint32 len= 0xffffffff; // Max uint32
|
uint32 len= 0xffffffff; // Max uint32
|
||||||
DBUG_PRINT("value", ("read blob ptr=%x len=%u",
|
DBUG_PRINT("value", ("read blob ptr=%x len=%u",
|
||||||
(uint)buf, (uint)blob_len));
|
(UintPtr)buf, (uint)blob_len));
|
||||||
if (ndb_blob->readData(buf, len) != 0)
|
if (ndb_blob->readData(buf, len) != 0)
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
DBUG_ASSERT(len == blob_len);
|
DBUG_ASSERT(len == blob_len);
|
||||||
@ -3169,7 +3169,7 @@ int ha_ndbcluster::start_stmt(THD *thd)
|
|||||||
|
|
||||||
NdbConnection *tablock_trans=
|
NdbConnection *tablock_trans=
|
||||||
(NdbConnection*)thd->transaction.all.ndb_tid;
|
(NdbConnection*)thd->transaction.all.ndb_tid;
|
||||||
DBUG_PRINT("info", ("tablock_trans: %x", (uint)tablock_trans));
|
DBUG_PRINT("info", ("tablock_trans: %x", (UintPtr)tablock_trans));
|
||||||
DBUG_ASSERT(tablock_trans);
|
DBUG_ASSERT(tablock_trans);
|
||||||
// trans= ndb->hupp(tablock_trans);
|
// trans= ndb->hupp(tablock_trans);
|
||||||
trans= ndb->startTransaction();
|
trans= ndb->startTransaction();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user