Commit 1944f98a authored by Andrei Elkin's avatar Andrei Elkin

merging 5.1-bt to a local tree.

parents ca25988f e10a3e99
......@@ -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")
......
......@@ -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
......
......@@ -616,6 +616,8 @@ static int run_mysqlcheck_upgrade(void)
"--check-upgrade",
"--all-databases",
"--auto-repair",
"--fix-db-names",
"--fix-table-names",
NULL);
}
......
......@@ -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
......@@ -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)
......
......@@ -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
}
......
......@@ -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
......
......@@ -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
{
......
......@@ -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)
......@@ -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()
......
......@@ -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
......@@ -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
......@@ -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 * from t1;
d u
9.22337203685478e+18 9223372036854775808
9.22337203685478e+18 9223372036854779904
9.22337203685479e+18 9223372036854790144
1.84e+19 18400000000000000000
drop table t1;
End of 5.0 tests
......@@ -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
......@@ -395,16 +385,16 @@ master-bin.000001 # Xid # # COMMIT /* XID */
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 # 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 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`; 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 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
......@@ -412,7 +402,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`; ROLLBACK
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
master-bin.000001 # Query # # use `test`; COMMIT
......
......@@ -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 ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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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;
......@@ -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;
......
......@@ -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
......
......@@ -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;
......@@ -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 ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
# 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
......@@ -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;
......
......@@ -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;
......
......@@ -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;
#
# End of tests
# Bug#40116: Uncommited changes are replicated and stay on slave after
# rollback on master
#
save_master_pos;
connection master;
source include/master-slave-reset.inc;
source include/have_innodb.inc;
connection slave;
sync_with_master;
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
#
......@@ -12,3 +12,4 @@
federated_transactions : Bug#29523 Transactions do not work
log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows
slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions
wait_timeout_func : Bug #41225 joro wait_timeout_func fails
......@@ -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
......@@ -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 * from t1;
drop table t1;
--echo End of 5.0 tests
......@@ -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);
}
......
......@@ -1480,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
*/
......@@ -1546,11 +1497,7 @@ 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)
......
......@@ -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)());
......
......@@ -784,16 +784,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 +1186,7 @@ void clean_up(bool print_message)
if (cleanup_done++)
return; /* purecov: inspected */
stop_handle_manager();
release_ddl_log();
/*
......@@ -4038,17 +4029,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__
......@@ -4363,7 +4343,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);
......
......@@ -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;
}
......@@ -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");
......
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment