due to merge

This commit is contained in:
Horst Hunger 2008-12-09 16:15:07 +01:00
commit b53c4d0bac
85 changed files with 1040 additions and 507 deletions

View file

@ -1,4 +1,4 @@
[MYSQL]
post_commit_to = "commits@lists.mysql.com"
post_push_to = "commits@lists.mysql.com"
tree_name = "mysql-5.1"
tree_name = "mysql-5.1-bugteam"

View file

@ -3032,3 +3032,28 @@ mysql-test/bug36522.tar
mysql-test/t.log
mysql-test/tps.log
libmysqld/event_parse_data.cc
autom4te.cache
sql/share/czech
sql/share/danish
sql/share/dutch
sql/share/english
sql/share/estonian
sql/share/french
sql/share/german
sql/share/greek
sql/share/hungarian
sql/share/italian
sql/share/japanese
sql/share/japanese-sjis
sql/share/korean
sql/share/norwegian
sql/share/norwegian-ny
sql/share/polish
sql/share/portuguese
sql/share/romanian
sql/share/russian
sql/share/serbian
sql/share/slovak
sql/share/spanish
sql/share/swedish
sql/share/ukrainian

View file

@ -98,6 +98,10 @@ IF(CYBOZU)
ADD_DEFINITIONS(-DCYBOZU)
ENDIF(CYBOZU)
IF(EXTRA_DEBUG)
ADD_DEFINITIONS(-D EXTRA_DEBUG)
ENDIF(EXTRA_DEBUG)
# in some places we use DBUG_OFF
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")

View file

@ -1627,8 +1627,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_nopager= 1;
break;
case OPT_MYSQL_PROTOCOL:
#ifndef EMBEDDED_LIBRARY
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
#endif
break;
case OPT_SERVER_ARG:
#ifdef EMBEDDED_LIBRARY

View file

@ -620,6 +620,20 @@ static int run_mysqlcheck_upgrade(void)
}
static int run_mysqlcheck_fixnames(void)
{
verbose("Running 'mysqlcheck'...");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
ds_args.str,
"--all-databases",
"--fix-db-names",
"--fix-table-names",
NULL);
}
static const char *expected_errors[]=
{
"ERROR 1060", /* Duplicate column name */
@ -782,7 +796,8 @@ int main(int argc, char **argv)
/*
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
*/
if (run_mysqlcheck_upgrade() ||
if (run_mysqlcheck_fixnames() ||
run_mysqlcheck_upgrade() ||
run_sql_fix_privilege_tables())
{
/*

View file

@ -1851,13 +1851,7 @@ static void DBUGOpenFile(CODE_STATE *cs,
else
{
newfile= !EXISTS(name);
if (!(fp= fopen(name,
#if defined(MSDOS) || defined(__WIN__)
append ? "a+c" : "wc"
#else
append ? "a+" : "w"
#endif
)))
if (!(fp= fopen(name, append ? "a+" : "w")))
{
(void) fprintf(stderr, ERR_OPEN, cs->process, name);
perror("");
@ -2407,13 +2401,4 @@ int i_am_a_dummy_function() {
return 0;
}
#ifdef __WIN__
char _db_doprnt_;
char _db_enter_;
char _db_pargs_;
char _db_process_;
char _db_push_;
char _db_return_;
#endif /*__WIN__*/
#endif

View file

@ -203,8 +203,8 @@ SSL_CTX* SSL_CTX_new(SSL_METHOD*);
SSL* SSL_new(SSL_CTX*);
int SSL_set_fd (SSL*, YASSL_SOCKET_T);
YASSL_SOCKET_T SSL_get_fd(const SSL*);
int SSL_connect(SSL*); // if you get an error from connect
// see note at top of REAMDE
int SSL_connect(SSL*); /* if you get an error from connect
see note at top of REAMDE */
int SSL_write(SSL*, const void*, int);
int SSL_read(SSL*, void*, int);
int SSL_accept(SSL*);

View file

@ -1560,6 +1560,7 @@ void ClientHello::Process(input_buffer&, SSL& ssl)
return;
}
ssl.matchSuite(cipher_suites_, suite_len_);
if (ssl.GetError()) return;
ssl.set_pending(ssl.getSecurity().get_parms().suite_[1]);
if (compression_methods_ == zlib)

View file

@ -250,6 +250,15 @@ inline double ulonglong2double(ulonglong value)
#define my_off_t2double(A) ulonglong2double(A)
#endif /* _WIN64 */
inline ulonglong double2ulonglong(double d)
{
double t= d - (double) 0x8000000000000000ULL;
if (t >= 0)
return ((ulonglong) t) + 0x8000000000000000ULL;
return (ulonglong) d;
}
#if SIZEOF_OFF_T > 4
#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
#define tell(A) _telli64(A)

View file

@ -108,22 +108,6 @@ extern FILE *_db_fp_(void);
#define DBUG_EXPLAIN(buf,len)
#define DBUG_EXPLAIN_INITIAL(buf,len)
#define IF_DBUG(A)
#ifdef __WIN__
/*
On windows all the dll export has to be declared in the *.def file
so as we export these symbols in DEBUG mode we have to export
these in the RELEASE mode also. So below are the dummy symbols
for the RELEASE export
*/
extern char _db_doprnt_;
extern char _db_enter_;
extern char _db_pargs_;
extern char _db_process_;
extern char _db_push_;
extern char _db_return_;
#endif /*__WIN__*/
#endif
#ifdef __cplusplus
}

View file

@ -789,6 +789,9 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define ulonglong2double(A) ((double) (ulonglong) (A))
#define my_off_t2double(A) ((double) (my_off_t) (A))
#endif
#ifndef double2ulonglong
#define double2ulonglong(A) ((ulonglong) (double) (A))
#endif
#endif
#ifndef offsetof

View file

@ -207,9 +207,7 @@ void STDCALL mysql_server_end()
/* If library called my_init(), free memory allocated by it */
if (!org_my_init_done)
{
my_end(MY_DONT_FREE_DBUG);
/* Remove TRACING, if enabled by mysql_debug() */
DBUG_POP();
my_end(0);
}
else
{

View file

@ -29,13 +29,13 @@ ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc
../../client/sql_string.cc)
TARGET_LINK_LIBRARIES(mysql_embedded wsock32)
TARGET_LINK_LIBRARIES(mysql_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
ADD_DEPENDENCIES(mysql_embedded libmysqld)
ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.c)
TARGET_LINK_LIBRARIES(mysqltest_embedded wsock32)
TARGET_LINK_LIBRARIES(mysqltest_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
ADD_DEPENDENCIES(mysqltest_embedded libmysqld)
ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c)
TARGET_LINK_LIBRARIES(mysql_client_test_embedded wsock32)
TARGET_LINK_LIBRARIES(mysql_client_test_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32)
ADD_DEPENDENCIES(mysql_client_test_embedded libmysqld)

View file

@ -386,6 +386,7 @@ static void emb_free_embedded_thd(MYSQL *mysql)
thd->store_globals();
thd->unlink();
delete thd;
my_pthread_setspecific_ptr(THR_THD, 0);
mysql->thd=0;
}
@ -539,12 +540,7 @@ int init_embedded_server(int argc, char **argv, char **groups)
(void) thr_setconcurrency(concurrency); // 10 by default
if (flush_time && flush_time != ~(ulong) 0L)
{
pthread_t hThread;
if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
sql_print_error("Warning: Can't create thread to manage maintenance");
}
start_handle_manager();
// FIXME initialize binlog_filter and rpl_filter if not already done
// corresponding delete is in clean_up()

View file

@ -2,94 +2,6 @@ LIBRARY LIBMYSQLD
DESCRIPTION 'MySQL 5.1 Embedded Server Library'
VERSION 5.1
EXPORTS
_db_process_
_db_enter_
_db_return_
_db_push_
_db_doprnt_
_db_pargs_
strnmov
get_charset
my_memmem
my_snprintf
pthread_exit
pthread_cond_signal
dynstr_append_mem
init_dynamic_string
dynstr_free
my_hash_free
my_vsnprintf
dynstr_append
my_close
my_open
dynstr_set
dynstr_append_os_quoted
my_delete
my_seek
my_write
create_temp_file
fn_format
dirname_part
my_hash_insert
my_hash_search
test_if_hard_path
my_copy
my_mkdir
my_sleep
my_strtod
pthread_cond_wait
my_strnncoll_simple
get_dynamic
my_regerror
init_dynamic_array2
pthread_create
pthread_cond_init
my_regcomp
my_regexec
my_regex_end
my_regfree
longlong2str
my_set_exception_pointers
my_print_stacktrace
my_thread_stack_size
my_safe_print_str
my_stat
_my_hash_init
pthread_attr_setstacksize
pthread_attr_init
my_dirend
wild_compare
my_dir
my_micro_time
find_type_or_exit
_dig_vec_upper
_dig_vec_lower
bmove_upp
delete_dynamic
free_defaults
getopt_compare_strings
getopt_ull_limit_value
handle_options
init_dynamic_array
insert_dynamic
int2str
is_prefix
list_add
list_delete
load_defaults
max_allowed_packet
my_cgets
my_end
my_getopt_print_errors
my_init
my_malloc
my_memdup
my_no_flags_free
my_path
my_print_help
my_print_variables
my_realloc
my_strdup
mysql_thread_end
mysql_thread_init
myodbc_remove_escape
@ -162,47 +74,13 @@ EXPORTS
mysql_thread_safe
mysql_use_result
mysql_warning_count
set_dynamic
strcend
strcont
strdup_root
strfill
strinstr
strmake
strmov
strxmov
mysql_server_end
mysql_server_init
get_tty_password
sql_protocol_typelib
mysql_get_server_version
mysql_set_character_set
mysql_sqlstate
charsets_dir
disabled_my_option
my_charset_latin1
init_alloc_root
my_progname
get_charset_name
get_charset_by_csname
print_defaults
find_type
strxnmov
strend
my_fopen
my_fclose
unpack_filename
str2int
int10_to_str
longlong10_to_str
my_snprintf_8bit
alloc_root
free_root
my_read
llstr
mysql_get_parameters
mysql_thread_init
mysql_thread_end
mysql_stmt_bind_param
mysql_stmt_bind_result
mysql_stmt_execute
@ -230,7 +108,3 @@ EXPORTS
mysql_stmt_attr_get
mysql_stmt_attr_set
mysql_stmt_field_count
get_defaults_options
my_charset_bin
my_charset_same
modify_defaults_file

View file

@ -0,0 +1,11 @@
SET CHARACTER SET utf8;
SHOW VARIABLES like 'character_sets_dir';
Variable_name Value
character_sets_dir MYSQL_TEST_DIR/ß/
SHOW VARIABLES like 'character_set_filesystem';
Variable_name Value
character_set_filesystem latin1
SHOW VARIABLES like 'character_set_client';
Variable_name Value
character_set_client utf8
SET CHARACTER SET default;

View file

@ -522,3 +522,12 @@ WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 5 const 4 Using where
DROP TABLE t1;
CREATE TABLE t1(a CHAR(10));
INSERT INTO t1 VALUES('aaa15');
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE)
1
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
2
DROP TABLE t1;

View file

@ -256,3 +256,15 @@ a
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f")
2003-01-02 10:11:12.001200
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10') time('00:00:00')
-24:00:00 00:00:00
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00')
0
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00')
1
SELECT CAST(time('-73:42:12') AS DECIMAL);
CAST(time('-73:42:12') AS DECIMAL)
-734212

View file

@ -717,8 +717,6 @@ insert(_latin2'abcd',2,3,_latin2'ef'),
replace(_latin2'abcd',_latin2'b',_latin2'B'),
encode('abcd','ab')
;
Warnings:
Warning 1265 Data truncated for column 'format(130,10)' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -727,7 +725,7 @@ t1 CREATE TABLE `t1` (
`conv(130,16,10)` varchar(64) DEFAULT NULL,
`hex(130)` varchar(6) NOT NULL DEFAULT '',
`char(130)` varbinary(4) NOT NULL DEFAULT '',
`format(130,10)` varchar(4) NOT NULL DEFAULT '',
`format(130,10)` varchar(37) NOT NULL DEFAULT '',
`left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
`right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
`lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
@ -2513,4 +2511,12 @@ SELECT HEX(c1) from v1;
HEX(c1)
414243
DROP VIEW v1;
create table t1(a float);
insert into t1 values (1.33);
select format(a, 2) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def format(a, 2) 253 49 4 Y 0 31 8
format(a, 2)
1.33
drop table t1;
End of 5.0 tests

View file

@ -1683,3 +1683,88 @@ CREATE INDEX i1 on t1 (a(3));
SELECT * FROM t1 WHERE a = 'abcde';
a
DROP TABLE t1;
CREATE TABLE foo (a int, b int, c char(10),
PRIMARY KEY (c(3)),
KEY b (b)
) engine=innodb;
CREATE TABLE foo2 (a int, b int, c char(10),
PRIMARY KEY (c),
KEY b (b)
) engine=innodb;
CREATE TABLE bar (a int, b int, c char(10),
PRIMARY KEY (c(3)),
KEY b (b)
) engine=myisam;
INSERT INTO foo VALUES
(1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'),
(4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe');
INSERT INTO bar SELECT * FROM foo;
INSERT INTO foo2 SELECT * FROM foo;
EXPLAIN SELECT c FROM bar WHERE b>2;;
id 1
select_type SIMPLE
table bar
type ALL
possible_keys b
key NULL
key_len NULL
ref NULL
rows 6
Extra Using where
EXPLAIN SELECT c FROM foo WHERE b>2;;
id 1
select_type SIMPLE
table foo
type ALL
possible_keys b
key NULL
key_len NULL
ref NULL
rows 6
Extra Using where
EXPLAIN SELECT c FROM foo2 WHERE b>2;;
id 1
select_type SIMPLE
table foo2
type range
possible_keys b
key b
key_len 5
ref NULL
rows 3
Extra Using where; Using index
EXPLAIN SELECT c FROM bar WHERE c>2;;
id 1
select_type SIMPLE
table bar
type ALL
possible_keys PRIMARY
key NULL
key_len NULL
ref NULL
rows 6
Extra Using where
EXPLAIN SELECT c FROM foo WHERE c>2;;
id 1
select_type SIMPLE
table foo
type ALL
possible_keys PRIMARY
key NULL
key_len NULL
ref NULL
rows 6
Extra Using where
EXPLAIN SELECT c FROM foo2 WHERE c>2;;
id 1
select_type SIMPLE
table foo2
type index
possible_keys PRIMARY
key b
key_len 5
ref NULL
rows 6
Extra Using where; Using index
DROP TABLE foo, bar, foo2;
End of 5.1 tests

View file

@ -40,3 +40,4 @@ count(*)
65536
DROP PROCEDURE sp_addRec;
DROP TABLE t1;
SET @@global.myisam_data_pointer_size = default;

View file

@ -27,3 +27,25 @@ CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
drop table if exists t1;
create table t1(f1 int, f2 varchar(255));
insert into t1 values(1, 'foo'), (2, 'bar');
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
flush tables;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize error Table 'test.t1' is read only
Warnings:
Error 1036 Table 't1' is read only
drop table t1;

View file

@ -324,7 +324,7 @@ partition by hash (a)
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bit(27) NOT NULL DEFAULT '\0\0\0\0',
`a` bit(27) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a)

View file

@ -1,5 +1,6 @@
MySQL error code 150: Foreign key constraint is incorrectly formed
Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
OS error code 23: Too many open files in system
Win32 error code 23: Data error (cyclic redundancy check).
Win32 error code 15000: The specified channel path is invalid.
Win32 error code 23: Data error (cyclic redundancy check).
Win32 error code 1062: The service has not been started.
Illegal error code: 30000

View file

@ -110,7 +110,7 @@ i ts
362793610 1981-07-01 04:00:00
select from_unixtime(362793609);
from_unixtime(362793609)
1981-07-01 03:59:60
1981-07-01 03:59:59
drop table t1;
create table t1 (ts timestamp);
set time_zone='UTC';

View file

@ -17,6 +17,9 @@ insert into t1 values
insert into t1 values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
insert into t1 values
(unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
(unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
select i, from_unixtime(i), c from t1;
i from_unixtime(i) c
1072904422 2004-01-01 00:00:00 2004-01-01 00:00:00
@ -31,6 +34,8 @@ i from_unixtime(i) c
1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
362793608 1981-07-01 03:59:59 1981-07-01 03:59:59
362793610 1981-07-01 04:00:00 1981-07-01 04:00:00
1230768022 2009-01-01 02:59:59 2009-01-01 02:59:59
1230768024 2009-01-01 03:00:00 2009-01-01 03:00:00
drop table t1;
create table t1 (ts timestamp);
insert into t1 values (19730101235900), (20040101235900);
@ -39,3 +44,6 @@ ts
1973-01-01 23:59:00
2004-01-01 23:59:00
drop table t1;
SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
FROM_UNIXTIME(1230768022) FROM_UNIXTIME(1230768023) FROM_UNIXTIME(1230768024)
2009-01-01 02:59:59 2009-01-01 02:59:59 2009-01-01 03:00:00

View file

@ -708,6 +708,21 @@ HEX(b1) HEX(b2) i2
1 0 100
1 0 200
DROP TABLE t1, t2;
CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b'10',
f2 bit(14) NOT NULL default b'11110000111100'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` bit(2) NOT NULL DEFAULT b'10',
`f2` bit(14) NOT NULL DEFAULT b'11110000111100'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
DROP TABLE t1;
CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
ERROR 42000: Invalid default value for 'f1'
End of 5.0 tests
create table t1(a bit(7));
insert into t1 values(0x40);

View file

@ -392,4 +392,17 @@ f1 + 0e0
1.0000000150475e+30
-1.0000000150475e+30
drop table t1;
create table t1(d double, u bigint unsigned);
insert into t1(d) values (9.2233720368547777e+18),
(9.223372036854779e18),
(9.22337203685479e18),
(1.84e19);
update t1 set u = d;
select u from t1;
u
9223372036854775808
9223372036854779904
9223372036854790144
18400000000000000000
drop table t1;
End of 5.0 tests

View file

@ -491,4 +491,15 @@ update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
affected rows: 127
info: Rows matched: 128 Changed: 127 Warnings: 0
drop table t1,t2;
DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INT RETURN f1();
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1);
UPDATE t1 SET i = 3 WHERE f1();
ERROR HY000: Recursive stored functions and triggers are not allowed.
UPDATE t1 SET i = f1();
ERROR HY000: Recursive stored functions and triggers are not allowed.
DROP TABLE t1;
DROP FUNCTION f1;
End of 5.0 tests

View file

@ -1325,19 +1325,6 @@ ERROR HY000: Variable 'skip_show_database' is a read only variable
SET @@global.skip_show_database= true;
ERROR HY000: Variable 'skip_show_database' is a read only variable
#
SHOW VARIABLES like 'socket';
Variable_name Value
socket #
SELECT @@session.socket;
ERROR HY000: Variable 'socket' is a GLOBAL variable
SELECT @@global.socket;
@@global.socket
#
SET @@session.socket= 'x';
ERROR HY000: Variable 'socket' is a read only variable
SET @@global.socket= 'x';
ERROR HY000: Variable 'socket' is a read only variable
#
SHOW VARIABLES like 'thread_stack';
Variable_name Value
thread_stack #

View file

@ -625,7 +625,7 @@ drop table t1;
create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a;
select b from v1 use index (some_index) where b=1;
ERROR HY000: Incorrect usage of index hints and VIEW
ERROR 42000: Key 'some_index' doesn't exist in table 'v1'
drop view v1;
drop table t1;
create table t1 (col1 char(5),col2 char(5));
@ -3562,11 +3562,11 @@ CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM v1 USE KEY(non_existant);
ERROR HY000: Incorrect usage of index hints and VIEW
ERROR 42000: Key 'non_existant' doesn't exist in table 'v1'
SELECT * FROM v1 FORCE KEY(non_existant);
ERROR HY000: Incorrect usage of index hints and VIEW
ERROR 42000: Key 'non_existant' doesn't exist in table 'v1'
SELECT * FROM v1 IGNORE KEY(non_existant);
ERROR HY000: Incorrect usage of index hints and VIEW
ERROR 42000: Key 'non_existant' doesn't exist in table 'v1'
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
@ -3674,6 +3674,31 @@ DROP VIEW v1;
CREATE VIEW v1 AS SELECT 1;
DROP VIEW v1;
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
c1 c2
2 2
SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
c1 c2
2 2
CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
SHOW INDEX FROM v1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1'
SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1'
SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
ERROR 42000: Key 'PRIMARY' doesn't exist in table 'v1'
SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
ERROR 42000: Key 'c2' doesn't exist in table 'v1'
SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
ERROR 42000: Key 'c2' doesn't exist in table 'v1'
SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
ERROR 42000: Key 'c2' doesn't exist in table 'v1'
DROP VIEW v1;
DROP TABLE t1;
# -----------------------------------------------------------------
# -- End of 5.0 tests.
# -----------------------------------------------------------------

Binary file not shown.

View file

@ -0,0 +1,31 @@
CREATE TABLE t1 (i int unique) ENGINE=innodb;
reset master;
begin;
insert into t1 values (1),(2);
*** the following UPDATE query wont generate any updates for the binlog ***
update t1 set i = 3 where i < 3;
ERROR 23000: Duplicate entry '3' for key 'i'
commit;
*** Results of the test: the binlog must have only Write_rows events not any Update_rows ***
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
reset master;
begin;
insert into t1 values (1),(2);
*** the following UPDATE query wont generate any updates for the binlog ***
insert into t1 values (3),(4),(1),(2);
ERROR 23000: Duplicate entry '1' for key 'i'
commit;
*** Results of the test: the binlog must have only one Write_rows event not two ***
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
drop table t1;

View file

@ -133,10 +133,6 @@ master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
insert into t1 values(11);
commit;
show binlog events from <binlog_start>;
@ -148,8 +144,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
@ -278,10 +272,6 @@ master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; drop table t1,t2
master-bin.000001 # Query # # use `test`; create table t0 (n int)
master-bin.000001 # Query # # use `test`; BEGIN
@ -382,7 +372,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; ROLLBACK
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
master-bin.000001 # Query # # use `test`; BEGIN
@ -400,7 +390,9 @@ master-bin.000001 # Query # # use `test`; DROP TABLE t2
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; ROLLBACK
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
@ -408,11 +400,7 @@ master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; ROLLBACK
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
master-bin.000001 # Query # # use `test`; COMMIT

View file

@ -0,0 +1,42 @@
#
# Tests of innodb/binlog with the row binlog format
#
source include/have_innodb.inc;
source include/have_log_bin.inc;
source include/have_binlog_format_row.inc;
#
# Bug #40221 Replication failure on RBR + UPDATE the primary key
#
CREATE TABLE t1 (i int unique) ENGINE=innodb;
reset master;
# part 1: update can cause the dup key
begin;
insert into t1 values (1),(2);
--echo *** the following UPDATE query wont generate any updates for the binlog ***
--error ER_DUP_ENTRY
update t1 set i = 3 where i < 3;
commit;
--echo *** Results of the test: the binlog must have only Write_rows events not any Update_rows ***
source include/show_binlog_events.inc;
# part 2: insert can cause the dup key
delete from t1;
reset master;
begin;
insert into t1 values (1),(2);
--echo *** the following UPDATE query wont generate any updates for the binlog ***
--error ER_DUP_ENTRY
insert into t1 values (3),(4),(1),(2);
commit;
--echo *** Results of the test: the binlog must have only one Write_rows event not two ***
source include/show_binlog_events.inc;
drop table t1;

View file

@ -29,44 +29,9 @@ SET @@global.max_allowed_packet=4096;
SET @@global.net_buffer_length=4096;
STOP SLAVE;
START SLAVE;
CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
show slave status;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running No
Slave_SQL_Running #
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
Slave_IO_Running = No (expect No)
==== clean up ====
DROP TABLE t1;
DROP TABLE t1;

View file

@ -4,34 +4,39 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
**** Resetting master and slave ****
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
START SLAVE;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
SHOW BINLOG EVENTS FROM 216;
SHOW BINLOG EVENTS FROM 106;
Log_name #
Pos 216
Pos 106
Event_type Query
Server_id #
End_log_pos 309
End_log_pos 199
Info use `test`; CREATE TABLE t1 (a INT, b INT)
Log_name #
Pos 309
Pos 199
Event_type Query
Server_id #
End_log_pos 415
End_log_pos 305
Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
Log_name #
Pos 415
Pos 305
Event_type Query
Server_id #
End_log_pos 521
End_log_pos 411
Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
Log_name #
Pos 521
Pos 411
Event_type Query
Server_id #
End_log_pos 640
End_log_pos 530
Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
**** On Master ****
SHOW CREATE TABLE t1;
@ -125,9 +130,14 @@ NULL 3 6
NULL 4 2
NULL 5 10
NULL 6 12
**** Resetting master and slave ****
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
START SLAVE;
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
ERROR 23000: Duplicate entry '2' for key 'b'
SHOW BINLOG EVENTS FROM 1374;
SHOW BINLOG EVENTS FROM 106;
Log_name Pos Event_type Server_id End_log_pos Info
CREATE TABLE t7 (a INT, b INT UNIQUE);
INSERT INTO t7 SELECT a,b FROM tt3;
@ -137,18 +147,23 @@ a b
1 2
2 4
3 6
SHOW BINLOG EVENTS FROM 1374;
SHOW BINLOG EVENTS FROM 106;
Log_name Pos Event_type Server_id End_log_pos Info
# 1374 Query # 1474 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
# 1474 Query # 1542 use `test`; BEGIN
# 1542 Table_map # 1584 table_id: # (test.t7)
# 1584 Write_rows # 1640 table_id: # flags: STMT_END_F
# 1640 Query # 1711 use `test`; ROLLBACK
# 106 Query # 206 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
# 206 Query # 274 use `test`; BEGIN
# 274 Table_map # 316 table_id: # (test.t7)
# 316 Write_rows # 372 table_id: # flags: STMT_END_F
# 372 Query # 443 use `test`; ROLLBACK
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
2 4
3 6
**** Resetting master and slave ****
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
START SLAVE;
CREATE TEMPORARY TABLE tt4 (a INT, b INT);
INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
BEGIN;
@ -156,12 +171,12 @@ INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SHOW BINLOG EVENTS FROM 1711;
SHOW BINLOG EVENTS FROM 106;
Log_name Pos Event_type Server_id End_log_pos Info
# 1711 Query # 1779 use `test`; BEGIN
# 1779 Table_map # 1821 table_id: # (test.t7)
# 1821 Write_rows # 1877 table_id: # flags: STMT_END_F
# 1877 Query # 1946 use `test`; COMMIT
# 106 Query # 174 use `test`; BEGIN
# 174 Table_map # 216 table_id: # (test.t7)
# 216 Write_rows # 272 table_id: # flags: STMT_END_F
# 272 Query # 343 use `test`; ROLLBACK
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@ -178,6 +193,11 @@ a b
4 8
5 10
6 12
**** Resetting master and slave ****
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
START SLAVE;
CREATE TABLE t8 LIKE t4;
CREATE TABLE t9 LIKE tt4;
CREATE TEMPORARY TABLE tt5 LIKE t4;
@ -196,10 +216,10 @@ Create Table CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW BINLOG EVENTS FROM 1946;
SHOW BINLOG EVENTS FROM 106;
Log_name Pos Event_type Server_id End_log_pos Info
# 1946 Query # 2032 use `test`; CREATE TABLE t8 LIKE t4
# 2032 Query # 2171 use `test`; CREATE TABLE `t9` (
# 106 Query # 192 use `test`; CREATE TABLE t8 LIKE t4
# 192 Query # 331 use `test`; CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
)
@ -276,9 +296,8 @@ a
1
2
3
SHOW BINLOG EVENTS;
SHOW BINLOG EVENTS FROM 106;
Log_name Pos Event_type Server_id End_log_pos Info
# 4 Format_desc # 106 Server ver: #, Binlog ver: #
# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT)
# 192 Query # 260 use `test`; BEGIN
# 260 Table_map # 301 table_id: # (test.t1)
@ -308,7 +327,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
# 1329 Query # 1397 use `test`; BEGIN
# 1397 Table_map # 1438 table_id: # (test.t1)
# 1438 Write_rows # 1482 table_id: # flags: STMT_END_F
# 1482 Query # 1551 use `test`; COMMIT
# 1482 Query # 1553 use `test`; ROLLBACK
SHOW TABLES;
Tables_in_test
t1
@ -371,9 +390,8 @@ a
4
6
9
SHOW BINLOG EVENTS;
SHOW BINLOG EVENTS FROM 106;
Log_name Pos Event_type Server_id End_log_pos Info
# 4 Format_desc # 106 Server ver: #, Binlog ver: #
# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT)
# 192 Query # 260 use `test`; BEGIN
# 260 Table_map # 301 table_id: # (test.t1)
@ -394,6 +412,11 @@ a
6
9
TRUNCATE TABLE t2;
**** Resetting master and slave ****
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
START SLAVE;
BEGIN;
INSERT INTO t2 SELECT a*a FROM t1;
CREATE TEMPORARY TABLE tt2
@ -406,14 +429,14 @@ Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT * FROM t2 ORDER BY a;
a
SHOW BINLOG EVENTS FROM 949;
SHOW BINLOG EVENTS FROM 106;
Log_name Pos Event_type Server_id End_log_pos Info
# 949 Query # 1017 use `test`; BEGIN
# 1017 Table_map # 1058 table_id: # (test.t2)
# 1058 Write_rows # 1102 table_id: # flags: STMT_END_F
# 1102 Table_map # 1143 table_id: # (test.t2)
# 1143 Write_rows # 1182 table_id: # flags: STMT_END_F
# 1182 Query # 1253 use `test`; ROLLBACK
# 106 Query # 174 use `test`; BEGIN
# 174 Table_map # 215 table_id: # (test.t2)
# 215 Write_rows # 259 table_id: # flags: STMT_END_F
# 259 Table_map # 300 table_id: # (test.t2)
# 300 Write_rows # 339 table_id: # flags: STMT_END_F
# 339 Query # 410 use `test`; ROLLBACK
SELECT * FROM t2 ORDER BY a;
a
DROP TABLE t1,t2;

View file

@ -174,6 +174,7 @@ DROP TRIGGER tr2;
INSERT INTO t1 VALUES (3,'master/slave');
INSERT INTO t2 VALUES (3,'master/slave');
INSERT INTO t3 VALUES (3,'master/slave');
COMMIT;
SELECT * FROM t1 ORDER BY a;
a b
2 master only

View file

@ -975,3 +975,22 @@ a b
2 b
3 c
drop table t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 ( f int ) engine = innodb;
create table log ( r int ) engine = myisam;
create trigger tr
after insert on t1
for each row insert into log values ( new.f );
set autocommit = 0;
insert into t1 values ( 1 );
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
Comparing tables master:test.t1 and slave:test.t1
Comparing tables master:test.log and slave:test.log
drop table t1, log;

View file

@ -75,16 +75,25 @@ disconnect master;
connect (master, localhost, root);
connection master;
CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
sync_slave_with_master;
connection master;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
# The slave I/O thread must stop after trying to read the above event
connection slave;
--source include/wait_for_slave_io_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_MYPORT
# import is only the 11th column Slave_IO_Running
--replace_column 1 # 7 # 8 # 9 # 12 # 22 # 23 # 33 #
query_vertical show slave status;
--source include/wait_for_slave_io_to_stop.inc
let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1);
--echo Slave_IO_Running = $slave_io_running (expect No)
--echo ==== clean up ====
connection master;
DROP TABLE t1;
# slave is stopped
connection slave;
DROP TABLE t1;
# End of tests

View file

@ -29,6 +29,8 @@ SET GLOBAL storage_engine=memory;
START SLAVE;
--enable_query_log
--source include/reset_master_and_slave.inc
connection master;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
@ -36,7 +38,7 @@ CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
--query_vertical SHOW BINLOG EVENTS FROM 216
--query_vertical SHOW BINLOG EVENTS FROM 106
--echo **** On Master ****
--query_vertical SHOW CREATE TABLE t1
--query_vertical SHOW CREATE TABLE t2
@ -65,6 +67,8 @@ SELECT * FROM t5 ORDER BY a,b,c;
--query_vertical SHOW CREATE TABLE t6
SELECT * FROM t6 ORDER BY a,b,c;
--source include/reset_master_and_slave.inc
connection master;
# Test for erroneous constructions
--error ER_DUP_ENTRY
@ -72,7 +76,7 @@ CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
# Shouldn't be written to the binary log
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS FROM 1374;
SHOW BINLOG EVENTS FROM 106;
# Test that INSERT-SELECT works the same way as for SBR.
CREATE TABLE t7 (a INT, b INT UNIQUE);
@ -82,10 +86,12 @@ SELECT * FROM t7 ORDER BY a,b;
# Should be written to the binary log
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS FROM 1374;
SHOW BINLOG EVENTS FROM 106;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
--source include/reset_master_and_slave.inc
connection master;
CREATE TEMPORARY TABLE tt4 (a INT, b INT);
INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
@ -94,11 +100,13 @@ INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS FROM 1711;
SHOW BINLOG EVENTS FROM 106;
SELECT * FROM t7 ORDER BY a,b;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
--source include/reset_master_and_slave.inc
connection master;
CREATE TABLE t8 LIKE t4;
CREATE TABLE t9 LIKE tt4;
@ -110,7 +118,7 @@ CREATE TEMPORARY TABLE tt7 SELECT 1;
--query_vertical SHOW CREATE TABLE t9
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS FROM 1946;
SHOW BINLOG EVENTS FROM 106;
sync_slave_with_master;
--echo **** On Slave ****
--query_vertical SHOW CREATE TABLE t8
@ -162,7 +170,7 @@ SELECT * FROM t3 ORDER BY a;
SELECT * FROM t4 ORDER BY a;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS;
SHOW BINLOG EVENTS FROM 106;
sync_slave_with_master;
SHOW TABLES;
SELECT TABLE_NAME,ENGINE
@ -208,13 +216,17 @@ COMMIT;
SELECT * FROM t2 ORDER BY a;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS;
SHOW BINLOG EVENTS FROM 106;
sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;
connection master;
TRUNCATE TABLE t2;
sync_slave_with_master;
--source include/reset_master_and_slave.inc
connection master;
BEGIN;
INSERT INTO t2 SELECT a*a FROM t1;
CREATE TEMPORARY TABLE tt2
@ -227,7 +239,7 @@ ROLLBACK;
SELECT * FROM t2 ORDER BY a;
--replace_column 1 # 4 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
SHOW BINLOG EVENTS FROM 949;
SHOW BINLOG EVENTS FROM 106;
sync_slave_with_master;
SELECT * FROM t2 ORDER BY a;

View file

@ -121,6 +121,7 @@ DROP TRIGGER tr2;
INSERT INTO t1 VALUES (3,'master/slave');
INSERT INTO t2 VALUES (3,'master/slave');
INSERT INTO t3 VALUES (3,'master/slave');
COMMIT;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;

View file

@ -467,20 +467,48 @@ drop trigger if exists t1_bi;
insert into t1 values (3, "c");
select * from t1;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
sync_slave_with_master;
#
# Bug#40116: Uncommited changes are replicated and stay on slave after
# rollback on master
#
connection master;
source include/master-slave-reset.inc;
source include/have_innodb.inc;
connection slave;
source include/have_innodb.inc;
connection master;
create table t1 ( f int ) engine = innodb;
create table log ( r int ) engine = myisam;
create trigger tr
after insert on t1
for each row insert into log values ( new.f );
set autocommit = 0;
insert into t1 values ( 1 );
rollback;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
--source include/diff_tables.inc
let $diff_table_1=master:test.log;
let $diff_table_2=slave:test.log;
--source include/diff_tables.inc
connection master;
drop table t1, log;
sync_slave_with_master;
#
# End of tests
#
save_master_pos;
connection slave;
sync_with_master;

View file

@ -0,0 +1,2 @@
--character-sets-dir=$MYSQL_TEST_DIR/ß
--character-set-filesystem=latin1

View file

@ -0,0 +1,6 @@
SET CHARACTER SET utf8;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
SHOW VARIABLES like 'character_sets_dir';
SHOW VARIABLES like 'character_set_filesystem';
SHOW VARIABLES like 'character_set_client';
SET CHARACTER SET default;

View file

@ -12,4 +12,5 @@
federated_transactions : Bug#29523 Transactions do not work
log_tables : Bug #37798: main.log_tables fails randomly on powermacg5 and windows
slow_query_log_func : Bug #37962: *_func tests containing sleeps/race conditions
wait_timeout_func : Bug #41225 joro wait_timeout_func fails
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enoiugh for pushbuild.

View file

@ -445,3 +445,12 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
DROP TABLE t1;
#
# BUG#37245 - Full text search problem
#
CREATE TABLE t1(a CHAR(10));
INSERT INTO t1 VALUES('aaa15');
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
DROP TABLE t1;

View file

@ -135,3 +135,20 @@ select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
--enable_ps_protocol
# End of 4.1 tests
#
# Bug#37553: MySql Error Compare TimeDiff & Time
#
# calculations involving negative time values ignored sign
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
# show that conversion to DECIMAL no longer drops sign
SELECT CAST(time('-73:42:12') AS DECIMAL);
# End of 5.0 tests

View file

@ -1263,4 +1263,14 @@ CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1;
SELECT HEX(c1) from v1;
DROP VIEW v1;
#
# Bug #35558 Wrong server metadata blows up the client
#
create table t1(a float);
insert into t1 values (1.33);
--enable_metadata
select format(a, 2) from t1;
--disable_metadata
drop table t1;
--echo End of 5.0 tests

View file

