summaryrefslogtreecommitdiff
path: root/storage/tokudb
diff options
context:
space:
mode:
authorTeodor Mircea Ionita <teodor@mariadb.org>2018-05-10 10:00:51 +0300
committerVicențiu-Marian Ciorbaru <cvicentiu@gmail.com>2018-06-10 10:12:34 +0300
commit7053e26e1869962ef473043686996f40ac0fb88c (patch)
tree4f4ac2bd8b2f79518153b294f1ab14ce4af8d31f /storage/tokudb
parent8f82c4844342f42c27e2336b64f7bdd1a1344cbd (diff)
downloadmariadb-git-7053e26e1869962ef473043686996f40ac0fb88c.tar.gz
MDEV-15778: Fix TokuDB build issues on macOS 10.13.4
Several issues were encountered and fixed as explained bellow: * missing link to dbug lib; * user proper fprintf format specifier; * ZERO_COND_INITIALIZER was using wrong toku_cond_t struct initializer for first member of type pthread_cond_t and not considering the TOKU_PTHREAD_DEBUG case which has one extra struct member of type pfs_key_t; * Remove likely(!opt_debug_sync_timeout), argument is declared extern and not available to Toku; * pthread_mutex_timedlock() is not available in pthreads for Mac, as it's not part of the POSIX pthreads spec. The encompassing event_t::wait(ms) methods are unused, thus have been removed;
Diffstat (limited to 'storage/tokudb')
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-ops.cc4
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc6
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc58
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_debug_sync.h3
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_pthread.h12
-rw-r--r--storage/tokudb/PerconaFT/src/CMakeLists.txt2
-rw-r--r--storage/tokudb/tokudb_thread.h49
7 files changed, 46 insertions, 88 deletions
diff --git a/storage/tokudb/PerconaFT/ft/ft-ops.cc b/storage/tokudb/PerconaFT/ft/ft-ops.cc
index d036366dd63..d7ea5efdff5 100644
--- a/storage/tokudb/PerconaFT/ft/ft-ops.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-ops.cc
@@ -821,7 +821,7 @@ int toku_ftnode_fetch_callback(CACHEFILE UU(cachefile),
fprintf(
stderr,
"%s:%d:toku_ftnode_fetch_callback - "
- "file[%s], blocknum[%ld], toku_deserialize_ftnode_from "
+ "file[%s], blocknum[%lld], toku_deserialize_ftnode_from "
"failed with a checksum error.\n",
__FILE__,
__LINE__,
@@ -831,7 +831,7 @@ int toku_ftnode_fetch_callback(CACHEFILE UU(cachefile),
fprintf(
stderr,
"%s:%d:toku_ftnode_fetch_callback - "
- "file[%s], blocknum[%ld], toku_deserialize_ftnode_from "
+ "file[%s], blocknum[%lld], toku_deserialize_ftnode_from "
"failed with %d.\n",
__FILE__,
__LINE__,
diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc b/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc
index b24d72a5dff..fe68e1b20e0 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc
+++ b/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc
@@ -656,9 +656,9 @@ exit:
fprintf(stderr, \
"%s:%d toku_deserialize_ft_from: " \
"filename[%s] " \
- "r[%d] max_acceptable_lsn[%lu]" \
- "r0[%d] checkpoint_lsn_0[%lu] checkpoint_count_0[%lu] " \
- "r1[%d] checkpoint_lsn_1[%lu] checkpoint_count_1[%lu]\n", \
+ "r[%d] max_acceptable_lsn[%llu]" \
+ "r0[%d] checkpoint_lsn_0[%llu] checkpoint_count_0[%llu] " \
+ "r1[%d] checkpoint_lsn_1[%llu] checkpoint_count_1[%llu]\n", \
__FILE__, \
__LINE__, \
fn, \
diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
index 55899905baf..02d0cc691cd 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
+++ b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
@@ -1170,7 +1170,7 @@ int verify_ftnode_sub_block(struct sub_block *sb,
fprintf(
stderr,
"%s:%d:verify_ftnode_sub_block - "
- "file[%s], blocknum[%ld], stored_xsum[%u] != actual_xsum[%u]\n",
+ "file[%s], blocknum[%lld], stored_xsum[%u] != actual_xsum[%u]\n",
__FILE__,
__LINE__,
fname ? fname : "unknown",
@@ -1197,7 +1197,7 @@ static int deserialize_ftnode_info(struct sub_block *sb, FTNODE node) {
fprintf(
stderr,
"%s:%d:deserialize_ftnode_info - "
- "file[%s], blocknum[%ld], verify_ftnode_sub_block failed with %d\n",
+ "file[%s], blocknum[%lld], verify_ftnode_sub_block failed with %d\n",
__FILE__,
__LINE__,
fname ? fname : "unknown",
@@ -1253,7 +1253,7 @@ static int deserialize_ftnode_info(struct sub_block *sb, FTNODE node) {
fprintf(
stderr,
"%s:%d:deserialize_ftnode_info - "
- "file[%s], blocknum[%ld], data_size[%d] != rb.ndone[%d]\n",
+ "file[%s], blocknum[%lld], data_size[%d] != rb.ndone[%d]\n",
__FILE__,
__LINE__,
fname ? fname : "unknown",
@@ -1388,7 +1388,7 @@ static int deserialize_ftnode_partition(
if (r != 0) {
fprintf(stderr,
"%s:%d:deserialize_ftnode_partition - "
- "file[%s], blocknum[%ld], "
+ "file[%s], blocknum[%lld], "
"verify_ftnode_sub_block failed with %d\n",
__FILE__,
__LINE__,
@@ -1410,7 +1410,7 @@ static int deserialize_ftnode_partition(
if (ch != FTNODE_PARTITION_MSG_BUFFER) {
fprintf(stderr,
"%s:%d:deserialize_ftnode_partition - "
- "file[%s], blocknum[%ld], ch[%d] != "
+ "file[%s], blocknum[%lld], ch[%d] != "
"FTNODE_PARTITION_MSG_BUFFER[%d]\n",
__FILE__,
__LINE__,
@@ -1433,7 +1433,7 @@ static int deserialize_ftnode_partition(
if (ch != FTNODE_PARTITION_DMT_LEAVES) {
fprintf(stderr,
"%s:%d:deserialize_ftnode_partition - "
- "file[%s], blocknum[%ld], ch[%d] != "
+ "file[%s], blocknum[%lld], ch[%d] != "
"FTNODE_PARTITION_DMT_LEAVES[%d]\n",
__FILE__,
__LINE__,
@@ -1457,7 +1457,7 @@ static int deserialize_ftnode_partition(
if (rb.ndone != rb.size) {
fprintf(stderr,
"%s:%d:deserialize_ftnode_partition - "
- "file[%s], blocknum[%ld], rb.ndone[%d] != rb.size[%d]\n",
+ "file[%s], blocknum[%lld], rb.ndone[%d] != rb.size[%d]\n",
__FILE__,
__LINE__,
fname ? fname : "unknown",
@@ -1485,7 +1485,7 @@ static int decompress_and_deserialize_worker(struct rbuf curr_rbuf,
const char *fname = toku_ftnode_get_cachefile_fname_in_env(node);
fprintf(stderr,
"%s:%d:decompress_and_deserialize_worker - "
- "file[%s], blocknum[%ld], read_and_decompress_sub_block failed "
+ "file[%s], blocknum[%lld], read_and_decompress_sub_block failed "
"with %d\n",
__FILE__,
__LINE__,
@@ -1502,7 +1502,7 @@ static int decompress_and_deserialize_worker(struct rbuf curr_rbuf,
const char *fname = toku_ftnode_get_cachefile_fname_in_env(node);
fprintf(stderr,
"%s:%d:decompress_and_deserialize_worker - "
- "file[%s], blocknum[%ld], deserialize_ftnode_partition failed "
+ "file[%s], blocknum[%lld], deserialize_ftnode_partition failed "
"with %d\n",
__FILE__,
__LINE__,
@@ -1582,7 +1582,7 @@ static int deserialize_ftnode_header_from_rbuf_if_small_enough(
fprintf(
stderr,
"%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
- "file[%s], blocknum[%ld], rb->size[%u] < 24\n",
+ "file[%s], blocknum[%lld], rb->size[%u] < 24\n",
__FILE__,
__LINE__,
fname ? fname : "unknown",
@@ -1602,7 +1602,7 @@ static int deserialize_ftnode_header_from_rbuf_if_small_enough(
fprintf(
stderr,
"%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
- "file[%s], blocknum[%ld], unrecognized magic number "
+ "file[%s], blocknum[%lld], unrecognized magic number "
"%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
__FILE__,
__LINE__,
@@ -1627,7 +1627,7 @@ static int deserialize_ftnode_header_from_rbuf_if_small_enough(
fprintf(
stderr,
"%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
- "file[%s], blocknum[%ld], node->layout_version_read_from_disk[%d] "
+ "file[%s], blocknum[%lld], node->layout_version_read_from_disk[%d] "
"< FT_FIRST_LAYOUT_VERSION_WITH_BASEMENT_NODES[%d]\n",
__FILE__,
__LINE__,
@@ -1667,7 +1667,7 @@ static int deserialize_ftnode_header_from_rbuf_if_small_enough(
fprintf(
stderr,
"%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
- "file[%s], blocknum[%ld], needed_size[%d] > rb->size[%d]\n",
+ "file[%s], blocknum[%lld], needed_size[%d] > rb->size[%d]\n",
__FILE__,
__LINE__,
fname ? fname : "unknown",
@@ -1695,7 +1695,7 @@ static int deserialize_ftnode_header_from_rbuf_if_small_enough(
fprintf(
stderr,
"%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
- "file[%s], blocknum[%ld], stored_checksum[%d] != checksum[%d]\n",
+ "file[%s], blocknum[%lld], stored_checksum[%d] != checksum[%d]\n",
__FILE__,
__LINE__,
fname ? fname : "unknown",
@@ -1717,7 +1717,7 @@ static int deserialize_ftnode_header_from_rbuf_if_small_enough(
fprintf(
stderr,
"%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
- "file[%s], blocknum[%ld], rb->size[%d] - rb->ndone[%d] < "
+ "file[%s], blocknum[%lld], rb->size[%d] - rb->ndone[%d] < "
"sb_node_info.compressed_size[%d] + 8\n",
__FILE__,
__LINE__,
@@ -1744,7 +1744,7 @@ static int deserialize_ftnode_header_from_rbuf_if_small_enough(
fprintf(
stderr,
"%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
- "file[%s], blocknum[%ld], sb_node_info.xsum[%d] != actual_xsum[%d]\n",
+ "file[%s], blocknum[%lld], sb_node_info.xsum[%d] != actual_xsum[%d]\n",
__FILE__,
__LINE__,
fname ? fname : "unknown",
@@ -1774,7 +1774,7 @@ static int deserialize_ftnode_header_from_rbuf_if_small_enough(
fprintf(
stderr,
"%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
- "file[%s], blocknum[%ld], deserialize_ftnode_info failed with "
+ "file[%s], blocknum[%lld], deserialize_ftnode_info failed with "
"%d\n",
__FILE__,
__LINE__,
@@ -1812,7 +1812,7 @@ static int deserialize_ftnode_header_from_rbuf_if_small_enough(
fprintf(
stderr,
"%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
- "file[%s], blocknum[%ld], toku_ftnode_pf_callback failed with "
+ "file[%s], blocknum[%lld], toku_ftnode_pf_callback failed with "
"%d\n",
__FILE__,
__LINE__,
@@ -2164,7 +2164,7 @@ static int deserialize_and_upgrade_ftnode(FTNODE node,
const char* fname = toku_cachefile_fname_in_env(bfe->ft->cf);
fprintf(stderr,
"%s:%d:deserialize_and_upgrade_ftnode - "
- "file[%s], blocknum[%ld], "
+ "file[%s], blocknum[%lld], "
"read_and_decompress_block_from_fd_into_rbuf failed with %d\n",
__FILE__,
__LINE__,
@@ -2190,7 +2190,7 @@ static int deserialize_and_upgrade_ftnode(FTNODE node,
const char* fname = toku_cachefile_fname_in_env(bfe->ft->cf);
fprintf(stderr,
"%s:%d:deserialize_and_upgrade_ftnode - "
- "file[%s], blocknum[%ld], version[%d] > "
+ "file[%s], blocknum[%lld], version[%d] > "
"FT_LAYOUT_VERSION_14[%d]\n",
__FILE__,
__LINE__,
@@ -2278,7 +2278,7 @@ static int deserialize_ftnode_from_rbuf(FTNODE *ftnode,
memcmp(magic, "tokunode", 8) != 0) {
fprintf(stderr,
"%s:%d:deserialize_ftnode_from_rbuf - "
- "file[%s], blocknum[%ld], unrecognized magic number "
+ "file[%s], blocknum[%lld], unrecognized magic number "
"%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
__FILE__,
__LINE__,
@@ -2309,7 +2309,7 @@ static int deserialize_ftnode_from_rbuf(FTNODE *ftnode,
if (r != 0) {
fprintf(stderr,
"%s:%d:deserialize_ftnode_from_rbuf - "
- "file[%s], blocknum[%ld], deserialize_and_upgrade_ftnode "
+ "file[%s], blocknum[%lld], deserialize_and_upgrade_ftnode "
"failed with %d\n",
__FILE__,
__LINE__,
@@ -2355,7 +2355,7 @@ static int deserialize_ftnode_from_rbuf(FTNODE *ftnode,
fprintf(
stderr,
"%s:%d:deserialize_ftnode_from_rbuf - "
- "file[%s], blocknum[%ld], stored_checksum[%d] != checksum[%d]\n",
+ "file[%s], blocknum[%lld], stored_checksum[%d] != checksum[%d]\n",
__FILE__,
__LINE__,
fname ? fname : "unknown",
@@ -2377,7 +2377,7 @@ static int deserialize_ftnode_from_rbuf(FTNODE *ftnode,
fprintf(
stderr,
"%s:%d:deserialize_ftnode_from_rbuf - "
- "file[%s], blocknum[%ld], read_and_decompress_sub_block failed "
+ "file[%s], blocknum[%lld], read_and_decompress_sub_block failed "
"with %d\n",
__FILE__,
__LINE__,
@@ -2398,7 +2398,7 @@ static int deserialize_ftnode_from_rbuf(FTNODE *ftnode,
fprintf(
stderr,
"%s:%d:deserialize_ftnode_from_rbuf - "
- "file[%s], blocknum[%ld], deserialize_ftnode_info failed with "
+ "file[%s], blocknum[%lld], deserialize_ftnode_info failed with "
"%d\n",
__FILE__,
__LINE__,
@@ -2470,7 +2470,7 @@ static int deserialize_ftnode_from_rbuf(FTNODE *ftnode,
fprintf(
stderr,
"%s:%d:deserialize_ftnode_from_rbuf - "
- "file[%s], blocknum[%ld], childnum[%d], "
+ "file[%s], blocknum[%lld], childnum[%d], "
"decompress_and_deserialize_worker failed with %d\n",
__FILE__,
__LINE__,
@@ -2490,7 +2490,7 @@ static int deserialize_ftnode_from_rbuf(FTNODE *ftnode,
fprintf(
stderr,
"%s:%d:deserialize_ftnode_from_rbuf - "
- "file[%s], blocknum[%ld], childnum[%d], "
+ "file[%s], blocknum[%lld], childnum[%d], "
"check_and_copy_compressed_sub_block_worker failed with "
"%d\n",
__FILE__,
@@ -2641,7 +2641,7 @@ int toku_deserialize_bp_from_compressed(FTNODE node,
const char* fname = toku_cachefile_fname_in_env(bfe->ft->cf);
fprintf(stderr,
"%s:%d:toku_deserialize_bp_from_compressed - "
- "file[%s], blocknum[%ld], "
+ "file[%s], blocknum[%lld], "
"deserialize_ftnode_partition failed with %d\n",
__FILE__,
__LINE__,
@@ -2689,7 +2689,7 @@ static int deserialize_ftnode_from_fd(int fd,
fprintf(
stderr,
"%s:%d:deserialize_ftnode_from_fd - "
- "file[%s], blocknum[%ld], deserialize_ftnode_from_rbuf failed with "
+ "file[%s], blocknum[%lld], deserialize_ftnode_from_rbuf failed with "
"%d\n",
__FILE__,
__LINE__,
diff --git a/storage/tokudb/PerconaFT/portability/toku_debug_sync.h b/storage/tokudb/PerconaFT/portability/toku_debug_sync.h
index b5394e58d68..493075c36c3 100644
--- a/storage/tokudb/PerconaFT/portability/toku_debug_sync.h
+++ b/storage/tokudb/PerconaFT/portability/toku_debug_sync.h
@@ -62,9 +62,6 @@ inline void toku_debug_sync(struct tokutxn *txn, const char *sync_point_name) {
void *client_extra;
THD *thd;
- if (likely(!opt_debug_sync_timeout))
- return;
-
toku_txn_get_client_id(txn, &client_id, &client_extra);
thd = reinterpret_cast<THD *>(client_extra);
DEBUG_SYNC(thd, sync_point_name);
diff --git a/storage/tokudb/PerconaFT/portability/toku_pthread.h b/storage/tokudb/PerconaFT/portability/toku_pthread.h
index e3bd3bce598..a0dfcc246a7 100644
--- a/storage/tokudb/PerconaFT/portability/toku_pthread.h
+++ b/storage/tokudb/PerconaFT/portability/toku_pthread.h
@@ -162,10 +162,20 @@ typedef struct toku_mutex_aligned {
#define ZERO_COND_INITIALIZER \
{ 0 }
#elif defined(__APPLE__)
+#if TOKU_PTHREAD_DEBUG
+#define ZERO_COND_INITIALIZER \
+ { \
+ { 0 , { 0 } }, \
+ nullptr, \
+ 0 \
+ }
+#else
#define ZERO_COND_INITIALIZER \
{ \
- { 0 } \
+ { 0 , { 0 } }, \
+ nullptr \
}
+#endif
#else // __linux__, at least
#define ZERO_COND_INITIALIZER \
{}
diff --git a/storage/tokudb/PerconaFT/src/CMakeLists.txt b/storage/tokudb/PerconaFT/src/CMakeLists.txt
index 65bf4814cf8..bae37389004 100644
--- a/storage/tokudb/PerconaFT/src/CMakeLists.txt
+++ b/storage/tokudb/PerconaFT/src/CMakeLists.txt
@@ -18,7 +18,7 @@ set(tokudb_srcs
## make the shared library
add_library(${LIBTOKUDB} SHARED ${tokudb_srcs})
add_dependencies(${LIBTOKUDB} install_tdb_h generate_log_code)
-target_link_libraries(${LIBTOKUDB} LINK_PRIVATE locktree_static ft_static util_static lzma snappy ${LIBTOKUPORTABILITY})
+target_link_libraries(${LIBTOKUDB} LINK_PRIVATE locktree_static ft_static util_static lzma snappy dbug ${LIBTOKUPORTABILITY})
target_link_libraries(${LIBTOKUDB} LINK_PUBLIC ${ZLIB_LIBRARY} )
## make the static library
diff --git a/storage/tokudb/tokudb_thread.h b/storage/tokudb/tokudb_thread.h
index dec58f3fd35..5df0159901f 100644
--- a/storage/tokudb/tokudb_thread.h
+++ b/storage/tokudb/tokudb_thread.h
@@ -111,7 +111,6 @@ public:
// wait for the event to become signalled
void wait(void);
- int wait(ulonglong microseconds);
// signal the event
void signal(void);
@@ -152,7 +151,6 @@ public:
// wait for the semaphore to become signalled
E_WAIT wait(void);
- E_WAIT wait(ulonglong microseconds);
// signal the semaphore to increase the count
// return true if signalled, false if ignored due to count
@@ -372,28 +370,6 @@ inline void event_t::wait(void) {
assert_debug(r == 0);
return;
}
-inline int event_t::wait(ulonglong microseconds) {
- timespec waittime = time::offset_timespec(microseconds);
- int r = pthread_mutex_timedlock(&_mutex, &waittime);
- if (r == ETIMEDOUT) return ETIMEDOUT;
- assert_debug(r == 0);
- while (_signalled == false && _pulsed == false) {
- r = pthread_cond_timedwait(&_cond, &_mutex, &waittime);
- if (r == ETIMEDOUT) {
- r = pthread_mutex_unlock(&_mutex);
- assert_debug(r == 0);
- return ETIMEDOUT;
- }
- assert_debug(r == 0);
- }
- if (_manual_reset == false)
- _signalled = false;
- if (_pulsed)
- _pulsed = false;
- r = pthread_mutex_unlock(&_mutex);
- assert_debug(r == 0);
- return 0;
-}
inline void event_t::signal(void) {
int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex);
assert_debug(r == 0);
@@ -479,31 +455,6 @@ inline semaphore_t::E_WAIT semaphore_t::wait(void) {
assert_debug(r == 0);
return ret;
}
-inline semaphore_t::E_WAIT semaphore_t::wait(ulonglong microseconds) {
- E_WAIT ret;
- timespec waittime = time::offset_timespec(microseconds);
- int r = pthread_mutex_timedlock(&_mutex, &waittime);
- if (r == ETIMEDOUT) return E_TIMEDOUT;
- assert_debug(r == 0);
- while (_signalled == 0 && _interrupted == false) {
- r = pthread_cond_timedwait(&_cond, &_mutex, &waittime);
- if (r == ETIMEDOUT) {
- r = pthread_mutex_unlock(&_mutex);
- assert_debug(r == 0);
- return E_TIMEDOUT;
- }
- assert_debug(r == 0);
- }
- if (_interrupted) {
- ret = E_INTERRUPTED;
- } else {
- _signalled--;
- ret = E_SIGNALLED;
- }
- r = pthread_mutex_unlock(&_mutex);
- assert_debug(r == 0);
- return ret;
-}
inline bool semaphore_t::signal(void) {
bool ret = false;
int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex);