merge with 10.0-monty

This commit is contained in:
Sergei Golubchik 2014-02-06 16:38:40 +01:00
commit 1b3c15f199
153 changed files with 3149 additions and 848 deletions

View File

@ -352,6 +352,7 @@ MYSQL_CHECK_SSL()
# Add readline or libedit.
MYSQL_CHECK_READLINE()
SET(MALLOC_LIBRARY "system")
CHECK_JEMALLOC()
#

View File

@ -53,6 +53,7 @@ MACRO (CHECK_JEMALLOC)
CHECK_LIBRARY_EXISTS(jemalloc malloc_stats_print "" HAVE_JEMALLOC)
IF (HAVE_JEMALLOC)
SET(LIBJEMALLOC jemalloc)
SET(MALLOC_LIBRARY "system jemalloc")
ELSEIF (WITH_JEMALLOC STREQUAL "system")
MESSAGE(FATAL_ERROR "system jemalloc is not found")
ELSEIF (WITH_JEMALLOC STREQUAL "yes")
@ -61,5 +62,6 @@ MACRO (CHECK_JEMALLOC)
ENDIF()
IF(WITH_JEMALLOC STREQUAL "bundled" OR trybundled)
USE_BUNDLED_JEMALLOC()
SET(MALLOC_LIBRARY "bundled jemalloc")
ENDIF()
ENDMACRO()

View File

@ -636,6 +636,7 @@
#define VERSION "@VERSION@"
#define PROTOCOL_VERSION 10
#define MALLOC_LIBRARY "@MALLOC_LIBRARY@"
/* time_t related defines */

View File

@ -6,6 +6,15 @@ found in the git revision history:
http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git
git://canonware.com/jemalloc.git
* 3.3.1a (December 27, 2013)
Bug fixes from 3.4.1
- Fix Valgrind integration flaws that caused Valgrind warnings about reads of
uninitialized memory in:
+ arena chunk headers
+ internal zero-initialized data structures (relevant to tcache and prof
code)
* 3.3.1 (March 6, 2013)
This version fixes bugs that are typically encountered only when utilizing

View File

@ -441,6 +441,7 @@ void arena_postfork_child(arena_t *arena);
#ifndef JEMALLOC_ENABLE_INLINE
arena_chunk_map_t *arena_mapp_get(arena_chunk_t *chunk, size_t pageind);
size_t *arena_mapbitsp_get(arena_chunk_t *chunk, size_t pageind);
size_t arena_mapbitsp_read(size_t *mapbitsp);
size_t arena_mapbits_get(arena_chunk_t *chunk, size_t pageind);
size_t arena_mapbits_unallocated_size_get(arena_chunk_t *chunk,
size_t pageind);
@ -451,6 +452,7 @@ size_t arena_mapbits_dirty_get(arena_chunk_t *chunk, size_t pageind);
size_t arena_mapbits_unzeroed_get(arena_chunk_t *chunk, size_t pageind);
size_t arena_mapbits_large_get(arena_chunk_t *chunk, size_t pageind);
size_t arena_mapbits_allocated_get(arena_chunk_t *chunk, size_t pageind);
void arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits);
void arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind,
size_t size, size_t flags);
void arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind,
@ -497,11 +499,18 @@ arena_mapbitsp_get(arena_chunk_t *chunk, size_t pageind)
return (&arena_mapp_get(chunk, pageind)->bits);
}
JEMALLOC_ALWAYS_INLINE size_t
arena_mapbitsp_read(size_t *mapbitsp)
{
return (*mapbitsp);
}
JEMALLOC_ALWAYS_INLINE size_t
arena_mapbits_get(arena_chunk_t *chunk, size_t pageind)
{
return (*arena_mapbitsp_get(chunk, pageind));
return (arena_mapbitsp_read(arena_mapbitsp_get(chunk, pageind)));
}
JEMALLOC_ALWAYS_INLINE size_t
@ -584,83 +593,90 @@ arena_mapbits_allocated_get(arena_chunk_t *chunk, size_t pageind)
return (mapbits & CHUNK_MAP_ALLOCATED);
}
JEMALLOC_ALWAYS_INLINE void
arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits)
{
*mapbitsp = mapbits;
}
JEMALLOC_ALWAYS_INLINE void
arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind, size_t size,
size_t flags)
{
size_t *mapbitsp;
size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind);
mapbitsp = arena_mapbitsp_get(chunk, pageind);
assert((size & PAGE_MASK) == 0);
assert((flags & ~CHUNK_MAP_FLAGS_MASK) == 0);
assert((flags & (CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == flags);
*mapbitsp = size | CHUNK_MAP_BININD_INVALID | flags;
arena_mapbitsp_write(mapbitsp, size | CHUNK_MAP_BININD_INVALID | flags);
}
JEMALLOC_ALWAYS_INLINE void
arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind,
size_t size)
{
size_t *mapbitsp;
size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind);
size_t mapbits = arena_mapbitsp_read(mapbitsp);
mapbitsp = arena_mapbitsp_get(chunk, pageind);
assert((size & PAGE_MASK) == 0);
assert((*mapbitsp & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0);
*mapbitsp = size | (*mapbitsp & PAGE_MASK);
assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0);
arena_mapbitsp_write(mapbitsp, size | (mapbits & PAGE_MASK));
}
JEMALLOC_ALWAYS_INLINE void
arena_mapbits_large_set(arena_chunk_t *chunk, size_t pageind, size_t size,
size_t flags)
{
size_t *mapbitsp;
size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind);
size_t mapbits = arena_mapbitsp_read(mapbitsp);
size_t unzeroed;
mapbitsp = arena_mapbitsp_get(chunk, pageind);
assert((size & PAGE_MASK) == 0);
assert((flags & CHUNK_MAP_DIRTY) == flags);
unzeroed = *mapbitsp & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */
*mapbitsp = size | CHUNK_MAP_BININD_INVALID | flags | unzeroed |
CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED;
unzeroed = mapbits & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */
arena_mapbitsp_write(mapbitsp, size | CHUNK_MAP_BININD_INVALID | flags
| unzeroed | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED);
}
JEMALLOC_ALWAYS_INLINE void
arena_mapbits_large_binind_set(arena_chunk_t *chunk, size_t pageind,
size_t binind)
{
size_t *mapbitsp;
size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind);
size_t mapbits = arena_mapbitsp_read(mapbitsp);
assert(binind <= BININD_INVALID);
mapbitsp = arena_mapbitsp_get(chunk, pageind);
assert(arena_mapbits_large_size_get(chunk, pageind) == PAGE);
*mapbitsp = (*mapbitsp & ~CHUNK_MAP_BININD_MASK) | (binind <<
CHUNK_MAP_BININD_SHIFT);
arena_mapbitsp_write(mapbitsp, (mapbits & ~CHUNK_MAP_BININD_MASK) |
(binind << CHUNK_MAP_BININD_SHIFT));
}
JEMALLOC_ALWAYS_INLINE void
arena_mapbits_small_set(arena_chunk_t *chunk, size_t pageind, size_t runind,
size_t binind, size_t flags)
{
size_t *mapbitsp;
size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind);
size_t mapbits = arena_mapbitsp_read(mapbitsp);
size_t unzeroed;
assert(binind < BININD_INVALID);
mapbitsp = arena_mapbitsp_get(chunk, pageind);
assert(pageind - runind >= map_bias);
assert((flags & CHUNK_MAP_DIRTY) == flags);
unzeroed = *mapbitsp & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */
*mapbitsp = (runind << LG_PAGE) | (binind << CHUNK_MAP_BININD_SHIFT) |
flags | unzeroed | CHUNK_MAP_ALLOCATED;
unzeroed = mapbits & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */
arena_mapbitsp_write(mapbitsp, (runind << LG_PAGE) | (binind <<
CHUNK_MAP_BININD_SHIFT) | flags | unzeroed | CHUNK_MAP_ALLOCATED);
}
JEMALLOC_ALWAYS_INLINE void
arena_mapbits_unzeroed_set(arena_chunk_t *chunk, size_t pageind,
size_t unzeroed)
{
size_t *mapbitsp;
size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind);
size_t mapbits = arena_mapbitsp_read(mapbitsp);
mapbitsp = arena_mapbitsp_get(chunk, pageind);
*mapbitsp = (*mapbitsp & ~CHUNK_MAP_UNZEROED) | unzeroed;
arena_mapbitsp_write(mapbitsp, (mapbits & ~CHUNK_MAP_UNZEROED) |
unzeroed);
}
JEMALLOC_INLINE bool

View File

@ -235,6 +235,7 @@ static const bool config_ivsalloc =
#ifdef JEMALLOC_DEBUG
/* Disable inlining to make debugging easier. */
# define JEMALLOC_ALWAYS_INLINE
# define JEMALLOC_ALWAYS_INLINE_C static
# define JEMALLOC_INLINE
# define inline
#else
@ -242,8 +243,11 @@ static const bool config_ivsalloc =
# ifdef JEMALLOC_HAVE_ATTR
# define JEMALLOC_ALWAYS_INLINE \
static inline JEMALLOC_ATTR(unused) JEMALLOC_ATTR(always_inline)
# define JEMALLOC_ALWAYS_INLINE_C \
static inline JEMALLOC_ATTR(always_inline)
# else
# define JEMALLOC_ALWAYS_INLINE static inline
# define JEMALLOC_ALWAYS_INLINE_C static inline
# endif
# define JEMALLOC_INLINE static inline
# ifdef _MSC_VER

View File

@ -33,6 +33,8 @@
#define arena_mapbits_unzeroed_get JEMALLOC_N(arena_mapbits_unzeroed_get)
#define arena_mapbits_unzeroed_set JEMALLOC_N(arena_mapbits_unzeroed_set)
#define arena_mapbitsp_get JEMALLOC_N(arena_mapbitsp_get)
#define arena_mapbitsp_read JEMALLOC_N(arena_mapbitsp_read)
#define arena_mapbitsp_write JEMALLOC_N(arena_mapbitsp_write)
#define arena_mapp_get JEMALLOC_N(arena_mapp_get)
#define arena_maxclass JEMALLOC_N(arena_maxclass)
#define arena_new JEMALLOC_N(arena_new)

View File

@ -313,6 +313,7 @@ tcache_alloc_small(tcache_t *tcache, size_t size, bool zero)
} else if (opt_zero)
memset(ret, 0, size);
}
VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
} else {
if (config_fill && opt_junk) {
arena_alloc_junk_small(ret, &arena_bin_info[binind],
@ -321,7 +322,6 @@ tcache_alloc_small(tcache_t *tcache, size_t size, bool zero)
VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
memset(ret, 0, size);
}
VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
if (config_stats)
tbin->tstats.nrequests++;
@ -368,11 +368,11 @@ tcache_alloc_large(tcache_t *tcache, size_t size, bool zero)
else if (opt_zero)
memset(ret, 0, size);
}
VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
} else {
VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
memset(ret, 0, size);
}
VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
if (config_stats)
tbin->tstats.nrequests++;

View File

@ -368,14 +368,21 @@ arena_run_zero(arena_chunk_t *chunk, size_t run_ind, size_t npages)
(npages << LG_PAGE));
}
static inline void
arena_run_page_mark_zeroed(arena_chunk_t *chunk, size_t run_ind)
{
VALGRIND_MAKE_MEM_DEFINED((void *)((uintptr_t)chunk + (run_ind <<
LG_PAGE)), PAGE);
}
static inline void
arena_run_page_validate_zeroed(arena_chunk_t *chunk, size_t run_ind)
{
size_t i;
UNUSED size_t *p = (size_t *)((uintptr_t)chunk + (run_ind << LG_PAGE));
VALGRIND_MAKE_MEM_DEFINED((void *)((uintptr_t)chunk + (run_ind <<
LG_PAGE)), PAGE);
arena_run_page_mark_zeroed(chunk, run_ind);
for (i = 0; i < PAGE / sizeof(size_t); i++)
assert(p[i] == 0);
}
@ -458,6 +465,9 @@ arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large,
} else if (config_debug) {
arena_run_page_validate_zeroed(
chunk, run_ind+i);
} else {
arena_run_page_mark_zeroed(
chunk, run_ind+i);
}
}
} else {
@ -467,6 +477,9 @@ arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large,
*/
arena_run_zero(chunk, run_ind, need_pages);
}
} else {
VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk +
(run_ind << LG_PAGE)), (need_pages << LG_PAGE));
}
/*
@ -508,9 +521,9 @@ arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large,
arena_run_page_validate_zeroed(chunk,
run_ind+need_pages-1);
}
VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk +
(run_ind << LG_PAGE)), (need_pages << LG_PAGE));
}
VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk + (run_ind <<
LG_PAGE)), (need_pages << LG_PAGE));
}
static arena_chunk_t *
@ -569,17 +582,24 @@ arena_chunk_alloc(arena_t *arena)
* unless the chunk is not zeroed.
*/
if (zero == false) {
VALGRIND_MAKE_MEM_UNDEFINED(
(void *)arena_mapp_get(chunk, map_bias+1),
(size_t)((uintptr_t) arena_mapp_get(chunk,
chunk_npages-1) - (uintptr_t)arena_mapp_get(chunk,
map_bias+1)));
for (i = map_bias+1; i < chunk_npages-1; i++)
arena_mapbits_unzeroed_set(chunk, i, unzeroed);
} else if (config_debug) {
} else {
VALGRIND_MAKE_MEM_DEFINED(
(void *)arena_mapp_get(chunk, map_bias+1),
(void *)((uintptr_t)
arena_mapp_get(chunk, chunk_npages-1)
- (uintptr_t)arena_mapp_get(chunk, map_bias+1)));
for (i = map_bias+1; i < chunk_npages-1; i++) {
assert(arena_mapbits_unzeroed_get(chunk, i) ==
unzeroed);
(size_t)((uintptr_t) arena_mapp_get(chunk,
chunk_npages-1) - (uintptr_t)arena_mapp_get(chunk,
map_bias+1)));
if (config_debug) {
for (i = map_bias+1; i < chunk_npages-1; i++) {
assert(arena_mapbits_unzeroed_get(chunk,
i) == unzeroed);
}
}
}
arena_mapbits_unallocated_set(chunk, chunk_npages-1,
@ -1458,6 +1478,7 @@ arena_malloc_small(arena_t *arena, size_t size, bool zero)
} else if (opt_zero)
memset(ret, 0, size);
}
VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
} else {
if (config_fill && opt_junk) {
arena_alloc_junk_small(ret, &arena_bin_info[binind],
@ -1466,7 +1487,6 @@ arena_malloc_small(arena_t *arena, size_t size, bool zero)
VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
memset(ret, 0, size);
}
VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
return (ret);
}

View File

@ -41,9 +41,14 @@ typedef struct st_bitmap
#ifdef __cplusplus
extern "C" {
#endif
/* compatibility functions */
#define bitmap_init(A,B,C,D) my_bitmap_init(A,B,C,D)
#define bitmap_free(A) my_bitmap_free(A)
extern void create_last_word_mask(MY_BITMAP *map);
extern my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
my_bool thread_safe);
extern my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
my_bool thread_safe);
extern my_bool bitmap_is_clear_all(const MY_BITMAP *map);
extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size);
extern my_bool bitmap_is_set_all(const MY_BITMAP *map);
@ -64,7 +69,7 @@ extern uint bitmap_get_first(const MY_BITMAP *map);
extern uint bitmap_get_first_set(const MY_BITMAP *map);
extern uint bitmap_bits_set(const MY_BITMAP *map);
extern uint bitmap_get_next_set(const MY_BITMAP *map, uint bitmap_bit);
extern void bitmap_free(MY_BITMAP *map);
extern void my_bitmap_free(MY_BITMAP *map);
extern void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit);
extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size);
extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2);

View File

@ -18,8 +18,12 @@ start slave;
--source include/wait_for_slave_to_start.inc
let $VERSION=`select version()`;
# Lets run this test in STRICT MODE (DROP TABLE is not DROP TABLE IF EXISTS)
connection slave;
set @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode;
set @@global.slave_ddl_exec_mode=STRICT;
connection master;
eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type;
insert into t1 values (NULL);
drop table t1;
@ -141,3 +145,5 @@ drop table t1;
# End of 4.1 tests
sync_slave_with_master;
set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode;
connection master;

View File

@ -59,3 +59,6 @@ source include/wait_for_slave_sql_to_stop.inc;
connection slave;
START SLAVE SQL_THREAD;
source include/wait_for_slave_sql_to_start.inc;
connection master;
sync_slave_with_master;

View File

@ -751,7 +751,7 @@ call p_verify_status_increment(4, 4, 4, 4);
--echo # Sic: no table is created.
create table if not exists t2 (a int) select 6 union select 7;
--echo # Sic: first commits the statement, and then the transaction.
call p_verify_status_increment(2, 0, 2, 0);
call p_verify_status_increment(0, 0, 0, 0);
create table t3 select a from t2;
call p_verify_status_increment(2, 0, 4, 4);
alter table t3 add column (b int);

View File

@ -0,0 +1,4 @@
if (!`SELECT count(*) FROM information_schema.plugins WHERE
(PLUGIN_STATUS = 'ACTIVE') AND PLUGIN_NAME = 'METADATA_LOCK_INFO'`){
skip Need archive METADATA_LOCK_INFO plugin;
}

View File

@ -0,0 +1,2 @@
--loose-metadata-lock-info
--plugin-load-add=$METADATA_LOCK_INFO_SO

View File

@ -6188,6 +6188,13 @@ sub valgrind_arguments {
mtr_add_arg($args, "--num-callers=16");
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
if -f "$glob_mysql_test_dir/valgrind.supp";
# Ensure the jemalloc works with mysqld
if ($mysqld_variables{'version-malloc-library'} ne "system" &&
$$exe =~ /mysqld/)
{
mtr_add_arg($args, "--soname-synonyms=somalloc=NONE" );
}
}
# Add valgrind options, can be overriden by user
@ -6318,7 +6325,20 @@ sub usage ($) {
$0 [ OPTIONS ] [ TESTCASE ]
Options to control what engine/variation to run
Where test case can be specified as:
testcase[.test] Runs the test case named 'testcase' from all suits
path-to-testcase
[suite.]testcase[,combination]
Examples:
alias
main.alias 'main' is the name of the suite for the 't' directory.
rpl.rpl_invoked_features,mix,xtradb_plugin
suite/rpl/t/rpl.rpl_invoked_features
Options to control what engine/variation to run:
embedded-server Use the embedded server, i.e. no mysqld daemons
ps-protocol Use the binary protocol between client and server

View File

@ -830,7 +830,7 @@ create table if not exists t2 (a int) select 6 union select 7;
Warnings:
Note 1050 Table 't2' already exists
# Sic: first commits the statement, and then the transaction.
call p_verify_status_increment(2, 0, 2, 0);
call p_verify_status_increment(0, 0, 0, 0);
SUCCESS
create table t3 select a from t2;

View File

@ -2602,6 +2602,8 @@ create table t1 (a int, b int) select 2,2;
ERROR 42S01: Table 't1' already exists
create table t1 like t2;
ERROR 42S01: Table 't1' already exists
create or replace table t1 (a int, b int) select 2,2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t1;
a b
1 1

View File

@ -0,0 +1,362 @@
drop table if exists t1,t2,t3;
CREATE TABLE t2 (a int);
INSERT INTO t2 VALUES(1),(2),(3);
#
# Check first syntax and wrong usage
#
CREATE OR REPLACE TABLE IF NOT EXISTS t1 (a int);
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
create or replace trigger trg before insert on t1 for each row set @a:=1;
ERROR HY000: Incorrect usage of OR REPLACE and TRIGGERS / SP / EVENT
create or replace table mysql.general_log (a int);
ERROR HY000: You cannot 'CREATE OR REPLACE' a log table if logging is enabled
create or replace table mysql.slow_log (a int);
ERROR HY000: You cannot 'CREATE OR REPLACE' a log table if logging is enabled
#
# Usage when table doesn't exist
#
CREATE OR REPLACE TABLE t1 (a int);
CREATE TABLE t1 (a int);
ERROR 42S01: Table 't1' already exists
DROP TABLE t1;
CREATE OR REPLACE TEMPORARY TABLE t1 (a int);
CREATE TEMPORARY TABLE t1 (a int, b int, c int);
ERROR 42S01: Table 't1' already exists
DROP TEMPORARY TABLE t1;
#
# Testing with temporary tables
#
CREATE OR REPLACE TABLE t1 (a int);
CREATE OR REPLACE TEMPORARY TABLE t1 (a int);
CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TEMPORARY TABLE t1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
create temporary table t1 (i int) engine=InnoDB;
create or replace temporary table t1 (a int, b int) engine=InnoDB;
create or replace temporary table t1 (j int);
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`j` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE OR REPLACE TABLE t1 (a int);
LOCK TABLES t1 write;
CREATE OR REPLACE TEMPORARY TABLE t1 (a int);
CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int);
CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int) engine= innodb;
CREATE OR REPLACE TEMPORARY TABLE t1 (a int) engine= innodb;
CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int) engine=myisam;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TEMPORARY TABLE t1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE OR REPLACE TABLE t2 (a int);
ERROR HY000: Table 't2' was not locked with LOCK TABLES
DROP TABLE t1;
UNLOCK TABLES;
CREATE OR REPLACE TEMPORARY TABLE t1 (a int) SELECT * from t2;
SELECT * FROM t1;
a
1
2
3
CREATE OR REPLACE TEMPORARY TABLE t1 (b int) SELECT * from t2;
SELECT * FROM t1;
b a
NULL 1
NULL 2
NULL 3
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`b` int(11) DEFAULT NULL,
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT a FROM t2;
CREATE TEMPORARY TABLE IF NOT EXISTS t1(a int, b int) SELECT 1,2 FROM t2;
Warnings:
Note 1050 Table 't1' already exists
DROP TABLE t1;
CREATE TABLE t1 (a int);
CREATE OR REPLACE TABLE t1 AS SELECT 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`1` int(1) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
create table t1 (a int);
create or replace table t1 as select * from t1;
ERROR HY000: Table 't1' is specified twice, both as a target for 'CREATE' and as a separate source for data
create or replace table t1 as select a from (select a from t1) as t3;
ERROR HY000: Table 't1' is specified twice, both as a target for 'CREATE' and as a separate source for data
create or replace table t1 as select a from t2 where t2.a in (select a from t1);
ERROR HY000: Table 't1' is specified twice, both as a target for 'CREATE' and as a separate source for data
drop table t1;
#
# Testing with normal tables
#
CREATE OR REPLACE TABLE t1 (a int);
CREATE OR REPLACE TABLE t1 (a int, b int);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a int) SELECT * from t2;
SELECT * FROM t1;
a
1
2
3
TRUNCATE TABLE t1;
CREATE TABLE IF NOT EXISTS t1 (a int) SELECT * from t2;
Warnings:
Note 1050 Table 't1' already exists
SELECT * FROM t1;
a
DROP TABLE t1;
CREATE TABLE t1 (i int);
CREATE OR REPLACE TABLE t1 AS SELECT 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`1` int(1) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (a int);
LOCK TABLES t1 write,t2 write;
CREATE OR REPLACE TABLE t1 (a int, b int);
SELECT * FROM t1;
a b
INSERT INTO t1 values(1,1);
CREATE OR REPLACE TABLE t1 (a int, b int, c int);
INSERT INTO t1 values(1,1,1);
CREATE OR REPLACE TABLE t3 (a int);
ERROR HY000: Table 't3' was not locked with LOCK TABLES
UNLOCK TABLES;
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (a int);
LOCK TABLES t1 write,t2 write;
CREATE OR REPLACE TABLE t1 (a int, b int) select a,1 from t2;
SELECT * FROM t2;
a
1
2
3
SELECT * FROM t1;
b a 1
NULL 1 1
NULL 2 1
NULL 3 1
SELECT * FROM t1;
b a 1
NULL 1 1
NULL 2 1
NULL 3 1
INSERT INTO t1 values(1,1,1);
CREATE OR REPLACE TABLE t1 (a int, b int, c int, d int);
INSERT INTO t1 values(1,1,1,1);
CREATE OR REPLACE TABLE t3 (a int);
ERROR HY000: Table 't3' was not locked with LOCK TABLES
UNLOCK TABLES;
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (a int);
LOCK TABLES t1 write,t2 write, t1 as t1_read read;
CREATE OR REPLACE TABLE t1 (a int, b int) select a,1 from t2;
SELECT * FROM t1;
b a 1
NULL 1 1
NULL 2 1
NULL 3 1
SELECT * FROM t2;
a
1
2
3
SELECT * FROM t1 as t1_read;
ERROR HY000: Table 't1_read' was not locked with LOCK TABLES
DROP TABLE t1;
UNLOCK TABLES;
CREATE OR REPLACE TABLE t1 (a int);
LOCK TABLE t1 WRITE;
CREATE OR REPLACE TABLE t1 AS SELECT 1;
SELECT * from t1;
1
1
SELECT * from t2;
ERROR HY000: Table 't2' was not locked with LOCK TABLES
DROP TABLE t1;
#
# Test also with InnoDB (transactional engine)
#
create table t1 (i int) engine=innodb;
lock table t1 write;
create or replace table t1 (j int);
unlock tables;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`j` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (i int) engine=InnoDB;
lock table t1 write, t2 write;
create or replace table t1 (j int) engine=innodb;
unlock tables;
drop table t1;
create table t1 (i int) engine=InnoDB;
create table t3 (i int) engine=InnoDB;
insert into t3 values(1),(2),(3);
lock table t1 write, t2 write, t3 write;
create or replace table t1 (a int, i int) engine=innodb select t2.a,t3.i from t2,t3;
unlock tables;
select * from t1 order by a,i;
a i
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
drop table t1,t3;
#
# Testing CREATE .. LIKE
#
create or replace table t1 like t2;
create or replace table t1 like t2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (b int);
lock tables t1 write, t2 read;
create or replace table t1 like t2;
SELECT * FROM t1;
a
INSERT INTO t1 values(1);
CREATE OR REPLACE TABLE t1 like t2;
INSERT INTO t1 values(2);
unlock tables;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create or replace table t1 like t2;
create or replace table t1 like t1;
ERROR 42000: Not unique table/alias: 't1'
drop table t1;
CREATE TEMPORARY TABLE t1 like t2;
CREATE OR REPLACE TABLE t1 like t1;
ERROR 42000: Not unique table/alias: 't1'
CREATE OR REPLACE TABLE t1 like t1;
ERROR 42000: Not unique table/alias: 't1'
drop table t1;
CREATE TEMPORARY TABLE t1 like t2;
CREATE OR REPLACE TEMPORARY TABLE t3 like t1;
CREATE OR REPLACE TEMPORARY TABLE t3 like t3;
ERROR 42000: Not unique table/alias: 't3'
drop table t1,t3;
#
# Test with prepared statements
#
prepare stmt1 from 'create or replace table t1 select * from t2';
execute stmt1;
select * from t1;
a
1
2
3
execute stmt1;
select * from t1;
a
1
2
3
drop table t1;
execute stmt1;
select * from t1;
a
1
2
3
deallocate prepare stmt1;
drop table t1;
#
# Test with views
#
create view t1 as select 1;
create table if not exists t1 (a int);
Warnings:
Note 1050 Table 't1' already exists
create or replace table t1 (a int);
ERROR 42S02: 'test.t1' is a view
drop table t1;
ERROR 42S02: 'test.t1' is a view
drop view t1;
#
# MDEV-5602 CREATE OR REPLACE obtains stricter locks than the
# connection had before
#
create table t1 (a int);
lock table t1 write, t2 read;
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock
# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1
# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2
create or replace table t1 (i int);
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock
# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1
# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2
create or replace table t1 like t2;
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock
# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1
# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2
create or replace table t1 select 1 as f1;
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock
# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1
# MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2
drop table t1;
unlock tables;
DROP TABLE t2;

View File

@ -274,7 +274,7 @@ Database Table In_use Name_locked
test t_bug44738_uppercase 0 0
# So attempt to create table with the same name should fail.
create table t_bug44738_UPPERCASE (i int);
ERROR HY000: Can't find file: './test/t_bug44738_uppercase.MYI' (errno: 2 "No such file or directory")
ERROR 42S01: Table 't_bug44738_uppercase' already exists
# And should succeed after FLUSH TABLES.
flush tables;
create table t_bug44738_UPPERCASE (i int);

View File

@ -20,13 +20,13 @@ ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table '
update v2Aa set col1 = (select max(col1) from t1Aa);
ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 'v2Aa'.
update v2aA set col1 = (select max(col1) from v2Aa);
ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause
ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v1aA) where v2aA.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v2aA'.
update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v1Aa) where t1aA.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 't1aA'.
update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1;
ERROR HY000: You can't specify target table 'v1aA' for update in FROM clause
ERROR HY000: Table 'v1aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from v1aA) where v2Aa.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 't2Aa'.
update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v1Aa) where t1Aa.col1 = t2aA.col1;
@ -36,17 +36,17 @@ ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table '
update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from t1aA) where v2aA.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 'v2aA'.
update t1Aa,t2Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1;
ERROR HY000: You can't specify target table 't1Aa' for update in FROM clause
ERROR HY000: Table 't1Aa' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from t1Aa) where v1aA.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v1aA'.
update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from t1aA) where v2Aa.col1 = t2aA.col1;
ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause
ERROR HY000: Table 't2Aa' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1;
ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause
ERROR HY000: Table 't2Aa' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from t1Aa) where v1Aa.col1 = t2aA.col1;
ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause
ERROR HY000: Table 't2Aa' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1;
ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause
ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v2aA) where t1aA.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't1aA'.
update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v2Aa) where v1aA.col1 = t2aA.col1;
@ -64,27 +64,27 @@ ERROR HY000: The definition of table 'v3aA' prevents operation UPDATE on table '
update v3aA set v3Aa.col1 = (select max(col1) from v2aA);
ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 'v3aA'.
update v3aA set v3Aa.col1 = (select max(col1) from v3aA);
ERROR HY000: You can't specify target table 'v3aA' for update in FROM clause
ERROR HY000: Table 'v3aA' is specified twice, both as a target for 'UPDATE' and as a separate source for data
delete from v2Aa where col1 = (select max(col1) from v1Aa);
ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 'v2Aa'.
delete from v2aA where col1 = (select max(col1) from t1Aa);
ERROR HY000: The definition of table 'v2aA' prevents operation DELETE on table 'v2aA'.
delete from v2Aa where col1 = (select max(col1) from v2aA);
ERROR HY000: You can't specify target table 'v2Aa' for update in FROM clause
ERROR HY000: Table 'v2Aa' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v2Aa from v2aA,t2Aa where (select max(col1) from v1aA) > 0 and v2Aa.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v1aA' prevents operation DELETE on table 'v2aA'.
delete t1aA from t1Aa,t2Aa where (select max(col1) from v1Aa) > 0 and t1aA.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 't1Aa'.
delete v1aA from v1Aa,t2Aa where (select max(col1) from v1aA) > 0 and v1Aa.col1 = t2aA.col1;
ERROR HY000: You can't specify target table 'v1Aa' for update in FROM clause
ERROR HY000: Table 'v1Aa' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v2aA from v2Aa,t2Aa where (select max(col1) from t1Aa) > 0 and v2aA.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 'v2Aa'.
delete t1aA from t1Aa,t2Aa where (select max(col1) from t1aA) > 0 and t1Aa.col1 = t2aA.col1;
ERROR HY000: You can't specify target table 't1Aa' for update in FROM clause
ERROR HY000: Table 't1Aa' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v1aA from v1Aa,t2Aa where (select max(col1) from t1aA) > 0 and v1aA.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 'v1Aa'.
delete v2Aa from v2aA,t2Aa where (select max(col1) from v2Aa) > 0 and v2aA.col1 = t2aA.col1;
ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause
ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete t1Aa from t1aA,t2Aa where (select max(col1) from v2Aa) > 0 and t1Aa.col1 = t2aA.col1;
ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 't1aA'.
delete v1Aa from v1aA,t2Aa where (select max(col1) from v2aA) > 0 and v1Aa.col1 = t2aA.col1;
@ -98,15 +98,15 @@ ERROR HY000: The definition of table 'v1aA' prevents operation INSERT on table '
insert into v2Aa values ((select max(col1) from t1Aa));
ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 'v2Aa'.
insert into t1aA values ((select max(col1) from t1Aa));
ERROR HY000: You can't specify target table 't1aA' for update in FROM clause
ERROR HY000: Table 't1aA' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v2aA values ((select max(col1) from t1aA));
ERROR HY000: The definition of table 'v2aA' prevents operation INSERT on table 'v2aA'.
insert into v2Aa values ((select max(col1) from v2aA));
ERROR HY000: You can't specify target table 'v2Aa' for update in FROM clause
ERROR HY000: Table 'v2Aa' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into t1Aa values ((select max(col1) from v2Aa));
ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 't1Aa'.
insert into v2aA values ((select max(col1) from v2Aa));
ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause
ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v3Aa (col1) values ((select max(col1) from v1Aa));
ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 'v3Aa'.
insert into v3aA (col1) values ((select max(col1) from t1aA));

View File

@ -3657,85 +3657,85 @@ insert into tmp (b) values (1);
insert into t1 (a) values (1);
insert into t3 (b) values (1);
insert into m1 (a) values ((select max(a) from m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t3, m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t3, m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t3, t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t3, t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from tmp, m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from tmp, m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from tmp, t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from tmp, t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'.
insert into m1 (a) values ((select max(a) from tmp, v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'.
update m1 set a = ((select max(a) from m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from t3, m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from t3, m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from t3, t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from t3, t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from tmp, m1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from tmp, m2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from tmp, t1));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from tmp, t2));
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update m1 set a = ((select max(a) from v1));
ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'.
update m1 set a = ((select max(a) from tmp, v1));
ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'm1'.
delete from m1 where a = (select max(a) from m1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from m2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from t1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from t2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from t3, m1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from t3, m2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from t3, t1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from t3, t2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from tmp, m1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from tmp, m2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from tmp, t1);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from tmp, t2);
ERROR HY000: You can't specify target table 'm1' for update in FROM clause
ERROR HY000: Table 'm1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from m1 where a = (select max(a) from v1);
ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1'.
delete from m1 where a = (select max(a) from tmp, v1);

View File

@ -439,9 +439,9 @@ drop table t1, t2, t3;
create table t1 (col1 int);
create table t2 (col1 int);
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
drop table t1,t2;
create table t1 (
aclid bigint not null primary key,
@ -457,7 +457,7 @@ drop table t1, t2;
create table t1(a int);
create table t2(a int);
delete from t1,t2 using t1,t2 where t1.a=(select a from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
drop table t1, t2;
create table t1 ( c char(8) not null ) engine=innodb;
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');

View File

@ -860,13 +860,22 @@ The following options may be given as the first argument:
--skip-slave-start If set, slave is not autostarted.
--slave-compressed-protocol
Use compression on master/slave protocol
--slave-ddl-exec-mode=name
Modes for how replication events should be executed.
Legal values are STRICT and IDEMPOTENT (default). In
IDEMPOTENT mode, replication will not stop for DDL
operations that are idempotent. This means that CREATE
TABLE is treated CREATE TABLE OR REPLACE and DROP TABLE
is threated as DROP TABLE IF EXISTS.
--slave-exec-mode=name
Modes for how replication events should be executed.
Legal values are STRICT (default) and IDEMPOTENT. In
IDEMPOTENT mode, replication will not stop for operations
that are idempotent. In STRICT mode, replication will
stop on any unexpected difference between the master and
the slave
that are idempotent. For example, in row based
replication attempts to delete rows that doesn't exist
will be ignored.In STRICT mode, replication will stop on
any unexpected difference between the master and the
slave
--slave-load-tmpdir=name
The location where the slave should put its temporary
files when replicating a LOAD DATA INFILE command
@ -1023,7 +1032,7 @@ auto-increment-increment 1
auto-increment-offset 1
autocommit TRUE
automatic-sp-privileges TRUE
back-log 50
back-log 150
big-tables FALSE
bind-address (No default value)
binlog-annotate-row-events FALSE
@ -1226,6 +1235,7 @@ port-open-timeout 0
preload-buffer-size 32768
profiling-history-size 15
progress-report-time 56
protocol-version 10
query-alloc-block-size 8192
query-cache-limit 1048576
query-cache-min-res-unit 4096
@ -1264,6 +1274,7 @@ skip-networking FALSE
skip-show-database FALSE
skip-slave-start FALSE
slave-compressed-protocol FALSE
slave-ddl-exec-mode IDEMPOTENT
slave-exec-mode STRICT
slave-max-allowed-packet 1073741824
slave-net-timeout 3600

View File

@ -1088,7 +1088,7 @@ ALTER TABLE t PARTITION BY RANGE (UNIX_TIMESTAMP(event_time) DIV 1)
(PARTITION p0 VALUES LESS THAN (123456789),
PARTITION pMAX VALUES LESS THAN MAXVALUE);
ALTER TABLE t EXCHANGE PARTITION p0 WITH TABLE general_log;
ERROR HY000: Incorrect usage of PARTITION and log table
ERROR HY000: You cannot 'ALTER PARTITION' a log table if logging is enabled
ALTER TABLE general_log ENGINE = CSV;
SET @@global.general_log = @old_general_log_state;
DROP TABLE t;

View File

@ -1930,7 +1930,7 @@ SUCCESS
execute stmt;
ERROR 42S01: Table 't2' already exists
call p_verify_reprepare_count(1);
call p_verify_reprepare_count(0);
SUCCESS
execute stmt;
@ -1946,7 +1946,7 @@ SUCCESS
execute stmt;
ERROR 42S01: Table 't2' already exists
call p_verify_reprepare_count(1);
call p_verify_reprepare_count(0);
SUCCESS
drop temporary table t2;
@ -1964,7 +1964,7 @@ drop table t2;
create view t2 as select 1;
execute stmt;
Got one of the listed errors
call p_verify_reprepare_count(1);
call p_verify_reprepare_count(0);
SUCCESS
execute stmt;

View File

@ -579,7 +579,7 @@ a b
1 11
2 12
update t1 set b= (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t1 set b= (select b from t2);
ERROR 21000: Subquery returns more than 1 row
update t1 set b= (select b from t2 where t1.a = t2.a);
@ -602,7 +602,7 @@ select * from t1 where b = (select b from t2 where t1.a = t2.a);
a b
2 12
delete from t1 where b in (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from t1 where b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete from t1 where b = (select b from t2 where t1.a = t2.a);
@ -628,7 +628,7 @@ a b
22 11
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
ERROR HY000: You can't specify target table 't12' for update in FROM clause
ERROR HY000: Table 't12' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
@ -647,7 +647,7 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
@ -697,7 +697,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -765,9 +765,9 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
SELECT * FROM t2;
id
1

View File

@ -583,7 +583,7 @@ a b
1 11
2 12
update t1 set b= (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t1 set b= (select b from t2);
ERROR 21000: Subquery returns more than 1 row
update t1 set b= (select b from t2 where t1.a = t2.a);
@ -606,7 +606,7 @@ select * from t1 where b = (select b from t2 where t1.a = t2.a);
a b
2 12
delete from t1 where b in (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from t1 where b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete from t1 where b = (select b from t2 where t1.a = t2.a);
@ -632,7 +632,7 @@ a b
22 11
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
ERROR HY000: You can't specify target table 't12' for update in FROM clause
ERROR HY000: Table 't12' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
@ -651,7 +651,7 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
@ -701,7 +701,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -769,9 +769,9 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
SELECT * FROM t2;
id
1

View File

@ -586,7 +586,7 @@ a b
1 11
2 12
update t1 set b= (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t1 set b= (select b from t2);
ERROR 21000: Subquery returns more than 1 row
update t1 set b= (select b from t2 where t1.a = t2.a);
@ -609,7 +609,7 @@ select * from t1 where b = (select b from t2 where t1.a = t2.a);
a b
2 12
delete from t1 where b in (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from t1 where b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete from t1 where b = (select b from t2 where t1.a = t2.a);
@ -635,7 +635,7 @@ a b
22 11
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
ERROR HY000: You can't specify target table 't12' for update in FROM clause
ERROR HY000: Table 't12' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
@ -654,7 +654,7 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
@ -704,7 +704,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -772,9 +772,9 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
SELECT * FROM t2;
id
1

View File

@ -582,7 +582,7 @@ a b
1 11
2 12
update t1 set b= (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t1 set b= (select b from t2);
ERROR 21000: Subquery returns more than 1 row
update t1 set b= (select b from t2 where t1.a = t2.a);
@ -605,7 +605,7 @@ select * from t1 where b = (select b from t2 where t1.a = t2.a);
a b
2 12
delete from t1 where b in (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from t1 where b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete from t1 where b = (select b from t2 where t1.a = t2.a);
@ -631,7 +631,7 @@ a b
22 11
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
ERROR HY000: You can't specify target table 't12' for update in FROM clause
ERROR HY000: Table 't12' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
@ -650,7 +650,7 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
@ -700,7 +700,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -768,9 +768,9 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
SELECT * FROM t2;
id
1

View File

@ -585,7 +585,7 @@ a b
1 11
2 12
update t1 set b= (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t1 set b= (select b from t2);
ERROR 21000: Subquery returns more than 1 row
update t1 set b= (select b from t2 where t1.a = t2.a);
@ -608,7 +608,7 @@ select * from t1 where b = (select b from t2 where t1.a = t2.a);
a b
2 12
delete from t1 where b in (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from t1 where b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete from t1 where b = (select b from t2 where t1.a = t2.a);
@ -634,7 +634,7 @@ a b
22 11
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
ERROR HY000: You can't specify target table 't12' for update in FROM clause
ERROR HY000: Table 't12' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
@ -653,7 +653,7 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
@ -703,7 +703,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -771,9 +771,9 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
SELECT * FROM t2;
id
1

View File

@ -582,7 +582,7 @@ a b
1 11
2 12
update t1 set b= (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t1 set b= (select b from t2);
ERROR 21000: Subquery returns more than 1 row
update t1 set b= (select b from t2 where t1.a = t2.a);
@ -605,7 +605,7 @@ select * from t1 where b = (select b from t2 where t1.a = t2.a);
a b
2 12
delete from t1 where b in (select b from t1);
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete from t1 where b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete from t1 where b = (select b from t2 where t1.a = t2.a);
@ -631,7 +631,7 @@ a b
22 11
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
ERROR HY000: You can't specify target table 't12' for update in FROM clause
ERROR HY000: Table 't12' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
@ -650,7 +650,7 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
@ -700,7 +700,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -768,9 +768,9 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
SELECT * FROM t2;
id
1

View File

@ -1137,12 +1137,12 @@ ERROR HY000: Variable 'ft_stopword_file' is a read only variable
#
SHOW VARIABLES like 'back_log';
Variable_name Value
back_log 50
back_log 150
SELECT @@session.back_log;
ERROR HY000: Variable 'back_log' is a GLOBAL variable
SELECT @@global.back_log;
@@global.back_log
50
150
SET @@session.back_log= 7;
ERROR HY000: Variable 'back_log' is a read only variable
SET @@global.back_log= 7;

View File

@ -205,7 +205,7 @@ ERROR 42S02: Unknown table 'v100'
drop view t1;
ERROR HY000: 'test.t1' is not VIEW
drop table v1;
ERROR 42S02: Unknown table 'test.v1'
ERROR 42S02: 'test.v1' is a view
drop view v1,v2;
drop table t1;
create table t1 (a int);
@ -931,13 +931,13 @@ ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v2
update v2 set col1 = (select max(col1) from t1);
ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v2'.
update v2 set col1 = (select max(col1) from v2);
ERROR HY000: You can't specify target table 'v2' for update in FROM clause
ERROR HY000: Table 'v2' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update v2,t2 set v2.col1 = (select max(col1) from v1) where v2.col1 = t2.col1;
ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v2'.
update t1,t2 set t1.col1 = (select max(col1) from v1) where t1.col1 = t2.col1;
ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't1'.
update v1,t2 set v1.col1 = (select max(col1) from v1) where v1.col1 = t2.col1;
ERROR HY000: You can't specify target table 'v1' for update in FROM clause
ERROR HY000: Table 'v1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t2,v2 set v2.col1 = (select max(col1) from v1) where v2.col1 = t2.col1;
ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2'.
update t2,t1 set t1.col1 = (select max(col1) from v1) where t1.col1 = t2.col1;
@ -947,17 +947,17 @@ ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 't2
update v2,t2 set v2.col1 = (select max(col1) from t1) where v2.col1 = t2.col1;
ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v2'.
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update v1,t2 set v1.col1 = (select max(col1) from t1) where v1.col1 = t2.col1;
ERROR HY000: The definition of table 'v1' prevents operation UPDATE on table 'v1'.
update t2,v2 set v2.col1 = (select max(col1) from t1) where v2.col1 = t2.col1;
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t2,t1 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t2,v1 set v1.col1 = (select max(col1) from t1) where v1.col1 = t2.col1;
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: Table 't2' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update v2,t2 set v2.col1 = (select max(col1) from v2) where v2.col1 = t2.col1;
ERROR HY000: You can't specify target table 'v2' for update in FROM clause
ERROR HY000: Table 'v2' is specified twice, both as a target for 'UPDATE' and as a separate source for data
update t1,t2 set t1.col1 = (select max(col1) from v2) where t1.col1 = t2.col1;
ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 't1'.
update v1,t2 set v1.col1 = (select max(col1) from v2) where v1.col1 = t2.col1;
@ -975,27 +975,27 @@ ERROR HY000: The definition of table 'v3' prevents operation UPDATE on table 'v3
update v3 set v3.col1 = (select max(col1) from v2);
ERROR HY000: The definition of table 'v2' prevents operation UPDATE on table 'v3'.
update v3 set v3.col1 = (select max(col1) from v3);
ERROR HY000: You can't specify target table 'v3' for update in FROM clause
ERROR HY000: Table 'v3' is specified twice, both as a target for 'UPDATE' and as a separate source for data
delete from v2 where col1 = (select max(col1) from v1);
ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'v2'.
delete from v2 where col1 = (select max(col1) from t1);
ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 'v2'.
delete from v2 where col1 = (select max(col1) from v2);
ERROR HY000: You can't specify target table 'v2' for update in FROM clause
ERROR HY000: Table 'v2' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v2 from v2,t2 where (select max(col1) from v1) > 0 and v2.col1 = t2.col1;
ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'v2'.
delete t1 from t1,t2 where (select max(col1) from v1) > 0 and t1.col1 = t2.col1;
ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 't1'.
delete v1 from v1,t2 where (select max(col1) from v1) > 0 and v1.col1 = t2.col1;
ERROR HY000: You can't specify target table 'v1' for update in FROM clause
ERROR HY000: Table 'v1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v2 from v2,t2 where (select max(col1) from t1) > 0 and v2.col1 = t2.col1;
ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 'v2'.
delete t1 from t1,t2 where (select max(col1) from t1) > 0 and t1.col1 = t2.col1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete v1 from v1,t2 where (select max(col1) from t1) > 0 and v1.col1 = t2.col1;
ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'v1'.
delete v2 from v2,t2 where (select max(col1) from v2) > 0 and v2.col1 = t2.col1;
ERROR HY000: You can't specify target table 'v2' for update in FROM clause
ERROR HY000: Table 'v2' is specified twice, both as a target for 'DELETE' and as a separate source for data
delete t1 from t1,t2 where (select max(col1) from v2) > 0 and t1.col1 = t2.col1;
ERROR HY000: The definition of table 'v2' prevents operation DELETE on table 't1'.
delete v1 from v1,t2 where (select max(col1) from v2) > 0 and v1.col1 = t2.col1;
@ -1009,15 +1009,15 @@ ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v2
insert into v2 values ((select max(col1) from t1));
ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v2'.
insert into t1 values ((select max(col1) from t1));
ERROR HY000: You can't specify target table 't1' for update in FROM clause
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v2 values ((select max(col1) from t1));
ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v2'.
insert into v2 values ((select max(col1) from v2));
ERROR HY000: You can't specify target table 'v2' for update in FROM clause
ERROR HY000: Table 'v2' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into t1 values ((select max(col1) from v2));
ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 't1'.
insert into v2 values ((select max(col1) from v2));
ERROR HY000: You can't specify target table 'v2' for update in FROM clause
ERROR HY000: Table 'v2' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v3 (col1) values ((select max(col1) from v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v3'.
insert into v3 (col1) values ((select max(col1) from t1));

View File

@ -135,4 +135,7 @@ select * from t1;
a
flush tables;
create table t1 (a int) engine=archive;
ERROR 42S01: Table 't1' already exists
flush tables;
create table t1 (a int) engine=archive;
drop table t1;

View File

@ -125,6 +125,10 @@ create table t1 (a int) engine=archive;
select * from t1;
flush tables;
remove_file $mysqld_datadir/test/t1.ARZ;
--error ER_TABLE_EXISTS_ERROR
create table t1 (a int) engine=archive;
remove_file $mysqld_datadir/test/t1.frm;
flush tables;
create table t1 (a int) engine=archive;
drop table t1;

View File

@ -7579,7 +7579,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT * FROM test.tb2 limit 2' at line 1
CREATE OR REPLACE TEMPORARY VIEW test.v1 AS
SELECT * FROM test.tb2 limit 2 ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TEMPORARY VIEW test.v1 AS
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VIEW test.v1 AS
SELECT * FROM test.tb2 limit 2' at line 1
Drop view if exists test.v1 ;
Use test;

View File

@ -7580,7 +7580,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT * FROM test.tb2 limit 2' at line 1
CREATE OR REPLACE TEMPORARY VIEW test.v1 AS
SELECT * FROM test.tb2 limit 2 ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TEMPORARY VIEW test.v1 AS
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VIEW test.v1 AS
SELECT * FROM test.tb2 limit 2' at line 1
Drop view if exists test.v1 ;
Use test;

View File

@ -8400,7 +8400,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT * FROM test.tb2 limit 2' at line 1
CREATE OR REPLACE TEMPORARY VIEW test.v1 AS
SELECT * FROM test.tb2 limit 2 ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TEMPORARY VIEW test.v1 AS
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VIEW test.v1 AS
SELECT * FROM test.tb2 limit 2' at line 1
Drop view if exists test.v1 ;
Use test;

View File

@ -10,7 +10,6 @@
#
##############################################################################
rpl_row_create_table : Bug#11759274 2010-02-27 andrei failed different way than earlier with bug#45576
rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table

View File

@ -0,0 +1,162 @@
include/rpl_init.inc [topology=1->2]
create table t2 (a int) engine=myisam;
insert into t2 values (0),(1),(2),(2);
create temporary table t3 (a_in_temporary int) engine=myisam;
#
# Check how create table and create or replace table are logged
#
create table t1 (to_be_deleted int);
CREATE TABLE t1 AS SELECT 1 AS f1;
CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1;
CREATE OR REPLACE table t1 like t2;
CREATE OR REPLACE table t1 like t3;
drop table t1;
binlog from server 1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t2 (a int) engine=myisam
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t2 values (0),(1),(2),(2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t3 (a_in_temporary int) engine=myisam
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT 1 AS f1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t3
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t2 (a int) engine=myisam
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; insert into t2 values (0),(1),(2),(2)
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create temporary table t3 (a_in_temporary int) engine=myisam
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (to_be_deleted int)
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT 1 AS f1
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t3
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
#
# Ensure that also failed create_or_replace are logged
#
create table t1 (a int);
create or replace table t1;
ERROR 42000: A table must have at least 1 column
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
create or replace table t1 (a int primary key) select a from t2;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
create table t1 (a int);
create or replace table t1 (a int primary key) select a from t2;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
binlog from server 1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create or replace table t1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
show tables;
Tables_in_test
t1
t2
drop table if exists t1,t2;
Warnings:
Note 1051 Unknown table 'test.t1'
#
# Ensure that CREATE are run as CREATE OR REPLACE on slave
#
create table t1 (server_2_to_be_delete int);
create table t1 (new_table int);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`new_table` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
# Ensure that DROP TABLE is run as DROP IF NOT EXISTS
#
create table t1 (server_1_ver_1 int);
create table t4 (server_1_ver_2 int);
drop table t1;
drop table t1,t4;
create table t1 (server_2_ver_2 int);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`server_2_ver_2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t4` /* generated by server */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (server_2_ver_2 int)
drop table t1;
#
# Ensure that CREATE ... SELECT is recorded as one GTID on the slave
#
create table t1 (a int);
insert into t1 values (0),(1),(2);
create table t2 engine=myisam select * from t1;
create or replace table t2 engine=innodb select * from t1;
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (a int)
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM
slave-bin.000001 # Table_map # # table_id: # (test.t2)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
slave-bin.000001 # Table_map # # table_id: # (test.t2)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Xid # # COMMIT /* XID */
drop table t1;
drop table t2,t3;
include/rpl_end.inc

View File

@ -0,0 +1,184 @@
include/rpl_init.inc [topology=1->2]
create table t2 (a int) engine=myisam;
insert into t2 values (0),(1),(2),(2);
create temporary table t3 (a_in_temporary int) engine=myisam;
#
# Check how create table and create or replace table are logged
#
create table t1 (to_be_deleted int);
CREATE TABLE t1 AS SELECT 1 AS f1;
CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1;
CREATE OR REPLACE table t1 like t2;
CREATE OR REPLACE table t1 like t3;
drop table t1;
binlog from server 1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t2 (a int) engine=myisam
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` (
`f1` int(1) NOT NULL DEFAULT '0'
)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` (
`f1` int(1) NOT NULL DEFAULT '0'
)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` (
`a_in_temporary` int(11) DEFAULT NULL
)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t2 (a int) engine=myisam
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Table_map # # table_id: # (test.t2)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (to_be_deleted int)
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TABLE `t1` (
`f1` int(1) NOT NULL DEFAULT '0'
)
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` (
`f1` int(1) NOT NULL DEFAULT '0'
)
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` (
`a_in_temporary` int(11) DEFAULT NULL
)
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
#
# Ensure that also failed create_or_replace are logged
#
create table t1 (a int);
create or replace table t1;
ERROR 42000: A table must have at least 1 column
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
create or replace table t1 (a int primary key) select a from t2;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
create table t1 (a int);
create or replace table t1 (a int primary key) select a from t2;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
binlog from server 1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create or replace table t1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
show tables;
Tables_in_test
t1
t2
drop table if exists t1,t2;
Warnings:
Note 1051 Unknown table 'test.t1'
#
# Ensure that CREATE are run as CREATE OR REPLACE on slave
#
create table t1 (server_2_to_be_delete int);
create table t1 (new_table int);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`new_table` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
# Ensure that DROP TABLE is run as DROP IF NOT EXISTS
#
create table t1 (server_1_ver_1 int);
create table t4 (server_1_ver_2 int);
drop table t1;
drop table t1,t4;
create table t1 (server_2_ver_2 int);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`server_2_ver_2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t4` /* generated by server */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (server_2_ver_2 int)
drop table t1;
#
# Ensure that CREATE ... SELECT is recorded as one GTID on the slave
#
create table t1 (a int);
insert into t1 values (0),(1),(2);
create table t2 engine=myisam select * from t1;
create or replace table t2 engine=innodb select * from t1;
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (a int)
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM
slave-bin.000001 # Table_map # # table_id: # (test.t2)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
slave-bin.000001 # Table_map # # table_id: # (test.t2)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-bin.000001 # Xid # # COMMIT /* XID */
drop table t1;
drop table t2,t3;
include/rpl_end.inc

View File

@ -0,0 +1,144 @@
include/rpl_init.inc [topology=1->2]
create table t2 (a int) engine=myisam;
insert into t2 values (0),(1),(2),(2);
create temporary table t3 (a_in_temporary int) engine=myisam;
#
# Check how create table and create or replace table are logged
#
create table t1 (to_be_deleted int);
CREATE TABLE t1 AS SELECT 1 AS f1;
CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1;
CREATE OR REPLACE table t1 like t2;
CREATE OR REPLACE table t1 like t3;
drop table t1;
binlog from server 1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t2 (a int) engine=myisam
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t2 values (0),(1),(2),(2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create temporary table t3 (a_in_temporary int) engine=myisam
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT 1 AS f1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t3
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t2 (a int) engine=myisam
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; insert into t2 values (0),(1),(2),(2)
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create temporary table t3 (a_in_temporary int) engine=myisam
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (to_be_deleted int)
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT 1 AS f1
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t2
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE table t1 like t3
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
#
# Ensure that also failed create_or_replace are logged
#
create table t1 (a int);
create or replace table t1;
ERROR 42000: A table must have at least 1 column
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
create or replace table t1 (a int primary key) select a from t2;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
create table t1 (a int);
create or replace table t1 (a int primary key) select a from t2;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
binlog from server 1
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create or replace table t1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create or replace table t1 (a int primary key) select a from t2
show tables;
Tables_in_test
t2
drop table if exists t1,t2;
Warnings:
Note 1051 Unknown table 'test.t1'
#
# Ensure that CREATE are run as CREATE OR REPLACE on slave
#
create table t1 (server_2_to_be_delete int);
create table t1 (new_table int);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`new_table` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
# Ensure that DROP TABLE is run as DROP IF NOT EXISTS
#
create table t1 (server_1_ver_1 int);
create table t4 (server_1_ver_2 int);
drop table t1;
drop table t1,t4;
create table t1 (server_2_ver_2 int);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`server_2_ver_2` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t4` /* generated by server */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (server_2_ver_2 int)
drop table t1;
#
# Ensure that CREATE ... SELECT is recorded as one GTID on the slave
#
create table t1 (a int);
insert into t1 values (0),(1),(2);
create table t2 engine=myisam select * from t1;
create or replace table t2 engine=innodb select * from t1;
binlog from server 2
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t1 (a int)
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; insert into t1 values (0),(1),(2)
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create table t2 engine=myisam select * from t1
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; create or replace table t2 engine=innodb select * from t1
drop table t1;
drop table t2,t3;
include/rpl_end.inc

View File

@ -110,6 +110,8 @@ DROP TABLE t1;
SET SQL_LOG_BIN=1;
RESET SLAVE;
SET GLOBAL gtid_slave_pos="";
SET @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode;
SET GLOBAL slave_ddl_exec_mode=STRICT;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
@ -225,4 +227,5 @@ a
1
2
DROP TABLE t1;
set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode;
include/rpl_end.inc

View File

@ -1,23 +1,24 @@
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;
**** Resetting master and slave ****
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
include/start_slave.inc
CREATE TABLE t1 (a INT, b INT);
include/master-slave.inc
[connection master]
include/wait_for_slave_to_stop.inc
include/wait_for_slave_to_start.inc
include/rpl_reset.inc
CREATE TABLE t1 (a INT);
CREATE OR REPLACE 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 <binlog_start>;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (a INT, b INT)
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
**** On Master ****
SHOW CREATE TABLE t1;
@ -111,15 +112,10 @@ NULL 3 6
NULL 4 2
NULL 5 10
NULL 6 12
**** Resetting master and slave ****
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
include/start_slave.inc
include/rpl_reset.inc
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
ERROR 23000: Duplicate entry '2' for key 'b'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
include/show_binlog_events.inc
CREATE TABLE t7 (a INT, b INT UNIQUE);
INSERT INTO t7 SELECT a,b FROM tt3;
ERROR 23000: Duplicate entry '2' for key 'b'
@ -128,23 +124,20 @@ a b
1 2
2 4
3 6
show binlog events from <binlog_start>;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.t7)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
2 4
3 6
**** Resetting master and slave ****
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
include/start_slave.inc
include/rpl_reset.inc
CREATE TEMPORARY TABLE tt4 (a INT, b INT);
INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
BEGIN;
@ -152,11 +145,11 @@ 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 <binlog_start>;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.t7)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
SELECT * FROM t7 ORDER BY a,b;
a b
@ -174,11 +167,7 @@ a b
4 8
5 10
6 12
**** Resetting master and slave ****
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
include/start_slave.inc
include/rpl_reset.inc
CREATE TABLE t8 LIKE t4;
CREATE TABLE t9 LIKE tt4;
CREATE TEMPORARY TABLE tt5 LIKE t4;
@ -197,9 +186,11 @@ Create Table CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show binlog events from <binlog_start>;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t8 LIKE t4
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE `t9` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
@ -219,15 +210,12 @@ Create Table CREATE TABLE `t9` (
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
STOP SLAVE;
include/wait_for_slave_to_stop.inc
SET GLOBAL storage_engine=@storage_engine;
START SLAVE;
include/wait_for_slave_to_start.inc
================ BUG#22864 ================
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;
include/rpl_reset.inc
SET AUTOCOMMIT=0;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
@ -270,37 +258,38 @@ a
1
2
3
show binlog events from <binlog_start>;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE `t3` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
master-bin.000001 # Table_map # # table_id: # (test.t3)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE `t4` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB
master-bin.000001 # Table_map # # table_id: # (test.t4)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
SHOW TABLES;
Tables_in_test
@ -333,10 +322,7 @@ a
3
DROP TABLE IF EXISTS t1,t2,t3,t4;
SET AUTOCOMMIT=1;
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
START SLAVE;
include/rpl_reset.inc
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 (a INT) ENGINE=INNODB;
@ -355,19 +341,21 @@ a
4
6
9
show binlog events from <binlog_start>;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Write_rows_v1 # # 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 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
SELECT * FROM t2 ORDER BY a;
a
@ -377,11 +365,7 @@ a
6
9
TRUNCATE TABLE t2;
**** Resetting master and slave ****
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
include/start_slave.inc
include/rpl_reset.inc
BEGIN;
INSERT INTO t2 SELECT a*a FROM t1;
CREATE TEMPORARY TABLE tt2
@ -394,8 +378,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 <binlog_start>;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
SELECT * FROM t2 ORDER BY a;
a
DROP TABLE t1,t2;
@ -412,35 +402,28 @@ a
1
2
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;
include/rpl_reset.inc
DROP DATABASE IF EXISTS mysqltest1;
CREATE DATABASE mysqltest1;
CREATE TABLE mysqltest1.without_select (f1 BIGINT);
CREATE TABLE mysqltest1.with_select AS SELECT 1 AS f1;
show binlog events from <binlog_start>;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # DROP DATABASE IF EXISTS mysqltest1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # CREATE DATABASE mysqltest1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE mysqltest1.without_select (f1 BIGINT)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE `mysqltest1`.`with_select` (
`f1` int(1) NOT NULL DEFAULT '0'
)
master-bin.000001 # Table_map # # table_id: # (mysqltest1.with_select)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP DATABASE mysqltest1;
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;
include/rpl_reset.inc
CREATE TEMPORARY TABLE t7(c1 INT);
CREATE TABLE t5(c1 INT);
CREATE TABLE t4(c1 INT);
@ -461,4 +444,5 @@ DROP VIEW IF EXISTS bug48506_t1, bug48506_t2, bug48506_t3;
DROP TEMPORARY TABLES t7;
DROP TABLES t4, t5;
DROP TABLES IF EXISTS bug48506_t4;
include/rpl_end.inc
end of the tests

View File

@ -6,6 +6,8 @@ reset master;
reset slave;
start slave;
include/wait_for_slave_to_start.inc
set @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode;
set @@global.slave_ddl_exec_mode=STRICT;
create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
insert into t1 values (NULL);
drop table t1;
@ -287,4 +289,5 @@ a b
5 1
6 1
drop table t1;
set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode;
include/rpl_end.inc

View File

@ -6,6 +6,8 @@ reset master;
reset slave;
start slave;
include/wait_for_slave_to_start.inc
set @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode;
set @@global.slave_ddl_exec_mode=STRICT;
create table t1(n int not null auto_increment primary key)ENGINE=InnoDB;
insert into t1 values (NULL);
drop table t1;
@ -287,4 +289,5 @@ a b
5 1
6 1
drop table t1;
set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode;
include/rpl_end.inc

View File

@ -172,7 +172,7 @@ include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
slave-bin.000002 # Gtid # # GTID #-#-#
slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 2 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@ -181,7 +181,7 @@ slave-bin.000002 # Gtid # # GTID #-#-#
******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 2,3 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
******** [slave] SHOW BINLOG EVENTS ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info

View File

@ -6,6 +6,8 @@ reset master;
reset slave;
start slave;
include/wait_for_slave_to_start.inc
set @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode;
set @@global.slave_ddl_exec_mode=STRICT;
create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
insert into t1 values (NULL);
drop table t1;
@ -286,4 +288,5 @@ a b
5 1
6 1
drop table t1;
set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode;
include/rpl_end.inc

View File

@ -154,7 +154,7 @@ include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
slave-bin.000002 # Gtid # # GTID #-#-#
slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 2 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
@ -163,7 +163,7 @@ slave-bin.000002 # Gtid # # GTID #-#-#
******** [slave] SHOW BINLOG EVENTS IN <FILE> LIMIT 2,3 ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
slave-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
******** [slave] SHOW BINLOG EVENTS ********
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info

View File

@ -62,7 +62,7 @@ slave-bin.000001 # Query # # use `test`; ALTER TABLE t1_tmp ADD COLUMN b INT
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t1_tmp` /* generated by server */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
@ -73,7 +73,7 @@ slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
slave-bin.000001 # Xid # # COMMIT /* XID */
slave-bin.000001 # Gtid # # GTID #-#-#
slave-bin.000001 # Query # # use `test`; DROP TABLE `t3`,`t1` /* generated by server */
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t3`,`t1` /* generated by server */
# Bug#55478 Row events wrongly apply on the temporary table of the same name
# ==========================================================================

View File

@ -0,0 +1,137 @@
# Test CREATE OR REPLACE TABLE in replication
--source include/have_innodb.inc
--let $rpl_topology=1->2
--source include/rpl_init.inc
# Create help tables
create table t2 (a int) engine=myisam;
insert into t2 values (0),(1),(2),(2);
create temporary table t3 (a_in_temporary int) engine=myisam;
--echo #
--echo # Check how create table and create or replace table are logged
--echo #
save_master_pos;
connection server_2;
sync_with_master;
create table t1 (to_be_deleted int);
connection server_1;
CREATE TABLE t1 AS SELECT 1 AS f1;
CREATE OR REPLACE TABLE t1 AS SELECT 2 AS f1;
CREATE OR REPLACE table t1 like t2;
CREATE OR REPLACE table t1 like t3;
drop table t1;
--echo binlog from server 1
--source include/show_binlog_events.inc
save_master_pos;
connection server_2;
sync_with_master;
--echo binlog from server 2
--source include/show_binlog_events.inc
connection server_1;
--echo #
--echo # Ensure that also failed create_or_replace are logged
--echo #
--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
create table t1 (a int);
--error ER_TABLE_MUST_HAVE_COLUMNS
create or replace table t1;
drop table if exists t1;
# The following is not logged as t1 does not exists;
--error ER_DUP_ENTRY
create or replace table t1 (a int primary key) select a from t2;
create table t1 (a int);
# This should be logged as we will delete t1
--error ER_DUP_ENTRY
create or replace table t1 (a int primary key) select a from t2;
--echo binlog from server 1
--source include/show_binlog_events.inc
save_master_pos;
connection server_2;
sync_with_master;
show tables;
connection server_1;
drop table if exists t1,t2;
--echo #
--echo # Ensure that CREATE are run as CREATE OR REPLACE on slave
--echo #
save_master_pos;
connection server_2;
sync_with_master;
create table t1 (server_2_to_be_delete int);
connection server_1;
create table t1 (new_table int);
save_master_pos;
connection server_2;
sync_with_master;
show create table t1;
connection server_1;
drop table t1;
--echo #
--echo # Ensure that DROP TABLE is run as DROP IF NOT EXISTS
--echo #
create table t1 (server_1_ver_1 int);
create table t4 (server_1_ver_2 int);
save_master_pos;
connection server_2;
sync_with_master;
--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
# Drop the table on the slave
drop table t1;
connection server_1;
drop table t1,t4;
create table t1 (server_2_ver_2 int);
save_master_pos;
connection server_2;
sync_with_master;
show create table t1;
--echo binlog from server 2
--source include/show_binlog_events.inc
connection server_1;
drop table t1;
--echo #
--echo # Ensure that CREATE ... SELECT is recorded as one GTID on the slave
--echo #
save_master_pos;
connection server_2;
sync_with_master;
--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
connection server_1;
create table t1 (a int);
insert into t1 values (0),(1),(2);
create table t2 engine=myisam select * from t1;
create or replace table t2 engine=innodb select * from t1;
save_master_pos;
connection server_2;
sync_with_master;
--echo binlog from server 2
--source include/show_binlog_events.inc
connection server_1;
drop table t1;
# Clean up
drop table t2,t3;
--source include/rpl_end.inc

View File

@ -0,0 +1,9 @@
!include suite/rpl/my.cnf
[mysqld.1]
log-slave-updates
loose-innodb
[mysqld.2]
log-slave-updates
loose-innodb

View File

@ -0,0 +1,4 @@
# Testing create or replace table in mixed mode.
--source include/have_binlog_format_mixed.inc
--source create_or_replace.inc

View File

@ -0,0 +1,9 @@
!include suite/rpl/my.cnf
[mysqld.1]
log-slave-updates
loose-innodb
[mysqld.2]
log-slave-updates
loose-innodb

View File

@ -0,0 +1,4 @@
# Testing create or replace table in mixed mode.
--source include/have_binlog_format_row.inc
--source create_or_replace.inc

View File

@ -0,0 +1,9 @@
!include suite/rpl/my.cnf
[mysqld.1]
log-slave-updates
loose-innodb
[mysqld.2]
log-slave-updates
loose-innodb

View File

@ -0,0 +1,4 @@
# Testing create or replace table in mixed mode.
--source include/have_binlog_format_statement.inc
--source create_or_replace.inc

View File

@ -52,6 +52,8 @@ CREATE DATABASE IF NOT EXISTS mysqltest;
USE mysqltest;
CREATE TABLE IF NOT EXISTS t(c1 int);
CREATE TABLE IF NOT EXISTS t1 LIKE t;
# The following will not be logged because t2 existed and we will not
# put the data of SELECT into the binary log
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t;
CREATE EVENT IF NOT EXISTS e
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
@ -104,7 +106,7 @@ SELECT * FROM t1;
SELECT * FROM t2;
sync_slave_with_master;
# In these two statements, t1 and t2 are the base table. The recoreds of t2
# In these two statements, t1 and t2 are the base table. The records of t2
# are inserted into it when CREATE TABLE ... SELECT was executed.
SELECT * FROM t1;
SELECT * FROM t2;

View File

@ -165,7 +165,7 @@ SET GLOBAL gtid_slave_pos="";
SELECT * FROM t1 ORDER BY a;
# Same thing, but this time using SQL_LOG_BIN=0 to avoid polliting the
# Same thing, but this time using SQL_LOG_BIN=0 to avoid polluting the
# slave binlog.
--connection server_2
@ -175,6 +175,9 @@ DROP TABLE t1;
SET SQL_LOG_BIN=1;
RESET SLAVE;
SET GLOBAL gtid_slave_pos="";
# Ensure that the slave fails because of missing table to be dropped
SET @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode;
SET GLOBAL slave_ddl_exec_mode=STRICT;
--source include/start_slave.inc
--sync_with_master
@ -349,6 +352,7 @@ SELECT * FROM t1 ORDER BY a;
# Clean up.
--connection server_1
DROP TABLE t1;
--connection server_2
set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode;
--source include/rpl_end.inc

View File

@ -28,7 +28,8 @@ START SLAVE;
--source include/rpl_reset.inc
connection master;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t1 (a INT);
CREATE OR REPLACE 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;

View File

@ -4,7 +4,5 @@
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_log.test
# End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012: Delete me
--source include/rpl_end.inc

View File

@ -1,20 +1,20 @@
select @@global.back_log;
@@global.back_log
50
150
select @@session.back_log;
ERROR HY000: Variable 'back_log' is a GLOBAL variable
show global variables like 'back_log';
Variable_name Value
back_log 50
back_log 150
show session variables like 'back_log';
Variable_name Value
back_log 50
back_log 150
select * from information_schema.global_variables where variable_name='back_log';
VARIABLE_NAME VARIABLE_VALUE
BACK_LOG 50
BACK_LOG 150
select * from information_schema.session_variables where variable_name='back_log';
VARIABLE_NAME VARIABLE_VALUE
BACK_LOG 50
BACK_LOG 150
set global back_log=1;
ERROR HY000: Variable 'back_log' is a read only variable
set session back_log=1;

View File

@ -0,0 +1,39 @@
SET @start_value = @@global.slave_ddl_exec_mode;
SELECT @@global.slave_ddl_exec_mode;
@@global.slave_ddl_exec_mode
IDEMPOTENT
SELECT @@slave_ddl_exec_mode = @@GLOBAL.slave_ddl_exec_mode;
@@slave_ddl_exec_mode = @@GLOBAL.slave_ddl_exec_mode
1
1 Expected
SELECT COUNT(@@slave_ddl_exec_mode);
COUNT(@@slave_ddl_exec_mode)
1
1 Expected
SELECT COUNT(@@local.slave_ddl_exec_mode);
ERROR HY000: Variable 'slave_ddl_exec_mode' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@SESSION.slave_ddl_exec_mode);
ERROR HY000: Variable 'slave_ddl_exec_mode' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.slave_ddl_exec_mode);
COUNT(@@GLOBAL.slave_ddl_exec_mode)
1
1 Expected
SELECT slave_ddl_exec_mode = @@SESSION.version;
ERROR 42S22: Unknown column 'slave_ddl_exec_mode' in 'field list'
Expected error 'Readonly variable'
SET @@GLOBAL.slave_ddl_exec_mode=STRICT;
SELECT @@GLOBAL.slave_ddl_exec_mode;
@@GLOBAL.slave_ddl_exec_mode
STRICT
SET @@GLOBAL.slave_ddl_exec_mode=IDEMPOTENT;
SELECT @@GLOBAL.slave_ddl_exec_mode;
@@GLOBAL.slave_ddl_exec_mode
IDEMPOTENT
SET @@GLOBAL.slave_ddl_exec_mode=XXX;
ERROR 42000: Variable 'slave_ddl_exec_mode' can't be set to the value of 'XXX'
SELECT @@GLOBAL.slave_ddl_exec_mode;
@@GLOBAL.slave_ddl_exec_mode
IDEMPOTENT
SET @@global.slave_ddl_exec_mode= @start_value;

View File

@ -0,0 +1,53 @@
'#---------------------BS_STVARS_053_01----------------------#'
SELECT COUNT(@@GLOBAL.version_malloc_library);
COUNT(@@GLOBAL.version_malloc_library)
1
1 Expected
'#---------------------BS_STVARS_053_02----------------------#'
SET @@GLOBAL.version_malloc_library=1;
ERROR HY000: Variable 'version_malloc_library' is a read only variable
Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.version_malloc_library);
COUNT(@@GLOBAL.version_malloc_library)
1
1 Expected
'#---------------------BS_STVARS_053_03----------------------#'
SELECT @@GLOBAL.version_malloc_library = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='version_malloc_library';
@@GLOBAL.version_malloc_library = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.version_malloc_library);
COUNT(@@GLOBAL.version_malloc_library)
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='version_malloc_library';
COUNT(VARIABLE_VALUE)
1
1 Expected
'#---------------------BS_STVARS_053_04----------------------#'
SELECT @@version_malloc_library = @@GLOBAL.version_malloc_library;
@@version_malloc_library = @@GLOBAL.version_malloc_library
1
1 Expected
'#---------------------BS_STVARS_053_05----------------------#'
SELECT COUNT(@@version_malloc_library);
COUNT(@@version_malloc_library)
1
1 Expected
SELECT COUNT(@@local.version_malloc_library);
ERROR HY000: Variable 'version_malloc_library' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@SESSION.version_malloc_library);
ERROR HY000: Variable 'version_malloc_library' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.version_malloc_library);
COUNT(@@GLOBAL.version_malloc_library)
1
1 Expected
SELECT version_malloc_library = @@SESSION.version;
ERROR 42S22: Unknown column 'version_malloc_library' in 'field list'
Expected error 'Readonly variable'

View File

@ -0,0 +1,67 @@
############## mysql-test\t\slave_ddl_exec_mode_basic.test ####################
# #
# Variable Name: slave_ddl_exec_mode #
# Scope: GLOBAL & SESSION #
# Access Type: Dynamic #
# Data Type: Numeric #
# Default Value: 1 #
# Range: 1 - 65536 #
# #
# #
# Description: Test Cases of Dynamic System Variable slave_ddl_exec_mode #
# that checks the behavior of this variable in the following ways#
# * Default Value #
# * Valid & Invalid values #
# * Scope & Access method #
# * Data Integrity #
# #
###############################################################################
--source include/not_embedded.inc
--source include/load_sysvars.inc
########################################################################
# START OF slave_ddl_exec_mode TESTS #
########################################################################
SET @start_value = @@global.slave_ddl_exec_mode;
SELECT @@global.slave_ddl_exec_mode;
SELECT @@slave_ddl_exec_mode = @@GLOBAL.slave_ddl_exec_mode;
--echo 1 Expected
SELECT COUNT(@@slave_ddl_exec_mode);
--echo 1 Expected
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@local.slave_ddl_exec_mode);
--echo Expected error 'Variable is a GLOBAL variable'
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@SESSION.slave_ddl_exec_mode);
--echo Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.slave_ddl_exec_mode);
--echo 1 Expected
--Error ER_BAD_FIELD_ERROR
SELECT slave_ddl_exec_mode = @@SESSION.version;
--echo Expected error 'Readonly variable'
SET @@GLOBAL.slave_ddl_exec_mode=STRICT;
SELECT @@GLOBAL.slave_ddl_exec_mode;
SET @@GLOBAL.slave_ddl_exec_mode=IDEMPOTENT;
SELECT @@GLOBAL.slave_ddl_exec_mode;
--error ER_WRONG_VALUE_FOR_VAR
SET @@GLOBAL.slave_ddl_exec_mode=XXX;
SELECT @@GLOBAL.slave_ddl_exec_mode;
SET @@global.slave_ddl_exec_mode= @start_value;
########################################################################
# END OF slave_ddl_exec_mode TESTS #
########################################################################

View File

@ -0,0 +1,90 @@
################## mysql-test\t\version_malloc_library.test ###################
# #
# Variable Name: version_malloc_library #
# Scope: Global #
# Access Type: Static #
# Data Type: String #
# #
# Description:Test Cases of Dynamic System Variable version #
# that checks the behavior of this variable in the following ways #
# * Value Check #
# * Scope Check #
# #
###############################################################################
--echo '#---------------------BS_STVARS_053_01----------------------#'
####################################################################
# Displaying default value #
####################################################################
SELECT COUNT(@@GLOBAL.version_malloc_library);
--echo 1 Expected
--echo '#---------------------BS_STVARS_053_02----------------------#'
####################################################################
# Check if Value can set #
####################################################################
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@GLOBAL.version_malloc_library=1;
--echo Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.version_malloc_library);
--echo 1 Expected
--echo '#---------------------BS_STVARS_053_03----------------------#'
#################################################################
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
SELECT @@GLOBAL.version_malloc_library = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='version_malloc_library';
--echo 1 Expected
SELECT COUNT(@@GLOBAL.version_malloc_library);
--echo 1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='version_malloc_library';
--echo 1 Expected
--echo '#---------------------BS_STVARS_053_04----------------------#'
###############################################################################
# Check if accessing variable with and without GLOBAL point to same variable #
###############################################################################
SELECT @@version_malloc_library = @@GLOBAL.version_malloc_library;
--echo 1 Expected
--echo '#---------------------BS_STVARS_053_05----------------------#'
###############################################################################
# Check if version_malloc_library can be accessed with and without @@ sign #
###############################################################################
SELECT COUNT(@@version_malloc_library);
--echo 1 Expected
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@local.version_malloc_library);
--echo Expected error 'Variable is a GLOBAL variable'
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@SESSION.version_malloc_library);
--echo Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.version_malloc_library);
--echo 1 Expected
--Error ER_BAD_FIELD_ERROR
SELECT version_malloc_library = @@SESSION.version;
--echo Expected error 'Readonly variable'

View File

@ -2014,6 +2014,8 @@ create table t1 (a int, b int);
create table t1 (a int, b int) select 2,2;
--error ER_TABLE_EXISTS_ERROR
create table t1 like t2;
--error ER_LOCK_WAIT_TIMEOUT
create or replace table t1 (a int, b int) select 2,2;
disconnect user1;
connection default;
select * from t1;

View File

@ -0,0 +1 @@
--log-output=TABLE,FILE --general-log=1 --slow-query-log=1

View File

@ -0,0 +1,293 @@
#
# Check CREATE OR REPLACE ALTER TABLE
#
--source include/have_innodb.inc
--source include/have_metadata_lock_info.inc
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
#
# Create help table
#
CREATE TABLE t2 (a int);
INSERT INTO t2 VALUES(1),(2),(3);
--echo #
--echo # Check first syntax and wrong usage
--echo #
--error ER_WRONG_USAGE
CREATE OR REPLACE TABLE IF NOT EXISTS t1 (a int);
--error ER_WRONG_USAGE
create or replace trigger trg before insert on t1 for each row set @a:=1;
# check that we don't try to create a log table in use
--error ER_BAD_LOG_STATEMENT
create or replace table mysql.general_log (a int);
--error ER_BAD_LOG_STATEMENT
create or replace table mysql.slow_log (a int);
--echo #
--echo # Usage when table doesn't exist
--echo #
CREATE OR REPLACE TABLE t1 (a int);
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 (a int);
DROP TABLE t1;
CREATE OR REPLACE TEMPORARY TABLE t1 (a int);
--error ER_TABLE_EXISTS_ERROR
CREATE TEMPORARY TABLE t1 (a int, b int, c int);
DROP TEMPORARY TABLE t1;
--echo #
--echo # Testing with temporary tables
--echo #
CREATE OR REPLACE TABLE t1 (a int);
CREATE OR REPLACE TEMPORARY TABLE t1 (a int);
CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int);
SHOW CREATE TABLE t1;
DROP TEMPORARY TABLE t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Test also with InnoDB
create temporary table t1 (i int) engine=InnoDB;
create or replace temporary table t1 (a int, b int) engine=InnoDB;
create or replace temporary table t1 (j int);
show create table t1;
drop table t1;
# Using lock tables on normal tables with create or replace on temp tables
CREATE OR REPLACE TABLE t1 (a int);
LOCK TABLES t1 write;
CREATE OR REPLACE TEMPORARY TABLE t1 (a int);
CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int);
CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int) engine= innodb;
CREATE OR REPLACE TEMPORARY TABLE t1 (a int) engine= innodb;
CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int) engine=myisam;
SHOW CREATE TABLE t1;
DROP TEMPORARY TABLE t1;
SHOW CREATE TABLE t1;
# Verify that table is still locked
--error ER_TABLE_NOT_LOCKED
CREATE OR REPLACE TABLE t2 (a int);
DROP TABLE t1;
UNLOCK TABLES;
#
# Using CREATE SELECT
#
CREATE OR REPLACE TEMPORARY TABLE t1 (a int) SELECT * from t2;
SELECT * FROM t1;
CREATE OR REPLACE TEMPORARY TABLE t1 (b int) SELECT * from t2;
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT a FROM t2;
CREATE TEMPORARY TABLE IF NOT EXISTS t1(a int, b int) SELECT 1,2 FROM t2;
DROP TABLE t1;
CREATE TABLE t1 (a int);
CREATE OR REPLACE TABLE t1 AS SELECT 1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
create table t1 (a int);
--error ER_UPDATE_TABLE_USED
create or replace table t1 as select * from t1;
--error ER_UPDATE_TABLE_USED
create or replace table t1 as select a from (select a from t1) as t3;
--error ER_UPDATE_TABLE_USED
create or replace table t1 as select a from t2 where t2.a in (select a from t1);
drop table t1;
--echo #
--echo # Testing with normal tables
--echo #
CREATE OR REPLACE TABLE t1 (a int);
CREATE OR REPLACE TABLE t1 (a int, b int);
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a int) SELECT * from t2;
SELECT * FROM t1;
TRUNCATE TABLE t1;
CREATE TABLE IF NOT EXISTS t1 (a int) SELECT * from t2;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (i int);
CREATE OR REPLACE TABLE t1 AS SELECT 1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Using lock tables with CREATE OR REPLACE
CREATE OR REPLACE TABLE t1 (a int);
LOCK TABLES t1 write,t2 write;
CREATE OR REPLACE TABLE t1 (a int, b int);
# Verify if table is still locked
SELECT * FROM t1;
INSERT INTO t1 values(1,1);
CREATE OR REPLACE TABLE t1 (a int, b int, c int);
INSERT INTO t1 values(1,1,1);
--error ER_TABLE_NOT_LOCKED
CREATE OR REPLACE TABLE t3 (a int);
UNLOCK TABLES;
DROP TABLE t1;
# Using lock tables with CREATE OR REPLACE ... SELECT
CREATE OR REPLACE TABLE t1 (a int);
LOCK TABLES t1 write,t2 write;
CREATE OR REPLACE TABLE t1 (a int, b int) select a,1 from t2;
# Verify if table is still locked
SELECT * FROM t2;
SELECT * FROM t1;
SELECT * FROM t1;
INSERT INTO t1 values(1,1,1);
CREATE OR REPLACE TABLE t1 (a int, b int, c int, d int);
INSERT INTO t1 values(1,1,1,1);
--error ER_TABLE_NOT_LOCKED
CREATE OR REPLACE TABLE t3 (a int);
UNLOCK TABLES;
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (a int);
LOCK TABLES t1 write,t2 write, t1 as t1_read read;
CREATE OR REPLACE TABLE t1 (a int, b int) select a,1 from t2;
SELECT * FROM t1;
SELECT * FROM t2;
--error ER_TABLE_NOT_LOCKED
SELECT * FROM t1 as t1_read;
DROP TABLE t1;
UNLOCK TABLES;
CREATE OR REPLACE TABLE t1 (a int);
LOCK TABLE t1 WRITE;
CREATE OR REPLACE TABLE t1 AS SELECT 1;
SELECT * from t1;
--error ER_TABLE_NOT_LOCKED
SELECT * from t2;
DROP TABLE t1;
--echo #
--echo # Test also with InnoDB (transactional engine)
--echo #
create table t1 (i int) engine=innodb;
lock table t1 write;
create or replace table t1 (j int);
unlock tables;
show create table t1;
drop table t1;
create table t1 (i int) engine=InnoDB;
lock table t1 write, t2 write;
create or replace table t1 (j int) engine=innodb;
unlock tables;
drop table t1;
create table t1 (i int) engine=InnoDB;
create table t3 (i int) engine=InnoDB;
insert into t3 values(1),(2),(3);
lock table t1 write, t2 write, t3 write;
create or replace table t1 (a int, i int) engine=innodb select t2.a,t3.i from t2,t3;
unlock tables;
select * from t1 order by a,i;
drop table t1,t3;
--echo #
--echo # Testing CREATE .. LIKE
--echo #
create or replace table t1 like t2;
create or replace table t1 like t2;
show create table t1;
drop table t1;
create table t1 (b int);
lock tables t1 write, t2 read;
create or replace table t1 like t2;
SELECT * FROM t1;
INSERT INTO t1 values(1);
CREATE OR REPLACE TABLE t1 like t2;
INSERT INTO t1 values(2);
unlock tables;
show create table t1;
drop table t1;
create or replace table t1 like t2;
--error ER_NONUNIQ_TABLE
create or replace table t1 like t1;
drop table t1;
CREATE TEMPORARY TABLE t1 like t2;
--error ER_NONUNIQ_TABLE
CREATE OR REPLACE TABLE t1 like t1;
--error ER_NONUNIQ_TABLE
CREATE OR REPLACE TABLE t1 like t1;
drop table t1;
CREATE TEMPORARY TABLE t1 like t2;
CREATE OR REPLACE TEMPORARY TABLE t3 like t1;
--error ER_NONUNIQ_TABLE
CREATE OR REPLACE TEMPORARY TABLE t3 like t3;
drop table t1,t3;
--echo #
--echo # Test with prepared statements
--echo #
prepare stmt1 from 'create or replace table t1 select * from t2';
execute stmt1;
select * from t1;
execute stmt1;
select * from t1;
drop table t1;
execute stmt1;
select * from t1;
deallocate prepare stmt1;
drop table t1;
--echo #
--echo # Test with views
--echo #
create view t1 as select 1;
create table if not exists t1 (a int);
--error ER_IT_IS_A_VIEW
create or replace table t1 (a int);
--error ER_IT_IS_A_VIEW
drop table t1;
drop view t1;
--echo #
--echo # MDEV-5602 CREATE OR REPLACE obtains stricter locks than the
--echo # connection had before
--echo #
create table t1 (a int);
lock table t1 write, t2 read;
--replace_column 1 #
select * from information_schema.metadata_lock_info;
create or replace table t1 (i int);
--replace_column 1 #
select * from information_schema.metadata_lock_info;
create or replace table t1 like t2;
--replace_column 1 #
select * from information_schema.metadata_lock_info;
create or replace table t1 select 1 as f1;
--replace_column 1 #
select * from information_schema.metadata_lock_info;
drop table t1;
unlock tables;
#
# Cleanup
#
DROP TABLE t2;

View File

@ -20,7 +20,9 @@ perl;
# their paths may vary:
@skipvars=qw/basedir open-files-limit general-log-file log plugin-dir
log-slow-queries pid-file slow-query-log-file log-basename
datadir slave-load-tmpdir tmpdir socket thread-pool-size/;
datadir slave-load-tmpdir tmpdir socket thread-pool-size
large-files-support lower-case-file-system system-time-zone
version.*/;
# Plugins which may or may not be there:
@plugins=qw/innodb ndb archive blackhole federated partition ndbcluster

View File

@ -439,7 +439,7 @@ CREATE TABLE t LIKE general_log;
ALTER TABLE t PARTITION BY RANGE (UNIX_TIMESTAMP(event_time) DIV 1)
(PARTITION p0 VALUES LESS THAN (123456789),
PARTITION pMAX VALUES LESS THAN MAXVALUE);
--error ER_WRONG_USAGE
--error ER_BAD_LOG_STATEMENT
ALTER TABLE t EXCHANGE PARTITION p0 WITH TABLE general_log;
ALTER TABLE general_log ENGINE = CSV;
SET @@global.general_log = @old_general_log_state;

View File

@ -1610,7 +1610,7 @@ call p_verify_reprepare_count(0);
# Base table with name of table to be created exists
--error ER_TABLE_EXISTS_ERROR
execute stmt;
call p_verify_reprepare_count(1);
call p_verify_reprepare_count(0);
--error ER_TABLE_EXISTS_ERROR
execute stmt;
call p_verify_reprepare_count(0);
@ -1622,7 +1622,7 @@ execute stmt;
call p_verify_reprepare_count(0);
--error ER_TABLE_EXISTS_ERROR
execute stmt;
call p_verify_reprepare_count(1);
call p_verify_reprepare_count(0);
drop temporary table t2;
--error ER_TABLE_EXISTS_ERROR
execute stmt;
@ -1641,7 +1641,7 @@ drop table t2;
create view t2 as select 1;
--error ER_TABLE_EXISTS_ERROR,9999
execute stmt;
call p_verify_reprepare_count(1);
call p_verify_reprepare_count(0);
--error ER_TABLE_EXISTS_ERROR,9999
execute stmt;
call p_verify_reprepare_count(0);

