forked from percona/percona-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[myrocks] PS-8164: Make MyRocks buildable
Import all functions and changes required to compile MyRocks (-DWITH_ROCKSDB=1). ---------------------------------------------------------------------- PS-9218 merge: Merge MySQL 8.4.0 (GCC 12.3 RelWithDebInfo fixes) (percona#5356) https://perconadev.atlassian.net/browse/PS-9218 Added more warning suppressions for RocksDB submodule files that appeared in GCC 12.3 in RelWithDebInfo mode. ---------------------------------------------------------------------- PS-9218: Merge MySQL 8.4.0 (fix gcc-14 build) #2 (rocksdb part)
- Loading branch information
Showing
16 changed files
with
520 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Copyright (c) 2017, Percona and/or its affiliates. All rights reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; version 2 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ | ||
|
||
# helper macros to prepend or append c and cxx flags if supported by compiler | ||
|
||
INCLUDE (CheckCCompilerFlag) | ||
INCLUDE (CheckCXXCompilerFlag) | ||
|
||
MACRO (prepend_cflags_if_supported) | ||
FOREACH (flag ${ARGN}) | ||
STRING (REGEX REPLACE "-" "_" temp_flag ${flag}) | ||
check_c_compiler_flag (${flag} HAVE_C_${temp_flag}) | ||
IF (HAVE_C_${temp_flag}) | ||
SET (CMAKE_C_FLAGS "${flag} ${CMAKE_C_FLAGS}") | ||
ENDIF () | ||
check_cxx_compiler_flag (${flag} HAVE_CXX_${temp_flag}) | ||
IF (HAVE_CXX_${temp_flag}) | ||
SET (CMAKE_CXX_FLAGS "${flag} ${CMAKE_CXX_FLAGS}") | ||
ENDIF () | ||
ENDFOREACH (flag) | ||
ENDMACRO (prepend_cflags_if_supported) | ||
|
||
MACRO (append_cflags_if_supported) | ||
FOREACH (flag ${ARGN}) | ||
STRING (REGEX REPLACE "-" "_" temp_flag ${flag}) | ||
check_c_compiler_flag (${flag} HAVE_C_${temp_flag}) | ||
IF (HAVE_C_${temp_flag}) | ||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") | ||
ENDIF () | ||
check_cxx_compiler_flag (${flag} HAVE_CXX_${temp_flag}) | ||
IF (HAVE_CXX_${temp_flag}) | ||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") | ||
ENDIF () | ||
ENDFOREACH (flag) | ||
ENDMACRO (append_cflags_if_supported) | ||
|
||
MACRO (remove_compile_flags) | ||
FOREACH (flag ${ARGN}) | ||
IF(CMAKE_C_FLAGS MATCHES ${flag}) | ||
STRING(REGEX REPLACE "${flag}( |$)" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") | ||
ENDIF(CMAKE_C_FLAGS MATCHES ${flag}) | ||
IF(CMAKE_CXX_FLAGS MATCHES ${flag}) | ||
STRING(REGEX REPLACE "${flag}( |$)" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") | ||
ENDIF(CMAKE_CXX_FLAGS MATCHES ${flag}) | ||
ENDFOREACH (flag) | ||
ENDMACRO (remove_compile_flags) | ||
|
||
## ADD_CXX_COMPILE_FLAGS_TO_FILES(<flags> FILES <source files>) | ||
## Add compile flags to given c++ files for all supported flags | ||
MACRO(ADD_CXX_COMPILE_FLAGS_TO_FILES) | ||
SET(FILES "") | ||
SET(FLAGS "") | ||
SET(FILES_SEEN) | ||
FOREACH(ARG ${ARGV}) | ||
IF("x${ARG}" STREQUAL "xFILES") | ||
SET(FILES_SEEN 1) | ||
ELSEIF(FILES_SEEN) | ||
LIST(APPEND FILES ${ARG}) | ||
ELSE() | ||
LIST(APPEND FLAGS ${ARG}) | ||
ENDIF() | ||
ENDFOREACH() | ||
SET(CHECKED_FLAGS "") | ||
FOREACH (flag ${FLAGS}) | ||
STRING (REGEX REPLACE "-" "_" temp_flag ${flag}) | ||
MY_CHECK_CXX_COMPILER_FLAG(${flag} HAVE_CXX_${temp_flag}) | ||
IF (HAVE_CXX_${temp_flag}) | ||
STRING_APPEND(CHECKED_FLAGS "${flag} ") | ||
ENDIF() | ||
ENDFOREACH(flag) | ||
ADD_COMPILE_FLAGS(${FILES} COMPILE_FLAGS ${CHECKED_FLAGS}) | ||
ENDMACRO(ADD_CXX_COMPILE_FLAGS_TO_FILES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* This is an atomic integer abstract data type, for high-performance | ||
tracking of a single stat. It intentionally permits inconsistent | ||
atomic operations and reads, for better performance. This means | ||
that, though no data should ever be lost by this stat, reads of it | ||
at any time may not include all changes up to any particular point. | ||
So, values read from these may only be approximately correct. | ||
If your use-case will fail under these conditions, do not use this. | ||
Copyright (C) 2012 - 2014 Steaphan Greene <steaphan@gmail.com> | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the | ||
Free Software Foundation, Inc. | ||
51 Franklin Street, Fifth Floor | ||
Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#ifndef _atomic_stat_h_ | ||
#define _atomic_stat_h_ | ||
|
||
#include <atomic> | ||
|
||
template <typename TYPE> | ||
class atomic_stat { | ||
public: | ||
// Initialize value to the default for the type | ||
atomic_stat() : value_(TYPE()){}; | ||
|
||
// This enforces a strict order, as all absolute sets should | ||
void clear() { value_.store(TYPE(), std::memory_order_seq_cst); }; | ||
|
||
// Reads can get any valid value, it doesn't matter which, exactly | ||
TYPE load() const { return value_.load(std::memory_order_relaxed); }; | ||
|
||
// This only supplies relative arithmetic operations | ||
// These are all done atomically, and so can show up in any order | ||
void inc(const TYPE &other) { | ||
value_.fetch_add(other, std::memory_order_relaxed); | ||
}; | ||
|
||
void dec(const TYPE &other) { | ||
value_.fetch_sub(other, std::memory_order_relaxed); | ||
}; | ||
|
||
void inc() { value_.fetch_add(1, std::memory_order_relaxed); }; | ||
|
||
void dec() { value_.fetch_sub(1, std::memory_order_relaxed); }; | ||
|
||
// This will make one attempt to set the value to the max of | ||
// the current value, and the passed-in value. It can fail | ||
// for any reason, and we only try it once. | ||
void set_max_maybe(const TYPE &new_val) { | ||
TYPE old_val = value_; | ||
if (new_val > old_val) { | ||
value_.compare_exchange_weak(old_val, new_val, std::memory_order_relaxed, | ||
std::memory_order_relaxed); | ||
} | ||
}; | ||
|
||
// This will make one attempt to assign the value to the passed-in | ||
// value. It can fail for any reason, and we only try it once. | ||
void set_maybe(const TYPE &new_val) { | ||
TYPE old_val = value_; | ||
value_.compare_exchange_weak(old_val, new_val, std::memory_order_relaxed, | ||
std::memory_order_relaxed); | ||
}; | ||
|
||
private: | ||
std::atomic<TYPE> value_; | ||
}; | ||
|
||
#endif // _atomic_stat_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/* Copyright (c) 2016, Percona and/or its affiliates. All rights reserved. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; version 2 of the License. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ | ||
|
||
#ifndef _io_perf_h_ | ||
#define _io_perf_h_ | ||
|
||
#include <memory.h> | ||
#include <algorithm> | ||
#include "atomic_stat.h" | ||
#include "my_inttypes.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/* Per-table operation and IO statistics */ | ||
|
||
/* Struct used for IO performance counters within a single thread */ | ||
struct my_io_perf_struct { | ||
ulonglong bytes; | ||
ulonglong requests; | ||
ulonglong svc_time; /*!< time to do read or write operation */ | ||
ulonglong svc_time_max; | ||
ulonglong wait_time; /*!< total time in the request array */ | ||
ulonglong wait_time_max; | ||
ulonglong slow_ios; /*!< requests that take too long */ | ||
|
||
/* Initialize a my_io_perf_t struct. */ | ||
inline void init() { memset(this, 0, sizeof(*this)); } | ||
|
||
/* Sets this to a - b in diff */ | ||
inline void diff(const my_io_perf_struct &a, const my_io_perf_struct &b) { | ||
if (a.bytes > b.bytes) | ||
bytes = a.bytes - b.bytes; | ||
else | ||
bytes = 0; | ||
|
||
if (a.requests > b.requests) | ||
requests = a.requests - b.requests; | ||
else | ||
requests = 0; | ||
|
||
if (a.svc_time > b.svc_time) | ||
svc_time = a.svc_time - b.svc_time; | ||
else | ||
svc_time = 0; | ||
|
||
if (a.wait_time > b.wait_time) | ||
wait_time = a.wait_time - b.wait_time; | ||
else | ||
wait_time = 0; | ||
|
||
if (a.slow_ios > b.slow_ios) | ||
slow_ios = a.slow_ios - b.slow_ios; | ||
else | ||
slow_ios = 0; | ||
|
||
svc_time_max = std::max(a.svc_time_max, b.svc_time_max); | ||
wait_time_max = std::max(a.wait_time_max, b.wait_time_max); | ||
} | ||
|
||
/* Accumulates io perf values */ | ||
inline void sum(const my_io_perf_struct &that) { | ||
bytes += that.bytes; | ||
requests += that.requests; | ||
svc_time += that.svc_time; | ||
svc_time_max = std::max(svc_time_max, that.svc_time_max); | ||
wait_time += that.wait_time; | ||
wait_time_max = std::max(wait_time_max, that.wait_time_max); | ||
slow_ios += that.slow_ios; | ||
} | ||
}; | ||
typedef struct my_io_perf_struct my_io_perf_t; | ||
|
||
/* Struct used for IO performance counters, shared among multiple threads */ | ||
struct my_io_perf_atomic_struct { | ||
atomic_stat<ulonglong> bytes; | ||
atomic_stat<ulonglong> requests; | ||
atomic_stat<ulonglong> svc_time; /*!< time to do read or write operation */ | ||
atomic_stat<ulonglong> svc_time_max; | ||
atomic_stat<ulonglong> wait_time; /*!< total time in the request array */ | ||
atomic_stat<ulonglong> wait_time_max; | ||
atomic_stat<ulonglong> slow_ios; /*!< requests that take too long */ | ||
|
||
/* Initialize an my_io_perf_atomic_t struct. */ | ||
inline void init() { | ||
bytes.clear(); | ||
requests.clear(); | ||
svc_time.clear(); | ||
svc_time_max.clear(); | ||
wait_time.clear(); | ||
wait_time_max.clear(); | ||
slow_ios.clear(); | ||
} | ||
|
||
/* Accumulates io perf values using atomic operations */ | ||
inline void sum(const my_io_perf_struct &that) { | ||
bytes.inc(that.bytes); | ||
requests.inc(that.requests); | ||
|
||
svc_time.inc(that.svc_time); | ||
wait_time.inc(that.wait_time); | ||
|
||
// In the unlikely case that two threads attempt to update the max | ||
// value at the same time, only the first will succeed. It's possible | ||
// that the second thread would have set a larger max value, but we | ||
// would rather error on the side of simplicity and avoid looping the | ||
// compare-and-swap. | ||
svc_time_max.set_max_maybe(that.svc_time); | ||
wait_time_max.set_max_maybe(that.wait_time); | ||
|
||
slow_ios.inc(that.slow_ios); | ||
} | ||
|
||
/* These assignments allow for races. That is OK. */ | ||
inline void set_maybe(const my_io_perf_struct &that) { | ||
bytes.set_maybe(that.bytes); | ||
requests.set_maybe(that.requests); | ||
svc_time.set_maybe(that.svc_time); | ||
svc_time_max.set_maybe(that.svc_time_max); | ||
wait_time.set_maybe(that.wait_time); | ||
wait_time_max.set_maybe(that.wait_time_max); | ||
slow_ios.set_maybe(that.slow_ios); | ||
} | ||
}; | ||
typedef struct my_io_perf_atomic_struct my_io_perf_atomic_t; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.