Skip to content

Commit e19f1dd

Browse files
committed
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
1 parent f9e63b7 commit e19f1dd

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

storage/rocksdb/ha_rocksdb.cc

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7992,12 +7992,7 @@ int ha_rocksdb::info(uint flag) {
79927992
uchar buf[Rdb_key_def::INDEX_NUMBER_SIZE * 2];
79937993
auto r = get_range(pk_index(table, m_tbl_def), buf);
79947994
uint64_t sz = 0;
7995-
7996-
#pragma GCC diagnostic push
7997-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
79987995
rdb->GetApproximateSizes(m_pk_descr->get_cf(), &r, 1, &sz, true);
7999-
#pragma GCC diagnostic pop
8000-
80017996
stats.records = sz / ROCKSDB_ASSUMED_KEY_VALUE_DISK_SIZE;
80027997
stats.data_file_length = sz;
80037998

@@ -8838,11 +8833,8 @@ ha_rows ha_rocksdb::records_in_range(uint inx, key_range *const min_key,
88388833
disk_size = ROCKSDB_ASSUMED_KEY_VALUE_DISK_SIZE;
88398834
}
88408835

8841-
#pragma GCC diagnostic push
8842-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
88438836
// Getting statistics, including from Memtables
88448837
rdb->GetApproximateSizes(kd.get_cf(), &r, 1, &sz, true);
8845-
#pragma GCC diagnostic pop
88468838

88478839
ret = rows * sz / disk_size;
88488840

@@ -10160,8 +10152,10 @@ const char *get_rdb_io_error_string(const RDB_IO_ERROR_TYPE err_type) {
1016010152
// In case of core dump generation we want this function NOT to be optimized
1016110153
// so that we can capture as much data as possible to debug the root cause
1016210154
// more efficiently.
10155+
#ifdef __GNUC__
1016310156
#pragma GCC push_options
1016410157
#pragma GCC optimize("O0")
10158+
#endif
1016510159

1016610160
void rdb_handle_io_error(const rocksdb::Status status,
1016710161
const RDB_IO_ERROR_TYPE err_type) {
@@ -10234,8 +10228,9 @@ void rdb_handle_io_error(const rocksdb::Status status,
1023410228
}
1023510229
}
1023610230
}
10237-
10231+
#ifdef __GNUC__
1023810232
#pragma GCC pop_options
10233+
#endif
1023910234

1024010235
Rdb_dict_manager *rdb_get_dict_manager(void) { return &dict_manager; }
1024110236

storage/rocksdb/rdb_threads.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int Rdb_thread::create_thread(const std::string &thread_name
6262

6363
int err = mysql_thread_create(background_psi_thread_key, &m_handle, nullptr,
6464
thread_func, this);
65-
65+
#ifdef __linux__
6666
if (!err) {
6767
/*
6868
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
7373
*/
7474
err = pthread_setname_np(m_handle, thread_name.c_str());
7575
}
76+
#endif
7677

7778
return err;
7879
}

storage/rocksdb/rdb_threads.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ class Rdb_thread {
7575

7676
void signal(const bool &stop_thread = false);
7777

78-
int join() { return pthread_join(m_handle, nullptr); }
78+
int join()
79+
{
7980
#ifndef _WIN32
81+
return pthread_join(m_handle, nullptr);
8082
#else
8183
/*
8284
mysys on Windows creates "detached" threads in pthread_create().
@@ -88,9 +90,10 @@ class Rdb_thread {
8890
If thread is already finished before pthread_join(),
8991
we get EINVAL, and it is safe to ignore and handle this as success.
9092
*/
91-
(void)pthread_join(m_handle, nullptr);
93+
pthread_join(m_handle, nullptr);
9294
return 0;
9395
#endif
96+
}
9497

9598
void uninit();
9699

0 commit comments

Comments
 (0)