Skip to content

Commit a4a84e1

Browse files
Alexey KopytovAlexey Kopytov
authored andcommitted
Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
--BZR-- revision-id: [email protected] property-branch-nick: mysql-trunk-merge testament3-sha1: 65c2a188cb95fbd9c9272686b95c4122b693270f
2 parents f1a888b + c4162e3 commit a4a84e1

57 files changed

Lines changed: 1481 additions & 814 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bzrfileids

216 Bytes
Binary file not shown.

include/my_no_pthread.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,13 @@
4848
#define rw_unlock(A)
4949
#define rwlock_destroy(A)
5050

51+
typedef int my_pthread_once_t;
52+
#define MY_PTHREAD_ONCE_INIT 0
53+
#define MY_PTHREAD_ONCE_DONE 1
54+
55+
#define my_pthread_once(C,F) do { \
56+
if (*(C) != MY_PTHREAD_ONCE_DONE) { F(); *(C)= MY_PTHREAD_ONCE_DONE; } \
57+
} while(0)
58+
5159
#endif
5260
#endif /* MY_NO_PTHREAD_INCLUDED */

include/my_pthread.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ typedef int pthread_mutexattr_t;
6868
#define pthread_handler_t EXTERNC void * __cdecl
6969
typedef void * (__cdecl *pthread_handler)(void *);
7070

71+
typedef volatile LONG my_pthread_once_t;
72+
#define MY_PTHREAD_ONCE_INIT 0
73+
#define MY_PTHREAD_ONCE_INPROGRESS 1
74+
#define MY_PTHREAD_ONCE_DONE 2
75+
7176
/*
7277
Struct and macros to be used in combination with the
7378
windows implementation of pthread_cond_timedwait
@@ -112,6 +117,7 @@ int pthread_attr_init(pthread_attr_t *connect_att);
112117
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack);
113118
int pthread_attr_setprio(pthread_attr_t *connect_att,int priority);
114119
int pthread_attr_destroy(pthread_attr_t *connect_att);
120+
int my_pthread_once(my_pthread_once_t *once_control,void (*init_routine)(void));
115121
struct tm *localtime_r(const time_t *timep,struct tm *tmp);
116122
struct tm *gmtime_r(const time_t *timep,struct tm *tmp);
117123

@@ -190,6 +196,10 @@ extern int my_pthread_getprio(pthread_t thread_id);
190196
#define pthread_handler_t EXTERNC void *
191197
typedef void *(* pthread_handler)(void *);
192198

199+
#define my_pthread_once_t pthread_once_t
200+
#define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
201+
#define my_pthread_once(C,F) pthread_once(C,F)
202+
193203
/* Test first for RTS or FSU threads */
194204

195205
#if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM)

include/my_sys.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,6 @@ extern my_bool resolve_collation(const char *cl_name,
978978
CHARSET_INFO *default_cl,
979979
CHARSET_INFO **cl);
980980

981-
extern void free_charsets(void);
982981
extern char *get_charsets_dir(char *buf);
983982
extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2);
984983
extern my_bool init_compiled_charsets(myf flags);

libmysql/libmysql.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ void STDCALL mysql_server_end()
211211
}
212212
else
213213
{
214-
free_charsets();
215214
mysql_thread_end();
216215
}
217216

mysql-test/extra/rpl_tests/rpl_loaddata.test

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,26 @@ connection slave;
2121
reset master;
2222
connection master;
2323

24+
# MTR is not case-sensitive.
25+
let $lower_stmt_head= load data;
26+
let $UPPER_STMT_HEAD= LOAD DATA;
27+
if (`SELECT '$lock_option' <> ''`)
28+
{
29+
#if $lock_option is null, an extra blank is added into the statement,
30+
#this will change the result of rpl_loaddata test case. so $lock_option
31+
#is set only when it is not null.
32+
let $lower_stmt_head= load data $lock_option;
33+
let $UPPER_STMT_HEAD= LOAD DATA $lock_option;
34+
}
35+
2436
select last_insert_id();
2537
create table t1(a int not null auto_increment, b int, primary key(a) );
26-
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
38+
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
2739
# verify that LAST_INSERT_ID() is set by LOAD DATA INFILE
2840
select last_insert_id();
2941

3042
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
31-
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
43+
eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
3244

3345
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
3446
insert into t3 select * from t2;
@@ -56,7 +68,7 @@ sync_with_master;
5668
insert into t1 values(1,10);
5769

5870
connection master;
59-
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
71+
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
6072

6173
save_master_pos;
6274
connection slave;
@@ -70,17 +82,19 @@ connection slave;
7082
set global sql_slave_skip_counter=1;
7183
start slave;
7284
sync_with_master;
73-
--replace_result $MASTER_MYPORT MASTER_PORT
74-
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
75-
--query_vertical show slave status;
85+
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
86+
echo Last_SQL_Errno=$last_error;
87+
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
88+
echo Last_SQL_Error;
89+
echo $last_error;
7690

7791
# Trigger error again to test CHANGE MASTER
7892

7993
connection master;
8094
set sql_log_bin=0;
8195
delete from t1;
8296
set sql_log_bin=1;
83-
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
97+
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
8498
save_master_pos;
8599
connection slave;
86100
# The SQL slave thread should be stopped now.
@@ -92,9 +106,11 @@ connection slave;
92106
stop slave;
93107
change master to master_user='test';
94108
change master to master_user='root';
95-
--replace_result $MASTER_MYPORT MASTER_PORT
96-
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
97-
--query_vertical show slave status;
109+
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
110+
echo Last_SQL_Errno=$last_error;
111+
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
112+
echo Last_SQL_Error;
113+
echo $last_error;
98114

99115
# Trigger error again to test RESET SLAVE
100116

@@ -105,7 +121,7 @@ connection master;
105121
set sql_log_bin=0;
106122
delete from t1;
107123
set sql_log_bin=1;
108-
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
124+
eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
109125
save_master_pos;
110126
connection slave;
111127
# The SQL slave thread should be stopped now.
@@ -114,9 +130,11 @@ connection slave;
114130
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
115131
stop slave;
116132
reset slave;
117-
--replace_result $MASTER_MYPORT MASTER_PORT
118-
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
119-
--query_vertical show slave status;
133+
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
134+
echo Last_SQL_Errno=$last_error;
135+
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
136+
echo Last_SQL_Error;
137+
echo $last_error;
120138

121139
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
122140

@@ -125,7 +143,7 @@ reset master;
125143
eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
126144
unique(day)) engine=$engine_type; # no transactions
127145
--error ER_DUP_ENTRY
128-
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
146+
eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
129147
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
130148
'\n##\n' starting by '>' ignore 1 lines;
131149
select * from t2;
@@ -141,7 +159,7 @@ alter table t2 drop key day;
141159
connection master;
142160
delete from t2;
143161
--error ER_DUP_ENTRY
144-
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
162+
eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
145163
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
146164
'\n##\n' starting by '>' ignore 1 lines;
147165
connection slave;
@@ -154,7 +172,7 @@ drop table t1, t2;
154172
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
155173

156174
--error ER_DUP_ENTRY
157-
LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
175+
eval $UPPER_STMT_HEAD INFILE "../../std_data/words.dat" INTO TABLE t1;
158176

159177
DROP TABLE IF EXISTS t1;
160178

@@ -182,25 +200,25 @@ DROP TABLE IF EXISTS t1;
182200

183201
-- echo ### assertion: works with cross-referenced database
184202
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
185-
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
203+
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
186204

187205
-- eval use $db1
188206
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
189207
-- echo ### assertion: works with fully qualified name on current database
190208
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
191-
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
209+
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
192210

193211
-- echo ### assertion: works without fully qualified name on current database
194212
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
195-
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1
213+
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1
196214

197215
-- echo ### create connection without default database
198216
-- echo ### connect (conn2,localhost,root,,*NO-ONE*);
199217
connect (conn2,localhost,root,,*NO-ONE*);
200218
-- connection conn2
201219
-- echo ### assertion: works without stating the default database
202220
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
203-
-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
221+
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
204222
-- echo ### disconnect and switch back to master connection
205223
-- disconnect conn2
206224
-- connection master

