Skip to content

Commit 9d47c4c

Browse files
committed
Merge branch '10.2' of github.com:MariaDB/server into bb-10.2-mariarocks
2 parents d577b1a + 7c42b09 commit 9d47c4c

34 files changed

+282
-116
lines changed

cmake/mysql_version.cmake

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,9 @@ ENDMACRO()
6969
# Get mysql version and other interesting variables
7070
GET_MYSQL_VERSION()
7171

72-
SET(MYSQL_TCP_PORT_DEFAULT "3306")
73-
72+
SET(MYSQL_TCP_PORT_DEFAULT 0)
7473
IF(NOT MYSQL_TCP_PORT)
75-
SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT})
76-
SET(MYSQL_TCP_PORT_DEFAULT "0")
77-
ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT)
78-
SET(MYSQL_TCP_PORT_DEFAULT "0")
74+
SET(MYSQL_TCP_PORT 3306)
7975
ENDIF()
8076

8177
IF(NOT COMPILATION_COMMENT)

extra/mariabackup/xtrabackup.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,7 +2460,7 @@ static os_thread_ret_t log_copying_thread(void*)
24602460

24612461
log_copying_running = false;
24622462
my_thread_end();
2463-
os_thread_exit(NULL);
2463+
os_thread_exit();
24642464

24652465
return(0);
24662466
}
@@ -2483,7 +2483,7 @@ static os_thread_ret_t io_watching_thread(void*)
24832483

24842484
io_watching_thread_running = false;
24852485

2486-
os_thread_exit(NULL);
2486+
os_thread_exit();
24872487

24882488
return(0);
24892489
}
@@ -2523,7 +2523,7 @@ data_copy_thread_func(
25232523
pthread_mutex_unlock(&ctxt->count_mutex);
25242524

25252525
my_thread_end();
2526-
os_thread_exit(NULL);
2526+
os_thread_exit();
25272527
OS_THREAD_DUMMY_RETURN;
25282528
}
25292529

mysql-test/lib/My/SafeProcess.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,14 @@ sub start_kill {
336336

337337
sub dump_core {
338338
my ($self)= @_;
339-
return if IS_WINDOWS;
340339
my $pid= $self->{SAFE_PID};
341340
die "Can't get core from not started process" unless defined $pid;
341+
342+
if (IS_WINDOWS) {
343+
system("$safe_kill $pid dump");
344+
return 1;
345+
}
346+
342347
_verbose("Sending ABRT to $self");
343348
kill ("ABRT", $pid);
344349
return 1;

mysql-test/lib/My/SafeProcess/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ SET(INSTALL_ARGS
2525
IF (WIN32)
2626
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process_win.cc ${INSTALL_ARGS})
2727
MYSQL_ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc ${INSTALL_ARGS})
28+
TARGET_LINK_LIBRARIES(my_safe_kill dbghelp psapi)
2829
ELSE()
2930
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process.cc ${INSTALL_ARGS})
3031
ENDIF()

mysql-test/lib/My/SafeProcess/safe_kill_win.cc

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,80 @@
2525
#include <stdio.h>
2626
#include <signal.h>
2727
#include <stdlib.h>
28+
#include <psapi.h>
29+
#include <DbgHelp.h>
30+
31+
static int create_dump(DWORD pid)
32+
{
33+
char path[MAX_PATH];
34+
char working_dir[MAX_PATH];
35+
int ret= -1;
36+
HANDLE process= INVALID_HANDLE_VALUE;
37+
HANDLE file= INVALID_HANDLE_VALUE;
38+
char *p;
39+
40+
process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, (DWORD)pid);
41+
if (!process)
42+
{
43+
fprintf(stderr,"safe_kill : cannot open process pid=%u to create dump, last error %u\n",
44+
pid, GetLastError());
45+
goto exit;
46+
}
47+
48+
DWORD size = MAX_PATH;
49+
if (QueryFullProcessImageName(process, 0, path, &size) == 0)
50+
{
51+
fprintf(stderr,"safe_kill : cannot read process path for pid %u, last error %u\n",
52+
pid, GetLastError());
53+
goto exit;
54+
}
55+
56+
if ((p = strrchr(path, '.')) == 0)
57+
p= path + strlen(path);
58+
59+
strncpy(p, ".dmp", path + MAX_PATH - p);
60+
61+
/* Create dump in current directory.*/
62+
const char *filename= strrchr(path, '\\');
63+
if (filename == 0)
64+
filename = path;
65+
else
66+
filename++;
67+
68+
if (!GetCurrentDirectory(MAX_PATH, working_dir))
69+
{
70+
fprintf(stderr, "GetCurrentDirectory failed, last error %u",GetLastError());
71+
goto exit;
72+
}
73+
74+
file = CreateFile(filename, GENERIC_READ | GENERIC_WRITE,
75+
0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
76+
77+
if (file == INVALID_HANDLE_VALUE)
78+
{
79+
fprintf(stderr,"safe_kill : CreateFile() failed for file %s, working dir %s, last error = %u\n",
80+
filename, working_dir, GetLastError());
81+
goto exit;
82+
}
83+
84+
if (!MiniDumpWriteDump(process, pid, file, MiniDumpNormal, 0,0,0))
85+
{
86+
fprintf(stderr, "Failed to write minidump to %s, working dir %s, last error %u\n",
87+
filename, working_dir, GetLastError());
88+
goto exit;
89+
}
90+
91+
ret = 0;
92+
fprintf(stderr, "Minidump written to %s, directory %s\n", filename, working_dir);
93+
94+
exit:
95+
if(process!= 0 && process != INVALID_HANDLE_VALUE)
96+
CloseHandle(process);
97+
98+
if (file != 0 && file != INVALID_HANDLE_VALUE)
99+
CloseHandle(file);
100+
return ret;
101+
}
28102

29103
int main(int argc, const char** argv )
30104
{
@@ -37,12 +111,16 @@ int main(int argc, const char** argv )
37111
signal(SIGBREAK, SIG_IGN);
38112
signal(SIGTERM, SIG_IGN);
39113

40-
if (argc != 2) {
41-
fprintf(stderr, "safe_kill <pid>\n");
114+
if ((argc != 2 && argc != 3) || (argc == 3 && strcmp(argv[2],"dump"))) {
115+
fprintf(stderr, "safe_kill <pid> [dump]\n");
42116
exit(2);
43117
}
44118
pid= atoi(argv[1]);
45119

120+
if (argc == 3)
121+
{
122+
return create_dump(pid);
123+
}
46124
_snprintf(safe_process_name, sizeof(safe_process_name),
47125
"safe_process[%d]", pid);
48126

mysql-test/suite/innodb/r/alter_table.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,14 @@ t1 CREATE TABLE `t1` (
1111
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
1212
drop table t1;
1313
set @@sql_mode=default;
14+
create table t1 (
15+
id1 int(11) not null auto_increment,
16+
id2 varchar(30) not null,
17+
id3 datetime not null default current_timestamp,
18+
primary key (id1),
19+
unique key unique_id2 (id2)
20+
) engine=innodb;
21+
alter table t1 change column id2 id4 varchar(100) not null;
22+
select * from t1 where id4 like 'a';
23+
id1 id4 id3
24+
drop table t1;

mysql-test/suite/innodb/r/innodb-alter.result

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,8 @@ CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
640640
ALTER TABLE t1o DROP INDEX ct, DROP INDEX FTS_DOC_ID_INDEX,
641641
CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL;
642642
ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id);
643-
call mtr.add_suppression("InnoDB: No matching column for `FTS_DOC_ID` in index `ct` of table `test`\\.`t1o`");
644643
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
645644
ADD FULLTEXT INDEX(ct);
646-
ERROR HY000: Index for table 't1o' is corrupt; try to repair it
647645
DROP TABLE sys_indexes;
648646
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
649647
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;

mysql-test/suite/innodb/t/alter_table.test

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,17 @@ create index idx1 on t1(a(3073));
88
show create table t1;
99
drop table t1;
1010
set @@sql_mode=default;
11+
12+
#
13+
# MDEV-14081 ALTER TABLE CHANGE COLUMN Corrupts Index Leading to Crashes in 10.2
14+
#
15+
create table t1 (
16+
id1 int(11) not null auto_increment,
17+
id2 varchar(30) not null,
18+
id3 datetime not null default current_timestamp,
19+
primary key (id1),
20+
unique key unique_id2 (id2)
21+
) engine=innodb;
22+
alter table t1 change column id2 id4 varchar(100) not null;
23+
select * from t1 where id4 like 'a';
24+
drop table t1;

mysql-test/suite/innodb/t/innodb-alter.test

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,8 @@ CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL;
370370

371371
ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id);
372372

373-
# FIXME: MDEV-9469 'Incorrect key file' on ALTER TABLE
374-
call mtr.add_suppression("InnoDB: No matching column for `FTS_DOC_ID` in index `ct` of table `test`\\.`t1o`");
375-
--error ER_NOT_KEYFILE
376373
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
377374
ADD FULLTEXT INDEX(ct);
378-
# FIXME: MDEV-9469 (enable this)
379-
#--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
380-
#ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
381-
#ALGORITHM=INPLACE;
382-
#end of MDEV-9469 FIXME
383375

384376
DROP TABLE sys_indexes;
385377
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#
2+
# Bug#25053705 - INVALID I/O ON TABLE AFTER TRUNCATE
3+
#
4+
CREATE TABLE t1 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b),
5+
FULLTEXT fts2(c));
6+
TRUNCATE TABLE t1;
7+
INSERT INTO t1 (a,d,b,c) VALUES (
8+
'79795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
9+
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
10+
cuullucocraloracurooulrooauuar','1'));
11+
CREATE TABLE t2 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b));
12+
INSERT INTO t2 VALUES (1, 1, repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
13+
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorccuullucocraloracurooulrooauuar','1'));
14+
create procedure insert_t2(IN total int)
15+
begin
16+
declare i int default 1;
17+
while (i <= total) DO
18+
insert into t2 select * from t2;
19+
set i = i + 1;
20+
end while;
21+
end|
22+
CALL insert_t2(15);
23+
SET @save_dbug = @@SESSION.DEBUG_DBUG;
24+
SET DEBUG_DBUG = '+d,innodb_invalid_read_after_truncate';
25+
INSERT INTO t1 (a,d,b,c) VALUES (
26+
'7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
27+
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
28+
cuullucocraloracurooulrooauuar','1'));
29+
SET DEBUG_DBUG = @save_dbug;
30+
DROP PROCEDURE insert_t2;
31+
DROP TABLE t1,t2;

0 commit comments

Comments
 (0)