Skip to content

Commit

Permalink
MDEV-15778: Fix TokuDB build issues on macOS 10.13.4
Browse files Browse the repository at this point in the history
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;
  • Loading branch information
shinnok authored and cvicentiu committed Jun 10, 2018
1 parent 8f82c48 commit 7053e26
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 88 deletions.
4 changes: 2 additions & 2 deletions storage/tokudb/PerconaFT/ft/ft-ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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__,
Expand All @@ -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__,
Expand Down
6 changes: 3 additions & 3 deletions storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,9 @@ int deserialize_ft_from_fd_into_rbuf(int fd,
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, \
Expand Down
58 changes: 29 additions & 29 deletions storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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__,
Expand All @@ -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__,
Expand All @@ -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__,
Expand All @@ -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",
Expand Down Expand Up @@ -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__,
Expand All @@ -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__,
Expand Down Expand Up @@ -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",
Expand All @@ -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__,
Expand All @@ -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__,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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__,
Expand All @@ -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",
Expand Down Expand Up @@ -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__,
Expand Down Expand Up @@ -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__,
Expand Down Expand Up @@ -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__,
Expand All @@ -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__,
Expand Down Expand Up @@ -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__,
Expand Down Expand Up @@ -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__,
Expand Down Expand Up @@ -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",
Expand All @@ -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__,
Expand All @@ -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__,
Expand Down Expand Up @@ -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__,
Expand All @@ -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__,
Expand Down Expand Up @@ -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__,
Expand Down Expand Up @@ -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__,
Expand Down
3 changes: 0 additions & 3 deletions storage/tokudb/PerconaFT/portability/toku_debug_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 11 additions & 1 deletion storage/tokudb/PerconaFT/portability/toku_pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
{}
Expand Down
2 changes: 1 addition & 1 deletion storage/tokudb/PerconaFT/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 7053e26

Please sign in to comment.