Hi Varun!

Please change the CMakeLists.txt to be like so:

diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index 5db6d88..6db8211 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -146,7 +146,10 @@ ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib
 ADD_DEPENDENCIES(rocksdb_aux_lib GenError)

 # MARIAROCKS-TODO: how to properly depend on -lrt ?
-TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY} -lrt)
+TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY})
+if (UNIX AND NOT APPLE)
+  TARGET_LINK_LIBRARIES(rocksdb_aux_lib -lrt)
+endif()

 TARGET_LINK_LIBRARIES(rocksdb rocksdb_aux_lib)

@@ -182,7 +185,9 @@ ENDIF()
 #  ADD_SUBDIRECTORY(unittest)
 #ENDIF()

-SET(rocksdb_static_libs ${rocksdb_static_libs} "-lrt")
+if (UNIX AND NOT APPLE)
+  SET(rocksdb_static_libs ${rocksdb_static_libs} "-lrt")
+endif()

 ADD_LIBRARY(rocksdb_tools STATIC
    rocksdb/tools/ldb_tool.cc

Also, change how you define the __APPLE__ #ifdef like so:

- #ifndef _WIN32
+ #if not defined(_WIN32) && not defined(__APPLE__)

This way, you don't have to add an extra #endif. The point of #ifndef is to avoid typing, but it doesn't work well with multiple conditions. We can make use #if then.

Vicențiu


On Wed, 30 Aug 2017 at 15:37 Varun <varunraiko1803@gmail.com> wrote:
revision-id: dccebdf862d66e65528e18562c4503f40b695eca (mariadb-10.3.0-107-gdccebdf862d)
parent(s): e1051590b61b45532284071ac78c50e7a2f24c63
author: Varun Gupta
committer: Varun Gupta
timestamp: 2017-08-30 18:05:52 +0530
message:

Rdb_io_watchdog doesn't support osx so disabling it

---
 storage/rocksdb/CMakeLists.txt     |  4 ++++
 storage/rocksdb/ha_rocksdb.cc      | 14 +++++++++++++-
 storage/rocksdb/rdb_io_watchdog.cc |  2 ++
 storage/rocksdb/rdb_io_watchdog.h  |  6 ++++--
 4 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index 5db6d888bb6..435fe784d6c 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -146,7 +146,11 @@ ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib
 ADD_DEPENDENCIES(rocksdb_aux_lib GenError)

 # MARIAROCKS-TODO: how to properly depend on -lrt ?
+if (APPLE)
+TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY})
+else()
 TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY} -lrt)
+endif()

 TARGET_LINK_LIBRARIES(rocksdb rocksdb_aux_lib)

diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index e4d9ce02f10..4ffe6caf70b 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -173,9 +173,11 @@ Rdb_ddl_manager ddl_manager;
 const char *m_mysql_gtid;
 Rdb_binlog_manager binlog_manager;

-#ifndef _WIN32
+#ifndef _WIN32
+#ifndef __APPLE__
 Rdb_io_watchdog *io_watchdog = nullptr;
 #endif
+#endif
 /**
   MyRocks background thread control
   N.B. This is besides RocksDB's own background threads
@@ -555,7 +557,9 @@ static void rocksdb_set_io_write_timeout(
   DBUG_ASSERT(save != nullptr);
   DBUG_ASSERT(rdb != nullptr);
 #ifndef _WIN32
+#ifndef __APPLE__
   DBUG_ASSERT(io_watchdog != nullptr);
+#endif
 #endif

   RDB_MUTEX_LOCK_CHECK(rdb_sysvars_mutex);
@@ -564,7 +568,9 @@ static void rocksdb_set_io_write_timeout(

   rocksdb_io_write_timeout_secs = new_val;
 #ifndef _WIN32
+#ifndef __APPLE__
   io_watchdog->reset_timeout(rocksdb_io_write_timeout_secs);
+#endif
 #endif
   RDB_MUTEX_UNLOCK_CHECK(rdb_sysvars_mutex);
 }
@@ -3746,7 +3752,9 @@ static int rocksdb_init_func(void *const p) {
     */
     if (status.IsIOError()
 #ifndef _WIN32
+#ifndef __APPLE__
       && errno == ENOENT
+#endif
 #endif
       ) {
       sql_print_information("RocksDB: Got ENOENT when listing column families");
@@ -3985,8 +3993,10 @@ static int rocksdb_init_func(void *const p) {
   }

 #ifndef _WIN32
+#ifndef __APPLE__
   io_watchdog = new Rdb_io_watchdog(directories);
   io_watchdog->reset_timeout(rocksdb_io_write_timeout_secs);
+#endif
 #endif

   // NO_LINT_DEBUG
@@ -4077,9 +4087,11 @@ static int rocksdb_done_func(void *const p) {
   commit_latency_stats = nullptr;

 #ifndef _WIN32
+#ifndef __APPLE__
   delete io_watchdog;
   io_watchdog = nullptr;
 #endif
+#endif

 // Disown the cache data since we're shutting down.
 // This results in memory leaks but it improved the shutdown time.
diff --git a/storage/rocksdb/rdb_io_watchdog.cc b/storage/rocksdb/rdb_io_watchdog.cc
index a599ba58aec..a9e79283382 100644
--- a/storage/rocksdb/rdb_io_watchdog.cc
+++ b/storage/rocksdb/rdb_io_watchdog.cc
@@ -23,6 +23,7 @@

 /* Rdb_io_watchdog doesn't work on Windows [yet] */
 #ifndef _WIN32
+#ifndef __APPLE__

 namespace myrocks {

@@ -236,4 +237,5 @@ int Rdb_io_watchdog::reset_timeout(const uint32_t &write_timeout) {
 }  // namespace myrocks

 #endif
+#endif

diff --git a/storage/rocksdb/rdb_io_watchdog.h b/storage/rocksdb/rdb_io_watchdog.h
index de8c1b9500e..12aec516f26 100644
--- a/storage/rocksdb/rdb_io_watchdog.h
+++ b/storage/rocksdb/rdb_io_watchdog.h
@@ -35,7 +35,8 @@
 namespace myrocks {

 // Rdb_io_watchdog does not support Windows ATM.
-#ifndef _WIN32
+#ifndef _WIN32
+#ifndef __APPLE__

 class Rdb_io_watchdog {
   const int RDB_IO_WRITE_BUFFER_SIZE = 4096;
@@ -113,5 +114,6 @@ class Rdb_io_watchdog {
   Rdb_io_watchdog &operator=(const Rdb_io_watchdog &) = delete;
 };

-#endif
+#endif
+#endif
 }  // namespace myrocks
_______________________________________________
commits mailing list
commits@mariadb.org
https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits