Skip to content

Commit bfba2bc

Browse files
committed
Merge 10.1 into 10.2
2 parents 309302a + ece0b06 commit bfba2bc

File tree

11 files changed

+117
-130
lines changed

11 files changed

+117
-130
lines changed

client/mysqltest.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9062,10 +9062,6 @@ static void init_signal_handling(void)
90629062
struct sigaction sa;
90639063
DBUG_ENTER("init_signal_handling");
90649064

9065-
#ifdef HAVE_STACKTRACE
9066-
my_init_stacktrace();
9067-
#endif
9068-
90699065
sa.sa_flags = SA_RESETHAND | SA_NODEFER;
90709066
sigemptyset(&sa.sa_mask);
90719067
sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL);

include/my_stacktrace.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
C_MODE_START
4444

4545
#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
46-
void my_init_stacktrace();
4746
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack);
4847
int my_safe_print_str(const char* val, int max_len);
4948
void my_write_core(int sig);
@@ -53,8 +52,6 @@ char *my_demangle(const char *mangled_name, int *status);
5352
#ifdef __WIN__
5453
void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
5554
#endif /* __WIN__ */
56-
#else
57-
#define my_init_stacktrace() do { } while(0)
5855
#endif /* ! (defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)) */
5956

6057
#ifndef _WIN32

mysql-test/r/mysql_tzinfo_to_sql_symlink.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ TRUNCATE TABLE time_zone;
1515
TRUNCATE TABLE time_zone_name;
1616
TRUNCATE TABLE time_zone_transition;
1717
TRUNCATE TABLE time_zone_transition_type;
18+
START TRANSACTION;
1819
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
1920
SET @time_zone_id= LAST_INSERT_ID();
2021
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -32,6 +33,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
3233
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
3334
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
3435
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
36+
COMMIT;
3537
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
3638
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
3739
\d |
@@ -57,6 +59,7 @@ TRUNCATE TABLE time_zone;
5759
TRUNCATE TABLE time_zone_name;
5860
TRUNCATE TABLE time_zone_transition;
5961
TRUNCATE TABLE time_zone_transition_type;
62+
START TRANSACTION;
6063
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
6164
SET @time_zone_id= LAST_INSERT_ID();
6265
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -71,6 +74,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
7174
(@time_zone_id, 0, 0, 0, 'GMT')
7275
;
7376
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
77+
COMMIT;
7478
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
7579
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
7680
\d |
@@ -160,6 +164,8 @@ TRUNCATE TABLE time_zone;
160164
TRUNCATE TABLE time_zone_name;
161165
TRUNCATE TABLE time_zone_transition;
162166
TRUNCATE TABLE time_zone_transition_type;
167+
START TRANSACTION;
168+
COMMIT;
163169
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
164170
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
165171
\d |

mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ TRUNCATE TABLE time_zone;
1515
TRUNCATE TABLE time_zone_name;
1616
TRUNCATE TABLE time_zone_transition;
1717
TRUNCATE TABLE time_zone_transition_type;
18+
START TRANSACTION;
1819
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
1920
SET @time_zone_id= LAST_INSERT_ID();
2021
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -32,6 +33,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
3233
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
3334
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
3435
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
36+
COMMIT;
3537
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
3638
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
3739
\d |
@@ -57,6 +59,7 @@ TRUNCATE TABLE time_zone;
5759
TRUNCATE TABLE time_zone_name;
5860
TRUNCATE TABLE time_zone_transition;
5961
TRUNCATE TABLE time_zone_transition_type;
62+
START TRANSACTION;
6063
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
6164
SET @time_zone_id= LAST_INSERT_ID();
6265
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -71,6 +74,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
7174
(@time_zone_id, 0, 0, 0, 'GMT')
7275
;
7376
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
77+
COMMIT;
7478
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
7579
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
7680
\d |

mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ TRUNCATE TABLE time_zone;
99
TRUNCATE TABLE time_zone_name;
1010
TRUNCATE TABLE time_zone_transition;
1111
TRUNCATE TABLE time_zone_transition_type;
12+
START TRANSACTION;
1213
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
1314
SET @time_zone_id= LAST_INSERT_ID();
1415
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -26,6 +27,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
2627
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
2728
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
2829
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
30+
COMMIT;
2931
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
3032
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
3133
# Silent run
@@ -36,6 +38,7 @@ TRUNCATE TABLE time_zone;
3638
TRUNCATE TABLE time_zone_name;
3739
TRUNCATE TABLE time_zone_transition;
3840
TRUNCATE TABLE time_zone_transition_type;
41+
START TRANSACTION;
3942
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
4043
SET @time_zone_id= LAST_INSERT_ID();
4144
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -50,6 +53,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
5053
(@time_zone_id, 0, 0, 0, 'GMT')
5154
;
5255
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
56+
COMMIT;
5357
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
5458
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
5559
#

mysys/stacktrace.c

Lines changed: 16 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -34,108 +34,11 @@
3434
#include <execinfo.h>
3535
#endif
3636

37-
#ifdef __linux__
38-
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
39-
static char *heap_start;
40-
char *__bss_start;
41-
#else
42-
#define PTR_SANE(p) (p)
43-
#endif /* __linux */
44-
45-
46-
void my_init_stacktrace()
47-
{
48-
#ifdef __linux__
49-
heap_start = (char*) &__bss_start;
50-
#endif /* __linux */
51-
}
52-
53-
#ifdef __linux__
54-
55-
static void print_buffer(char *buffer, size_t count)
56-
{
57-
const char s[]= " ";
58-
for (; count && *buffer; --count)
59-
{
60-
my_write_stderr(isprint(*buffer) ? buffer : s, 1);
61-
++buffer;
62-
}
63-
}
64-
65-
/**
66-
Access the pages of this process through /proc/self/task/<tid>/mem
67-
in order to safely print the contents of a memory address range.
68-
69-
@param addr The address at the start of the memory region.
70-
@param max_len The length of the memory region.
71-
72-
@return Zero on success.
73-
*/
74-
static int safe_print_str(const char *addr, int max_len)
75-
{
76-
int fd;
77-
pid_t tid;
78-
off_t offset;
79-
ssize_t nbytes= 0;
80-
size_t total, count;
81-
char buf[256];
82-
83-
tid= (pid_t) syscall(SYS_gettid);
84-
85-
sprintf(buf, "/proc/self/task/%d/mem", tid);
86-
87-
if ((fd= open(buf, O_RDONLY)) < 0)
88-
return -1;
89-
90-
/* Ensure that off_t can hold a pointer. */
91-
compile_time_assert(sizeof(off_t) >= sizeof(intptr));
92-
93-
total= max_len;
94-
offset= (intptr) addr;
95-
96-
/* Read up to the maximum number of bytes. */
97-
while (total)
98-
{
99-
count= MY_MIN(sizeof(buf), total);
100-
101-
if ((nbytes= pread(fd, buf, count, offset)) < 0)
102-
{
103-
/* Just in case... */
104-
if (errno == EINTR)
105-
continue;
106-
else
107-
break;
108-
}
109-
110-
/* Advance offset into memory. */
111-
total-= nbytes;
112-
offset+= nbytes;
113-
addr+= nbytes;
114-
115-
/* Output the printable characters. */
116-
print_buffer(buf, nbytes);
117-
118-
/* Break if less than requested... */
119-
if ((count - nbytes))
120-
break;
121-
}
122-
123-
if (nbytes == -1)
124-
my_safe_printf_stderr("Can't read from address %p", addr);
125-
126-
close(fd);
127-
128-
return 0;
129-
}
130-
131-
#endif
132-
13337
/*
13438
Attempt to print a char * pointer as a string.
13539
13640
SYNOPSIS
137-
Prints either until the end of string ('\0'), or max_len characters have
138-
been printed.
41+
Prints until max_len characters have been printed.
13942
14043
RETURN VALUE
14144
0 Pointer was within the heap address space.
@@ -150,24 +53,25 @@ static int safe_print_str(const char *addr, int max_len)
15053

15154
int my_safe_print_str(const char* val, int max_len)
15255
{
153-
#ifdef __linux__
154-
char *heap_end;
155-
156-
// Try and make use of /proc filesystem to safely print memory contents.
157-
if (!safe_print_str(val, max_len))
158-
return 0;
159-
160-
heap_end= (char*) sbrk(0);
161-
#endif
162-
163-
if (!PTR_SANE(val))
56+
const char *orig_val= val;
57+
if (!val)
16458
{
165-
my_safe_printf_stderr("%s", "is an invalid pointer");
59+
my_safe_printf_stderr("%s", "(null)");
16660
return 1;
16761
}
16862

169-
for (; max_len && PTR_SANE(val) && *val; --max_len)
170-
my_write_stderr((val++), 1);
63+
for (; max_len; --max_len)
64+
{
65+
if (my_write_stderr((val++), 1) != 1)
66+
{
67+
if ((errno == EFAULT) &&(val == orig_val + 1))
68+
{
69+
// We can not read the address from very beginning
70+
my_safe_printf_stderr("Can't access address %p", orig_val);
71+
}
72+
break;
73+
}
74+
}
17175
my_safe_printf_stderr("%s", "\n");
17276

17377
return 0;
@@ -507,11 +411,6 @@ static EXCEPTION_POINTERS *exception_ptrs;
507411
#define MODULE64_SIZE_WINXP 576
508412
#define STACKWALK_MAX_FRAMES 64
509413

510-
void my_init_stacktrace()
511-
{
512-
}
513-
514-
515414
void my_set_exception_pointers(EXCEPTION_POINTERS *ep)
516415
{
517416
exception_ptrs = ep;

scripts/mysqld_safe.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ numa_interleave=0
2323
wsrep_on=0
2424
dry_run=0
2525
defaults_group_suffix=
26+
ignore_unknown=1
2627

2728
# Initial logging status: error log is not open, and not using syslog
2829
logging=init
@@ -389,11 +390,22 @@ parse_arguments() {
389390

390391
--help) usage ;;
391392

393+
--ignore-unknown) ignore_unknown=1 ;;
394+
--no-ignore-unknown|--not-ignore-unknown) ignore_unknown=0 ;;
395+
392396
*)
393-
case "$unrecognized_handling" in
394-
collect) append_arg_to_args "$arg" ;;
395-
complain) log_error "unknown option '$arg'" ;;
396-
esac
397+
if test $ignore_unknown -eq 0
398+
then
399+
case "$unrecognized_handling" in
400+
collect) append_arg_to_args "$arg" ;;
401+
complain) log_error "unknown option '$arg'"
402+
esac
403+
else
404+
case "$arg" in
405+
"--loose-"*) append_arg_to_args "$arg" ;;
406+
*) append_arg_to_args "--loose-$arg"
407+
esac
408+
fi
397409
esac
398410
done
399411
}

sql/mysqld.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3357,7 +3357,6 @@ void init_signals(void)
33573357
sigemptyset(&sa.sa_mask);
33583358
sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL);
33593359

3360-
my_init_stacktrace();
33613360
#if defined(__amiga__)
33623361
sa.sa_handler=(void(*)())handle_fatal_signal;
33633362
#else

sql/tztime.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,16 +2747,19 @@ main(int argc, char **argv)
27472747
printf("TRUNCATE TABLE time_zone_name;\n");
27482748
printf("TRUNCATE TABLE time_zone_transition;\n");
27492749
printf("TRUNCATE TABLE time_zone_transition_type;\n");
2750+
printf("START TRANSACTION;\n");
27502751

27512752
if (scan_tz_dir(root_name_end, 0, opt_verbose))
27522753
{
2754+
printf("ROLLBACK;\n");
27532755
fflush(stdout);
27542756
fprintf(stderr,
27552757
"There were fatal errors during processing "
27562758
"of zoneinfo directory '%s'\n", fullname);
27572759
return 1;
27582760
}
27592761

2762+
printf("COMMIT;\n");
27602763
printf("ALTER TABLE time_zone_transition "
27612764
"ORDER BY Time_zone_id, Transition_time;\n");
27622765
printf("ALTER TABLE time_zone_transition_type "

unittest/mysys/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring
1717
byte_order
18-
queues LINK_LIBRARIES mysys)
18+
queues stacktrace LINK_LIBRARIES mysys)
1919
MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys)
2020
MY_ADD_TESTS(aes LINK_LIBRARIES mysys mysys_ssl)
2121
ADD_DEFINITIONS(${SSL_DEFINES})

0 commit comments

Comments
 (0)