Commit 1d6e50c6 authored by Sergey Petrunya's avatar Sergey Petrunya

Fix PBXT build on windows by backporting some of their changes (under advise of Vlad Kolesnikov):

- Adjust CMakeLists.txt to follow latest mysql's expectations about plugins
- Add typecasts
- wrap pbms_enabled.cc in #ifdef
parent 5c7232af
......@@ -32,22 +32,72 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/extra/yassl/include)
SET(PBXT_SOURCES ha_pbxt.cc bsearch_xt.cc index_xt.cc strutil_xt.cc cache_xt.cc linklist_xt.cc
ccutils_xt.cc lock_xt.cc table_xt.cc database_xt.cc thread_xt.cc
datadic_xt.cc memory_xt.cc trace_xt.cc datalog_xt.cc myxt_xt.cc util_xt.cc
filesys_xt.cc pthread_xt.cc xaction_xt.cc restart_xt.cc xactlog_xt.cc
hashtab_xt.cc sortedlist_xt.cc heap_xt.cc streaming_xt.cc tabcache_xt.cc
systab_xt.cc ha_xtsys.cc discover_xt.cc
bsearch_xt.h linklist_xt.h tabcache_xt.h cache_xt.h lock_xt.h table_xt.h
ccutils_xt.h thread_xt.h database_xt.h memory_xt.h trace_xt.h
datadic_xt.h pbms.h util_xt.h datalog_xt.h myxt_xt.h xaction_xt.h
filesys_xt.h pthread_xt.h xactlog_xt.h ha_pbxt.h restart_xt.h xt_config.h
hashtab_xt.h sortedlist_xt.h xt_defs.h heap_xt.h streaming_xt.h xt_errno.h
systab_xt.h ha_xtsys.h discover_xt.h
index_xt.h strutil_xt.h)
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(pbxt ${PBXT_SOURCES})
ADD_DEPENDENCIES(pbxt GenError)
ENDIF(NOT SOURCE_SUBLIBS)
SET(PBXT_SOURCES
src/bsearch_xt.cc
src/bsearch_xt.h
src/cache_xt.cc
src/cache_xt.h
src/ccutils_xt.cc
src/ccutils_xt.h
src/database_xt.cc
src/database_xt.h
src/datadic_xt.cc
src/datadic_xt.h
src/datalog_xt.cc
src/datalog_xt.h
src/discover_xt.cc
src/discover_xt.h
src/filesys_xt.cc
src/filesys_xt.h
src/hashtab_xt.cc
src/hashtab_xt.h
src/ha_pbxt.cc
src/ha_pbxt.h
src/ha_xtsys.cc
src/ha_xtsys.h
src/heap_xt.cc
src/heap_xt.h
src/index_xt.cc
src/index_xt.h
src/linklist_xt.cc
src/linklist_xt.h
src/locklist_xt.cc
src/locklist_xt.h
src/lock_xt.cc
src/lock_xt.h
src/memory_xt.cc
src/memory_xt.h
src/myxt_xt.cc
src/myxt_xt.h
src/pbms.h
src/pbms_enabled.cc
src/pbms_enabled.h
src/pthread_xt.cc
src/pthread_xt.h
src/restart_xt.cc
src/restart_xt.h
src/sortedlist_xt.cc
src/sortedlist_xt.h
src/strutil_xt.cc
src/strutil_xt.h
src/systab_xt.cc
src/systab_xt.h
src/tabcache_xt.cc
src/tabcache_xt.h
src/table_xt.cc
src/table_xt.h
src/thread_xt.cc
src/thread_xt.h
src/trace_xt.cc
src/trace_xt.h
src/util_xt.cc
src/util_xt.h
src/xaction_xt.cc
src/xaction_xt.h
src/xactlog_xt.cc
src/xactlog_xt.h
src/xt_config.h
src/xt_defs.h
src/xt_errno.h)
MYSQL_STORAGE_ENGINE(PBXT)
......@@ -29,6 +29,12 @@
*
*/
/*
The following two lines backported by psergey. Remove them when we merge from PBXT again.
*/
#include "xt_config.h"
#ifdef PBMS_ENABLED
#define PBMS_API pbms_enabled_api
#include "pbms_enabled.h"
......@@ -236,3 +242,4 @@ void pbms_completed(TABLE *table, bool ok)
return ;
}
#endif
\ No newline at end of file
......@@ -1016,7 +1016,7 @@ extern "C" void *thr_main(void *data)
#endif
try_(a) {
if (!xt_set_key(thr_key, self, &self->t_exception))
if (!xt_set_key((pthread_key_t)thr_key, self, &self->t_exception))
throw_();
td->td_started = TRUE;
return_data = (*start_routine)(self);
......@@ -1352,12 +1352,12 @@ xtPublic XTThreadPtr xt_get_self(void)
return self;
/* Then it must be a background process, and the
* thread info is stored in the local key: */
return (XTThreadPtr) xt_get_key(thr_key);
return (XTThreadPtr) xt_get_key((pthread_key_t)thr_key);
}
xtPublic void xt_set_self(XTThreadPtr self)
{
xt_set_key(thr_key, self, NULL);
xt_set_key((pthread_key_t)thr_key, self, NULL);
}
xtPublic void xt_clear_exception(XTThreadPtr thread)
......@@ -1386,7 +1386,7 @@ xtPublic XTThreadPtr xt_create_thread(c_char *name, xtBool main_thread, xtBool u
return NULL;
}
if (!xt_set_key(thr_key, self, e)) {
if (!xt_set_key((pthread_key_t)thr_key, self, e)) {
xt_free_ns(self);
return NULL;
}
......@@ -1400,7 +1400,7 @@ xtPublic XTThreadPtr xt_create_thread(c_char *name, xtBool main_thread, xtBool u
}
catch_(a) {
*e = self->t_exception;
xt_set_key(thr_key, NULL, NULL);
xt_set_key((pthread_key_t)thr_key, NULL, NULL);
xt_free_ns(self);
self = NULL;
}
......@@ -1464,8 +1464,8 @@ void xt_free_thread(XTThreadPtr self)
* PBXT resources on all MySQL THDs created by PBMS for it's own pthreads. So the 'self'
* being freed is not the same 'self' associated with the PBXT 'thr_key'.
*/
if (thr_key && (self == ((XTThreadPtr) xt_get_key(thr_key)))) {
xt_set_key(thr_key, NULL, NULL);
if (thr_key && (self == ((XTThreadPtr) xt_get_key((pthread_key_t)thr_key)))) {
xt_set_key((pthread_key_t)thr_key, NULL, NULL);
}
xt_free_ns(self);
}
......
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