mysql-test/r/ctype_ucs.result

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@ select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
116116
binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
117117
1 1 1
118118
SET CHARACTER SET koi8r;
119+
create table t1 (a varchar(2) character set ucs2 collate ucs2_bin, key(a));
120+
insert into t1 values ('A'),('A'),('B'),('C'),('D'),('A\t');
121+
insert into t1 values ('A\0'),('A\0'),('A\0'),('A\0'),('AZ');
122+
select hex(a) from t1 where a like 'A_' order by a;
123+
hex(a)
124+
00410000
125+
00410000
126+
00410000
127+
00410000
128+
00410009
129+
0041005A
130+
select hex(a) from t1 ignore key(a) where a like 'A_' order by a;
131+
hex(a)
132+
00410000
133+
00410000
134+
00410000
135+
00410000
136+
00410009
137+
0041005A
138+
drop table t1;
119139
CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2, word2 CHAR(64) CHARACTER SET ucs2);
120140
INSERT INTO t1 VALUES (_koi8r'�',_koi8r'�'), (X'2004',X'2004');
121141
SELECT hex(word) FROM t1 ORDER BY word;

mysql-test/r/fulltext.result

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,20 @@ MATCH (col) AGAINST('findme')
560560
DEALLOCATE PREPARE s;
561561
DROP TABLE t1;
562562
#
563+
# Bug #49250 : spatial btree index corruption and crash
564+
# Part two : fulltext syntax check
565+
#
566+
CREATE TABLE t1(col1 TEXT,
567+
FULLTEXT INDEX USING BTREE (col1));
568+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE (col1))' at line 2
569+
CREATE TABLE t2(col1 TEXT);
570+
CREATE FULLTEXT INDEX USING BTREE ON t2(col);
571+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1
572+
ALTER TABLE t2 ADD FULLTEXT INDEX USING BTREE (col1);
573+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE (col1)' at line 1
574+
DROP TABLE t2;
575+
End of 5.0 tests
576+
#
563577
# Bug #47930: MATCH IN BOOLEAN MODE returns too many results
564578
# inside subquery
565579
#

mysql-test/r/gis.result

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,19 @@ GEOMFROMTEXT(
984984
SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
985985
1
986986
DROP TABLE t1;
987+
#
988+
# Bug #49250 : spatial btree index corruption and crash
989+
# Part one : spatial syntax check
990+
#
991+
CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL,
992+
SPATIAL INDEX USING BTREE (col1));
993+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE (col1))' at line 2
994+
CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL);
995+
CREATE SPATIAL INDEX USING BTREE ON t2(col);
996+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1
997+
ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1);
998+
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE (col1)' at line 1
999+
DROP TABLE t2;
9871000
End of 5.0 tests
9881001
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
9891002
create view v1 as select * from t1;

mysql-test/r/partition.result

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
2424
b varchar(10),
2525
PRIMARY KEY (a)
2626
)
27-
PARTITION BY RANGE (to_days(a)) (
28-
PARTITION p1 VALUES LESS THAN (733407),
27+
PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (
28+
PARTITION p1 VALUES LESS THAN (1199134800),
2929
PARTITION pmax VALUES LESS THAN MAXVALUE
3030
);
3131
INSERT INTO t1 VALUES ('2007-07-30 17:35:48', 'p1');
@@ -37,7 +37,7 @@ a b
3737
2009-07-14 17:35:55 pmax
3838
2009-09-21 17:31:42 pmax
3939
ALTER TABLE t1 REORGANIZE PARTITION pmax INTO (
40-
PARTITION p3 VALUES LESS THAN (733969),
40+
PARTITION p3 VALUES LESS THAN (1247688000),
4141
PARTITION pmax VALUES LESS THAN MAXVALUE);
4242
SELECT * FROM t1;
4343
a b
@@ -51,9 +51,9 @@ t1 CREATE TABLE `t1` (
5151
`b` varchar(10) DEFAULT NULL,
5252
PRIMARY KEY (`a`)
5353
) ENGINE=MyISAM DEFAULT CHARSET=latin1
54-
/*!50100 PARTITION BY RANGE (to_days(a))
55-
(PARTITION p1 VALUES LESS THAN (733407) ENGINE = MyISAM,
56-
PARTITION p3 VALUES LESS THAN (733969) ENGINE = MyISAM,
54+
/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
55+
(PARTITION p1 VALUES LESS THAN (1199134800) ENGINE = MyISAM,
56+
PARTITION p3 VALUES LESS THAN (1247688000) ENGINE = MyISAM,
5757
PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
5858
DROP TABLE t1;
5959
create table t1 (a int NOT NULL, b varchar(5) NOT NULL)

0 commit comments

Comments
 (0)