Skip to content

Commit

Permalink
Add initial set of patches for TokuDB engine build.
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Hajny committed May 26, 2015
1 parent d183fba commit 450762b
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mariadb10-client/distinfo
Expand Up @@ -13,3 +13,10 @@ SHA1 (patch-storage_connect_filamvct.cpp) = 1d619675be3db80b2a943ea9104b4cb82f58
SHA1 (patch-storage_connect_tabvct.cpp) = 2e3c7cd7e4b0a86d443da47d3cc514b8b276d836
SHA1 (patch-storage_csv_CMakeLists.txt) = edd6bee4a2091f11c35c26c328bce65fc1f3660a
SHA1 (patch-storage_mroonga_vendor_groonga_lib_com.c) = 810d1ecd1a4c20eb505791c48d97141edbe3f4bd
SHA1 (patch-storage_tokudb_CMakeLists.txt) = 0dac91b8a9a7267f190c6a3685bf2f6b338a0ba9
SHA1 (patch-storage_tokudb_ft-index_portability_file.cc) = 1efd56596393879153e6f10f506650dced429d78
SHA1 (patch-storage_tokudb_ft-index_portability_portability.cc) = bae306fb652fba04386214db83e477120ef9bf4a
SHA1 (patch-storage_tokudb_ft-index_portability_toku__htod.h) = 40fa26c3f410ba5798bc910656edededcec5d4a7
SHA1 (patch-storage_tokudb_ft-index_portability_toku__portability.h) = c80ee21a99a5e1b89b0fd5da7cfea79bc80ef2df
SHA1 (patch-storage_tokudb_ft-index_portability_toku__pthread.cc) = 2bdf55afe099728c5dfd7ac93cb0d0277227d316
SHA1 (patch-storage_tokudb_ft-index_portability_toku__pthread.h) = 04f6efecd8a13dd73160bfb1d6c88fc7809842c2
11 changes: 11 additions & 0 deletions mariadb10-client/patches/patch-storage_tokudb_CMakeLists.txt
@@ -0,0 +1,11 @@
$NetBSD$

--- storage/tokudb/CMakeLists.txt.orig 2015-02-25 15:40:56.000000000 +0000
+++ storage/tokudb/CMakeLists.txt
@@ -1,5 +1,5 @@
# ft-index only supports x86-64 and cmake-2.8.9+
-IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND
+IF(
NOT CMAKE_VERSION VERSION_LESS "2.8.9")
CHECK_CXX_SOURCE_COMPILES(
"
@@ -0,0 +1,14 @@
$NetBSD$

--- storage/tokudb/ft-index/portability/file.cc.orig 2015-02-25 15:40:56.000000000 +0000
+++ storage/tokudb/ft-index/portability/file.cc
@@ -373,6 +373,9 @@ toku_os_open_direct(const char *path, in
perror("setting F_NOCACHE");
}
}
+#elif defined(__sun)
+ rval = toku_os_open(path, oflag, mode);
+ directio(rval, DIRECTIO_ON);
#else
# error "No direct I/O implementation found."
#endif
@@ -0,0 +1,60 @@
$NetBSD$

--- storage/tokudb/ft-index/portability/portability.cc.orig 2015-02-25 15:40:56.000000000 +0000
+++ storage/tokudb/ft-index/portability/portability.cc
@@ -130,6 +130,9 @@ PATENT RIGHTS GRANT:
#include "memory.h"
#include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
+#if defined(__sun)
+#include <thread.h>
+#endif

