Commit e19f1dd6 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix build on Windows.

Remove some GCC specific pragmas, use #ifdef __GNUC__ in other places.
Only use  pthread_setname_np on Linux.
Fix a mismerge
parent f9e63b7c
...@@ -7992,12 +7992,7 @@ int ha_rocksdb::info(uint flag) { ...@@ -7992,12 +7992,7 @@ int ha_rocksdb::info(uint flag) {
uchar buf[Rdb_key_def::INDEX_NUMBER_SIZE * 2]; uchar buf[Rdb_key_def::INDEX_NUMBER_SIZE * 2];
auto r = get_range(pk_index(table, m_tbl_def), buf); auto r = get_range(pk_index(table, m_tbl_def), buf);
uint64_t sz = 0; uint64_t sz = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
rdb->GetApproximateSizes(m_pk_descr->get_cf(), &r, 1, &sz, true); rdb->GetApproximateSizes(m_pk_descr->get_cf(), &r, 1, &sz, true);
#pragma GCC diagnostic pop
stats.records = sz / ROCKSDB_ASSUMED_KEY_VALUE_DISK_SIZE; stats.records = sz / ROCKSDB_ASSUMED_KEY_VALUE_DISK_SIZE;
stats.data_file_length = sz; stats.data_file_length = sz;
...@@ -8838,11 +8833,8 @@ ha_rows ha_rocksdb::records_in_range(uint inx, key_range *const min_key, ...@@ -8838,11 +8833,8 @@ ha_rows ha_rocksdb::records_in_range(uint inx, key_range *const min_key,
disk_size = ROCKSDB_ASSUMED_KEY_VALUE_DISK_SIZE; disk_size = ROCKSDB_ASSUMED_KEY_VALUE_DISK_SIZE;
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Getting statistics, including from Memtables // Getting statistics, including from Memtables
rdb->GetApproximateSizes(kd.get_cf(), &r, 1, &sz, true); rdb->GetApproximateSizes(kd.get_cf(), &r, 1, &sz, true);
#pragma GCC diagnostic pop
ret = rows * sz / disk_size; ret = rows * sz / disk_size;
...@@ -10160,8 +10152,10 @@ const char *get_rdb_io_error_string(const RDB_IO_ERROR_TYPE err_type) { ...@@ -10160,8 +10152,10 @@ const char *get_rdb_io_error_string(const RDB_IO_ERROR_TYPE err_type) {
// In case of core dump generation we want this function NOT to be optimized // In case of core dump generation we want this function NOT to be optimized
// so that we can capture as much data as possible to debug the root cause // so that we can capture as much data as possible to debug the root cause
// more efficiently. // more efficiently.
#ifdef __GNUC__
#pragma GCC push_options #pragma GCC push_options
#pragma GCC optimize("O0") #pragma GCC optimize("O0")
#endif
void rdb_handle_io_error(const rocksdb::Status status, void rdb_handle_io_error(const rocksdb::Status status,
const RDB_IO_ERROR_TYPE err_type) { const RDB_IO_ERROR_TYPE err_type) {
...@@ -10234,8 +10228,9 @@ void rdb_handle_io_error(const rocksdb::Status status, ...@@ -10234,8 +10228,9 @@ void rdb_handle_io_error(const rocksdb::Status status,
} }
} }
} }
#ifdef __GNUC__
#pragma GCC pop_options #pragma GCC pop_options
#endif
Rdb_dict_manager *rdb_get_dict_manager(void) { return &dict_manager; } Rdb_dict_manager *rdb_get_dict_manager(void) { return &dict_manager; }
......
...@@ -62,7 +62,7 @@ int Rdb_thread::create_thread(const std::string &thread_name ...@@ -62,7 +62,7 @@ int Rdb_thread::create_thread(const std::string &thread_name
int err = mysql_thread_create(background_psi_thread_key, &m_handle, nullptr, int err = mysql_thread_create(background_psi_thread_key, &m_handle, nullptr,
thread_func, this); thread_func, this);
#ifdef __linux__
if (!err) { if (!err) {
/* /*
mysql_thread_create() ends up doing some work underneath and setting the mysql_thread_create() ends up doing some work underneath and setting the
...@@ -73,6 +73,7 @@ int Rdb_thread::create_thread(const std::string &thread_name ...@@ -73,6 +73,7 @@ int Rdb_thread::create_thread(const std::string &thread_name
*/ */
err = pthread_setname_np(m_handle, thread_name.c_str()); err = pthread_setname_np(m_handle, thread_name.c_str());
} }
#endif
return err; return err;
} }
......
...@@ -75,8 +75,10 @@ class Rdb_thread { ...@@ -75,8 +75,10 @@ class Rdb_thread {
void signal(const bool &stop_thread = false); void signal(const bool &stop_thread = false);
int join() { return pthread_join(m_handle, nullptr); } int join()
{
#ifndef _WIN32 #ifndef _WIN32
return pthread_join(m_handle, nullptr);
#else #else
/* /*
mysys on Windows creates "detached" threads in pthread_create(). mysys on Windows creates "detached" threads in pthread_create().
...@@ -88,9 +90,10 @@ class Rdb_thread { ...@@ -88,9 +90,10 @@ class Rdb_thread {
If thread is already finished before pthread_join(), If thread is already finished before pthread_join(),
we get EINVAL, and it is safe to ignore and handle this as success. we get EINVAL, and it is safe to ignore and handle this as success.
*/ */
(void)pthread_join(m_handle, nullptr); pthread_join(m_handle, nullptr);
return 0; return 0;
#endif #endif
}
void uninit(); void uninit();
......
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