55 #ifndef UNIV_HOTBACKUP 67 #ifndef UNIV_NO_ERR_MSGS 69 #include "mysqld_error.h" 74 #define TEMP_INDEX_PREFIX_STR "\377" 84 #ifndef UNIV_HOTBACKUP 85 #if defined(HAVE_PAUSE_INSTRUCTION) 91 #define UT_RELAX_CPU() asm("pause") 93 #define UT_RELAX_CPU() __asm__ __volatile__("pause") 96 #elif defined(HAVE_FAKE_PAUSE_INSTRUCTION) 97 #define UT_RELAX_CPU() __asm__ __volatile__("rep; nop") 102 #define UT_RELAX_CPU() YieldProcessor() 104 #define UT_RELAX_CPU() __asm__ __volatile__("" ::: "memory") 107 #if defined(HAVE_HMT_PRIORITY_INSTRUCTION) 108 #define UT_LOW_PRIORITY_CPU() __asm__ __volatile__("or 1,1,1") 109 #define UT_RESUME_PRIORITY_CPU() __asm__ __volatile__("or 2,2,2") 111 #define UT_LOW_PRIORITY_CPU() ((void)0) 112 #define UT_RESUME_PRIORITY_CPU() ((void)0) 119 #define UT_WAIT_FOR(cond, max_wait_us) \ 121 uintmax_t start_us; \ 122 start_us = ut_time_us(NULL); \ 123 while (!(cond) && ut_time_us(NULL) - start_us < (max_wait_us)) { \ 124 os_thread_sleep(2000 ); \ 128 #define UT_RELAX_CPU() 131 #define ut_max std::max 132 #define ut_min std::min 142 void ut_pair_min(ulint *min_hi, ulint *min_lo, ulint a_hi, ulint a_lo,
143 ulint b_hi, ulint b_lo);
162 int ut_pair_cmp(ulint a_h, ulint a_l, ulint b_h, ulint b_l)
163 MY_ATTRIBUTE((warn_unused_result));
169 #define ut_2pow_remainder(n, m) ((n) & ((m)-1)) 175 #define ut_2pow_round(n, m) ((n) & ~((m)-1)) 180 #define ut_calc_align_down(n, m) ut_2pow_round(n, m) 186 #define ut_calc_align(n, m) (((n) + ((m)-1)) & ~((m)-1)) 202 MY_ATTRIBUTE((
const));
208 #define UT_BITS_IN_BYTES(b) (((b) + 7) / 8) 236 bool ut_win_init_time();
254 #define ut_is_2pow(n) UNIV_LIKELY(!((n) & ((n)-1))) 260 return (strcmp(a, b) < 0);
300 char *
ut_format_name(
const char *name,
char *formatted, ulint formatted_size);
324 #define ut_vsnprintf(buf, size, fmt, ap) ((void)vsnprintf(buf, size, fmt, ap)) 332 #ifdef UNIV_PFS_MEMORY 354 explicit hex(uintmax_t
t) : m_val(t) {}
365 std::ios_base::fmtflags ff = lhs.flags();
366 lhs << std::showbase << std::hex << rhs.
m_val;
380 #ifndef UNIV_NO_ERR_MSGS 385 template <
class... Args>
387 ut_a(m_err == ER_IB_MSG_0);
391 m_oss << msg(err, std::forward<Args>(args)...);
398 template <
typename T>
408 std::ostream &
write(
const char *buf, std::streamsize
count) {
409 return (m_oss.write(buf, count));
417 return (m_oss.write(reinterpret_cast<const char *>(buf), count));
424 #ifndef UNIV_NO_ERR_MSGS 432 #ifdef UNIV_HOTBACKUP 438 #ifndef UNIV_NO_ERR_MSGS 440 #if defined(__SUNPRO_CC) 441 static const char *
PREFIX;
444 static constexpr
const char *PREFIX =
"InnoDB: ";
450 template <
class... Args>
451 static std::string
msg(
int err, Args &&... args) {
457 ret = snprintf(buf,
sizeof(buf), fmt, std::forward<Args>(args)...);
461 if (ret > 0 && (
size_t)ret <
sizeof(buf)) {
484 m_oss <<
msg(err,
"");
491 template <
class... Args>
493 : m_err(err), m_level(level) {
495 m_oss << msg(err, std::forward<Args>(args)...);
520 #ifndef UNIV_NO_ERR_MSGS 528 template <
class... Args>
541 #ifndef UNIV_NO_ERR_MSGS 548 template <
class... Args>
562 #ifndef UNIV_NO_ERR_MSGS 569 template <
class... Args>
584 #ifndef UNIV_NO_ERR_MSGS 592 m_oss <<
msg(err,
"");
598 template <
class... Args>
602 m_oss << msg(err, std::forward<Args>(args)...);
617 #ifndef UNIV_NO_ERR_MSGS 627 template <
class... Args>
630 std::forward<Args>(args)...) {}
639 #ifndef UNIV_NO_ERR_MSGS 651 template <
class... Args>
658 m_oss <<
msg(err,
"");
665 template <
class... Args>
672 m_oss << msg(err, std::forward<Args>(args)...);
686 #ifdef UNIV_HOTBACKUP 689 class trace_1 :
public logger {
691 #ifndef UNIV_NO_ERR_MSGS 698 template <
class... Args>
699 explicit trace_1(
int err, Args &&... args)
712 class trace_2 :
public logger {
714 #ifndef UNIV_NO_ERR_MSGS 721 template <
class... Args>
722 explicit trace_2(
int err, Args &&... args)
734 class trace_3 :
public logger {
736 #ifndef UNIV_NO_ERR_MSGS 743 template <
class... Args>
744 explicit trace_3(
int err, Args &&... args)
757 #ifdef UNIV_HOTBACKUP 761 void meb_sprintf_timestamp_without_extra_chars(
char *buf);
767 explicit Wait_stats(uint64_t wait_loops = 0) : wait_loops(wait_loops) {}
unsigned char byte
Blob class.
Definition: common.h:159
ulint ut_2_power_up(ulint n)
Calculates fast the number rounded up to the nearest power of 2.
Definition: ut0ut.cc:286
hex(uintmax_t t)
Definition: ut0ut.h:354
bool operator()(const char *a, const char *b) const
Definition: ut0ut.h:259
The class logger is the base class of all the error log related classes.
Definition: ut0ut.h:375
void ut_print_name(FILE *f, const trx_t *trx, const char *name)
Outputs a fixed-length string, quoted as an SQL identifier.
Definition: ut0ut.cc:326
Definition: my_loglevel.h:35
double ut_difftime(ib_time_t time2, ib_time_t time1)
Returns the difference of two times in seconds.
Definition: ut0ut.cc:225
Emit a fatal message if the given predicate is true, otherwise emit a error message.
Definition: ut0ut.h:637
Global error codes for the database.
ssize_t count
Definition: memcached.c:386
std::ostream & write(const char *buf, std::streamsize count)
Write the given buffer to the internal string stream object.
Definition: ut0ut.h:408
info(int err, Args &&... args)
Constructor.
Definition: ut0ut.h:529
const string name("\ame\)
Functor that compares two C strings.
Definition: ut0ut.h:258
#define ut_vsnprintf(buf, size, fmt, ap)
A wrapper for vsnprintf(3), formatted output conversion into a limited buffer.
Definition: ut0ut.h:324
logger & operator<<(const T &rhs)
Definition: ut0ut.h:399
Macros for using atomics.
logger(loglevel level)
Constructor.
Definition: ut0ut.h:500
Definition: trx0trx.h:713
std::ostringstream m_oss
For converting the message into a string.
Definition: ut0ut.h:422
time_t ib_time_t
Time stamp.
Definition: ut0ut.h:82
logger(loglevel level, int err, Args &&... args)
Constructor.
Definition: ut0ut.h:492
logger & log(int err, Args &&... args)
Format an error message.
Definition: ut0ut.h:386
Emit an error message if the given predicate is true, otherwise emit a warning message.
Definition: ut0ut.h:615
error_or_warn(bool pred)
Default constructor uses ER_IB_MSG_0.
Definition: ut0ut.h:621
fatal(int err)
Default constructor uses ER_IB_MSG_0.
Definition: ut0ut.h:589
Definition: varlen_sort.h:182
The class fatal is used to emit an error message and stop the server by crashing it.
Definition: ut0ut.h:582
fatal(int err, Args &&... args)
Constructor.
Definition: ut0ut.h:599
ulint ut_delay(ulint delay)
Runs an idle loop on CPU.
Definition: ut0ut.cc:265
error_or_warn(bool pred, int err, Args &&... args)
Constructor.
Definition: ut0ut.h:628
uint64_t wait_loops
Definition: ut0ut.h:765
char * ut_format_name(const char *name, char *formatted, ulint formatted_size)
Format a table name, quoted as an SQL identifier.
Definition: ut0ut.cc:352
The class warn is used to emit warnings.
Definition: ut0ut.h:539
error(int err, Args &&... args)
Constructor.
Definition: ut0ut.h:570
std::ostream & write(const byte *buf, std::streamsize count)
Write the given buffer to the internal string stream object.
Definition: ut0ut.h:416
Definition: my_loglevel.h:36
int ut_usectime(ulint *sec, ulint *ms)
Returns system time.
Definition: ut0ut.cc:155
static std::string msg(int err, Args &&... args)
Format an error message.
Definition: ut0ut.h:451
The class info is used to emit informational log messages.
Definition: ut0ut.h:518
Wait_stats & operator+=(const Wait_stats &rhs)
Definition: ut0ut.h:769
#define LOG_BUFF_MAX
advisory.
Definition: log_shared.h:221
const char * srv_get_server_errmsgs(int errcode)
Get the format string for the logger.
Definition: srv0srv.cc:3051
dberr_t
Definition: db0err.h:38
logger(loglevel level, int err)
Constructor.
Definition: ut0ut.h:472
size_t ut_basename_noext(const char *file, char *base, size_t base_size)
Extract the basename of a file without its extension.
fatal_or_error(bool fatal)
Default constructor uses ER_IB_MSG_0.
Definition: ut0ut.h:642
t
Definition: dbug_analyze.cc:147
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:48
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:910
void delay(int amt)
Definition: suite_stubs.c:27
char msg[1024]
Definition: test_sql_9_sessions.cc:282
std::ostream & operator<<(std::ostream &lhs, const hex &rhs)
This is an overload of the global operator<< for the user defined type ib::hex.
Definition: ut0ut.h:364
UNIV_INLINE uint32_t ut_2_exp(uint32_t n)
Calculates 2 to power n.
fatal_or_error(bool fatal, int err, Args &&... args)
Constructor.
Definition: ut0ut.h:666
Debug utilities for Innobase.
ib_time_t ut_time(void)
Returns system time.
Definition: ut0ut.cc:148
#define PREFIX
Definition: pfs_builtin_memory.cc:141
const char * ut_strerr(dberr_t num)
Convert an error number to a human readable text message.
Definition: ut0ut.cc:425
Definition: my_loglevel.h:34
uintmax_t ut_time_us(uintmax_t *tloc)
Returns the number of microseconds since epoch.
Definition: ut0ut.cc:195
Wait_stats operator+(const Wait_stats &rhs) const
Definition: ut0ut.h:774
const bool m_fatal
If true then assert after printing an error message.
Definition: ut0ut.h:683
error()
Default constructor uses ER_IB_MSG_0.
Definition: ut0ut.h:564
static Logger logger
The "top-level" logger used when no connection context is given.
Definition: test_trace_plugin.cc:293
UNIV_INLINE void ut_pair_min(ulint *min_hi, ulint *min_lo, ulint a_hi, ulint a_lo, ulint b_hi, ulint b_lo)
Calculate the minimum of two pairs.
fatal_or_error(bool fatal, int err)
Constructor.
Definition: ut0ut.h:652
UNIV_INLINE ulint ut_2_log(ulint n)
Calculates fast the 2-logarithm of a number, rounded upward to an integer.
loglevel
Definition: my_loglevel.h:32
Wait_stats(uint64_t wait_loops=0)
Definition: ut0ut.h:767
void ut_copy_file(FILE *dest, FILE *src)
Catenate files.
Definition: ut0ut.cc:380
UNIV_INLINE int ut_ulint_cmp(ulint a, ulint b)
Compares two ulints.
UNIV_INLINE int ut_pair_cmp(ulint a_h, ulint a_l, ulint b_h, ulint b_l)
Compare two pairs of integers.
warn(int err, Args &&... args)
Constructor.
Definition: ut0ut.h:549
fatal()
Default constructor uses ER_IB_MSG_0.
Definition: ut0ut.h:586
warn()
Default constructor uses ER_IB_MSG_0.
Definition: ut0ut.h:543
ulint ut_time_ms(void)
Returns the number of milliseconds since some epoch.
Definition: ut0ut.cc:215
const uintmax_t m_val
Definition: ut0ut.h:355
bool any_waits() const
Definition: ut0ut.h:778
static struct my_cs_file_section_st sec[]
Definition: ctype.cc:155
std::string ut_get_name(const trx_t *trx, const char *name)
Get a fixed-length string, quoted as an SQL identifier.
Definition: ut0ut.cc:310
This is a wrapper class, used to print any unsigned integer type in hexadecimal format.
Definition: ut0ut.h:353
info()
Default constructor uses ER_IB_MSG_0.
Definition: ut0ut.h:523
The class error is used to emit error messages.
Definition: ut0ut.h:560