@ -53,3 +53,42 @@ CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
CREATE INDEX i1 on t1 (a(3));
SELECT * FROM t1 WHERE a = 'abcde';
DROP TABLE t1;
#
# Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of
# requested column
#
CREATE TABLE foo (a int, b int, c char(10),
PRIMARY KEY (c(3)),
KEY b (b)
) engine=innodb;
CREATE TABLE foo2 (a int, b int, c char(10),
PRIMARY KEY (c),
KEY b (b)
) engine=innodb;
CREATE TABLE bar (a int, b int, c char(10),
PRIMARY KEY (c(3)),
KEY b (b)
) engine=myisam;
INSERT INTO foo VALUES
(1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'),
(4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe');
INSERT INTO bar SELECT * FROM foo;
INSERT INTO foo2 SELECT * FROM foo;
--query_vertical EXPLAIN SELECT c FROM bar WHERE b>2;
--query_vertical EXPLAIN SELECT c FROM foo WHERE b>2;
--query_vertical EXPLAIN SELECT c FROM foo2 WHERE b>2;
--query_vertical EXPLAIN SELECT c FROM bar WHERE c>2;
--query_vertical EXPLAIN SELECT c FROM foo WHERE c>2;
--query_vertical EXPLAIN SELECT c FROM foo2 WHERE c>2;
DROP TABLE foo, bar, foo2;
--echo End of 5.1 tests

View file

@ -105,6 +105,7 @@ SELECT count(*) from t1;
DROP PROCEDURE sp_addRec;
DROP TABLE t1;
SET @@global.myisam_data_pointer_size = default;
################################################################
# End of functionality Testing for myisam_data_pointer_size #
################################################################

View file

@ -31,3 +31,28 @@ FLUSH TABLES;
--exec $MYISAMCHK -s --unpack $MYSQLTEST_VARDIR/master-data/test/t1
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
# Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table.
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1(f1 int, f2 varchar(255));
insert into t1 values(1, 'foo'), (2, 'bar');
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
flush tables;
--exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1
optimize table t1;
drop table t1;

View file

@ -6,6 +6,9 @@ eval select LENGTH("$MY_PERROR") > 0 as "have_perror";
enable_query_log;
--exec $MY_PERROR 150
--exec $MY_PERROR 23
--exec $MY_PERROR 15000
--exec $MY_PERROR 150 2>&1
--exec $MY_PERROR 23 2>&1
--exec $MY_PERROR 1062 2>&1
--error 1
--exec $MY_PERROR 30000 2>&1

View file

@ -45,6 +45,10 @@ insert into t1 values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
insert into t1 values
(unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
(unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
select i, from_unixtime(i), c from t1;
drop table t1;
@ -58,4 +62,12 @@ insert into t1 values (19730101235900), (20040101235900);
select * from t1;
drop table t1;
#
# Test Bug #39920: MySQL cannot deal with Leap Second expression in string
# literal
#
# 2009-01-01 02:59:59, 2009-01-01 02:59:60 and 2009-01-01 03:00:00
SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
# End of 4.1 tests

View file

@ -352,6 +352,21 @@ SELECT HEX(b1), HEX(b2), i2 FROM t2
DROP TABLE t1, t2;
#
# Bug #35796 SHOW CREATE TABLE and default value for BIT field
#
CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b'10',
f2 bit(14) NOT NULL default b'11110000111100'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--error ER_INVALID_DEFAULT
CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
--echo End of 5.0 tests
#

View file

@ -252,4 +252,21 @@ insert into t1 values (2e30), (-2e30);
select f1 + 0e0 from t1;
drop table t1;
#
# Bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on
# windows.
#
create table t1(d double, u bigint unsigned);
insert into t1(d) values (9.2233720368547777e+18),
(9.223372036854779e18),
(9.22337203685479e18),
(1.84e19);
update t1 set u = d;
select u from t1;
drop table t1;
--echo End of 5.0 tests

View file

@ -430,4 +430,25 @@ drop table t1,t2;
connection default;
disconnect con1;
#
# Bug #40745: Error during WHERE clause calculation in UPDATE
# leads to an assertion failure
#
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS f1;
--enable_warnings
CREATE FUNCTION f1() RETURNS INT RETURN f1();
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1);
--error ER_SP_NO_RECURSION
UPDATE t1 SET i = 3 WHERE f1();
--error ER_SP_NO_RECURSION
UPDATE t1 SET i = f1();
DROP TABLE t1;
DROP FUNCTION f1;
--echo End of 5.0 tests

View file

@ -1067,18 +1067,6 @@ SET @@global.skip_show_database= true;
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'socket';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.socket;
--replace_column 1 #
SELECT @@global.socket;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.socket= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.socket= 'x';
#
--echo #
--replace_column 2 #
SHOW VARIABLES like 'thread_stack';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.thread_stack;

View file

@ -510,7 +510,7 @@ drop table t1;
#
create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a;
--error ER_WRONG_USAGE
--error ER_KEY_DOES_NOT_EXITS
select b from v1 use index (some_index) where b=1;
drop view v1;
drop table t1;
@ -3421,11 +3421,11 @@ drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
--error ER_WRONG_USAGE
--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 USE KEY(non_existant);
--error ER_WRONG_USAGE
--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 FORCE KEY(non_existant);
--error ER_WRONG_USAGE
--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 IGNORE KEY(non_existant);
DROP VIEW v1;
@ -3564,6 +3564,32 @@ DROP VIEW v1;
CREATE VIEW v1 AS SELECT 1;
DROP VIEW v1;
#
# Bug #33461: SELECT ... FROM <view> USE INDEX (...) throws an error
#
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
SHOW INDEX FROM v1;
--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
DROP VIEW v1;
DROP TABLE t1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.0 tests.

View file

@ -368,17 +368,7 @@ void my_thread_end(void)
struct st_my_thread_var *_my_thread_var(void)
{
struct st_my_thread_var *tmp=
my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
#if defined(USE_TLS)
/* This can only happen in a .DLL */
if (!tmp)
{
my_thread_init();
tmp=my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
}
#endif
return tmp;
return my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
}

View file

@ -3835,7 +3835,7 @@ int Field_longlong::store(double nr)
error= 1;
}
else
res=(longlong) (ulonglong) nr;
res=(longlong) double2ulonglong(nr);
}
else
{

View file

@ -5114,6 +5114,9 @@ int Item_hex_string::save_in_field(Field *field, bool no_conversions)
ulonglong nr;
uint32 length= str_value.length();
if (!length)
return 1;
if (length > 8)
{
nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX;

View file

@ -810,11 +810,11 @@ Arg_comparator::can_compare_as_dates(Item *a, Item *b, ulonglong *const_value)
obtained value
*/
ulonglong
longlong
get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
Item *warn_item, bool *is_null)
{
ulonglong value;
longlong value;
Item *item= **item_arg;
MYSQL_TIME ltime;
@ -826,7 +826,7 @@ get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
else
{
*is_null= item->get_time(&ltime);
value= !*is_null ? TIME_to_ulonglong_datetime(&ltime) : 0;
value= !*is_null ? (longlong) TIME_to_ulonglong_datetime(&ltime) : 0;
}
/*
Do not cache GET_USER_VAR() function as its const_item() may return TRUE
@ -951,11 +951,11 @@ void Arg_comparator::set_datetime_cmp_func(Item **a1, Item **b1)
obtained value
*/
ulonglong
longlong
get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
Item *warn_item, bool *is_null)
{
ulonglong value= 0;
longlong value= 0;
String buf, *str= 0;
Item *item= **item_arg;
@ -993,7 +993,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
enum_field_types f_type= warn_item->field_type();
timestamp_type t_type= f_type ==
MYSQL_TYPE_DATE ? MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME;
value= get_date_from_str(thd, str, t_type, warn_item->name, &error);
value= (longlong) get_date_from_str(thd, str, t_type, warn_item->name, &error);
/*
If str did not contain a valid date according to the current
SQL_MODE, get_date_from_str() has already thrown a warning,
@ -1047,7 +1047,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
int Arg_comparator::compare_datetime()
{
bool a_is_null, b_is_null;
ulonglong a_value, b_value;
longlong a_value, b_value;
/* Get DATE/DATETIME/TIME value of the 'a' item. */
a_value= (*get_value_func)(thd, &a, &a_cache, *b, &a_is_null);

View file

@ -42,8 +42,8 @@ class Arg_comparator: public Sql_alloc
bool is_nulls_eq; // TRUE <=> compare for the EQUAL_FUNC
enum enum_date_cmp_type { CMP_DATE_DFLT= 0, CMP_DATE_WITH_DATE,
CMP_DATE_WITH_STR, CMP_STR_WITH_DATE };
ulonglong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
Item *warn_item, bool *is_null);
longlong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
Item *warn_item, bool *is_null);
public:
DTCollation cmp_collation;
@ -1012,7 +1012,7 @@ public:
*/
class cmp_item_datetime :public cmp_item
{
ulonglong value;
longlong value;
public:
THD *thd;
/* Item used for issuing warnings. */

View file

@ -2259,7 +2259,7 @@ void Item_func_min_max::fix_length_and_dec()
uint Item_func_min_max::cmp_datetimes(ulonglong *value)
{
ulonglong min_max;
longlong min_max;
uint min_max_idx= 0;
LINT_INIT(min_max);
@ -2267,7 +2267,7 @@ uint Item_func_min_max::cmp_datetimes(ulonglong *value)
{
Item **arg= args + i;
bool is_null;
ulonglong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null);
longlong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null);
if ((null_value= args[i]->null_value))
return 0;
if (i == 0 || (res < min_max ? cmp_sign : -cmp_sign) > 0)

View file

@ -2033,10 +2033,11 @@ Item_func_format::Item_func_format(Item *org, Item *dec)
void Item_func_format::fix_length_and_dec()
{
collation.set(default_charset());
uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen;
max_length= ((char_length + (char_length-args[0]->decimals)/3) *
collation.collation->mbmaxlen);
uint max_sep_count= char_length/3 + (decimals ? 1 : 0) + /*sign*/1;
collation.set(default_charset());
max_length= (char_length + max_sep_count + decimals) *
collation.collation->mbmaxlen;
}

View file

@ -429,6 +429,7 @@ public:
{
return save_time_in_field(field);
}
bool result_as_longlong() { return TRUE; }
};

View file

@ -207,6 +207,7 @@ public:
truncate(0);
before_stmt_pos= MY_OFF_T_UNDEF;
trans_log.end_of_file= max_binlog_cache_size;
DBUG_ASSERT(empty());
}
Rows_log_event *pending() const
@ -1377,8 +1378,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data,
FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT),
FLAGSTR(thd->options, OPTION_BEGIN)));
thd->binlog_flush_pending_rows_event(TRUE);
/*
NULL denotes ROLLBACK with nothing to replicate: i.e., rollback of
only transactional tables. If the transaction contain changes to
@ -1387,6 +1386,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data,
*/
if (end_ev != NULL)
{
thd->binlog_flush_pending_rows_event(TRUE);
/*
Doing a commit or a rollback including non-transactional tables,
i.e., ending a transaction where we might write the transaction
@ -1435,6 +1435,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data,
mysql_bin_log.update_table_map_version();
}
DBUG_ASSERT(thd->binlog_get_pending_rows_event() == NULL);
DBUG_RETURN(error);
}
@ -1466,6 +1467,7 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all)
*/
static int binlog_commit(handlerton *hton, THD *thd, bool all)
{
int error= 0;
DBUG_ENTER("binlog_commit");
binlog_trx_data *const trx_data=
(binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
@ -1478,60 +1480,11 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
}
/*
Decision table for committing a transaction. The top part, the
*conditions* represent different cases that can occur, and hte
bottom part, the *actions*, represent what should be done in that
particular case.
We commit the transaction if:
Real transaction 'all' was true
- We are not in a transaction and committing a statement, or
Statement in cache There were at least one statement in the
transaction cache
In transaction We are inside a transaction
Stmt modified non-trans The statement being committed modified a
non-transactional table
All modified non-trans Some statement before this one in the
transaction modified a non-transactional
table
============================= = = = = = = = = = = = = = = = =
Real transaction N N N N N N N N N N N N N N N N
Statement in cache N N N N N N N N Y Y Y Y Y Y Y Y
In transaction N N N N Y Y Y Y N N N N Y Y Y Y
Stmt modified non-trans N N Y Y N N Y Y N N Y Y N N Y Y
All modified non-trans N Y N Y N Y N Y N Y N Y N Y N Y
Action: (C)ommit/(A)ccumulate C C - C A C - C - - - - A A - A
============================= = = = = = = = = = = = = = = = =
============================= = = = = = = = = = = = = = = = =
Real transaction Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Statement in cache N N N N N N N N Y Y Y Y Y Y Y Y
In transaction N N N N Y Y Y Y N N N N Y Y Y Y
Stmt modified non-trans N N Y Y N N Y Y N N Y Y N N Y Y
All modified non-trans N Y N Y N Y N Y N Y N Y N Y N Y
(C)ommit/(A)ccumulate/(-) - - - - C C - C - - - - C C - C
============================= = = = = = = = = = = = = = = = =
In other words, we commit the transaction if and only if both of
the following are true:
- We are not in a transaction and committing a statement
- We are in a transaction and one (or more) of the following are
true:
- A full transaction is committed
OR
- A non-transactional statement is committed and there is
no statement cached
- We are in a transaction and a full transaction is committed
Otherwise, we accumulate the statement
*/
@ -1544,18 +1497,18 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
YESNO(in_transaction),
YESNO(thd->transaction.all.modified_non_trans_table),
YESNO(thd->transaction.stmt.modified_non_trans_table)));
if (in_transaction &&
(all ||
(!trx_data->at_least_one_stmt &&
thd->transaction.stmt.modified_non_trans_table)) ||
!in_transaction && !all)
if (!in_transaction || all)
{
Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE);
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
int error= binlog_end_trans(thd, trx_data, &qev, all);
DBUG_RETURN(error);
error= binlog_end_trans(thd, trx_data, &qev, all);
goto end;
}
DBUG_RETURN(0);
end:
if (!all)
trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt commit
DBUG_RETURN(error);
}
/**
@ -1615,6 +1568,8 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
*/
error= binlog_end_trans(thd, trx_data, 0, all);
}
if (!all)
trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt rollback
DBUG_RETURN(error);
}

