mysql - mysql_real_connect call from within daemon plugin -
i want write mysql daemon plugin monitors queries on other mysql servers , compares them queries running on daemon running. in spider engine setting, query initiated on head node run on shards. whenever query killed on head, want have daemon on shard nodes kill associated query there.
the idea initiate pthread uses mysql_real_connect
, mysql_real_query
... access "show processlist" on head node , compare them local thread list. if issue mysql_real_connect
in thread of daemon, segmentation fault. think due threading issue in mysql_real_connect
. i've used #define mysql_server 1
, follow approach taken in ha_federated::real_connect()
.
is possible run mysql_real_connect
within daemon plugin?
thanks hints.
after meditating on handlersocker daemon plugin realised in order mysql_real_connect
, friends work in daemon thread, mysql internal thread environment needs set , registered server.
this involves calling following in daemon thread:
my_thread_init(); thd = new thd; mysql_mutex_lock(&lock_thread_count); thd->thread_id = thread_id++; mysql_mutex_unlock(&lock_thread_count); thd->store_globals(); ... setting various options in thd ... mysql_mutex_lock(&lock_thread_count); threads.append(thd); ++thread_count; mysql_mutex_unlock(&lock_thread_count);
Comments
Post a Comment