int
toku_portability_init(void) {
@@ -160,6 +163,8 @@ toku_os_gettid(void) {
return syscall(SYS_gettid);
#elif defined(HAVE_PTHREAD_GETTHREADID_NP)
return pthread_getthreadid_np();
+#elif defined(__sun)
+ return thr_self();
#else
# error "no implementation of gettid available"
#endif
@@ -244,7 +249,18 @@ toku_os_lock_file(const char *name) {
int r;
int fd = open(name, O_RDWR|O_CREAT, S_IRUSR | S_IWUSR);
if (fd>=0) {
+#if defined(__sun)
+ struct flock lock;
+
+ lock.l_start = 0;
+ lock.l_len = 0;
+ lock.l_type = F_WRLCK;
+ lock.l_whence = SEEK_SET;
+
+ r = fcntl(fd, F_SETLK, &lock);
+#else
r = flock(fd, LOCK_EX | LOCK_NB);
+#endif
if (r!=0) {
r = errno; //Save errno from flock.
close(fd);
@@ -257,7 +273,17 @@ toku_os_lock_file(const char *name) {

int
toku_os_unlock_file(int fildes) {
+#if defined(__sun)
+ struct flock lock;
+
+ lock.l_start = 0;
+ lock.l_len = 0;
+ lock.l_type = F_WRLCK;
+ lock.l_whence = SEEK_SET;
+ int r = fcntl(fildes, F_SETLK, &lock);
+#else
int r = flock(fildes, LOCK_UN);
+#endif
if (r==0) r = close(fildes);
return r;
}
@@ -0,0 +1,20 @@
$NetBSD$

--- storage/tokudb/ft-index/portability/toku_htod.h.orig 2015-02-25 15:40:56.000000000 +0000
+++ storage/tokudb/ft-index/portability/toku_htod.h
@@ -116,6 +116,15 @@ PATENT RIGHTS GRANT:
# define __BYTE_ORDER __DARWIN_BYTE_ORDER
# define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
# define __BIG_ENDIAN __DARWIN_BIG_ENDIAN
+#elif defined(__sun)
+# include <sys/isa_defs.h>
+# define __BIG_ENDIAN 4321
+# define __LITTLE_ENDIAN 1234
+# if defined(_BIG_ENDIAN)
+# define __BYTE_ORDER __BIG_ENDIAN
+# else
+# define __BYTE_ORDER __LITTLE_ENDIAN
+# endif
#endif
#if !defined(__BYTE_ORDER) || \
!defined(__LITTLE_ENDIAN) || \
@@ -0,0 +1,22 @@
$NetBSD$

--- storage/tokudb/ft-index/portability/toku_portability.h.orig 2015-02-25 15:40:56.000000000 +0000
+++ storage/tokudb/ft-index/portability/toku_portability.h
@@ -200,7 +200,7 @@ int _dup2(int fd, int fd2)
#undef strdup
# if defined(__FreeBSD__)
char* strdup(const char *) __malloc_like __attribute__((__deprecated__));
-# elif defined(__APPLE__)
+# elif defined(__APPLE__) || defined(__sun)
char* strdup(const char *) __attribute__((__deprecated__));
# else
char* strdup(const char *) __THROW __attribute_malloc__ __nonnull ((1)) __attribute__((__deprecated__));
@@ -216,7 +216,7 @@ ssize_t pwrite(int, const void *, size_
extern void *malloc(size_t) __malloc_like __attribute__((__deprecated__));
extern void free(void*) __attribute__((__deprecated__));
extern void *realloc(void*, size_t) __malloc_like __attribute__((__deprecated__));
-# elif defined(__APPLE__)
+# elif defined(__APPLE__) || defined(__sun)
extern void *malloc(size_t) __attribute__((__deprecated__));
extern void free(void*) __attribute__((__deprecated__));
extern void *realloc(void*, size_t) __attribute__((__deprecated__));
@@ -0,0 +1,24 @@
$NetBSD$

--- storage/tokudb/ft-index/portability/toku_pthread.cc.orig 2015-02-25 15:40:56.000000000 +0000
+++ storage/tokudb/ft-index/portability/toku_pthread.cc
@@ -92,6 +92,10 @@ PATENT RIGHTS GRANT:
#include <portability/toku_config.h>
#include <toku_pthread.h>

+#if defined(__sun)
+#include <sched.h> // for sched_yield()
+#endif
+
int toku_pthread_yield(void) {
#if defined(HAVE_PTHREAD_YIELD)
# if defined(PTHREAD_YIELD_RETURNS_INT)
@@ -105,6 +109,8 @@ int toku_pthread_yield(void) {
#elif defined(HAVE_PTHREAD_YIELD_NP)
pthread_yield_np();
return 0;
+#elif defined(__sun)
+ return sched_yield();
#else
# error "cannot find pthread_yield or pthread_yield_np"
#endif
@@ -0,0 +1,13 @@
$NetBSD$

--- storage/tokudb/ft-index/portability/toku_pthread.h.orig 2015-02-25 15:40:56.000000000 +0000
+++ storage/tokudb/ft-index/portability/toku_pthread.h
@@ -142,7 +142,7 @@ typedef struct toku_mutex_aligned {
#endif
// Darwin doesn't provide adaptive mutexes
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__sun)
# define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_DEFAULT
# if TOKU_PTHREAD_DEBUG
# define TOKU_ADAPTIVE_MUTEX_INITIALIZER { .pmutex = PTHREAD_MUTEX_INITIALIZER, .owner = 0, .locked = false, .valid = true }
5 changes: 5 additions & 0 deletions mariadb10-server/Makefile
Expand Up @@ -77,6 +77,11 @@ SUBST_STAGE.perl= pre-configure
SUBST_FILES.perl= sql-bench/test-table-elimination.sh
SUBST_SED.perl= -e 's,@PERL@,${PERL5},'

BUILDLINK_TRANSFORM+= rm:-fuse-linker-plugin

# Clumsy workaround for error thrown for storage/tokudb/ft-index/ft/txn/txn.cc:345:5
CPPFLAGS+= -Wno-missing-braces

CONF_FILES= ${PREFIX}/share/mysql/my-joyent.cnf \
${PKG_SYSCONFDIR}/my.cnf

Expand Down

0 comments on commit 450762b

Please sign in to comment.