From 0375f2e2730c6e30f3e6f171c9b73d8553a3ae9a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 14 Jul 2017 15:30:27 +0200 Subject: MDEV-12144 Signal 6 crash corrupts ibd files Avoid using STDERR_FILENO. The server uses freopen(stderr), so stderr can be on any file descriptor. --- mysys/my_fopen.c | 2 +- mysys/stacktrace.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'mysys') diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index 99a9035c0c2..9131a2549e0 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -143,7 +143,7 @@ static int no_close(void *cookie __attribute__((unused))) /* A hack around a race condition in the implementation of freopen. - The race condition steams from the fact that the current fd of + The race condition stems from the fact that the current fd of the stream is closed before its number is used to duplicate the new file descriptor. This defeats the desired atomicity of the close and duplicate of dup2(). diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 402520990b6..ae715c04621 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -744,7 +744,7 @@ void my_safe_print_str(const char *val, int len) size_t my_write_stderr(const void *buf, size_t count) { - return (size_t) write(STDERR_FILENO, buf, count); + return (size_t) write(fileno(stderr), buf, count); } -- cgit v1.2.1 From d023156782ce37f508c121437b8b3544fb03ef14 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 30 Oct 2015 10:10:43 +0400 Subject: MDEV-8692 prefschema test failures on ARM (on Debian build system) A few tests assumes that the CYCLE timer is always available, which is not true on some platforms (e.g. ARM). Fixing the tests not to reply on the CYCLE availability. --- mysys/my_rdtsc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'mysys') diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c index 028c7f810d4..ad11e8c6a6c 100644 --- a/mysys/my_rdtsc.c +++ b/mysys/my_rdtsc.c @@ -129,6 +129,31 @@ ulonglong my_timer_cycles_il_x86_64(); clock_gettime(CLOCK_SGI_CYCLE) for Irix platforms, or on read_real_time for aix platforms. There is nothing for Alpha platforms, they would be tricky. + + On the platforms that do not have a CYCLE timer, + "wait" events are initialized to use NANOSECOND instead of CYCLE + during performance_schema initialization (at the server startup). + + Linux performance monitor (see "man perf_event_open") can + provide cycle counter on the platforms that do not have + other kinds of cycle counters. But we don't use it so far. + + ARM notes + --------- + During tests on ARMv7 Debian, perf_even_open() based cycle counter provided + too low frequency with too high overhead: + MariaDB [performance_schema]> SELECT * FROM performance_timers; + +-------------+-----------------+------------------+----------------+ + | TIMER_NAME | TIMER_FREQUENCY | TIMER_RESOLUTION | TIMER_OVERHEAD | + +-------------+-----------------+------------------+----------------+ + | CYCLE | 689368159 | 1 | 970 | + | NANOSECOND | 1000000000 | 1 | 308 | + | MICROSECOND | 1000000 | 1 | 417 | + | MILLISECOND | 1000 | 1000 | 407 | + | TICK | 127 | 1 | 612 | + +-------------+-----------------+------------------+----------------+ + Therefore, it was decided not to use perf_even_open() on ARM + (i.e. go without CYCLE and have "wait" events use NANOSECOND by default). */ ulonglong my_timer_cycles(void) -- cgit v1.2.1