View file

@ -214,7 +214,7 @@ my_decimal *date2my_decimal(MYSQL_TIME *ltime, my_decimal *dec)
date = (ltime->year*100L + ltime->month)*100L + ltime->day;
if (ltime->time_type > MYSQL_TIMESTAMP_DATE)
date= ((date*100L + ltime->hour)*100L+ ltime->minute)*100L + ltime->second;
if (int2my_decimal(E_DEC_FATAL_ERROR, date, FALSE, dec))
if (int2my_decimal(E_DEC_FATAL_ERROR, ltime->neg ? -date : date, FALSE, dec))
return dec;
if (ltime->second_part)
{

View file

@ -1768,10 +1768,9 @@ int mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list,
int write_record(THD *thd, TABLE *table, COPY_INFO *info);
/* sql_manager.cc */
extern ulong volatile manager_status;
extern bool volatile manager_thread_in_use, mqh_used;
extern pthread_t manager_thread;
pthread_handler_t handle_manager(void *arg);
extern bool volatile mqh_used;
void start_handle_manager();
void stop_handle_manager();
bool mysql_manager_submit(void (*action)());
@ -2175,8 +2174,8 @@ void make_date(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
void make_time(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
String *str);
int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b);
ulonglong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
Item *warn_item, bool *is_null);
longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
Item *warn_item, bool *is_null);
int test_if_number(char *str,int *res,bool allow_wildcards);
void change_byte(uchar *,uint,char,char);

View file

@ -227,6 +227,12 @@ extern "C" int gethostname(char *name, int namelen);
extern "C" sig_handler handle_segfault(int sig);
#if defined(__linux__)
#define ENABLE_TEMP_POOL 1
#else
#define ENABLE_TEMP_TOOL 0
#endif
/* Constants */
const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"};
@ -784,16 +790,6 @@ static void close_connections(void)
kill_cached_threads++;
flush_thread_cache();
/* kill flush thread */
(void) pthread_mutex_lock(&LOCK_manager);
if (manager_thread_in_use)
{
DBUG_PRINT("quit", ("killing manager thread: 0x%lx",
(ulong)manager_thread));
(void) pthread_cond_signal(&COND_manager);
}
(void) pthread_mutex_unlock(&LOCK_manager);
/* kill connection thread */
#if !defined(__WIN__) && !defined(__NETWARE__)
DBUG_PRINT("quit", ("waiting for select thread: 0x%lx",
@ -1196,6 +1192,7 @@ void clean_up(bool print_message)
if (cleanup_done++)
return; /* purecov: inspected */
stop_handle_manager();
release_ddl_log();
/*
@ -3377,12 +3374,14 @@ static int init_common_variables(const char *conf_file_name, int argc,
sys_init_connect.value_length= strlen(opt_init_connect);
else
sys_init_connect.value=my_strdup("",MYF(0));
sys_init_connect.is_os_charset= TRUE;
sys_init_slave.value_length= 0;
if ((sys_init_slave.value= opt_init_slave))
sys_init_slave.value_length= strlen(opt_init_slave);
else
sys_init_slave.value=my_strdup("",MYF(0));
sys_init_slave.is_os_charset= TRUE;
/* check log options and issue warnings if needed */
if (opt_log && opt_logname && !(log_output_options & LOG_FILE) &&
@ -3405,8 +3404,13 @@ static int init_common_variables(const char *conf_file_name, int argc,
sys_var_slow_log_path.value= my_strdup(s, MYF(0));
sys_var_slow_log_path.value_length= strlen(s);
#if (ENABLE_TEMP_POOL)
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
return 1;
#else
use_temp_pool= 0;
#endif
if (my_database_names_init())
return 1;
@ -4036,17 +4040,6 @@ server.");
#ifndef EMBEDDED_LIBRARY
static void create_maintenance_thread()
{
if (flush_time && flush_time != ~(ulong) 0L)
{
pthread_t hThread;
if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
sql_print_warning("Can't create thread to manage maintenance");
}
}
static void create_shutdown_thread()
{
#ifdef __WIN__
@ -4361,7 +4354,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
execute_ddl_log_recovery();
create_shutdown_thread();
create_maintenance_thread();
start_handle_manager();
if (Events::init(opt_noacl))
unireg_abort(1);
@ -6315,9 +6308,14 @@ log and this option does nothing anymore.",
(uchar**) &opt_tc_heuristic_recover, (uchar**) &opt_tc_heuristic_recover,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"temp-pool", OPT_TEMP_POOL,
#if (ENABLE_TEMP_POOL)
"Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.",
#else
"This option is ignored on this OS.",
#endif
(uchar**) &use_temp_pool, (uchar**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"timed_mutexes", OPT_TIMED_MUTEXES,
"Specify whether to time mutexes (only InnoDB mutexes are currently supported)",
(uchar**) &timed_mutexes, (uchar**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0,

View file

@ -176,14 +176,14 @@ static sys_var_bool_ptr sys_automatic_sp_privileges(&vars, "automatic_sp_privile
static sys_var_const sys_back_log(&vars, "back_log",
OPT_GLOBAL, SHOW_LONG,
(uchar*) &back_log);
static sys_var_const_str sys_basedir(&vars, "basedir", mysql_home);
static sys_var_const_os_str sys_basedir(&vars, "basedir", mysql_home);
static sys_var_long_ptr sys_binlog_cache_size(&vars, "binlog_cache_size",
&binlog_cache_size);
static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
&SV::binlog_format);
static sys_var_thd_ulong sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size",
&SV::bulk_insert_buff_size);
static sys_var_const sys_character_sets_dir(&vars,
static sys_var_const_os sys_character_sets_dir(&vars,
"character_sets_dir",
OPT_GLOBAL, SHOW_CHAR,
(uchar*)
@ -233,7 +233,7 @@ static sys_var_long_ptr sys_concurrent_insert(&vars, "concurrent_insert",
&myisam_concurrent_insert);
static sys_var_long_ptr sys_connect_timeout(&vars, "connect_timeout",
&connect_timeout);
static sys_var_const_str sys_datadir(&vars, "datadir", mysql_real_data_home);
static sys_var_const_os_str sys_datadir(&vars, "datadir", mysql_real_data_home);
#ifndef DBUG_OFF
static sys_var_thd_dbug sys_dbug(&vars, "debug");
#endif
@ -466,7 +466,7 @@ static sys_var_thd_ulong sys_optimizer_search_depth(&vars, "optimizer_sea
static sys_var_const sys_pid_file(&vars, "pid_file",
OPT_GLOBAL, SHOW_CHAR,
(uchar*) pidfile_name);
static sys_var_const sys_plugin_dir(&vars, "plugin_dir",
static sys_var_const_os sys_plugin_dir(&vars, "plugin_dir",
OPT_GLOBAL, SHOW_CHAR,
(uchar*) opt_plugin_dir);
static sys_var_const sys_port(&vars, "port",
@ -538,7 +538,7 @@ static sys_var_const sys_thread_concurrency(&vars, "thread_concurrency",
static sys_var_const sys_thread_stack(&vars, "thread_stack",
OPT_GLOBAL, SHOW_LONG,
(uchar*) &my_thread_stack_size);
static sys_var_readonly sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
static sys_var_readonly_os sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
static sys_var_thd_ulong sys_trans_alloc_block_size(&vars, "transaction_alloc_block_size",
&SV::trans_alloc_block_size,
0, fix_trans_mem_root);
@ -589,17 +589,17 @@ static sys_var_thd_sql_mode sys_sql_mode(&vars, "sql_mode",
#ifdef HAVE_OPENSSL
extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
*opt_ssl_key;
static sys_var_const_str_ptr sys_ssl_ca(&vars, "ssl_ca", &opt_ssl_ca);
static sys_var_const_str_ptr sys_ssl_capath(&vars, "ssl_capath", &opt_ssl_capath);
static sys_var_const_str_ptr sys_ssl_cert(&vars, "ssl_cert", &opt_ssl_cert);
static sys_var_const_str_ptr sys_ssl_cipher(&vars, "ssl_cipher", &opt_ssl_cipher);
static sys_var_const_str_ptr sys_ssl_key(&vars, "ssl_key", &opt_ssl_key);
static sys_var_const_os_str_ptr sys_ssl_ca(&vars, "ssl_ca", &opt_ssl_ca);
static sys_var_const_os_str_ptr sys_ssl_capath(&vars, "ssl_capath", &opt_ssl_capath);
static sys_var_const_os_str_ptr sys_ssl_cert(&vars, "ssl_cert", &opt_ssl_cert);
static sys_var_const_os_str_ptr sys_ssl_cipher(&vars, "ssl_cipher", &opt_ssl_cipher);
static sys_var_const_os_str_ptr sys_ssl_key(&vars, "ssl_key", &opt_ssl_key);
#else
static sys_var_const_str sys_ssl_ca(&vars, "ssl_ca", NULL);
static sys_var_const_str sys_ssl_capath(&vars, "ssl_capath", NULL);
static sys_var_const_str sys_ssl_cert(&vars, "ssl_cert", NULL);
static sys_var_const_str sys_ssl_cipher(&vars, "ssl_cipher", NULL);
static sys_var_const_str sys_ssl_key(&vars, "ssl_key", NULL);
static sys_var_const_os_str sys_ssl_ca(&vars, "ssl_ca", NULL);
static sys_var_const_os_str sys_ssl_capath(&vars, "ssl_capath", NULL);
static sys_var_const_os_str sys_ssl_cert(&vars, "ssl_cert", NULL);
static sys_var_const_os_str sys_ssl_cipher(&vars, "ssl_cipher", NULL);
static sys_var_const_os_str sys_ssl_key(&vars, "ssl_key", NULL);
#endif
static sys_var_thd_enum
sys_updatable_views_with_limit(&vars, "updatable_views_with_limit",
@ -936,6 +936,7 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex,
old_value= var_str->value;
var_str->value= res;
var_str->value_length= new_length;
var_str->is_os_charset= FALSE;
rw_unlock(var_mutex);
my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
return 0;
@ -1805,6 +1806,13 @@ err:
}
CHARSET_INFO *sys_var::charset(THD *thd)
{
return is_os_charset ? thd->variables.character_set_filesystem :
system_charset_info;
}
bool sys_var_thd_enum::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)

View file

@ -71,9 +71,18 @@ public:
sys_after_update_func after_update;
bool no_support_one_shot;
/*
true if the value is in character_set_filesystem,
false otherwise.
Note that we can't use a pointer to the charset as the system var is
instantiated in global scope and the charset pointers are initialized
later.
*/
bool is_os_charset;
sys_var(const char *name_arg, sys_after_update_func func= NULL,
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
:name(name_arg), after_update(func), no_support_one_shot(1),
is_os_charset (FALSE),
binlog_status(binlog_status_arg),
m_allow_empty_value(TRUE)
{}
@ -107,6 +116,7 @@ public:
{ return option_limits == 0; }
virtual bool is_struct() { return 0; }
virtual bool is_readonly() const { return 0; }
CHARSET_INFO *charset(THD *thd);
virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
protected:
@ -291,6 +301,18 @@ public:
};
class sys_var_const_os_str: public sys_var_const_str
{
public:
sys_var_const_os_str(sys_var_chain *chain, const char *name_arg,
const char *value_arg)
:sys_var_const_str(chain, name_arg, value_arg)
{
is_os_charset= TRUE;
}
};
class sys_var_const_str_ptr :public sys_var
{
public:
@ -320,6 +342,18 @@ public:
};
class sys_var_const_os_str_ptr :public sys_var_const_str_ptr
{
public:
sys_var_const_os_str_ptr(sys_var_chain *chain, const char *name_arg,
char **value_arg)
:sys_var_const_str_ptr(chain, name_arg, value_arg)
{
is_os_charset= TRUE;
}
};
class sys_var_enum :public sys_var
{
uint *value;
@ -929,6 +963,19 @@ public:
};
class sys_var_readonly_os: public sys_var_readonly
{
public:
sys_var_readonly_os(sys_var_chain *chain, const char *name_arg, enum_var_type type,
SHOW_TYPE show_type_arg,
sys_value_ptr_func value_ptr_func_arg)
:sys_var_readonly(chain, name_arg, type, show_type_arg, value_ptr_func_arg)
{
is_os_charset= TRUE;
}
};
/**
Global-only, read-only variable. E.g. command line option.
*/
@ -957,6 +1004,22 @@ public:
};
class sys_var_const_os: public sys_var_const
{
public:
enum_var_type var_type;
SHOW_TYPE show_type_value;
uchar *ptr;
sys_var_const_os(sys_var_chain *chain, const char *name_arg,
enum_var_type type,
SHOW_TYPE show_type_arg, uchar *ptr_arg)
:sys_var_const(chain, name_arg, type, show_type_arg, ptr_arg)
{
is_os_charset= TRUE;
}
};
class sys_var_have_option: public sys_var
{
protected:

View file

@ -288,7 +288,7 @@ static void print_slave_skip_errors(void)
10 characters must be sufficient for a number plus {',' | '...'}
plus a NUL terminator. That is a max 6 digit number.
*/
const int MIN_ROOM= 10;
const size_t MIN_ROOM= 10;
DBUG_ENTER("print_slave_skip_errors");
DBUG_ASSERT(sizeof(slave_skip_error_names) > MIN_ROOM);
DBUG_ASSERT(MAX_SLAVE_ERROR <= 999999); // 6 digits

View file

@ -23,8 +23,9 @@
#include "mysql_priv.h"
ulong volatile manager_status;
bool volatile manager_thread_in_use;
static bool volatile manager_thread_in_use;
static bool abort_manager;
pthread_t manager_thread;
pthread_mutex_t LOCK_manager;
@ -63,7 +64,6 @@ bool mysql_manager_submit(void (*action)())
pthread_handler_t handle_manager(void *arg __attribute__((unused)))
{
int error = 0;
ulong status;
struct timespec abstime;
bool reset_flush_time = TRUE;
struct handler_cb *cb= NULL;
@ -72,7 +72,6 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
pthread_detach_this_thread();
manager_thread = pthread_self();
manager_status = 0;
manager_thread_in_use = 1;
for (;;)
@ -87,16 +86,14 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
set_timespec(abstime, flush_time);
reset_flush_time = FALSE;
}
while (!manager_status && (!error || error == EINTR) && !abort_loop)
while ((!error || error == EINTR) && !abort_manager)
error= pthread_cond_timedwait(&COND_manager, &LOCK_manager, &abstime);
}
else
{
while (!manager_status && (!error || error == EINTR) && !abort_loop)
while ((!error || error == EINTR) && !abort_manager)
error= pthread_cond_wait(&COND_manager, &LOCK_manager);
}
status = manager_status;
manager_status = 0;
if (cb == NULL)
{
cb= cb_list;
@ -104,7 +101,7 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
}
pthread_mutex_unlock(&LOCK_manager);
if (abort_loop)
if (abort_manager)
break;
if (error == ETIMEDOUT || error == ETIME)
@ -121,11 +118,42 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
my_free((uchar*)cb, MYF(0));
cb= next;
}
if (status)
DBUG_PRINT("error", ("manager did not handle something: %lx", status));
}
manager_thread_in_use = 0;
DBUG_LEAVE; // Can't use DBUG_RETURN after my_thread_end
my_thread_end();
DBUG_RETURN(NULL);
return (NULL);
}
/* Start handle manager thread */
void start_handle_manager()
{
DBUG_ENTER("start_handle_manager");
abort_manager = false;
if (flush_time && flush_time != ~(ulong) 0L)
{
pthread_t hThread;
if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
sql_print_warning("Can't create handle_manager thread");
}
DBUG_VOID_RETURN;
}
/* Initiate shutdown of handle manager thread */
void stop_handle_manager()
{
DBUG_ENTER("stop_handle_manager");
abort_manager = true;
pthread_mutex_lock(&LOCK_manager);
if (manager_thread_in_use)
{
DBUG_PRINT("quit", ("initiate shutdown of handle manager thread: 0x%lx",
(ulong)manager_thread));
pthread_cond_signal(&COND_manager);
}
pthread_mutex_unlock(&LOCK_manager);
DBUG_VOID_RETURN;
}

View file

@ -5304,8 +5304,8 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
DDL_LOG_ENTRY ddl_log_entry;
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
char tmp_path[FN_LEN];
char normal_path[FN_LEN];
char tmp_path[FN_REFLEN];
char normal_path[FN_REFLEN];
List_iterator<partition_element> part_it(part_info->partitions);
uint temp_partitions= part_info->temp_partitions.elements;
uint no_elements= part_info->partitions.elements;
@ -5516,7 +5516,7 @@ static bool write_log_drop_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
DDL_LOG_MEMORY_ENTRY *exec_log_entry= NULL;
char shadow_path[FN_LEN];
char shadow_path[FN_REFLEN];
DBUG_ENTER("write_log_drop_shadow_frm");
build_table_shadow_filename(shadow_path, sizeof(shadow_path), lpt);
@ -5559,8 +5559,8 @@ static bool write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
char path[FN_LEN];
char shadow_path[FN_LEN];
char path[FN_REFLEN];
char shadow_path[FN_REFLEN];
DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
DBUG_ENTER("write_log_rename_frm");
@ -5610,8 +5610,8 @@ static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
char tmp_path[FN_LEN];
char path[FN_LEN];
char tmp_path[FN_REFLEN];
char path[FN_REFLEN];
uint next_entry= 0;
DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
DBUG_ENTER("write_log_drop_partition");
@ -5669,8 +5669,8 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
DDL_LOG_MEMORY_ENTRY *exec_log_entry= NULL;
char tmp_path[FN_LEN];
char path[FN_LEN];
char tmp_path[FN_REFLEN];
char path[FN_REFLEN];
uint next_entry= 0;
DBUG_ENTER("write_log_add_change_partition");
@ -5723,8 +5723,8 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
char path[FN_LEN];
char shadow_path[FN_LEN];
char path[FN_REFLEN];
char shadow_path[FN_REFLEN];
DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
uint next_entry= 0;
DBUG_ENTER("write_log_final_change_partition");

View file

@ -993,7 +993,7 @@ static bool get_field_default_value(THD *thd, TABLE *table,
{
bool has_default;
bool has_now_default;
enum enum_field_types field_type= field->type();
/*
We are using CURRENT_TIMESTAMP instead of NOW because it is
more standard
@ -1001,7 +1001,7 @@ static bool get_field_default_value(THD *thd, TABLE *table,
has_now_default= table->timestamp_field == field &&
field->unireg_check != Field::TIMESTAMP_UN_FIELD;
has_default= (field->type() != FIELD_TYPE_BLOB &&
has_default= (field_type != FIELD_TYPE_BLOB &&
!(field->flags & NO_DEFAULT_VALUE_FLAG) &&
field->unireg_check != Field::NEXT_NUMBER &&
!((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40))
@ -1016,7 +1016,19 @@ static bool get_field_default_value(THD *thd, TABLE *table,
{ // Not null by default
char tmp[MAX_FIELD_WIDTH];
String type(tmp, sizeof(tmp), field->charset());
field->val_str(&type);
if (field_type == MYSQL_TYPE_BIT)
{
longlong dec= field->val_int();
char *ptr= longlong2str(dec, tmp + 2, 2);
uint32 length= (uint32) (ptr - tmp);
tmp[0]= 'b';
tmp[1]= '\'';
tmp[length]= '\'';
type.length(length + 1);
quoted= 0;
}
else
field->val_str(&type);
if (type.length())
{
String def_val;
@ -2087,6 +2099,7 @@ static bool show_status_array(THD *thd, const char *wild,
COND *partial_cond= 0;
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
bool res= FALSE;
CHARSET_INFO *charset= system_charset_info;
DBUG_ENTER("show_status_array");
thd->count_cuted_fields= CHECK_FIELD_WARN;
@ -2135,9 +2148,10 @@ static bool show_status_array(THD *thd, const char *wild,
if (show_type == SHOW_SYS)
{
show_type= ((sys_var*) value)->show_type();
value= (char*) ((sys_var*) value)->value_ptr(thd, value_type,
&null_lex_str);
sys_var *var= ((sys_var *) value);
show_type= var->show_type();
value= (char*) var->value_ptr(thd, value_type, &null_lex_str);
charset= var->charset(thd);
}
pos= end= buff;
@ -2213,7 +2227,7 @@ static bool show_status_array(THD *thd, const char *wild,
DBUG_ASSERT(0);
break;
}
table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
table->field[1]->store(pos, (uint32) (end - pos), charset);
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
table->field[1]->set_notnull();

View file

@ -4319,6 +4319,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
table->table=0; // For query cache
if (protocol->write())
goto err;
thd->main_da.reset_diagnostics_area();
continue;
/* purecov: end */
}

View file

@ -715,6 +715,11 @@ int mysql_update(THD *thd,
else
table->file->unlock_row();
thd->row_count++;
if (thd->is_error())
{
error= 1;
break;
}
}
dup_key_found= 0;
/*

View file

@ -1049,8 +1049,9 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
if (table->index_hints && table->index_hints->elements)
{
my_error(ER_WRONG_USAGE, MYF(0), "index hints", "VIEW");
DBUG_RETURN(TRUE);
my_error(ER_KEY_DOES_NOT_EXITS, MYF(0),
table->index_hints->head()->key_name.str, table->table_name);
DBUG_RETURN(TRUE);
}
/* check loop via view definition */

View file

@ -1416,7 +1416,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
*/
if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX)
{
field->part_of_key= share->keys_in_use;
if (field->key_length() == key_part->length &&
!(field->flags & BLOB_FLAG))
field->part_of_key= share->keys_in_use;
if (field->part_of_sortkey.is_set(key))
field->part_of_sortkey= share->keys_in_use;
}

View file

@ -1072,6 +1072,7 @@ Time_zone_system::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
localtime_r(&tmp_t, &tmp_tm);
localtime_to_TIME(tmp, &tmp_tm);
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
adjust_leap_second(tmp);
}
@ -1156,6 +1157,7 @@ Time_zone_utc::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
gmtime_r(&tmp_t, &tmp_tm);
localtime_to_TIME(tmp, &tmp_tm);
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
adjust_leap_second(tmp);
}
@ -1259,6 +1261,7 @@ void
Time_zone_db::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
{
::gmt_sec_to_TIME(tmp, t, tz_info);
adjust_leap_second(tmp);
}
@ -2279,6 +2282,24 @@ my_tz_find(THD *thd, const String *name)
}
/**
Convert leap seconds into non-leap
This function will convert the leap seconds added by the OS to
non-leap seconds, e.g. 23:59:59, 23:59:60 -> 23:59:59, 00:00:01 ...
This check is not checking for years on purpose : although it's not a
complete check this way it doesn't require looking (and having installed)
the leap seconds table.
@param[in,out] broken down time structure as filled in by the OS
*/
void Time_zone::adjust_leap_second(MYSQL_TIME *t)
{
if (t->second == 60 || t->second == 61)
t->second= 59;
}
#endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */

View file

@ -55,6 +55,9 @@ public:
allocated on MEM_ROOT and should not require destruction.
*/
virtual ~Time_zone() {};
protected:
static inline void adjust_leap_second(MYSQL_TIME *t);
};
extern Time_zone * my_tz_UTC;

View file

@ -161,11 +161,11 @@ static int FTB_WORD_cmp(my_off_t *v, FTB_WORD *a, FTB_WORD *b)
static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b)
{
/* ORDER BY word DESC, ndepth DESC */
int i= ha_compare_text(cs, (uchar*) (*b)->word+1,(*b)->len-1,
(uchar*) (*a)->word+1,(*a)->len-1,0,0);
/* ORDER BY word, ndepth */
int i= ha_compare_text(cs, (uchar*) (*a)->word + 1, (*a)->len - 1,
(uchar*) (*b)->word + 1, (*b)->len - 1, 0, 0);
if (!i)
i=CMP_NUM((*b)->ndepth,(*a)->ndepth);
i= CMP_NUM((*a)->ndepth, (*b)->ndepth);
return i;
}
@ -865,23 +865,49 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
FT_INFO *ftb= ftb_param->ftb;
FTB_WORD *ftbw;
int a, b, c;
/*
Find right-most element in the array of query words matching this
word from a document.
*/
for (a= 0, b= ftb->queue.elements, c= (a+b)/2; b-a>1; c= (a+b)/2)
{
ftbw= ftb->list[c];
if (ha_compare_text(ftb->charset, (uchar*)word, len,
(uchar*)ftbw->word+1, ftbw->len-1,
(my_bool)(ftbw->flags&FTB_FLAG_TRUNC), 0) > 0)
(my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0)
b= c;
else
a= c;
}
/*
If there were no words with truncation operator, we iterate to the
beginning of an array until array element is equal to the word from
a document. This is done mainly because the same word may be
mentioned twice (or more) in the query.
In case query has words with truncation operator we must iterate
to the beginning of the array. There may be non-matching query words
between matching word with truncation operator and the right-most
matching element. E.g., if we're looking for 'aaa15' in an array of
'aaa1* aaa14 aaa15 aaa16'.
Worse of that there still may be match even if the binary search
above didn't find matching element. E.g., if we're looking for
'aaa15' in an array of 'aaa1* aaa14 aaa16'. The binary search will
stop at 'aaa16'.
*/
for (; c >= 0; c--)
{
ftbw= ftb->list[c];
if (ha_compare_text(ftb->charset, (uchar*)word, len,
(uchar*)ftbw->word + 1,ftbw->len - 1,
(my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0))
break;
{
if (ftb->with_scan & FTB_FLAG_TRUNC)
continue;
else
break;
}
if (ftbw->docid[1] == ftb->info->lastpos)
continue;
ftbw->docid[1]= ftb->info->lastpos;

View file

@ -48,6 +48,7 @@ try
case "__NT__":
case "CYBOZU":
case "EMBED_MANIFESTS":
case "EXTRA_DEBUG":
case "WITH_EMBEDDED_SERVER":
configfile.WriteLine("SET (" + args.Item(i) + " TRUE)");
break;