View File

@ -141,7 +141,7 @@ drop view v100;
drop view t1;
# try to drop VIEW with DROP TABLE
-- error ER_BAD_TABLE_ERROR
-- error ER_IT_IS_A_VIEW
drop table v1;
# try to drop table with DROP VIEW

View File

@ -117,6 +117,15 @@
fun:pthread_create
}
{
pthread memalign memory loss2
Memcheck:Leak
fun:memalign
fun:tls_get_addr_tail
...
fun:*ha_initialize_handlerton*
}
{
pthread pthread_key_create
Memcheck:Leak

View File

@ -167,10 +167,10 @@ static inline uint get_first_set(my_bitmap_map value, uint word_pos)
}
my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
my_bool thread_safe __attribute__((unused)))
my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
my_bool thread_safe __attribute__((unused)))
{
DBUG_ENTER("bitmap_init");
DBUG_ENTER("my_bitmap_init");
if (!buf)
{
uint size_in_bytes= bitmap_buffer_size(n_bits);
@ -202,9 +202,9 @@ my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
}
void bitmap_free(MY_BITMAP *map)
void my_bitmap_free(MY_BITMAP *map)
{
DBUG_ENTER("bitmap_free");
DBUG_ENTER("my_bitmap_free");
if (map->bitmap)
{
if (map->mutex)

View File

@ -150,4 +150,4 @@ error:
my_osmaperr(last_error);
DBUG_RETURN(-1);
}
#endif
#endif

View File

@ -37,6 +37,7 @@ static const LEX_STRING metadata_lock_info_lock_mode[] = {
{ C_STRING_WITH_LEN("MDL_SHARED_HIGH_PRIO") },
{ C_STRING_WITH_LEN("MDL_SHARED_READ") },
{ C_STRING_WITH_LEN("MDL_SHARED_WRITE") },
{ C_STRING_WITH_LEN("MDL_SHARED_UPGRADABLE") },
{ C_STRING_WITH_LEN("MDL_SHARED_NO_WRITE") },
{ C_STRING_WITH_LEN("MDL_SHARED_NO_READ_WRITE") },
{ C_STRING_WITH_LEN("MDL_EXCLUSIVE") },

View File

@ -5,7 +5,7 @@ GET_LOCK('LOCK1',0)
1
SELECT lock_mode, lock_duration, lock_type, table_schema, table_name FROM information_schema.metadata_lock_info;
lock_mode lock_duration lock_type table_schema table_name
MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT User lock LOCK1
MDL_SHARED_NO_WRITE MDL_EXPLICIT User lock LOCK1
SELECT RELEASE_LOCK('LOCK1');
RELEASE_LOCK('LOCK1')
1

View File

@ -446,7 +446,7 @@ int ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table)
alloc_root(mem_root, no_nodes * sizeof(MY_BITMAP));
for (i= 0; i < no_nodes; i++)
{
bitmap_init(&share->subscriber_bitmap[i],
my_bitmap_init(&share->subscriber_bitmap[i],
(Uint32*)alloc_root(mem_root, max_ndb_nodes/8),
max_ndb_nodes, FALSE);
bitmap_clear_all(&share->subscriber_bitmap[i]);
@ -1119,7 +1119,7 @@ ndbcluster_update_slock(THD *thd,
MY_BITMAP slock;
uint32 bitbuf[SCHEMA_SLOCK_SIZE/4];
bitmap_init(&slock, bitbuf, sizeof(bitbuf)*8, false);
my_bitmap_init(&slock, bitbuf, sizeof(bitbuf)*8, false);
if (ndbtab == 0)
{
@ -1370,7 +1370,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
{
int i, updated= 0;
int no_storage_nodes= g_ndb_cluster_connection->no_db_nodes();
bitmap_init(&schema_subscribers, bitbuf, sizeof(bitbuf)*8, FALSE);
my_bitmap_init(&schema_subscribers, bitbuf, sizeof(bitbuf)*8, FALSE);
bitmap_set_all(&schema_subscribers);
/* begin protect ndb_schema_share */
@ -1908,7 +1908,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
Cluster_schema *schema= (Cluster_schema *)
sql_alloc(sizeof(Cluster_schema));
MY_BITMAP slock;
bitmap_init(&slock, schema->slock, 8*SCHEMA_SLOCK_SIZE, FALSE);
my_bitmap_init(&slock, schema->slock, 8*SCHEMA_SLOCK_SIZE, FALSE);
uint node_id= g_ndb_cluster_connection->node_id();
{
ndbcluster_get_schema(tmp_share, schema);
@ -3353,7 +3353,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
MY_BITMAP b;
/* Potential buffer for the bitmap */
uint32 bitbuf[128 / (sizeof(uint32) * 8)];
bitmap_init(&b, n_fields <= sizeof(bitbuf) * 8 ? bitbuf : NULL,
my_bitmap_init(&b, n_fields <= sizeof(bitbuf) * 8 ? bitbuf : NULL,
n_fields, FALSE);
bitmap_set_all(&b);
@ -3573,7 +3573,7 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key,
break;
}
mysql_mutex_init(key_ndb_schema_object_mutex, &ndb_schema_object->mutex, MY_MUTEX_INIT_FAST);
bitmap_init(&ndb_schema_object->slock_bitmap, ndb_schema_object->slock,
my_bitmap_init(&ndb_schema_object->slock_bitmap, ndb_schema_object->slock,
sizeof(ndb_schema_object->slock)*8, FALSE);
bitmap_clear_all(&ndb_schema_object->slock_bitmap);
break;

View File

@ -350,18 +350,18 @@ class Ndb_cond_traverse_context : public Sql_alloc
skip(0), collation(NULL), rewrite_stack(NULL)
{
// Allocate type checking bitmaps
bitmap_init(&expect_mask, 0, 512, FALSE);
bitmap_init(&expect_field_type_mask, 0, 512, FALSE);
bitmap_init(&expect_field_result_mask, 0, 512, FALSE);
my_bitmap_init(&expect_mask, 0, 512, FALSE);
my_bitmap_init(&expect_field_type_mask, 0, 512, FALSE);
my_bitmap_init(&expect_field_result_mask, 0, 512, FALSE);
if (stack)
cond_ptr= stack->ndb_cond;
};
~Ndb_cond_traverse_context()
{
bitmap_free(&expect_mask);
bitmap_free(&expect_field_type_mask);
bitmap_free(&expect_field_result_mask);
my_bitmap_free(&expect_mask);
my_bitmap_free(&expect_field_type_mask);
my_bitmap_free(&expect_field_result_mask);
if (rewrite_stack) delete rewrite_stack;
}
void expect(Item::Type type)

View File

@ -3318,10 +3318,10 @@ err:
void ha_partition::free_partition_bitmaps()
{
/* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */
bitmap_free(&m_bulk_insert_started);
bitmap_free(&m_locked_partitions);
bitmap_free(&m_partitions_to_reset);
bitmap_free(&m_key_not_found_partitions);
my_bitmap_free(&m_bulk_insert_started);
my_bitmap_free(&m_locked_partitions);
my_bitmap_free(&m_partitions_to_reset);
my_bitmap_free(&m_key_not_found_partitions);
}
@ -3333,14 +3333,14 @@ bool ha_partition::init_partition_bitmaps()
{
DBUG_ENTER("ha_partition::init_partition_bitmaps");
/* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */
if (bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
if (my_bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
DBUG_RETURN(true);
bitmap_clear_all(&m_bulk_insert_started);
/* Initialize the bitmap we use to keep track of locked partitions */
if (bitmap_init(&m_locked_partitions, NULL, m_tot_parts, FALSE))
if (my_bitmap_init(&m_locked_partitions, NULL, m_tot_parts, FALSE))
{
bitmap_free(&m_bulk_insert_started);
my_bitmap_free(&m_bulk_insert_started);
DBUG_RETURN(true);
}
bitmap_clear_all(&m_locked_partitions);
@ -3349,10 +3349,10 @@ bool ha_partition::init_partition_bitmaps()
Initialize the bitmap we use to keep track of partitions which may have
something to reset in ha_reset().
*/
if (bitmap_init(&m_partitions_to_reset, NULL, m_tot_parts, FALSE))
if (my_bitmap_init(&m_partitions_to_reset, NULL, m_tot_parts, FALSE))
{
bitmap_free(&m_bulk_insert_started);
bitmap_free(&m_locked_partitions);
my_bitmap_free(&m_bulk_insert_started);
my_bitmap_free(&m_locked_partitions);
DBUG_RETURN(true);
}
bitmap_clear_all(&m_partitions_to_reset);
@ -3361,11 +3361,11 @@ bool ha_partition::init_partition_bitmaps()
Initialize the bitmap we use to keep track of partitions which returned
HA_ERR_KEY_NOT_FOUND from index_read_map.
*/
if (bitmap_init(&m_key_not_found_partitions, NULL, m_tot_parts, FALSE))
if (my_bitmap_init(&m_key_not_found_partitions, NULL, m_tot_parts, FALSE))
{
bitmap_free(&m_bulk_insert_started);
bitmap_free(&m_locked_partitions);
bitmap_free(&m_partitions_to_reset);
my_bitmap_free(&m_bulk_insert_started);
my_bitmap_free(&m_locked_partitions);
my_bitmap_free(&m_partitions_to_reset);
DBUG_RETURN(true);
}
bitmap_clear_all(&m_key_not_found_partitions);

View File

@ -1251,7 +1251,8 @@ int ha_commit_trans(THD *thd, bool all)
the changes are not durable as they might be rolled back if the
enclosing 'all' transaction is rolled back.
*/
bool is_real_trans= all || thd->transaction.all.ha_list == 0;
bool is_real_trans= ((all || thd->transaction.all.ha_list == 0) &&
!(thd->variables.option_bits & OPTION_GTID_BEGIN));
Ha_trx_info *ha_info= trans->ha_list;
bool need_prepare_ordered, need_commit_ordered;
my_xid xid;
@ -1266,7 +1267,7 @@ int ha_commit_trans(THD *thd, bool all)
ER(ER_WARNING_NOT_COMPLETE_ROLLBACK)););
DBUG_PRINT("info",
("all: %d thd->in_sub_stmt: %d ha_info: %p is_real_trans: %d",
("all: %d thd->in_sub_stmt: %d ha_info: %p is_real_trans: %d",
all, thd->in_sub_stmt, ha_info, is_real_trans));
/*
We must not commit the normal transaction if a statement
@ -1476,7 +1477,8 @@ int ha_commit_one_phase(THD *thd, bool all)
ha_commit_one_phase() can be called with an empty
transaction.all.ha_list, see why in trans_register_ha()).
*/
bool is_real_trans=all || thd->transaction.all.ha_list == 0;
bool is_real_trans= ((all || thd->transaction.all.ha_list == 0) &&
!(thd->variables.option_bits & OPTION_GTID_BEGIN));
int res;
DBUG_ENTER("ha_commit_one_phase");
if (is_real_trans)
@ -5731,7 +5733,7 @@ static int binlog_log_row(TABLE* table,
the first row handled in this statement. In that case, we need
to write table maps for all locked tables to the binary log.
*/
if (likely(!(error= bitmap_init(&cols,
if (likely(!(error= my_bitmap_init(&cols,
use_bitbuf ? bitbuf : NULL,
(n_fields + 7) & ~7UL,
FALSE))))
@ -5753,7 +5755,7 @@ static int binlog_log_row(TABLE* table,
before_record, after_record);
}
if (!use_bitbuf)
bitmap_free(&cols);
my_bitmap_free(&cols);
}
}
return error ? HA_ERR_RBR_LOGGING_FAILED : 0;

View File

@ -32,6 +32,7 @@
#include "sql_cache.h"
#include "structs.h" /* SHOW_COMP_OPTION */
#include "sql_array.h" /* Dynamic_array<> */
#include "mdl.h"
#include <my_compare.h>
#include <ft_global.h>
@ -387,6 +388,7 @@ enum enum_alter_inplace_result {
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
#define HA_LEX_CREATE_TABLE_LIKE 4
#define HA_CREATE_TMP_ALTER 8
#define HA_LEX_CREATE_REPLACE 16
#define HA_MAX_REC_LENGTH 65535
/* Table caching type */
@ -1582,9 +1584,15 @@ struct HA_CREATE_INFO
ulong avg_row_length;
ulong used_fields;
ulong key_block_size;
uint stats_sample_pages; /* number of pages to sample during
stats estimation, if used, otherwise 0. */
enum_stats_auto_recalc stats_auto_recalc;
/*
number of pages to sample during
stats estimation, if used, otherwise 0.
*/
uint stats_sample_pages;
uint null_bits; /* NULL bits at start of record */
uint options; /* OR of HA_CREATE_ options */
uint merge_insert_method;
uint extra_size; /* length of extra data segment */
SQL_I_List<TABLE_LIST> merge_list;
handlerton *db_type;
/**
@ -1597,21 +1605,23 @@ struct HA_CREATE_INFO
If nothing speficied inherits the value of the original table (if present).
*/
enum row_type row_type;
uint null_bits; /* NULL bits at start of record */
uint options; /* OR of HA_CREATE_ options */
uint merge_insert_method;
uint extra_size; /* length of extra data segment */
enum ha_choice transactional;
bool varchar; ///< 1 if table has a VARCHAR
enum ha_storage_media storage_media; ///< DEFAULT, DISK or MEMORY
enum ha_choice page_checksum; ///< If we have page_checksums
engine_option_value *option_list; ///< list of table create options
enum_stats_auto_recalc stats_auto_recalc;
bool varchar; ///< 1 if table has a VARCHAR
/* the following three are only for ALTER TABLE, check_if_incompatible_data() */
ha_table_option_struct *option_struct; ///< structure with parsed table options
ha_field_option_struct **fields_option_struct; ///< array of field option structures
ha_index_option_struct **indexes_option_struct; ///< array of index option structures
/* The following is used to remember the old state for CREATE OR REPLACE */
TABLE *table;
TABLE_LIST *pos_in_locked_tables;
MDL_ticket *mdl_ticket;
bool tmp_table() { return options & HA_LEX_CREATE_TMP_TABLE; }
};

View File

@ -149,7 +149,7 @@ bool hostname_cache_init()
Host_entry tmp;
uint key_offset= (uint) ((char*) (&tmp.ip_key) - (char*) &tmp);
if (!(hostname_cache= new hash_filo(HOST_CACHE_SIZE,
if (!(hostname_cache= new hash_filo(host_cache_size,
key_offset, HOST_ENTRY_KEY_SIZE,
NULL, (my_hash_free_key) free,
&my_charset_bin)))

View File

@ -4685,13 +4685,13 @@ ulonglong subselect_hash_sj_engine::rowid_merge_buff_size(
*/
static my_bool
bitmap_init_memroot(MY_BITMAP *map, uint n_bits, MEM_ROOT *mem_root)
my_bitmap_init_memroot(MY_BITMAP *map, uint n_bits, MEM_ROOT *mem_root)
{
my_bitmap_map *bitmap_buf;
if (!(bitmap_buf= (my_bitmap_map*) alloc_root(mem_root,
bitmap_buffer_size(n_bits))) ||
bitmap_init(map, bitmap_buf, n_bits, FALSE))
my_bitmap_init(map, bitmap_buf, n_bits, FALSE))
return TRUE;
bitmap_clear_all(map);
return FALSE;
@ -4729,9 +4729,9 @@ bool subselect_hash_sj_engine::init(List<Item> *tmp_columns, uint subquery_id)
DBUG_ENTER("subselect_hash_sj_engine::init");
if (bitmap_init_memroot(&non_null_key_parts, tmp_columns->elements,
if (my_bitmap_init_memroot(&non_null_key_parts, tmp_columns->elements,
thd->mem_root) ||
bitmap_init_memroot(&partial_match_key_parts, tmp_columns->elements,
my_bitmap_init_memroot(&partial_match_key_parts, tmp_columns->elements,
thd->mem_root))
DBUG_RETURN(TRUE);
@ -5453,7 +5453,7 @@ Ordered_key::Ordered_key(uint keyid_arg, TABLE *tbl_arg, Item *search_key_arg,
Ordered_key::~Ordered_key()
{
my_free(key_buff);
bitmap_free(&null_key);
my_bitmap_free(&null_key);
}
@ -5563,7 +5563,7 @@ bool Ordered_key::alloc_keys_buffers()
lookup offset.
*/
/* Notice that max_null_row is max array index, we need count, so +1. */
if (bitmap_init(&null_key, NULL, (uint)(max_null_row + 1), FALSE))
if (my_bitmap_init(&null_key, NULL, (uint)(max_null_row + 1), FALSE))
return TRUE;
cur_key_idx= HA_POS_ERROR;
@ -6002,8 +6002,8 @@ subselect_rowid_merge_engine::init(MY_BITMAP *non_null_key_parts,
*/
if (!has_covering_null_columns)
{
if (bitmap_init_memroot(&matching_keys, merge_keys_count, thd->mem_root) ||
bitmap_init_memroot(&matching_outer_cols, merge_keys_count, thd->mem_root))
if (my_bitmap_init_memroot(&matching_keys, merge_keys_count, thd->mem_root) ||
my_bitmap_init_memroot(&matching_outer_cols, merge_keys_count, thd->mem_root))
return TRUE;
/*

View File

@ -525,35 +525,57 @@ bool LOGGER::is_log_table_enabled(uint log_table_type)
}
/* Check if a given table is opened log table */
int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
const char *table_name, bool check_if_opened)
/**
Check if a given table is opened log table
@param table Table to check
@param check_if_opened Only fail if it's a log table in use
@param error_msg String to put in error message if not ok.
No error message if 0
@return 0 ok
@return # Type of log file
*/
int check_if_log_table(const TABLE_LIST *table,
bool check_if_opened,
const char *error_msg)
{
if (db_len == 5 &&
int result= 0;
if (table->db_length == 5 &&
!(lower_case_table_names ?
my_strcasecmp(system_charset_info, db, "mysql") :
strcmp(db, "mysql")))
my_strcasecmp(system_charset_info, table->db, "mysql") :
strcmp(table->db, "mysql")))
{
if (table_name_len == 11 && !(lower_case_table_names ?
my_strcasecmp(system_charset_info,
table_name, "general_log") :
strcmp(table_name, "general_log")))
const char *table_name= table->table_name;
if (table->table_name_length == 11 &&
!(lower_case_table_names ?
my_strcasecmp(system_charset_info,
table_name, "general_log") :
strcmp(table_name, "general_log")))
{
if (!check_if_opened || logger.is_log_table_enabled(QUERY_LOG_GENERAL))
return QUERY_LOG_GENERAL;
return 0;
result= QUERY_LOG_GENERAL;
goto end;
}
if (table_name_len == 8 && !(lower_case_table_names ?
if (table->table_name_length == 8 && !(lower_case_table_names ?
my_strcasecmp(system_charset_info, table_name, "slow_log") :
strcmp(table_name, "slow_log")))
{
if (!check_if_opened || logger.is_log_table_enabled(QUERY_LOG_SLOW))
return QUERY_LOG_SLOW;
return 0;
result= QUERY_LOG_SLOW;
goto end;
}
}
return 0;
end:
if (!check_if_opened || logger.is_log_table_enabled(result))
{
if (error_msg)
my_error(ER_BAD_LOG_STATEMENT, MYF(0), error_msg);
return result;
}
return 0;
}
@ -1657,6 +1679,7 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
contain updates to non-transactional tables. Or it can be a flush of
a statement cache.
*/
static int
binlog_flush_cache(THD *thd, binlog_cache_mngr *cache_mngr,
Log_event *end_ev, bool all, bool using_stmt,
@ -1664,6 +1687,7 @@ binlog_flush_cache(THD *thd, binlog_cache_mngr *cache_mngr,
{
int error= 0;
DBUG_ENTER("binlog_flush_cache");
DBUG_PRINT("enter", ("end_ev: %p", end_ev));
if ((using_stmt && !cache_mngr->stmt_cache.empty()) ||
(using_trx && !cache_mngr->trx_cache.empty()))
@ -1722,9 +1746,10 @@ static inline int
binlog_commit_flush_stmt_cache(THD *thd, bool all,
binlog_cache_mngr *cache_mngr)
{
DBUG_ENTER("binlog_commit_flush_stmt_cache");
Query_log_event end_evt(thd, STRING_WITH_LEN("COMMIT"),
FALSE, TRUE, TRUE, 0);
return (binlog_flush_cache(thd, cache_mngr, &end_evt, all, TRUE, FALSE));
DBUG_RETURN(binlog_flush_cache(thd, cache_mngr, &end_evt, all, TRUE, FALSE));
}
/**
@ -1739,9 +1764,10 @@ binlog_commit_flush_stmt_cache(THD *thd, bool all,
static inline int
binlog_commit_flush_trx_cache(THD *thd, bool all, binlog_cache_mngr *cache_mngr)
{
DBUG_ENTER("binlog_commit_flush_trx_cache");
Query_log_event end_evt(thd, STRING_WITH_LEN("COMMIT"),
TRUE, TRUE, TRUE, 0);
return (binlog_flush_cache(thd, cache_mngr, &end_evt, all, FALSE, TRUE));
DBUG_RETURN(binlog_flush_cache(thd, cache_mngr, &end_evt, all, FALSE, TRUE));
}
/**
@ -5248,6 +5274,10 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
(long) table, table->s->table_name.str,
table->s->table_map_id));
/* Ensure that all events in a GTID group are in the same cache */
if (variables.option_bits & OPTION_GTID_BEGIN)
is_transactional= 1;
/* Pre-conditions */
DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open());
DBUG_ASSERT(table->s->table_map_id != ULONG_MAX);
@ -5265,7 +5295,7 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
cache_mngr->get_binlog_cache_log(use_trans_cache(this, is_transactional));
if (with_annotate && *with_annotate)
{
Annotate_rows_log_event anno(current_thd, is_transactional, false);
Annotate_rows_log_event anno(table->in_use, is_transactional, false);
/* Annotate event should be written not more than once */
*with_annotate= 0;
if ((error= anno.write(file)))
@ -5428,6 +5458,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
/* Generate a new global transaction ID, and write it to the binlog */
bool
MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
bool is_transactional, uint64 commit_id)
@ -5437,6 +5468,16 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
uint32 server_id= thd->variables.server_id;
uint64 seq_no= thd->variables.gtid_seq_no;
int err;
DBUG_ENTER("write_gtid_event");
DBUG_PRINT("enter", ("standalone: %d", standalone));
if (thd->variables.option_bits & OPTION_GTID_BEGIN)
{
DBUG_PRINT("error", ("OPTION_GTID_BEGIN is set. "
"Master and slave will have different GTID values"));
/* Reset the flag, as we will write out a GTID anyway */
thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
}
/*
Reset the session variable gtid_seq_no, to reduce the risk of accidentally
@ -5461,7 +5502,7 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
seq_no= gtid.seq_no;
}
if (err)
return true;
DBUG_RETURN(true);
Gtid_log_event gtid_event(thd, seq_no, domain_id, standalone,
LOG_EVENT_SUPPRESS_USE_F, is_transactional,
@ -5469,10 +5510,10 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
/* Write the event to the binary log. */
if (gtid_event.write(&mysql_bin_log.log_file))
return true;
DBUG_RETURN(true);
status_var_add(thd->status_var.binlog_bytes_written, gtid_event.data_written);
return false;
DBUG_RETURN(false);
}
@ -5654,14 +5695,22 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
{
THD *thd= event_info->thd;
bool error= 1;
DBUG_ENTER("MYSQL_BIN_LOG::write(Log_event *)");
binlog_cache_data *cache_data= 0;
bool is_trans_cache= FALSE;
bool using_trans= event_info->use_trans_cache();
bool direct= event_info->use_direct_logging();
ulong prev_binlog_id;
DBUG_ENTER("MYSQL_BIN_LOG::write(Log_event *)");
LINT_INIT(prev_binlog_id);
if (thd->variables.option_bits & OPTION_GTID_BEGIN)
{
DBUG_PRINT("info", ("OPTION_GTID_BEGIN was set"));
/* Wait for commit from binary log before we commit */
direct= 0;
using_trans= 1;
}
if (thd->binlog_evt_union.do_union)
{
/*
@ -5709,6 +5758,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
if (direct)
{
DBUG_PRINT("info", ("direct is set"));
file= &log_file;
my_org_b_tell= my_b_tell(file);
mysql_mutex_lock(&LOCK_log);
@ -7299,16 +7349,17 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
uint64 commit_id)
{
binlog_cache_mngr *mngr= entry->cache_mngr;
DBUG_ENTER("MYSQL_BIN_LOG::write_transaction_or_stmt");
if (write_gtid_event(entry->thd, false, entry->using_trx_cache, commit_id))
return ER_ERROR_ON_WRITE;
DBUG_RETURN(ER_ERROR_ON_WRITE);
if (entry->using_stmt_cache && !mngr->stmt_cache.empty() &&
write_cache(entry->thd, mngr->get_binlog_cache_log(FALSE)))
{
entry->error_cache= &mngr->stmt_cache.cache_log;
entry->commit_errno= errno;
return ER_ERROR_ON_WRITE;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
if (entry->using_trx_cache && !mngr->trx_cache.empty())
@ -7329,7 +7380,7 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
{
entry->error_cache= &mngr->trx_cache.cache_log;
entry->commit_errno= errno;
return ER_ERROR_ON_WRITE;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
}
@ -7337,7 +7388,7 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
{
entry->error_cache= NULL;
entry->commit_errno= errno;
return ER_ERROR_ON_WRITE;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
status_var_add(entry->thd->status_var.binlog_bytes_written,
entry->end_event->data_written);
@ -7348,7 +7399,7 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
{
entry->error_cache= NULL;
entry->commit_errno= errno;
return ER_ERROR_ON_WRITE;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
}
@ -7356,16 +7407,16 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
{
entry->error_cache= &mngr->stmt_cache.cache_log;
entry->commit_errno= errno;
return ER_ERROR_ON_READ;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
if (mngr->get_binlog_cache_log(TRUE)->error) // Error on read
{
entry->error_cache= &mngr->trx_cache.cache_log;
entry->commit_errno= errno;
return ER_ERROR_ON_READ;
DBUG_RETURN(ER_ERROR_ON_WRITE);
}
return 0;
DBUG_RETURN(0);
}

View File

@ -833,8 +833,8 @@ public:
};
int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
const char *table_name, bool check_if_opened);
int check_if_log_table(const TABLE_LIST *table, bool check_if_opened,
const char *errmsg);
class Log_to_csv_event_handler: public Log_event_handler
{

View File

@ -3984,6 +3984,8 @@ bool test_if_equal_repl_errors(int expected_error, int actual_error)
case ER_AUTOINC_READ_FAILED:
return (actual_error == ER_AUTOINC_READ_FAILED ||
actual_error == HA_ERR_AUTOINC_ERANGE);
case ER_UNKNOWN_TABLE:
return actual_error == ER_IT_IS_A_VIEW;
default:
break;
}
@ -4018,6 +4020,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
rpl_gtid gtid;
Relay_log_info const *rli= rgi->rli;
Rpl_filter *rpl_filter= rli->mi->rpl_filter;
bool current_stmt_is_commit;
DBUG_ENTER("Query_log_event::do_apply_event");
/*
@ -4044,7 +4047,9 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos));
clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
if (strcmp("COMMIT", query) == 0 && rgi->tables_to_lock)
current_stmt_is_commit= is_commit();
if (current_stmt_is_commit && rgi->tables_to_lock)
{
/*
Cleaning-up the last statement context:
@ -4093,9 +4098,11 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
thd->variables.pseudo_thread_id= thread_id; // for temp tables
DBUG_PRINT("query",("%s", thd->query()));
if (ignored_error_code((expected_error= error_code)) ||
!unexpected_error_code(expected_error))
if (!(expected_error= error_code) ||
ignored_error_code(expected_error) ||
!unexpected_error_code(expected_error))
{
thd->slave_expected_error= expected_error;
if (flags2_inited)
/*
all bits of thd->variables.option_bits which are 1 in OPTIONS_WRITTEN_TO_BIN_LOG
@ -4197,12 +4204,13 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
Record any GTID in the same transaction, so slave state is
transactionally consistent.
*/
if (strcmp("COMMIT", query) == 0 && (sub_id= rgi->gtid_sub_id))
if (current_stmt_is_commit && (sub_id= rgi->gtid_sub_id))
{
/* Clear the GTID from the RLI so we don't accidentally reuse it. */
rgi->gtid_sub_id= 0;
gtid= rgi->current_gtid;
thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
if (rpl_global_gtid_slave_state.record_gtid(thd, &gtid, sub_id, true, false))
{
rli->report(ERROR_LEVEL, ER_CANNOT_UPDATE_GTID_STATE,
@ -4232,6 +4240,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
concurrency_error_code(expected_error)))
{
thd->variables.option_bits|= OPTION_MASTER_SQL_ERROR;
thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
}
/* Execute the query (note that we bypass dispatch_command()) */
Parser_state parser_state;
@ -4395,8 +4404,7 @@ Default database: '%s'. Query: '%s'",
to shutdown trying to finish incomplete events group.
*/
DBUG_EXECUTE_IF("stop_slave_middle_group",
if (strcmp("COMMIT", query) != 0 &&
strcmp("BEGIN", query) != 0)
if (!current_stmt_is_commit && is_begin() == 0)
{
if (thd->transaction.all.modified_non_trans_table)
const_cast<Relay_log_info*>(rli)->abort_slave= 1;
@ -4457,7 +4465,7 @@ Query_log_event::do_shall_skip(rpl_group_info *rgi)
{
Relay_log_info *rli= rgi->rli;
DBUG_ENTER("Query_log_event::do_shall_skip");
DBUG_PRINT("debug", ("query: %s; q_len: %d", query, q_len));
DBUG_PRINT("debug", ("query: '%s' q_len: %d", query, q_len));
DBUG_ASSERT(query && q_len > 0);
DBUG_ASSERT(thd == rgi->thd);
@ -4473,13 +4481,13 @@ Query_log_event::do_shall_skip(rpl_group_info *rgi)
{
if (is_begin())
{
thd->variables.option_bits|= OPTION_BEGIN;
thd->variables.option_bits|= OPTION_BEGIN | OPTION_GTID_BEGIN;
DBUG_RETURN(Log_event::continue_group(rgi));
}
if (is_commit() || is_rollback())
{
thd->variables.option_bits&= ~OPTION_BEGIN;
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_GTID_BEGIN);
DBUG_RETURN(Log_event::EVENT_SKIP_COUNT);
}
}
@ -5906,6 +5914,7 @@ error:
thd->reset_query();
thd->get_stmt_da()->set_overwrite_status(true);
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_GTID_BEGIN);
thd->get_stmt_da()->set_overwrite_status(false);
close_thread_tables(thd);
/*
@ -6408,8 +6417,7 @@ Gtid_log_event::make_compatible_event(String *packet, bool *need_dummy_event,
{
if (*need_dummy_event)
return Query_log_event::dummy_event(packet, ev_offset, checksum_alg);
else
return 0;
return 0;
}
*need_dummy_event= true;
@ -6456,10 +6464,16 @@ Gtid_log_event::do_apply_event(rpl_group_info *rgi)
this->server_id, this->seq_no))
return 1;
}
DBUG_ASSERT((thd->variables.option_bits & OPTION_GTID_BEGIN) == 0);
if (flags2 & FL_STANDALONE)
return 0;
/* Execute this like a BEGIN query event. */
thd->variables.option_bits|= OPTION_BEGIN | OPTION_GTID_BEGIN;
DBUG_PRINT("info", ("Set OPTION_GTID_BEGIN"));
trans_begin(thd, 0);
thd->set_query_and_id(gtid_begin_string, sizeof(gtid_begin_string)-1,
&my_charset_bin, next_query_id());
Parser_state parser_state;
@ -7250,6 +7264,7 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
/* For a slave Xid_log_event is COMMIT */
general_log_print(thd, COM_QUERY,
"COMMIT /* implicit, from Xid_log_event */");
thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
res= trans_commit(thd); /* Automatically rolls back on error. */
thd->mdl_context.release_transactional_locks();
@ -7271,7 +7286,7 @@ Xid_log_event::do_shall_skip(rpl_group_info *rgi)
if (rgi->rli->slave_skip_counter > 0)
{
DBUG_ASSERT(!rgi->rli->get_flag(Relay_log_info::IN_TRANSACTION));
thd->variables.option_bits&= ~OPTION_BEGIN;
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_GTID_BEGIN);
DBUG_RETURN(Log_event::EVENT_SKIP_COUNT);
}
DBUG_RETURN(Log_event::do_shall_skip(rgi));
@ -9112,8 +9127,8 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
set_flags(NO_FOREIGN_KEY_CHECKS_F);
if (thd_arg->variables.option_bits & OPTION_RELAXED_UNIQUE_CHECKS)
set_flags(RELAXED_UNIQUE_CHECKS_F);
/* if bitmap_init fails, caught in is_valid() */
if (likely(!bitmap_init(&m_cols,
/* if my_bitmap_init fails, caught in is_valid() */
if (likely(!my_bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
m_width,
false)))
@ -9127,7 +9142,7 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
}
else
{
// Needed because bitmap_init() does not set it to null on failure
// Needed because my_bitmap_init() does not set it to null on failure
m_cols.bitmap= 0;
}
}
@ -9228,8 +9243,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
m_width = net_field_length(&ptr_after_width);
DBUG_PRINT("debug", ("m_width=%lu", m_width));
/* if bitmap_init fails, catched in is_valid() */
if (likely(!bitmap_init(&m_cols,
/* if my_bitmap_init fails, catched in is_valid() */
if (likely(!my_bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
m_width,
false)))
@ -9242,7 +9257,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
}
else
{
// Needed because bitmap_init() does not set it to null on failure
// Needed because my_bitmap_init() does not set it to null on failure
m_cols.bitmap= NULL;
DBUG_VOID_RETURN;
}
@ -9254,8 +9269,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
{
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
/* if bitmap_init fails, caught in is_valid() */
if (likely(!bitmap_init(&m_cols_ai,
/* if my_bitmap_init fails, caught in is_valid() */
if (likely(!my_bitmap_init(&m_cols_ai,
m_width <= sizeof(m_bitbuf_ai)*8 ? m_bitbuf_ai : NULL,
m_width,
false)))
@ -9269,7 +9284,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
}
else
{
// Needed because bitmap_init() does not set it to null on failure
// Needed because my_bitmap_init() does not set it to null on failure
m_cols_ai.bitmap= 0;
DBUG_VOID_RETURN;
}
@ -9300,8 +9315,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
Rows_log_event::~Rows_log_event()
{
if (m_cols.bitmap == m_bitbuf) // no my_malloc happened
m_cols.bitmap= 0; // so no my_free in bitmap_free
bitmap_free(&m_cols); // To pair with bitmap_init().
m_cols.bitmap= 0; // so no my_free in my_bitmap_free
my_bitmap_free(&m_cols); // To pair with my_bitmap_init().
my_free(m_rows_buf);
my_free(m_extra_row_data);
}
@ -11960,8 +11975,8 @@ Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
void Update_rows_log_event::init(MY_BITMAP const *cols)
{
/* if bitmap_init fails, caught in is_valid() */
if (likely(!bitmap_init(&m_cols_ai,
/* if my_bitmap_init fails, caught in is_valid() */
if (likely(!my_bitmap_init(&m_cols_ai,
m_width <= sizeof(m_bitbuf_ai)*8 ? m_bitbuf_ai : NULL,
m_width,
false)))
@ -11980,8 +11995,8 @@ void Update_rows_log_event::init(MY_BITMAP const *cols)
Update_rows_log_event::~Update_rows_log_event()
{
if (m_cols_ai.bitmap == m_bitbuf_ai) // no my_malloc happened
m_cols_ai.bitmap= 0; // so no my_free in bitmap_free
bitmap_free(&m_cols_ai); // To pair with bitmap_init().
m_cols_ai.bitmap= 0; // so no my_free in my_bitmap_free
my_bitmap_free(&m_cols_ai); // To pair with my_bitmap_init().
}

View File

@ -1244,8 +1244,8 @@ Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
set_flags(NO_FOREIGN_KEY_CHECKS_F);
if (thd_arg->variables.option_bits & OPTION_RELAXED_UNIQUE_CHECKS)
set_flags(RELAXED_UNIQUE_CHECKS_F);
/* if bitmap_init fails, caught in is_valid() */
if (likely(!bitmap_init(&m_cols,
/* if my_bitmap_init fails, caught in is_valid() */
if (likely(!my_bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
m_width,
false)))
@ -1259,7 +1259,7 @@ Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
}
else
{
// Needed because bitmap_init() does not set it to null on failure
// Needed because my_bitmap_init() does not set it to null on failure
m_cols.bitmap= 0;
}
}
@ -1313,8 +1313,8 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
m_width = net_field_length(&ptr_after_width);
DBUG_PRINT("debug", ("m_width=%lu", m_width));
/* if bitmap_init fails, catched in is_valid() */
if (likely(!bitmap_init(&m_cols,
/* if my_bitmap_init fails, catched in is_valid() */
if (likely(!my_bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
m_width,
false)))
@ -1327,7 +1327,7 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
}
else
{
// Needed because bitmap_init() does not set it to null on failure
// Needed because my_bitmap_init() does not set it to null on failure
m_cols.bitmap= NULL;
DBUG_VOID_RETURN;
}
@ -1358,8 +1358,8 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
Old_rows_log_event::~Old_rows_log_event()
{
if (m_cols.bitmap == m_bitbuf) // no my_malloc happened
m_cols.bitmap= 0; // so no my_free in bitmap_free
bitmap_free(&m_cols); // To pair with bitmap_init().
m_cols.bitmap= 0; // so no my_free in my_bitmap_free
my_bitmap_free(&m_cols); // To pair with my_bitmap_init().
my_free(m_rows_buf);
}

View File

@ -366,7 +366,8 @@ static DYNAMIC_ARRAY all_options;
/* Global variables */
bool opt_bin_log, opt_bin_log_used=0, opt_ignore_builtin_innodb= 0;
my_bool opt_log, opt_slow_log, debug_assert_if_crashed_table= 0, opt_help= 0, opt_abort;
my_bool opt_log, opt_slow_log, debug_assert_if_crashed_table= 0, opt_help= 0;
static my_bool opt_abort;
ulonglong log_output_options;
my_bool opt_userstat_running;
my_bool opt_log_queries_not_using_indexes= 0;
@ -478,6 +479,7 @@ ulong open_files_limit, max_binlog_size;
ulong slave_trans_retries;
uint slave_net_timeout;
ulong slave_exec_mode_options;
ulong slave_ddl_exec_mode_options= SLAVE_EXEC_MODE_IDEMPOTENT;
ulonglong slave_type_conversions_options;
ulong thread_cache_size=0;
ulonglong binlog_cache_size=0;
@ -1964,7 +1966,7 @@ void clean_up(bool print_message)
// We must call end_slave() as clean_up may have been called during startup
end_slave();
if (use_slave_mask)
bitmap_free(&slave_error_mask);
my_bitmap_free(&slave_error_mask);
#endif
stop_handle_manager();
release_ddl_log();
@ -2018,7 +2020,7 @@ void clean_up(bool print_message)
if (defaults_argv)
free_defaults(defaults_argv);
free_tmpdir(&mysql_tmpdir_list);
bitmap_free(&temp_pool);
my_bitmap_free(&temp_pool);
free_max_user_conn();
free_global_user_stats();
free_global_client_stats();
@ -4252,7 +4254,7 @@ static int init_common_variables()
#endif /* defined(ENABLED_DEBUG_SYNC) */
#if (ENABLE_TEMP_POOL)
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
if (use_temp_pool && my_bitmap_init(&temp_pool,0,1024,1))
return 1;
#else
use_temp_pool= 0;
@ -7966,7 +7968,6 @@ static int option_cmp(my_option *a, my_option *b)
return 1;
}
}
DBUG_ASSERT(a->name == b->name);
return 0;
}
@ -7981,9 +7982,16 @@ static void print_help()
sys_var_add_options(&all_options, sys_var::PARSE_EARLY);
add_plugin_options(&all_options, &mem_root);
sort_dynamic(&all_options, (qsort_cmp) option_cmp);
sort_dynamic(&all_options, (qsort_cmp) option_cmp);
add_terminator(&all_options);
my_print_help((my_option*) all_options.buffer);
/* Add variables that can be shown but not changed, like version numbers */
pop_dynamic(&all_options);
sys_var_add_options(&all_options, sys_var::SHOW_VALUE_IN_HELP);
sort_dynamic(&all_options, (qsort_cmp) option_cmp);
add_terminator(&all_options);
my_print_variables((my_option*) all_options.buffer);
free_root(&mem_root, MYF(0));
@ -8944,6 +8952,13 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
max_binlog_size_var->option.def_value;
}
}
/* Ensure that some variables are not set higher than needed */
if (back_log > max_connections)
back_log= max_connections;
if (thread_cache_size > max_connections)
thread_cache_size= max_connections;
return 0;
}

View File

@ -96,7 +96,7 @@ extern uint connection_count;
extern my_bool opt_safe_user_create;
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern ulong slave_exec_mode_options;
extern ulong slave_exec_mode_options, slave_ddl_exec_mode_options;
extern ulong slave_retried_transactions;
extern ulonglong slave_type_conversions_options;
extern my_bool read_only, opt_readonly;

View File

@ -1823,7 +1823,7 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
*create_error= 1;
}
else
bitmap_init(&column_bitmap, bitmap, head->s->fields, FALSE);
my_bitmap_init(&column_bitmap, bitmap, head->s->fields, FALSE);
DBUG_VOID_RETURN;
}
@ -2847,7 +2847,7 @@ static int fill_used_fields_bitmap(PARAM *param)
param->fields_bitmap_size= table->s->column_bitmap_size;
if (!(tmp= (my_bitmap_map*) alloc_root(param->mem_root,
param->fields_bitmap_size)) ||
bitmap_init(&param->needed_fields, tmp, table->s->fields, FALSE))
my_bitmap_init(&param->needed_fields, tmp, table->s->fields, FALSE))
return 1;
bitmap_copy(&param->needed_fields, table->read_set);
@ -4104,7 +4104,7 @@ static int find_used_partitions_imerge_list(PART_PRUNE_PARAM *ppar,
*/
return find_used_partitions_imerge(ppar, merges.head());
}
bitmap_init(&all_merges, bitmap_buf, n_bits, FALSE);
my_bitmap_init(&all_merges, bitmap_buf, n_bits, FALSE);
bitmap_set_prefix(&all_merges, n_bits);
List_iterator<SEL_IMERGE> it(merges);
@ -4751,7 +4751,7 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
uint32 bufsize= bitmap_buffer_size(ppar->part_info->num_subparts);
if (!(buf= (my_bitmap_map*) alloc_root(alloc, bufsize)))
return TRUE;
bitmap_init(&ppar->subparts_bitmap, buf, ppar->part_info->num_subparts,
my_bitmap_init(&ppar->subparts_bitmap, buf, ppar->part_info->num_subparts,
FALSE);
}
range_par->key_parts= key_part;
@ -5511,7 +5511,7 @@ bool create_fields_bitmap(PARAM *param, MY_BITMAP *fields_bitmap)
if (!(bitmap_buf= (my_bitmap_map *) alloc_root(param->mem_root,
param->fields_bitmap_size)))
return TRUE;
if (bitmap_init(fields_bitmap, bitmap_buf, param->table->s->fields, FALSE))
if (my_bitmap_init(fields_bitmap, bitmap_buf, param->table->s->fields, FALSE))
return TRUE;
return FALSE;
@ -6329,7 +6329,7 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg)
param->fields_bitmap_size)))
DBUG_RETURN(NULL);
if (bitmap_init(&ror_scan->covered_fields, bitmap_buf,
if (my_bitmap_init(&ror_scan->covered_fields, bitmap_buf,
param->table->s->fields, FALSE))
DBUG_RETURN(NULL);
bitmap_clear_all(&ror_scan->covered_fields);
@ -6447,7 +6447,7 @@ ROR_INTERSECT_INFO* ror_intersect_init(const PARAM *param)
if (!(buf= (my_bitmap_map*) alloc_root(param->mem_root,
param->fields_bitmap_size)))
return NULL;
if (bitmap_init(&info->covered_fields, buf, param->table->s->fields,
if (my_bitmap_init(&info->covered_fields, buf, param->table->s->fields,
FALSE))
return NULL;
info->is_covering= FALSE;
@ -7024,7 +7024,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
covered_fields->bitmap= (my_bitmap_map*)alloc_root(param->mem_root,
param->fields_bitmap_size);
if (!covered_fields->bitmap ||
bitmap_init(covered_fields, covered_fields->bitmap,
my_bitmap_init(covered_fields, covered_fields->bitmap,
param->table->s->fields, FALSE))
DBUG_RETURN(0);
bitmap_clear_all(covered_fields);

View File

@ -1042,7 +1042,7 @@ bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module>
void *buf;
if (!(buf= current_thd->alloc(bitmap_buffer_size(offset))) ||
bitmap_init(&expr_deps, (my_bitmap_map*)buf, offset, FALSE))
my_bitmap_init(&expr_deps, (my_bitmap_map*)buf, offset, FALSE))
{
DBUG_RETURN(TRUE); /* purecov: inspected */
}

View File

@ -385,7 +385,7 @@ bool partition_info::can_prune_insert(THD* thd,
DBUG_RETURN(true);
}
/* Also clears all bits. */
if (bitmap_init(used_partitions, bitmap_buf, num_partitions, false))
if (my_bitmap_init(used_partitions, bitmap_buf, num_partitions, false))
{
/* purecov: begin deadcode */
/* Cannot happen, due to pre-alloc. */

View File

@ -352,7 +352,8 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
{
DBUG_PRINT("info", ("resetting OPTION_BEGIN"));
thd->variables.option_bits&=
~(ulonglong)(OPTION_NOT_AUTOCOMMIT|OPTION_BEGIN|OPTION_BIN_LOG);
~(ulonglong)(OPTION_NOT_AUTOCOMMIT |OPTION_BEGIN |OPTION_BIN_LOG |
OPTION_GTID_BEGIN);
}
else
thd->variables.option_bits&= ~(ulonglong)OPTION_BIN_LOG;

View File

@ -94,13 +94,13 @@ public:
injector::transaction::table tbl(share->table, true);
MY_BITMAP cols;
bitmap_init(&cols, NULL, (i + 7) / 8, false);
my_bitmap_init(&cols, NULL, (i + 7) / 8, false);
inj->write_row(::server_id, tbl, &cols, row_data);
or
MY_BITMAP cols;
bitmap_init(&cols, NULL, (i + 7) / 8, false);
my_bitmap_init(&cols, NULL, (i + 7) / 8, false);
inj->write_row(::server_id,
injector::transaction::table(share->table, true),
&cols, row_data);

View File

@ -1583,6 +1583,7 @@ void rpl_group_info::cleanup_context(THD *thd, bool error)
if (error)
{
trans_rollback_stmt(thd); // if a "statement transaction"
/* trans_rollback() also resets OPTION_GTID_BEGIN */
trans_rollback(thd); // if a "real transaction"
}
m_table_map.clear_tables();

View File

@ -60,7 +60,7 @@ public:
sys_var *next;
LEX_CSTRING name;
enum flag_enum { GLOBAL, SESSION, ONLY_SESSION, SCOPE_MASK=1023,
READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096 };
READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096, SHOW_VALUE_IN_HELP=8192 };
/**
Enumeration type to indicate for a system variable whether
it will be written to the binlog or not.
@ -142,8 +142,9 @@ public:
}
bool register_option(DYNAMIC_ARRAY *array, int parse_flags)
{
return (option.id != -1) && ((flags & PARSE_EARLY) == parse_flags) &&
insert_dynamic(array, (uchar*)&option);
return ((((option.id != -1) && ((flags & PARSE_EARLY) == parse_flags)) ||
(flags & parse_flags)) &&
insert_dynamic(array, (uchar*)&option));
}
void do_deprecated_warning(THD *thd);

View File

@ -2118,13 +2118,9 @@ ER_INSERT_INFO
spa "Registros: %ld Duplicados: %ld Peligros: %ld"
swe "Rader: %ld Dubletter: %ld Varningar: %ld"
ukr "Записів: %ld Дублікатів: %ld Застережень: %ld"
ER_UPDATE_TABLE_USED
eng "You can't specify target table '%-.192s' for update in FROM clause"
ger "Die Verwendung der zu aktualisierenden Zieltabelle '%-.192s' ist in der FROM-Klausel nicht zulässig."
jpn "FROM句にある表 '%-.192s' はUPDATEの対象にできません。"
rus "Не допускается указание таблицы '%-.192s' в списке таблиц FROM для внесения в нее изменений"
swe "INSERT-table '%-.192s' får inte finnas i FROM tabell-listan"
ukr "Таблиця '%-.192s' що змінюється не дозволена у переліку таблиць FROM"
ER_UPDATE_TABLE_USED
eng "Table '%-.192s' is specified twice, both as a target for '%s' and as a separate source for data"
swe "Table '%-.192s' är använd två gånger. Både för '%s' och för att hämta data"
ER_NO_SUCH_THREAD
cze "Neznámá identifikace threadu: %lu"
dan "Ukendt tråd id: %lu"
@ -7067,3 +7063,5 @@ ER_CHANGE_SLAVE_PARALLEL_THREADS_ACTIVE
eng "Cannot change @@slave_parallel_threads while another change is in progress"
ER_PRIOR_COMMIT_FAILED
eng "Commit failed due to failure of an earlier commit on which this one depends"
ER_IT_IS_A_VIEW 42S02
eng "'%-.192s' is a view"

Some files were not shown because too many files have changed in this diff Show More