From 3e1d0ff5748db3881cca96f9d35bee179552c9f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 27 Jun 2017 20:53:14 +0300 Subject: [PATCH 01/53] Fix a merge error in commit 8f643e2063c9890a353149f39ef85b2cf3151fd0 A merge error caused InnoDB bootstrap to fail when innodb_undo_tablespaces was set to more than 2. This was because of a bug that was introduced to srv_undo_tablespaces_init() by the merge. Furthermore, some adjustments for Oracle Bug#25551311 aka Bug#23517560 changes were forgotten. We must minimize direct references to srv_undo_tablespaces_open and use predicates instead. srv_undo_tablespaces_init(): Increment srv_undo_tablespaces_open once, not twice, per loop iteration. is_system_or_undo_tablespace(): Remove (unused function). is_predefined_tablespace(): Invoke srv_is_undo_tablespace(). --- storage/innobase/buf/buf0buf.cc | 8 +++----- storage/innobase/include/fsp0sysspace.h | 15 +++------------ storage/innobase/include/srv0srv.h | 16 ++++++++++++++++ storage/innobase/include/srv0start.h | 16 ---------------- storage/innobase/mtr/mtr0mtr.cc | 2 +- storage/innobase/srv/srv0start.cc | 2 -- 6 files changed, 23 insertions(+), 36 deletions(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 8d6d95a020e..61006c8d89d 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -5959,9 +5959,8 @@ database_corrupted: error injection */ DBUG_EXECUTE_IF( "buf_page_import_corrupt_failure", - if (bpage->id.space() - > srv_undo_tablespaces_open - && bpage->id.space() != SRV_TMP_SPACE_ID) { + if (!is_predefined_tablespace( + bpage->id.space())) { buf_mark_space_corrupt(bpage); ib::info() << "Simulated IMPORT " "corruption"; @@ -6027,8 +6026,7 @@ database_corrupted: if (uncompressed && !recv_no_ibuf_operations && (bpage->id.space() == 0 - || (bpage->id.space() > srv_undo_tablespaces_open - && bpage->id.space() != SRV_TMP_SPACE_ID)) + || !is_predefined_tablespace(bpage->id.space())) && !srv_is_tablespace_truncated(bpage->id.space()) && fil_page_get_type(frame) == FIL_PAGE_INDEX && page_is_leaf(frame)) { diff --git a/storage/innobase/include/fsp0sysspace.h b/storage/innobase/include/fsp0sysspace.h index 4c88b268f34..b8890adad74 100644 --- a/storage/innobase/include/fsp0sysspace.h +++ b/storage/innobase/include/fsp0sysspace.h @@ -287,16 +287,6 @@ is_system_tablespace(ulint id) return(id == TRX_SYS_SPACE || id == SRV_TMP_SPACE_ID); } -/** Check if shared-system or undo tablespace. -@return true if shared-system or undo tablespace */ -UNIV_INLINE -bool -is_system_or_undo_tablespace( - ulint id) -{ - return(id <= srv_undo_tablespaces_open); -} - /** Check if predefined shared tablespace. @return true if predefined shared tablespace */ UNIV_INLINE @@ -306,7 +296,8 @@ is_predefined_tablespace( { ut_ad(srv_sys_space.space_id() == TRX_SYS_SPACE); ut_ad(TRX_SYS_SPACE == 0); - return(id <= srv_undo_tablespaces_open - || id == SRV_TMP_SPACE_ID); + return(id == TRX_SYS_SPACE + || id == SRV_TMP_SPACE_ID + || srv_is_undo_tablespace(id)); } #endif /* fsp0sysspace_h */ diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 8f0df34af74..6afa1bf7e4e 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -317,6 +317,22 @@ segment). It is quite possible that some of the tablespaces doesn't host any of the rollback-segment based on configuration used. */ extern ulint srv_undo_tablespaces_active; +/** Undo tablespaces starts with space_id. */ +extern ulint srv_undo_space_id_start; + +/** Check whether given space id is undo tablespace id +@param[in] space_id space id to check +@return true if it is undo tablespace else false. */ +inline +bool +srv_is_undo_tablespace(ulint space_id) +{ + return srv_undo_space_id_start > 0 + && space_id >= srv_undo_space_id_start + && space_id < (srv_undo_space_id_start + + srv_undo_tablespaces_open); +} + /** The number of undo segments to use */ extern ulong srv_undo_logs; diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 47b42725541..93ea0be2662 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -105,22 +105,6 @@ extern bool srv_startup_is_before_trx_rollback_phase; /** TRUE if a raw partition is in use */ extern ibool srv_start_raw_disk_in_use; -/** Undo tablespaces starts with space_id. */ -extern ulint srv_undo_space_id_start; - -/** Check whether given space id is undo tablespace id -@param[in] space_id space id to check -@return true if it is undo tablespace else false. */ -inline -bool -srv_is_undo_tablespace(ulint space_id) -{ - return srv_undo_space_id_start > 0 - && space_id >= srv_undo_space_id_start - && space_id < (srv_undo_space_id_start - + srv_undo_tablespaces_open); -} - /** Shutdown state */ enum srv_shutdown_t { SRV_SHUTDOWN_NONE = 0, /*!< Database running normally */ diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index d8c7d59fe27..54b9ff5d8d8 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -829,7 +829,7 @@ mtr_t::Command::prepare_write() fil_space_t* space = m_impl->m_user_space; - if (space != NULL && space->id <= srv_undo_tablespaces_open) { + if (space != NULL && is_predefined_tablespace(space->id)) { /* Omit MLOG_FILE_NAME for predefined tablespaces. */ space = NULL; } diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 7fbf069257d..ee475d43e87 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -959,8 +959,6 @@ srv_undo_tablespaces_init(bool create_new_db) if (0 == srv_undo_tablespaces_open++) { srv_undo_space_id_start = undo_tablespace_ids[i]; } - - ++srv_undo_tablespaces_open; } /* Open any extra unused undo tablespaces. These must be contiguous. From b3171607e3e3024ea493c785831a7421a36fa7fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 28 Jun 2017 11:58:43 +0300 Subject: [PATCH 02/53] Avoid InnoDB messages about recovery after creating redo logs srv_log_files_created: A debug flag to ensure that InnoDB redo log files can only be created once in the server lifetime, and that after log files have been created, no crash recovery will take place. recv_scan_log_recs(): Detect the special case where the log consists of a sole MLOG_CHECKPOINT record, such as immediately after creating the redo logs. recv_recovery_from_checkpoint_start(): Skip the recovery message if the redo log is logically empty. --- storage/innobase/include/srv0srv.h | 3 +++ storage/innobase/log/log0recv.cc | 23 ++++++++++++++++++++++- storage/innobase/srv/srv0start.cc | 5 +++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 6afa1bf7e4e..4704625e1fe 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -546,7 +546,10 @@ extern my_bool srv_purge_view_update_only_debug; /** Value of MySQL global used to disable master thread. */ extern my_bool srv_master_thread_disabled_debug; +/** InnoDB system tablespace to set during recovery */ extern uint srv_sys_space_size_debug; +/** whether redo log files have been created at startup */ +extern bool srv_log_files_created; #endif /* UNIV_DEBUG */ #define SRV_SEMAPHORE_WAIT_EXTENSION 7200 diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index e48e185274a..71ce7c82a65 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2806,7 +2806,24 @@ recv_scan_log_recs( scanned_lsn += data_len; + if (data_len == LOG_BLOCK_HDR_SIZE + SIZE_OF_MLOG_CHECKPOINT + && scanned_lsn == checkpoint_lsn + SIZE_OF_MLOG_CHECKPOINT + && log_block[LOG_BLOCK_HDR_SIZE] == MLOG_CHECKPOINT + && checkpoint_lsn == mach_read_from_8(LOG_BLOCK_HDR_SIZE + + 1 + log_block)) { + /* The redo log is logically empty. */ + ut_ad(recv_sys->mlog_checkpoint_lsn == 0 + || recv_sys->mlog_checkpoint_lsn + == checkpoint_lsn); + recv_sys->mlog_checkpoint_lsn = checkpoint_lsn; + DBUG_PRINT("ib_log", ("found empty log; LSN=" LSN_PF, + scanned_lsn)); + finished = true; + break; + } + if (scanned_lsn > recv_sys->scanned_lsn) { + ut_ad(!srv_log_files_created); if (!recv_needed_recovery) { recv_needed_recovery = true; @@ -3244,7 +3261,11 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) there is something wrong we will print a message to the user about recovery: */ - if (checkpoint_lsn != flush_lsn) { + if (flush_lsn == checkpoint_lsn + SIZE_OF_MLOG_CHECKPOINT + && recv_sys->mlog_checkpoint_lsn == checkpoint_lsn) { + /* The redo log is logically empty. */ + } else if (checkpoint_lsn != flush_lsn) { + ut_ad(!srv_log_files_created); if (checkpoint_lsn + SIZE_OF_MLOG_CHECKPOINT < flush_lsn) { ib::warn() << " Are you sure you are using the" diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index ee475d43e87..e625ab84334 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -147,6 +147,8 @@ UNIV_INTERN bool srv_undo_sources; #ifdef UNIV_DEBUG /** InnoDB system tablespace to set during recovery */ UNIV_INTERN uint srv_sys_space_size_debug; +/** whether redo log files have been created at startup */ +UNIV_INTERN bool srv_log_files_created; #endif /* UNIV_DEBUG */ /** Bit flags for tracking background thread creation. They are used to @@ -526,6 +528,9 @@ create_log_files_rename( we need to explicitly flush the log buffers. */ fil_flush(SRV_LOG_SPACE_FIRST_ID); + ut_ad(!srv_log_files_created); + ut_d(srv_log_files_created = true); + DBUG_EXECUTE_IF("innodb_log_abort_9", return(DB_ERROR);); DBUG_PRINT("ib_log", ("After innodb_log_abort_9")); From 90038693903044bbbf7946ac128c3757ad33d7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sun, 18 Jun 2017 19:48:57 +0300 Subject: [PATCH 03/53] Simplify IO_CACHE by removing current_pos and end_pos as self-references These self references were previously used to avoid having to check the IO_CACHE's type. However, a benchmark shows that on x86 5930k stock, the type comparison is marginally faster than the double pointer dereference. For 40 billion my_b_tell calls, the difference is .1 seconds in favor of performing the type check. (Basically there is no measurable difference) To prevent bugs from copying the structure using the equals(=) operator, and having to do the bookkeeping manually, remove these "convenience" variables. --- include/my_sys.h | 20 +++++++++--------- mysys/mf_iocache.c | 39 +----------------------------------- sql/filesort.cc | 3 --- storage/maria/ma_sort.c | 2 -- storage/myisam/sort.c | 2 -- unittest/sql/mf_iocache-t.cc | 2 +- 6 files changed, 11 insertions(+), 57 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index ed5a7200ec8..fb3e15b64a4 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -422,14 +422,6 @@ typedef struct st_io_cache /* Used when cacheing files */ /* The non-inclusive boundary of the valid write area */ uchar *write_end; - /* - Current_pos and current_end are convenience variables used by - my_b_tell() and other routines that need to know the current offset - current_pos points to &write_pos, and current_end to &write_end in a - WRITE_CACHE, and &read_pos and &read_end respectively otherwise - */ - uchar **current_pos, **current_end; - /* The lock is for append buffer used in SEQ_READ_APPEND cache need mutex copying from append buffer to read buffer. @@ -584,7 +576,11 @@ static inline size_t my_b_fill(IO_CACHE *info) static inline my_off_t my_b_tell(const IO_CACHE *info) { - return info->pos_in_file + (*info->current_pos - info->request_pos); + if (info->type == WRITE_CACHE) { + return info->pos_in_file + (info->write_pos - info->request_pos); + + } + return info->pos_in_file + (info->read_pos - info->request_pos); } static inline my_off_t my_b_write_tell(const IO_CACHE *info) @@ -609,7 +605,10 @@ static inline my_off_t my_b_get_pos_in_file(const IO_CACHE *info) static inline size_t my_b_bytes_in_cache(const IO_CACHE *info) { - return *info->current_end - *info->current_pos; + if (info->type == WRITE_CACHE) { + return info->write_end - info->write_pos; + } + return info->read_end - info->read_pos; } int my_b_copy_to_file(IO_CACHE *cache, FILE *file); @@ -803,7 +802,6 @@ extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize, extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type, my_off_t seek_offset, my_bool use_async_io, my_bool clear_cache); -extern void setup_io_cache(IO_CACHE* info); extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, IO_CACHE *write_cache, uint num_threads); diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 23f2d7984d3..0c2c1da354c 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -74,34 +74,6 @@ int (*_my_b_encr_read)(IO_CACHE *info,uchar *Buffer,size_t Count)= 0; int (*_my_b_encr_write)(IO_CACHE *info,const uchar *Buffer,size_t Count)= 0; -/* - Setup internal pointers inside IO_CACHE - - SYNOPSIS - setup_io_cache() - info IO_CACHE handler - - NOTES - This is called on automatically on init or reinit of IO_CACHE - It must be called externally if one moves or copies an IO_CACHE - object. -*/ - -void setup_io_cache(IO_CACHE* info) -{ - /* Ensure that my_b_tell() and my_b_bytes_in_cache works */ - if (info->type == WRITE_CACHE) - { - info->current_pos= &info->write_pos; - info->current_end= &info->write_end; - } - else - { - info->current_pos= &info->read_pos; - info->current_end= &info->read_end; - } -} - static void init_functions(IO_CACHE* info) @@ -148,8 +120,6 @@ init_functions(IO_CACHE* info) DBUG_ASSERT(0); break; } - - setup_io_cache(info); } @@ -360,12 +330,7 @@ int init_slave_io_cache(IO_CACHE *master, IO_CACHE *slave) memcpy(slave->buffer, master->buffer, master->buffer_length); slave->read_pos= slave->buffer + (master->read_pos - master->buffer); slave->read_end= slave->buffer + (master->read_end - master->buffer); - - DBUG_ASSERT(master->current_pos == &master->read_pos); - slave->current_pos= &slave->read_pos; - DBUG_ASSERT(master->current_end == &master->read_end); - slave->current_end= &slave->read_end; - + if (master->next_file_user) { IO_CACHE *p; @@ -924,8 +889,6 @@ void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, read_cache->share= cshare; read_cache->read_function= _my_b_cache_read_r; - read_cache->current_pos= NULL; - read_cache->current_end= NULL; if (write_cache) { diff --git a/sql/filesort.cc b/sql/filesort.cc index 83c8442937e..2388dd759b5 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1483,8 +1483,6 @@ int merge_many_buff(Sort_param *param, uchar *sort_buffer, if (flush_io_cache(to_file)) break; /* purecov: inspected */ temp=from_file; from_file=to_file; to_file=temp; - setup_io_cache(from_file); - setup_io_cache(to_file); *maxbuffer= (uint) (lastbuff-buffpek)-1; } cleanup: @@ -1492,7 +1490,6 @@ cleanup: if (to_file == t_file) { *t_file=t_file2; // Copy result file - setup_io_cache(t_file); } DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */ diff --git a/storage/maria/ma_sort.c b/storage/maria/ma_sort.c index edd5650e07b..6e106976b70 100644 --- a/storage/maria/ma_sort.c +++ b/storage/maria/ma_sort.c @@ -896,8 +896,6 @@ cleanup: { DBUG_ASSERT(t_file2.type == WRITE_CACHE); *t_file=t_file2; /* Copy result file */ - t_file->current_pos= &t_file->write_pos; - t_file->current_end= &t_file->write_end; } DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */ diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index 0d177072ec7..533f2cd2aa6 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -844,8 +844,6 @@ cleanup: { DBUG_ASSERT(t_file2.type == WRITE_CACHE); *t_file=t_file2; /* Copy result file */ - t_file->current_pos= &t_file->write_pos; - t_file->current_end= &t_file->write_end; } DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */ diff --git a/unittest/sql/mf_iocache-t.cc b/unittest/sql/mf_iocache-t.cc index a7db7c58713..36860892508 100644 --- a/unittest/sql/mf_iocache-t.cc +++ b/unittest/sql/mf_iocache-t.cc @@ -93,7 +93,7 @@ IO_CACHE info; #define CACHE_SIZE 16384 #define INFO_TAIL ", pos_in_file = %llu, pos_in_mem = %lu", \ - info.pos_in_file, (ulong) (*info.current_pos - info.request_pos) + info.pos_in_file, (ulong) ((info.type == READ_CACHE ? info.read_pos : info.write_pos) - info.request_pos) #define FILL 0x5A From 23edc7c88f29d7bee01f39f1a58f4ada05f724c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Tue, 27 Jun 2017 12:26:38 +0300 Subject: [PATCH 04/53] MDEV-13186: main.win failure post MDEV-12336 During statement preparation st_order::item gets set to a value in ref_ptr_array. During statement execution we were overriding that value, causing subsequent checks for window functions to return true. Whenever we do any setting from ref_ptr_array, make sure to always store the value in all_fields as well. For function items containing window functions, as MDEV-12336 has discovered, we don't need to create a separate Item_direct_ref or Item_aggregate_ref as they will be computed directly from the top-level item once the window function argument columns are computed. --- mysql-test/r/win.result | 12 ++++++++++++ mysql-test/t/win.test | 10 ++++++++++ sql/item.cc | 6 +++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index ec83998aa98..a67c336e5b4 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3085,3 +3085,15 @@ select max(id), rank() over (order by max(id)) from t1 where id < 3; max(id) rank() over (order by max(id)) 2 1 drop table t1; +# +# main.win failure post MDEV-12336 +# +create table t(a decimal(35,10), b int); +insert into t values (1, 10), (2, 20), (3, 30); +prepare stmt from "SELECT (CASE WHEN sum(t.a) over (partition by t.b)=1 THEN 1000 ELSE 300 END) AS a FROM t"; +execute stmt; +a +1000 +300 +300 +drop table t; diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index 95d32c5bd14..0ecb2b35074 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -1877,3 +1877,13 @@ select count(max(id)) over (order by max(id)) from t1 where id < 3; select max(id), rank() over (order by max(id)) from t1 where id < 3; drop table t1; + +--echo # +--echo # main.win failure post MDEV-12336 +--echo # +create table t(a decimal(35,10), b int); +insert into t values (1, 10), (2, 20), (3, 30); + +prepare stmt from "SELECT (CASE WHEN sum(t.a) over (partition by t.b)=1 THEN 1000 ELSE 300 END) AS a FROM t"; +execute stmt; +drop table t; diff --git a/sql/item.cc b/sql/item.cc index 7ec50c2f472..30778132afc 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1920,6 +1920,9 @@ void Item::split_sum_func2(THD *thd, Ref_ptr_array ref_pointer_array, point to the temporary table. */ split_sum_func(thd, ref_pointer_array, fields, split_flags); + if (type() == FUNC_ITEM) { + return; + } } else { @@ -1979,9 +1982,6 @@ void Item::split_sum_func2(THD *thd, Ref_ptr_array ref_pointer_array, &ref_pointer_array[el], 0, name)))) return; // fatal_error is set } - else if (type() == FUNC_ITEM && - ((Item_func *) this)->with_window_func) - return; else { if (!(item_ref= (new (thd->mem_root) From 31ba0fa48d27715e82258b1e74401093e0ee17a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Wed, 28 Jun 2017 18:42:56 +0300 Subject: [PATCH 05/53] MDEV-12851: Case with window functions query crashes server The "is null" function performs one operation which no other Item_func does, which is to update used tables during fix_length_and_dec(). This however can not be performed before window functions have had a chance to resolve their order by and partition by definitions, which happens after the initial setup_fields call. Consequently, do not call Item_func_isnull update_used_tables during fix_length_and_dec(). There was another issue detected once the crash was resolved. Because window functions did not implement is_null() method, we would end up returning bad results for "is null" and "is not null" functions. Implemented is_null() method for Item_windowfunc. --- mysql-test/r/win.result | 30 ++++++++++++++++++++++++++++++ mysql-test/t/win.test | 27 +++++++++++++++++++++++++++ sql/item_cmpfunc.h | 5 ----- sql/item_func.cc | 5 +++-- sql/item_windowfunc.h | 11 +++++++++++ 5 files changed, 71 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index a67c336e5b4..952bd82ac7f 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3097,3 +3097,33 @@ a 300 300 drop table t; +# +# MDEV-12851 case with window functions query crashes server +# +create table t1(dt datetime); +insert into t1 values ('2017-05-17'), ('2017-05-18'); +select dt, +case when (max(dt) over (order by dt rows between 1 following and 1 following) is null) +then '9999-12-31 12:00:00' + else max(dt) over (order by dt rows between 1 following and 1 following) +end x, +case when (max(dt) over (order by dt rows between 1 following and 1 following) is not null) +then '9999-12-31 12:00:00' + else max(dt) over (order by dt rows between 1 following and 1 following) +end x +from t1; +dt x x +2017-05-17 00:00:00 2017-05-18 00:00:00 9999-12-31 12:00:00 +2017-05-18 00:00:00 9999-12-31 12:00:00 NULL +drop table t1; +create table t1(i int); +insert into t1 values (null),(1),(2); +select max(i) over (order by i), +max(i) over (order by i) is null, +max(i) over (order by i) is not null +from t1; +max(i) over (order by i) max(i) over (order by i) is null max(i) over (order by i) is not null +NULL 1 0 +1 0 1 +2 0 1 +drop table t1; diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index 0ecb2b35074..45653b18682 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -1887,3 +1887,30 @@ insert into t values (1, 10), (2, 20), (3, 30); prepare stmt from "SELECT (CASE WHEN sum(t.a) over (partition by t.b)=1 THEN 1000 ELSE 300 END) AS a FROM t"; execute stmt; drop table t; + +--echo # +--echo # MDEV-12851 case with window functions query crashes server +--echo # + +create table t1(dt datetime); +insert into t1 values ('2017-05-17'), ('2017-05-18'); +select dt, + case when (max(dt) over (order by dt rows between 1 following and 1 following) is null) + then '9999-12-31 12:00:00' + else max(dt) over (order by dt rows between 1 following and 1 following) + end x, + case when (max(dt) over (order by dt rows between 1 following and 1 following) is not null) + then '9999-12-31 12:00:00' + else max(dt) over (order by dt rows between 1 following and 1 following) + end x +from t1; + +drop table t1; + +create table t1(i int); +insert into t1 values (null),(1),(2); +select max(i) over (order by i), + max(i) over (order by i) is null, + max(i) over (order by i) is not null +from t1; +drop table t1; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index c81a1621f8a..2f98c68bb5f 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1770,11 +1770,6 @@ public: Item_func_isnull(THD *thd, Item *a): Item_func_null_predicate(thd, a) {} longlong val_int(); enum Functype functype() const { return ISNULL_FUNC; } - void fix_length_and_dec() - { - Item_func_null_predicate::fix_length_and_dec(); - update_used_tables(); - } const char *func_name() const { return "isnull"; } void print(String *str, enum_query_type query_type); enum precedence precedence() const { return CMP_PRECEDENCE; } diff --git a/sql/item_func.cc b/sql/item_func.cc index 8529a1d08ca..1b83f86d19c 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -153,8 +153,9 @@ void Item_func::sync_with_sum_func_and_with_field(List &list) is to allow all Item_field() objects to setup pointers to the table fields. Sets as a side effect the following class variables: - maybe_null Set if any argument may return NULL - with_sum_func Set if any of the arguments contains a sum function + maybe_null Set if any argument may return NULL + with_sum_func Set if any of the arguments contains a sum function + with_window_func Set if any of the arguments contain a window function with_field Set if any of the arguments contains or is a field used_tables_cache Set to union of the tables used by arguments diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index b4953c8a6ac..0dee60915f8 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -848,6 +848,17 @@ public: read_value_from_result_field= true; } + bool is_null() + { + if (force_return_blank) + return false; + + if (read_value_from_result_field) + return result_field->is_null(); + + return window_func()->is_null(); + } + double val_real() { double res; From e60802394743d990e71754716c5f3cc234f581c1 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 28 Jun 2017 11:38:26 -0700 Subject: [PATCH 06/53] Fixed the bug mdev-13107 and some similar unreported bugs. The problems were in the code of sql_show.cc. There the tables could be opened in such a way that mysql_derived_init() never worked for CTE tables. As a result they were not marked as derived and mysql_handle_derived() were not called for derived tables used in their specifications. --- mysql-test/r/cte_nonrecursive.result | 33 ++++++++++++++++++++++++++++ mysql-test/t/cte_nonrecursive.test | 33 ++++++++++++++++++++++++++++ sql/sql_show.cc | 6 ++--- 3 files changed, 69 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index de681edf683..5a5cd0bdc8e 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -1002,3 +1002,36 @@ f 2 DROP TABLE cte; DROP TABLE t; +# +# MDEV-13107: SHOW TABLE STATUS, SHOW CREATE VIEW +# for CTEs that use derived tables +# +create table t1(a int) engine=myisam; +insert into t1 values (3), (1), (2); +create table t2 (b int) engine=myisam; +insert into t2 values (2), (10); +create view v1 as +with t as (select s.a from (select t1.a from t1) s), +r as(select t.a from t2, t where t2.b=t.a) +select a from r; +create view v2 as +with t as (select s.a from (select t1.a from t1) s), +r as(select t.a from t2, t where t2.b=t.a) +select a from t1; +show table status; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `s`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1`) `s`), r as (select `t`.`a` AS `a` from (`test`.`t2` join `t`) where `test`.`t2`.`b` = `t`.`a`)select `r`.`a` AS `a` from `r` latin1 latin1_swedish_ci +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `s`.`a` AS `a` from (select `test`.`t1`.`a` AS `a` from `test`.`t1`) `s`), r as (select `t`.`a` AS `a` from (`test`.`t2` join `t`) where `test`.`t2`.`b` = `t`.`a`)select `test`.`t1`.`a` AS `a` from `test`.`t1` latin1 latin1_swedish_ci +select * from v1; +a +2 +select * from v2; +a +3 +1 +2 +drop view v1,v2; +drop table t1,t2; diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test index 0cc63104fa5..361ab8de28e 100644 --- a/mysql-test/t/cte_nonrecursive.test +++ b/mysql-test/t/cte_nonrecursive.test @@ -681,3 +681,36 @@ SELECT * FROM cte; DROP TABLE cte; DROP TABLE t; + +--echo # +--echo # MDEV-13107: SHOW TABLE STATUS, SHOW CREATE VIEW +--echo # for CTEs that use derived tables +--echo # + +create table t1(a int) engine=myisam; +insert into t1 values (3), (1), (2); +create table t2 (b int) engine=myisam; +insert into t2 values (2), (10); + +create view v1 as +with t as (select s.a from (select t1.a from t1) s), + r as(select t.a from t2, t where t2.b=t.a) + select a from r; + +create view v2 as +with t as (select s.a from (select t1.a from t1) s), + r as(select t.a from t2, t where t2.b=t.a) + select a from t1; + +--disable_result_log +show table status; +--enable_result_log + +show create view v1; +show create view v2; + +select * from v1; +select * from v2; + +drop view v1,v2; +drop table t1,t2; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index bfeac981a93..1bc2321c1ca 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1163,7 +1163,7 @@ mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list, bool open_error= open_tables(thd, &table_list, &counter, MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL) || - mysql_handle_derived(thd->lex, DT_PREPARE); + mysql_handle_derived(thd->lex, DT_INIT | DT_PREPARE); thd->pop_internal_handler(); if (open_error && (thd->killed || thd->is_error())) goto exit; @@ -1416,7 +1416,7 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild) if (open_normal_and_derived_tables(thd, table_list, MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL, - DT_PREPARE | DT_CREATE)) + DT_INIT | DT_PREPARE | DT_CREATE)) DBUG_VOID_RETURN; table= table_list->table; @@ -4274,7 +4274,7 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys, MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL | (can_deadlock ? MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0)), - DT_PREPARE | DT_CREATE)); + DT_INIT | DT_PREPARE | DT_CREATE)); /* Restore old value of sql_command back as it is being looked at in process_table() function. From 9222d79b820edf4f2abd1f96ad411f39f8c81df3 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 29 Jun 2017 12:32:43 +1000 Subject: [PATCH 07/53] travis: packages for debian build - added fakeroot --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index d7657509297..f326db89d6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -151,6 +151,7 @@ addons: - libdistro-info-perl - uuid-dev - devscripts # implicit for any build on Ubuntu + - fakeroot # libsystemd-daemon-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3882 From 9e0aa294aa87adb1bdcb4fb57112e9704fb4b68b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 29 Jun 2017 12:39:42 +1000 Subject: [PATCH 08/53] travis: MDEV-13002 fixed - don't allow failures in MYSQL_TEST_SUITES=plugins Revert "travis: allowed_failures MYSQL_TEST_SUITES=plugins (MDEV-13002)" This reverts commit c4cbc7a8807250d2d5b5938b218fd9c423a0b30a. --- .travis.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index f326db89d6a..8acce3c9539 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,13 +62,6 @@ matrix: - os: osx compiler: clang env: GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,percona,perfschema,plugins,multi_source,roles - # MDEV-13002 plugins.server_audit and plugins.thread_pool_server_audit test fail due to mysqltest error - - os: linux - compiler: gcc - env: GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,percona,perfschema,plugins,multi_source,roles - - os: linux - compiler: clang - env: GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,percona,perfschema,plugins,multi_source,roles # Matrix include for coverity # - env: From 18a2b0a1681af73181bd98d23ae0973fc1249df5 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 29 Jun 2017 14:48:00 +1000 Subject: [PATCH 09/53] travis: disable ccache on deb build - ENOSPC --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8acce3c9539..9c39228c7f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,8 @@ matrix: include: - os: linux compiler: gcc + # disable cache - was out of disk space + cache: false script: - ${CC} --version ; ${CXX} --version - source .travis.compiler.sh From 13221b1eb20c16c0fd19079b670296aa2b789263 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 28 Jun 2017 22:39:21 -0700 Subject: [PATCH 10/53] Fixed a failure of the test case for the bug mdev-13107 in --ps-protocol. The fix was in the call the open_normal_and_derived_tables() from the function mysql_test_select() and it was similar to those from the patch for mdev-13107. Added explicit PREPARE statements that failed in --ps-protocol. --- mysql-test/r/cte_nonrecursive.result | 20 ++++++++++++++++++++ mysql-test/t/cte_nonrecursive.test | 10 ++++++++++ sql/sql_prepare.cc | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index 5a5cd0bdc8e..79d380a04db 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -1033,5 +1033,25 @@ a 3 1 2 +prepare stmt1 from "select * from v1"; +execute stmt1; +a +2 +execute stmt1; +a +2 +prepare stmt2 from "select * from v2"; +execute stmt2; +a +3 +1 +2 +execute stmt2; +a +3 +1 +2 +deallocate prepare stmt1; +deallocate prepare stmt2; drop view v1,v2; drop table t1,t2; diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test index 361ab8de28e..980bff01694 100644 --- a/mysql-test/t/cte_nonrecursive.test +++ b/mysql-test/t/cte_nonrecursive.test @@ -712,5 +712,15 @@ show create view v2; select * from v1; select * from v2; +prepare stmt1 from "select * from v1"; +execute stmt1; +execute stmt1; +prepare stmt2 from "select * from v2"; +execute stmt2; +execute stmt2; + +deallocate prepare stmt1; +deallocate prepare stmt2; + drop view v1,v2; drop table t1,t2; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 92137b30f77..f9da7e530cb 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1590,7 +1590,7 @@ static int mysql_test_select(Prepared_statement *stmt, } if (open_normal_and_derived_tables(thd, tables, MYSQL_OPEN_FORCE_SHARED_MDL, - DT_PREPARE | DT_CREATE)) + DT_INIT | DT_PREPARE | DT_CREATE)) goto error; thd->lex->used_tables= 0; // Updated by setup_fields From 7c997f4b2e25f388367b79b5228de4802d51ed6a Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 29 Jun 2017 15:59:17 +1000 Subject: [PATCH 11/53] travis: force deb build not to use ccache 18a2b0a1681af73181bd98d23ae0973fc1249df5 wasn't sufficient. The path needed to be set so ccache wasn't picked up. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9c39228c7f2..454bd351627 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,7 @@ matrix: # https://github.com/travis-ci/travis-ci/issues/7062 - /run/shm isn't writable or executable # in trusty containers - export MTR_MEM=/tmp - - env DEB_BUILD_OPTIONS="parallel=6" debian/autobake-deb.sh; + - env DEB_BUILD_OPTIONS="parallel=6" MYSQL_BUILD_PATH=/usr/local/bin:/usr/bin:/bin debian/autobake-deb.sh; - ccache --show-stats # Until OSX becomes a bit more stable: MDEV-12435 allow_failures: From 95979d2baeef242c725bf41984693849b88b1906 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 29 Jun 2017 12:24:47 +0400 Subject: [PATCH 12/53] Removing duplicate code in mysql_execute_command: Adding prepare_db_action(). The code in mysql_execute_command() for SQLCOM_CREATE_DB, SQLCOM_DROP_DB and SQLCOM_ALTER_DB contained around 20 lines of similar code. Moving this code into a new function prepare_db_action(). --- sql/sql_parse.cc | 128 +++++++++++++++++++---------------------------- 1 file changed, 52 insertions(+), 76 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 312054ec37a..bab670fd8fc 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3034,6 +3034,54 @@ error: /* Used by WSREP_TO_ISOLATION_BEGIN */ } +/** + Prepare for CREATE DATABASE, ALTER DATABASE, DROP DATABASE. + + @param thd - current THD + @param want_access - access needed + @param dbname - the database name + + @retval false - Ok to proceed with CREATE/ALTER/DROP + @retval true - not OK to proceed (error, or filtered) + + Note, on slave this function returns true if the database + is in the ignore filter. The caller must distinguish this case + from other cases: bad database error, no access error. + This can be done by testing thd->is_error(). +*/ +static bool prepare_db_action(THD *thd, ulong want_access, LEX_CSTRING *dbname) +{ + if (check_db_name((LEX_STRING*)dbname)) + { + my_error(ER_WRONG_DB_NAME, MYF(0), dbname->str); + return true; + } + /* + If in a slave thread : + - CREATE DATABASE DB was certainly not preceded by USE DB. + - ALTER DATABASE DB may not be preceded by USE DB. + - DROP DATABASE DB may not be preceded by USE DB. + For that reason, db_ok() in sql/slave.cc did not check the + do_db/ignore_db. And as this query involves no tables, tables_ok() + was not called. So we have to check rules again here. + */ +#ifdef HAVE_REPLICATION + if (thd->slave_thread) + { + Rpl_filter *rpl_filter; + rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter; + if (!rpl_filter->db_ok(dbname->str) || + !rpl_filter->db_ok_with_wild_table(dbname->str)) + { + my_message(ER_SLAVE_IGNORED_TABLE, + ER_THD(thd, ER_SLAVE_IGNORED_TABLE), MYF(0)); + return true; + } + } +#endif + return check_access(thd, want_access, dbname->str, NULL, NULL, 1, 0); +} + /** Execute command saved in thd and lex->sql_command. @@ -5038,33 +5086,9 @@ end_with_restore_list: break; case SQLCOM_CREATE_DB: { - if (check_db_name((LEX_STRING*) &lex->name)) - { - my_error(ER_WRONG_DB_NAME, MYF(0), lex->name.str); - break; - } - /* - If in a slave thread : - CREATE DATABASE DB was certainly not preceded by USE DB. - For that reason, db_ok() in sql/slave.cc did not check the - do_db/ignore_db. And as this query involves no tables, tables_ok() - above was not called. So we have to check rules again here. - */ -#ifdef HAVE_REPLICATION - if (thd->slave_thread) - { - rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter; - if (!rpl_filter->db_ok(lex->name.str) || - !rpl_filter->db_ok_with_wild_table(lex->name.str)) - { - my_message(ER_SLAVE_IGNORED_TABLE, ER_THD(thd, ER_SLAVE_IGNORED_TABLE), MYF(0)); - break; - } - } -#endif - if (check_access(thd, lex->create_info.or_replace() ? + if (prepare_db_action(thd, lex->create_info.or_replace() ? (CREATE_ACL | DROP_ACL) : CREATE_ACL, - lex->name.str, NULL, NULL, 1, 0)) + &lex->name)) break; WSREP_TO_ISOLATION_BEGIN(lex->name.str, NULL, NULL) res= mysql_create_db(thd, lex->name.str, @@ -5073,31 +5097,7 @@ end_with_restore_list: } case SQLCOM_DROP_DB: { - if (check_db_name((LEX_STRING*) &lex->name)) - { - my_error(ER_WRONG_DB_NAME, MYF(0), lex->name.str); - break; - } - /* - If in a slave thread : - DROP DATABASE DB may not be preceded by USE DB. - For that reason, maybe db_ok() in sql/slave.cc did not check the - do_db/ignore_db. And as this query involves no tables, tables_ok() - above was not called. So we have to check rules again here. - */ -#ifdef HAVE_REPLICATION - if (thd->slave_thread) - { - rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter; - if (!rpl_filter->db_ok(lex->name.str) || - !rpl_filter->db_ok_with_wild_table(lex->name.str)) - { - my_message(ER_SLAVE_IGNORED_TABLE, ER_THD(thd, ER_SLAVE_IGNORED_TABLE), MYF(0)); - break; - } - } -#endif - if (check_access(thd, DROP_ACL, lex->name.str, NULL, NULL, 1, 0)) + if (prepare_db_action(thd, DROP_ACL, &lex->name)) break; WSREP_TO_ISOLATION_BEGIN(lex->name.str, NULL, NULL) res= mysql_rm_db(thd, lex->name.str, lex->if_exists()); @@ -5140,31 +5140,7 @@ end_with_restore_list: case SQLCOM_ALTER_DB: { LEX_CSTRING *db= &lex->name; - if (check_db_name((LEX_STRING*) db)) - { - my_error(ER_WRONG_DB_NAME, MYF(0), db->str); - break; - } - /* - If in a slave thread : - ALTER DATABASE DB may not be preceded by USE DB. - For that reason, maybe db_ok() in sql/slave.cc did not check the - do_db/ignore_db. And as this query involves no tables, tables_ok() - above was not called. So we have to check rules again here. - */ -#ifdef HAVE_REPLICATION - if (thd->slave_thread) - { - rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter; - if (!rpl_filter->db_ok(db->str) || - !rpl_filter->db_ok_with_wild_table(db->str)) - { - my_message(ER_SLAVE_IGNORED_TABLE, ER_THD(thd, ER_SLAVE_IGNORED_TABLE), MYF(0)); - break; - } - } -#endif - if (check_access(thd, ALTER_ACL, db->str, NULL, NULL, 1, 0)) + if (prepare_db_action(thd, ALTER_ACL, db)) break; WSREP_TO_ISOLATION_BEGIN(db->str, NULL, NULL) res= mysql_alter_db(thd, db->str, &lex->create_info); From 629c60973d0ddfd89ae33c0d46a6d2adf756bf3d Mon Sep 17 00:00:00 2001 From: Sachin Setiya Date: Thu, 29 Jun 2017 18:30:39 +0530 Subject: [PATCH 13/53] MDEV-12758 wrep.pool_of_threads failed in buildbot with WSREP ... Problem:- While running tests from wsrep suite , we include file have_wsrep.inc or have_wsrep_enabled.inc , these file test wsrep plugin is ACTIVE or 'wsrep_on' is ON. These select does not ensure that whether 'wsrep_ready' is ON , So that we can process SQL queries. So sometimes we will get error like this mysqltest: At line 81: query 'call mtr.check_testcase()' failed: 1047: WSREP has not yet prepared node for application use not ok Solution:- In file have_wsrep.inc and have_wsrep_enabled.inc we will include wait_until_ready.inc , which will wait untill 'wsrep_on' is on --- mysql-test/include/have_wsrep.inc | 1 + mysql-test/include/have_wsrep_enabled.inc | 1 + mysql-test/suite/wsrep/t/wsrep_rpl.test | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/include/have_wsrep.inc b/mysql-test/include/have_wsrep.inc index 52220edf481..2a04485cec5 100644 --- a/mysql-test/include/have_wsrep.inc +++ b/mysql-test/include/have_wsrep.inc @@ -5,4 +5,5 @@ if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'wsre { --skip Test requires wsrep plugin. } +--source include/wait_until_ready.inc diff --git a/mysql-test/include/have_wsrep_enabled.inc b/mysql-test/include/have_wsrep_enabled.inc index 94eccadec3b..9287369c87c 100644 --- a/mysql-test/include/have_wsrep_enabled.inc +++ b/mysql-test/include/have_wsrep_enabled.inc @@ -8,4 +8,5 @@ if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_N { --skip Test requires wsrep_on=ON } +--source include/wait_until_ready.inc diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.test b/mysql-test/suite/wsrep/t/wsrep_rpl.test index 4f34aadc365..453a16e81ff 100644 --- a/mysql-test/suite/wsrep/t/wsrep_rpl.test +++ b/mysql-test/suite/wsrep/t/wsrep_rpl.test @@ -1,4 +1,3 @@ ---source include/have_wsrep.inc --source include/have_innodb.inc --source include/master-slave.inc From de3201df3fc830e4dc2ddc181a57d54e172ea3f4 Mon Sep 17 00:00:00 2001 From: Sachin Setiya Date: Thu, 29 Jun 2017 23:03:30 +0530 Subject: [PATCH 14/53] Fix MDEV-12758 --- mysql-test/include/have_wsrep.inc | 1 - mysql-test/suite/wsrep/t/pool_of_threads.test | 2 +- mysql-test/suite/wsrep/t/wsrep_rpl.test | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/include/have_wsrep.inc b/mysql-test/include/have_wsrep.inc index 2a04485cec5..52220edf481 100644 --- a/mysql-test/include/have_wsrep.inc +++ b/mysql-test/include/have_wsrep.inc @@ -5,5 +5,4 @@ if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'wsre { --skip Test requires wsrep plugin. } ---source include/wait_until_ready.inc diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.test b/mysql-test/suite/wsrep/t/pool_of_threads.test index dbf429e3f01..8e95d0ca495 100644 --- a/mysql-test/suite/wsrep/t/pool_of_threads.test +++ b/mysql-test/suite/wsrep/t/pool_of_threads.test @@ -1,4 +1,4 @@ ---source include/have_wsrep.inc +--source include/have_wsrep_enabled.inc --source include/have_binlog_format_row.inc --echo diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.test b/mysql-test/suite/wsrep/t/wsrep_rpl.test index 453a16e81ff..4f34aadc365 100644 --- a/mysql-test/suite/wsrep/t/wsrep_rpl.test +++ b/mysql-test/suite/wsrep/t/wsrep_rpl.test @@ -1,3 +1,4 @@ +--source include/have_wsrep.inc --source include/have_innodb.inc --source include/master-slave.inc From bb60a832ede139d24a2470a1b1217d30799d726e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 29 Jun 2017 11:31:01 +0300 Subject: [PATCH 15/53] Minor cleanup of InnoDB shutdown os_thread_active(): Remove. srv_shutdown_all_bg_threads(): Assert that high-level threads have already exited. Do not sleep if os_thread_count=0. --- storage/innobase/include/os0thread.h | 6 ------ storage/innobase/os/os0thread.cc | 18 ------------------ storage/innobase/srv/srv0start.cc | 15 ++++----------- 3 files changed, 4 insertions(+), 35 deletions(-) diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h index 071e7422894..d4430f5ebce 100644 --- a/storage/innobase/include/os0thread.h +++ b/storage/innobase/include/os0thread.h @@ -151,10 +151,4 @@ os_thread_sleep( /*============*/ ulint tm); /*!< in: time in microseconds */ -/*****************************************************************//** -Check if there are threads active. -@return true if the thread count > 0. */ -bool -os_thread_active(); - #endif diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc index 0462c62f4b2..fde743a9074 100644 --- a/storage/innobase/os/os0thread.cc +++ b/storage/innobase/os/os0thread.cc @@ -237,21 +237,3 @@ os_thread_sleep( select(0, NULL, NULL, NULL, &t); #endif /* _WIN32 */ } - -/*****************************************************************//** -Check if there are threads active. -@return true if the thread count > 0. */ -bool -os_thread_active() -/*==============*/ -{ - /* All the threads have exited or are just exiting; - NOTE that the threads may not have completed their - exit yet. Should we use pthread_join() to make sure - they have exited? If we did, we would have to - remove the pthread_detach() from - os_thread_exit(). Now we just sleep 0.1 - seconds and hope that is enough! */ - - return(my_atomic_loadlint(&os_thread_count) > 0); -} diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index e625ab84334..dfdea96d85d 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1234,6 +1234,7 @@ static void srv_shutdown_all_bg_threads() { + ut_ad(!srv_undo_sources); srv_shutdown_state = SRV_SHUTDOWN_EXIT_THREADS; /* All threads end up waiting for certain events. Put those events @@ -1285,13 +1286,7 @@ srv_shutdown_all_bg_threads() os_event_set(buf_flush_event); - /* f. dict_stats_thread is signaled from - logs_empty_and_mark_files_at_shutdown() and - should have already quit or is quitting right - now. */ - if (srv_use_mtflush) { - /* g. Exit the multi threaded flush threads */ buf_mtflu_io_thread_exit(); } } @@ -1300,13 +1295,11 @@ srv_shutdown_all_bg_threads() os_aio_wake_all_threads_at_shutdown(); } - const bool active = os_thread_active(); - - os_thread_sleep(100000); - - if (!active) { + if (!os_thread_count) { return; } + + os_thread_sleep(100000); } ib::warn() << os_thread_count << " threads created by InnoDB" From 8143ef1b7ca144f828f0a1d22671a76685825166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 29 Jun 2017 11:33:39 +0300 Subject: [PATCH 16/53] trx_validate_state_before_free(): Add debug assertions --- storage/innobase/trx/trx0trx.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 7fdbd808a60..b84bc6b961a 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -548,6 +548,10 @@ static void trx_validate_state_before_free(trx_t* trx) { + ut_ad(!trx->declared_to_be_inside_innodb); + ut_ad(!trx->n_mysql_tables_in_use); + ut_ad(!trx->mysql_n_tables_locked); + if (trx->declared_to_be_inside_innodb) { ib::error() << "Freeing a trx (" << trx << ", " @@ -558,7 +562,7 @@ trx_validate_state_before_free(trx_t* trx) putc('\n', stderr); /* This is an error but not a fatal error. We must keep - the counters like srv_conc_n_threads accurate. */ + the counters like srv_conc.n_active accurate. */ srv_conc_force_exit_innodb(trx); } From 859714e73d00e24268ac180341612e4ac9ac5788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 29 Jun 2017 22:24:48 +0300 Subject: [PATCH 17/53] Simplify up InnoDB redo log system startup and shutdown recv_sys_init(): Remove the parameter. recv_sys_create(): Merge to recv_sys_init(). recv_sys_mem_free(): Merge to recv_sys_close(). log_mem_free(): Merge to log_shutdown(). --- storage/innobase/include/log0log.h | 11 +----- storage/innobase/include/log0recv.h | 23 ++--------- storage/innobase/log/log0log.cc | 22 ++--------- storage/innobase/log/log0recv.cc | 61 ++++++----------------------- storage/innobase/srv/srv0start.cc | 6 +-- 5 files changed, 25 insertions(+), 98 deletions(-) diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 05e53e23f28..32668d7b929 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -407,16 +407,9 @@ Closes all log groups. */ void log_group_close_all(void); /*=====================*/ -/********************************************************//** -Shutdown the log system but do not release all the memory. */ +/** Shut down the redo log subsystem. */ void -log_shutdown(void); -/*==============*/ -/********************************************************//** -Free the log system data structures. */ -void -log_mem_free(void); -/*==============*/ +log_shutdown(); /** Whether to generate and require checksums on the redo log pages */ extern my_bool innodb_log_checksums; diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 784699279d4..bacfb86cc07 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -81,27 +81,12 @@ recv_reset_logs( OS_FILE_LOG_BLOCK_SIZE, after which we add LOG_BLOCK_HDR_SIZE */ -/********************************************************//** -Creates the recovery system. */ +/** Clean up after recv_sys_init() */ void -recv_sys_create(void); -/*=================*/ -/**********************************************************//** -Release recovery system mutexes. */ +recv_sys_close(); +/** Initialize the redo log recovery subsystem. */ void -recv_sys_close(void); -/*================*/ -/********************************************************//** -Frees the recovery system memory. */ -void -recv_sys_mem_free(void); -/*===================*/ -/********************************************************//** -Inits the recovery system for a recovery operation. */ -void -recv_sys_init( -/*==========*/ - ulint available_memory); /*!< in: available memory in bytes */ +recv_sys_init(); /********************************************************//** Frees the recovery system. */ void diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 4f924e064a8..71c9b23c439 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -2261,11 +2261,9 @@ log_group_close_all(void) log_group_close(&log_sys->log); } -/********************************************************//** -Shutdown the log system but do not release all the memory. */ +/** Shut down the redo log subsystem. */ void -log_shutdown(void) -/*==============*/ +log_shutdown() { log_group_close_all(); @@ -2289,20 +2287,8 @@ log_shutdown(void) } recv_sys_close(); -} - -/********************************************************//** -Free the log system data structures. */ -void -log_mem_free(void) -/*==============*/ -{ - if (log_sys != NULL) { - recv_sys_mem_free(); - ut_free(log_sys); - - log_sys = NULL; - } + ut_free(log_sys); + log_sys = NULL; } /******************************************************//** diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 71ce7c82a65..021d897e172 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -415,31 +415,9 @@ fil_name_parse( return(end_ptr); } -/********************************************************//** -Creates the recovery system. */ +/** Clean up after recv_sys_init() */ void -recv_sys_create(void) -/*=================*/ -{ - if (recv_sys != NULL) { - - return; - } - - recv_sys = static_cast(ut_zalloc_nokey(sizeof(*recv_sys))); - - mutex_create(LATCH_ID_RECV_SYS, &recv_sys->mutex); - mutex_create(LATCH_ID_RECV_WRITER, &recv_sys->writer_mutex); - - recv_sys->heap = NULL; - recv_sys->addr_hash = NULL; -} - -/********************************************************//** -Release recovery system mutexes. */ -void -recv_sys_close(void) -/*================*/ +recv_sys_close() { if (recv_sys != NULL) { recv_sys->dblwr.pages.clear(); @@ -578,56 +556,41 @@ DECLARE_THREAD(recv_writer_thread)( OS_THREAD_DUMMY_RETURN; } -/************************************************************ -Inits the recovery system for a recovery operation. */ +/** Initialize the redo log recovery subsystem. */ void -recv_sys_init( -/*==========*/ - ulint available_memory) /*!< in: available memory in bytes */ +recv_sys_init() { - if (recv_sys->heap != NULL) { + ut_ad(recv_sys == NULL); - return; - } + recv_sys = static_cast(ut_zalloc_nokey(sizeof(*recv_sys))); - mutex_enter(&(recv_sys->mutex)); + mutex_create(LATCH_ID_RECV_SYS, &recv_sys->mutex); + mutex_create(LATCH_ID_RECV_WRITER, &recv_sys->writer_mutex); - recv_sys->heap = mem_heap_create_typed(256, - MEM_HEAP_FOR_RECV_SYS); + recv_sys->heap = mem_heap_create_typed(256, MEM_HEAP_FOR_RECV_SYS); if (!srv_read_only_mode) { recv_sys->flush_start = os_event_create(0); recv_sys->flush_end = os_event_create(0); } + ulint size = buf_pool_get_curr_size(); /* Set appropriate value of recv_n_pool_free_frames. */ - if (buf_pool_get_curr_size() >= (10 * 1024 * 1024)) { + if (size >= 10 << 20) { /* Buffer pool of size greater than 10 MB. */ recv_n_pool_free_frames = 512; } recv_sys->buf = static_cast( ut_malloc_nokey(RECV_PARSING_BUF_SIZE)); - recv_sys->len = 0; - recv_sys->recovered_offset = 0; - recv_sys->addr_hash = hash_create(available_memory / 512); - recv_sys->n_addrs = 0; - - recv_sys->apply_log_recs = FALSE; - recv_sys->apply_batch_on = FALSE; - - recv_sys->found_corrupt_log = false; - recv_sys->found_corrupt_fs = false; - recv_sys->mlog_checkpoint_lsn = 0; + recv_sys->addr_hash = hash_create(size / 512); recv_sys->progress_time = ut_time(); recv_max_page_lsn = 0; /* Call the constructor for recv_sys_t::dblwr member */ new (&recv_sys->dblwr) recv_dblwr_t(); - - mutex_exit(&(recv_sys->mutex)); } /** Empty a fully processed hash table. */ diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index dfdea96d85d..1d72a700bba 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1831,8 +1831,7 @@ innobase_start_or_create_for_mysql() fsp_init(); log_sys_init(); - recv_sys_create(); - recv_sys_init(buf_pool_get_curr_size()); + recv_sys_init(); lock_sys_create(srv_lock_table_size); /* Create i/o-handler threads: */ @@ -2907,7 +2906,8 @@ innodb_shutdown() /* 4. Free all allocated memory */ pars_lexer_close(); - log_mem_free(); + recv_sys_close(); + ut_ad(buf_pool_ptr || !srv_was_started); if (buf_pool_ptr) { buf_pool_free(srv_buf_pool_instances); From 68b5aeae4e121ccb18fdc6ac389e85b79c6b7e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 29 Jun 2017 18:33:18 +0300 Subject: [PATCH 18/53] Minor cleanup of InnoDB I/O routines Change many function parameters from IORequest& to const IORequest&. Remove an unused definition of ECANCELED. --- storage/innobase/include/os0file.h | 92 ++++++++-------- storage/innobase/include/os0file.ic | 88 +++++++-------- storage/innobase/os/os0file.cc | 162 ++++++++++++---------------- 3 files changed, 156 insertions(+), 186 deletions(-) diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index b3a70edf8be..b366267d6d2 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -979,7 +979,7 @@ pfs_os_file_close_func( this function! This is the performance schema instrumented wrapper function for os_file_read() which requests a synchronous read operation. -@param[in, out] type IO request context +@param[in] type IO request context @param[in] file Open file handle @param[out] buf buffer where to read @param[in] offset file offset where to read @@ -990,20 +990,20 @@ os_file_read() which requests a synchronous read operation. UNIV_INLINE dberr_t pfs_os_file_read_func( - IORequest& type, - pfs_os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - const char* src_file, - uint src_line); + const IORequest& type, + pfs_os_file_t file, + void* buf, + os_offset_t offset, + ulint n, + const char* src_file, + uint src_line); /** NOTE! Please use the corresponding macro os_file_read_no_error_handling(), not directly this function! This is the performance schema instrumented wrapper function for os_file_read_no_error_handling_func() which requests a synchronous read operation. -@param[in, out] type IO request context +@param[in] type IO request context @param[in] file Open file handle @param[out] buf buffer where to read @param[in] offset file offset where to read @@ -1015,20 +1015,20 @@ read operation. UNIV_INLINE dberr_t pfs_os_file_read_no_error_handling_func( - IORequest& type, - pfs_os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - ulint* o, - const char* src_file, - uint src_line); + const IORequest& type, + pfs_os_file_t file, + void* buf, + os_offset_t offset, + ulint n, + ulint* o, + const char* src_file, + uint src_line); /** NOTE! Please use the corresponding macro os_aio(), not directly this function! Performance schema wrapper function of os_aio() which requests an asynchronous I/O operation. -@param[in] type IO request context +@param[in,out] type IO request context @param[in] mode IO mode @param[in] name Name of the file or path as NUL terminated string @@ -1066,7 +1066,7 @@ pfs_os_aio_func( this function! This is the performance schema instrumented wrapper function for os_file_write() which requests a synchronous write operation. -@param[in, out] type IO request context +@param[in] type IO request context @param[in] name Name of the file or path as NUL terminated string @param[in] file Open file handle @@ -1079,14 +1079,14 @@ os_file_write() which requests a synchronous write operation. UNIV_INLINE dberr_t pfs_os_file_write_func( - IORequest& type, - const char* name, - pfs_os_file_t file, - const void* buf, - os_offset_t offset, - ulint n, - const char* src_file, - uint src_line); + const IORequest& type, + const char* name, + pfs_os_file_t file, + const void* buf, + os_offset_t offset, + ulint n, + const char* src_file, + uint src_line); /** NOTE! Please use the corresponding macro os_file_flush(), not directly this function! @@ -1293,11 +1293,11 @@ Requests a synchronous read operation. @return DB_SUCCESS if request was successful */ dberr_t os_file_read_func( - IORequest& type, - os_file_t file, - void* buf, - os_offset_t offset, - ulint n) + const IORequest& type, + os_file_t file, + void* buf, + os_offset_t offset, + ulint n) MY_ATTRIBUTE((warn_unused_result)); /** Rewind file to its start, read at most size - 1 bytes from it to str, and @@ -1325,18 +1325,18 @@ any error handling. In case of error it returns FALSE. @return DB_SUCCESS or error code */ dberr_t os_file_read_no_error_handling_func( - IORequest& type, - os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - ulint* o) + const IORequest& type, + os_file_t file, + void* buf, + os_offset_t offset, + ulint n, + ulint* o) MY_ATTRIBUTE((warn_unused_result)); /** NOTE! Use the corresponding macro os_file_write(), not directly this function! Requests a synchronous write operation. -@param[in,out] type IO request context +@param[in] type IO request context @param[in] file Open file handle @param[out] buf buffer where to read @param[in] offset file offset where to read @@ -1344,12 +1344,12 @@ Requests a synchronous write operation. @return DB_SUCCESS if request was successful */ dberr_t os_file_write_func( - IORequest& type, - const char* name, - os_file_t file, - const void* buf, - os_offset_t offset, - ulint n) + const IORequest& type, + const char* name, + os_file_t file, + const void* buf, + os_offset_t offset, + ulint n) MY_ATTRIBUTE((warn_unused_result)); /** Check the existence and type of the given file. @@ -1432,7 +1432,7 @@ os_aio_free(); /** NOTE! Use the corresponding macro os_aio(), not directly this function! Requests an asynchronous i/o operation. -@param[in] type IO request context +@param[in,out] type IO request context @param[in] mode IO mode @param[in] name Name of the file or path as NUL terminated string diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic index 07c2b6212ed..6cb67af94ca 100644 --- a/storage/innobase/include/os0file.ic +++ b/storage/innobase/include/os0file.ic @@ -207,7 +207,7 @@ pfs_os_file_close_func( function! Performance schema wrapper function of os_aio() which requests an asynchronous i/o operation. -@param[in] type IO request context +@param[in,type] type IO request context @param[in] mode IO mode @param[in] name Name of the file or path as NUL terminated string @@ -264,7 +264,7 @@ pfs_os_aio_func( this function! This is the performance schema instrumented wrapper function for os_file_read() which requests a synchronous read operation. -@param[in, out] type IO request context +@param[in] type IO request context @param[in] file Open file handle @param[out] buf buffer where to read @param[in] offset file offset where to read @@ -275,13 +275,13 @@ os_file_read() which requests a synchronous read operation. UNIV_INLINE dberr_t pfs_os_file_read_func( - IORequest& type, - pfs_os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - const char* src_file, - uint src_line) + const IORequest& type, + pfs_os_file_t file, + void* buf, + os_offset_t offset, + ulint n, + const char* src_file, + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -305,7 +305,7 @@ not directly this function! This is the performance schema instrumented wrapper function for os_file_read_no_error_handling_func() which requests a synchronous read operation. -@param[in, out] type IO request context +@param[in] type IO request context @param[in] file Open file handle @param[out] buf buffer where to read @param[in] offset file offset where to read @@ -317,14 +317,14 @@ read operation. UNIV_INLINE dberr_t pfs_os_file_read_no_error_handling_func( - IORequest& type, - pfs_os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - ulint* o, - const char* src_file, - uint src_line) + const IORequest& type, + pfs_os_file_t file, + void* buf, + os_offset_t offset, + ulint n, + ulint* o, + const char* src_file, + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -343,7 +343,7 @@ pfs_os_file_read_no_error_handling_func( /** NOTE! Please use the corresponding macro os_file_read_no_error_handling_int_fd() to request a synchronous read operation. -@param[in,out] type read request +@param[in] type read request @param[in] file file handle @param[out] buf buffer where to read @param[in] offset file offset where to read @@ -354,13 +354,13 @@ a synchronous read operation. UNIV_INLINE bool pfs_os_file_read_no_error_handling_int_fd_func( - IORequest& type, - int file, - void* buf, - os_offset_t offset, - ulint n, - const char* src_file, - uint src_line) + const IORequest& type, + int file, + void* buf, + os_offset_t offset, + ulint n, + const char* src_file, + uint src_line) { PSI_file_locker_state state; @@ -387,7 +387,7 @@ pfs_os_file_read_no_error_handling_int_fd_func( this function! This is the performance schema instrumented wrapper function for os_file_write() which requests a synchronous write operation. -@param[in, out] type IO request context +@param[in] type IO request context @param[in] name Name of the file or path as NUL terminated string @param[in] file Open file handle @@ -401,14 +401,14 @@ os_file_write() which requests a synchronous write operation. UNIV_INLINE dberr_t pfs_os_file_write_func( - IORequest& type, - const char* name, - pfs_os_file_t file, - const void* buf, - os_offset_t offset, - ulint n, - const char* src_file, - uint src_line) + const IORequest& type, + const char* name, + pfs_os_file_t file, + const void* buf, + os_offset_t offset, + ulint n, + const char* src_file, + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -429,7 +429,7 @@ pfs_os_file_write_func( not directly this function! This is the performance schema instrumented wrapper function for os_file_write_int_fd() which requests a synchronous write operation. -@param[in,out] type write request +@param[in] type write request @param[in] name file name @param[in] file file handle @param[in] buf buffer to write @@ -441,14 +441,14 @@ os_file_write_int_fd() which requests a synchronous write operation. UNIV_INLINE bool pfs_os_file_write_int_fd_func( - IORequest& type, - const char* name, - int file, - const void* buf, - os_offset_t offset, - ulint n, - const char* src_file, - uint src_line) + const IORequest& type, + const char* name, + int file, + const void* buf, + os_offset_t offset, + ulint n, + const char* src_file, + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker; diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 5afb4527916..afe1b5b2079 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -107,9 +107,6 @@ static ulint os_innodb_umask = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; #else /** Umask for creating files */ static ulint os_innodb_umask = 0; -#ifndef ECANCELED -#define ECANCELED 125 -#endif static HANDLE completion_port; static HANDLE read_completion_port; static DWORD fls_sync_io = FLS_OUT_OF_INDEXES; @@ -303,7 +300,7 @@ public: /** Requests for a slot in the aio array. If no slot is available, waits until not_full-event becomes signaled. - @param[in,out] type IO context + @param[in] type IO context @param[in,out] m1 message to be passed along with the AIO operation @param[in,out] m2 message to be passed along with the AIO @@ -316,14 +313,14 @@ public: @param[in] len length of the block to read or write @return pointer to slot */ Slot* reserve_slot( - IORequest& type, - fil_node_t* m1, - void* m2, - pfs_os_file_t file, - const char* name, - void* buf, - os_offset_t offset, - ulint len) + const IORequest& type, + fil_node_t* m1, + void* m2, + pfs_os_file_t file, + const char* name, + void* buf, + os_offset_t offset, + ulint len) MY_ATTRIBUTE((warn_unused_result)); /** @return number of reserved slots */ @@ -510,14 +507,14 @@ public: MY_ATTRIBUTE((warn_unused_result)); /** Select the IO slot array - @param[in] type Type of IO, READ or WRITE + @param[in,out] type Type of IO, READ or WRITE @param[in] read_only true if running in read-only mode @param[in] mode IO mode @return slot array or NULL if invalid mode specified */ static AIO* select_slot_array( - IORequest& type, - bool read_only, - ulint mode) + IORequest& type, + bool read_only, + ulint mode) MY_ATTRIBUTE((warn_unused_result)); /** Calculates segment number for a slot. @@ -4931,14 +4928,15 @@ os_file_io( static MY_ATTRIBUTE((warn_unused_result)) ssize_t os_file_pwrite( - IORequest& type, - os_file_t file, - const byte* buf, - ulint n, - os_offset_t offset, - dberr_t* err) + const IORequest& type, + os_file_t file, + const byte* buf, + ulint n, + os_offset_t offset, + dberr_t* err) { ut_ad(type.validate()); + ut_ad(type.is_write()); ++os_n_file_writes; @@ -4951,26 +4949,25 @@ os_file_pwrite( return(n_bytes); } -/** Requests a synchronous write operation. +/** NOTE! Use the corresponding macro os_file_write(), not directly +Requests a synchronous write operation. @param[in] type IO flags @param[in] file handle to an open file @param[out] buf buffer from which to write @param[in] offset file offset from the start where to read @param[in] n number of bytes to read, starting from offset @return DB_SUCCESS if request was successful, false if fail */ -static MY_ATTRIBUTE((warn_unused_result)) dberr_t -os_file_write_page( - IORequest& type, - const char* name, - os_file_t file, - const void* buf, - os_offset_t offset, - ulint n) +os_file_write_func( + const IORequest& type, + const char* name, + os_file_t file, + const void* buf, + os_offset_t offset, + ulint n) { dberr_t err; - ut_ad(type.is_write()); ut_ad(type.validate()); ut_ad(n > 0); @@ -5017,13 +5014,15 @@ os_file_write_page( static MY_ATTRIBUTE((warn_unused_result)) ssize_t os_file_pread( - IORequest& type, - os_file_t file, - void* buf, - ulint n, - os_offset_t offset, - dberr_t* err) + const IORequest& type, + os_file_t file, + void* buf, + ulint n, + os_offset_t offset, + dberr_t* err) { + ut_ad(type.is_read()); + ++os_n_file_reads; const bool monitor = MONITOR_IS_ON(MONITOR_OS_PENDING_READS); @@ -5047,13 +5046,13 @@ os_file_pread( static MY_ATTRIBUTE((warn_unused_result)) dberr_t os_file_read_page( - IORequest& type, - os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - ulint* o, - bool exit_on_err) + const IORequest& type, + os_file_t file, + void* buf, + os_offset_t offset, + ulint n, + ulint* o, + bool exit_on_err) { dberr_t err; @@ -5421,14 +5420,12 @@ Requests a synchronous positioned read operation. @return DB_SUCCESS or error code */ dberr_t os_file_read_func( - IORequest& type, - os_file_t file, - void* buf, - os_offset_t offset, - ulint n) + const IORequest& type, + os_file_t file, + void* buf, + os_offset_t offset, + ulint n) { - ut_ad(type.is_read()); - return(os_file_read_page(type, file, buf, offset, n, NULL, true)); } @@ -5445,43 +5442,16 @@ Requests a synchronous positioned read operation. @return DB_SUCCESS or error code */ dberr_t os_file_read_no_error_handling_func( - IORequest& type, - os_file_t file, - void* buf, - os_offset_t offset, - ulint n, - ulint* o) + const IORequest& type, + os_file_t file, + void* buf, + os_offset_t offset, + ulint n, + ulint* o) { - ut_ad(type.is_read()); - return(os_file_read_page(type, file, buf, offset, n, o, false)); } -/** NOTE! Use the corresponding macro os_file_write(), not directly -Requests a synchronous write operation. -@param[in] type IO flags -@param[in] file handle to an open file -@param[out] buf buffer from which to write -@param[in] offset file offset from the start where to read -@param[in] n number of bytes to read, starting from offset -@return DB_SUCCESS if request was successful, false if fail */ -dberr_t -os_file_write_func( - IORequest& type, - const char* name, - os_file_t file, - const void* buf, - os_offset_t offset, - ulint n) -{ - ut_ad(type.validate()); - ut_ad(type.is_write()); - - const byte* ptr = reinterpret_cast(buf); - - return(os_file_write_page(type, name, file, ptr, offset, n)); -} - /** Check the existence and type of the given file. @param[in] path path name of file @param[out] exists true if the file exists @@ -6146,7 +6116,7 @@ AIO::get_segment_no_from_slot( /** Requests for a slot in the aio array. If no slot is available, waits until not_full-event becomes signaled. -@param[in,out] type IO context +@param[in] type IO context @param[in,out] m1 message to be passed along with the AIO operation @param[in,out] m2 message to be passed along with the AIO @@ -6160,14 +6130,14 @@ not_full-event becomes signaled. @return pointer to slot */ Slot* AIO::reserve_slot( - IORequest& type, - fil_node_t* m1, - void* m2, - pfs_os_file_t file, - const char* name, - void* buf, - os_offset_t offset, - ulint len) + const IORequest& type, + fil_node_t* m1, + void* m2, + pfs_os_file_t file, + const char* name, + void* buf, + os_offset_t offset, + ulint len) { #ifdef WIN_ASYNC_IO ut_a((len & 0xFFFFFFFFUL) == len); @@ -6378,7 +6348,7 @@ os_aio_simulated_wake_handler_threads() } /** Select the IO slot array -@param[in] type Type of IO, READ or WRITE +@param[in,out] type Type of IO, READ or WRITE @param[in] read_only true if running in read-only mode @param[in] mode IO mode @return slot array or NULL if invalid mode specified */ @@ -6595,7 +6565,7 @@ os_aio_windows_handler( /** NOTE! Use the corresponding macro os_aio(), not directly this function! Requests an asynchronous i/o operation. -@param[in] type IO request context +@param[in,out] type IO request context @param[in] mode IO mode @param[in] name Name of the file or path as NUL terminated string From cd623508dff53c210154392da6c0f65b7b6bcf4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 29 Jun 2017 19:16:07 +0300 Subject: [PATCH 19/53] buf_read_ibuf_merge_pages(): Discard all entries for a missing tablespace A similar change was contributed to Percona XtraBackup, but for some reason, it is not present in Percona XtraDB. Since MDEV-9566 (MariaDB 10.1.23), that change is present in the MariaDB XtraDB. --- storage/innobase/buf/buf0rea.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 20603021072..b8b7643702e 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -813,23 +813,26 @@ buf_read_ibuf_merge_pages( #endif for (ulint i = 0; i < n_stored; i++) { - const page_id_t page_id(space_ids[i], page_nos[i]); - - buf_pool_t* buf_pool = buf_pool_get(page_id); - bool found; const page_size_t page_size(fil_space_get_page_size( space_ids[i], &found)); if (!found) { tablespace_deleted: - /* The tablespace was not found, remove the - entries for that page */ - ibuf_merge_or_delete_for_page(NULL, page_id, - NULL, FALSE); + /* The tablespace was not found: remove all + entries for it */ + ibuf_delete_for_discarded_space(space_ids[i]); + while (i + 1 < n_stored + && space_ids[i + 1] == space_ids[i]) { + i++; + } continue; } + const page_id_t page_id(space_ids[i], page_nos[i]); + + buf_pool_t* buf_pool = buf_pool_get(page_id); + while (buf_pool->n_pend_reads > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) { os_thread_sleep(500000); From aea0e125d2cc17f4db5fe2079d8e89100f85714d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 29 Jun 2017 23:01:47 +0300 Subject: [PATCH 20/53] trx_sys_read_wsrep_checkpoint(): Return whether a checkpoint is present --- storage/innobase/include/trx0sys.h | 10 +++++----- storage/innobase/trx/trx0sys.cc | 12 +++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index bf8cf2481eb..48eca018a86 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -255,11 +255,11 @@ trx_sys_update_wsrep_checkpoint( trx_sysf_t* sys_header, /*!< in: sys_header */ mtr_t* mtr); /*!< in: mtr */ -void -/** Read WSREP checkpoint XID from sys header. */ -trx_sys_read_wsrep_checkpoint( -/*==========================*/ - XID* xid); /*!< out: WSREP XID */ +/** Read WSREP checkpoint XID from sys header. +@param[out] xid WSREP XID +@return whether the checkpoint was present */ +bool +trx_sys_read_wsrep_checkpoint(XID* xid); #endif /* WITH_WSREP */ /** Initializes the tablespace tag system. */ diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index 8d7c72319ed..ec144db5feb 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -349,10 +349,11 @@ trx_sys_update_wsrep_checkpoint( } -void -trx_sys_read_wsrep_checkpoint( -/*==========================*/ - XID* xid) +/** Read WSREP checkpoint XID from sys header. +@param[out] xid WSREP XID +@return whether the checkpoint was present */ +bool +trx_sys_read_wsrep_checkpoint(XID* xid) { trx_sysf_t* sys_header; mtr_t mtr; @@ -372,7 +373,7 @@ trx_sys_read_wsrep_checkpoint( memcpy(xid->data + 24, &seqno, sizeof(long long)); xid->formatID = -1; mtr_commit(&mtr); - return; + return false; } xid->formatID = (int)mach_read_from_4( @@ -389,6 +390,7 @@ trx_sys_read_wsrep_checkpoint( XIDDATASIZE); mtr_commit(&mtr); + return true; } #endif /* WITH_WSREP */ From 591edccc93617ab238399f445d69f662ee2dedb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 29 Jun 2017 23:03:39 +0300 Subject: [PATCH 21/53] Simplify access to the binlog offset in InnoDB trx_sys_print_mysql_binlog_offset(): Use 64-bit arithmetics and ib::info(). TRX_SYS_MYSQL_LOG_OFFSET: Replaces TRX_SYS_MYSQL_LOG_OFFSET_HIGH, TRX_SYS_MYSQL_LOG_OFFSET_LOW. trx_sys_update_mysql_binlog_offset(): Remove the constant parameter field=TRX_SYS_MYSQL_LOG_INFO. Use 64-bit arithmetics. --- .../innodb/r/group_commit_binlog_pos.result | 2 +- ...ommit_binlog_pos_no_optimize_thread.result | 2 +- .../innodb/t/group_commit_binlog_pos.test | 4 +- ..._commit_binlog_pos_no_optimize_thread.test | 4 +- storage/innobase/include/trx0sys.h | 14 +-- storage/innobase/trx/trx0sys.cc | 92 +++++++------------ storage/innobase/trx/trx0trx.cc | 1 - 7 files changed, 42 insertions(+), 77 deletions(-) diff --git a/mysql-test/suite/innodb/r/group_commit_binlog_pos.result b/mysql-test/suite/innodb/r/group_commit_binlog_pos.result index 616790c8b37..4de7cc8e43a 100644 --- a/mysql-test/suite/innodb/r/group_commit_binlog_pos.result +++ b/mysql-test/suite/innodb/r/group_commit_binlog_pos.result @@ -43,6 +43,6 @@ a 1 2 3 -InnoDB: Last MySQL binlog file position 0 , file name ./master-bin.000001 +InnoDB: Last binlog file './master-bin.000001', position SET DEBUG_SYNC= 'RESET'; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result b/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result index f338761aea8..faf57de1750 100644 --- a/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result +++ b/mysql-test/suite/innodb/r/group_commit_binlog_pos_no_optimize_thread.result @@ -44,6 +44,6 @@ a 1 2 3 -InnoDB: Last MySQL binlog file position 0 , file name ./master-bin.000001 +InnoDB: Last binlog file './master-bin.000001', position SET DEBUG_SYNC= 'RESET'; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/group_commit_binlog_pos.test b/mysql-test/suite/innodb/t/group_commit_binlog_pos.test index 7148733dc43..801895e825d 100644 --- a/mysql-test/suite/innodb/t/group_commit_binlog_pos.test +++ b/mysql-test/suite/innodb/t/group_commit_binlog_pos.test @@ -9,7 +9,7 @@ # Don't test this under valgrind, memory leaks will occur as we crash --source include/not_valgrind.inc -# The test case currently uses grep and tail, which may be unavailable on +# The test case currently uses sed and tail, which may be unavailable on # some windows systems. But see MWL#191 for how to remove the need for grep. --source include/not_windows.inc @@ -99,7 +99,7 @@ SELECT * FROM t1 ORDER BY a; let $MYSQLD_DATADIR= `SELECT @@datadir`; let pos=`select $binlog_start_pos + 730`; --replace_result $pos ---exec grep 'InnoDB: Last MySQL binlog file position' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1 +--exec sed -ne 's/.*\(InnoDB: Last binlog file .* position.*\)/\1/p' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1 SET DEBUG_SYNC= 'RESET'; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test index a2dab551cec..116bc54441e 100644 --- a/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test +++ b/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test @@ -9,7 +9,7 @@ # Don't test this under valgrind, memory leaks will occur as we crash --source include/not_valgrind.inc -# The test case currently uses grep and tail, which may be unavailable on +# The test case currently uses sed and tail, which may be unavailable on # some windows systems. But see MWL#191 for how to remove the need for grep. --source include/not_windows.inc @@ -100,6 +100,6 @@ SELECT * FROM t1 ORDER BY a; let $MYSQLD_DATADIR= `SELECT @@datadir`; let pos=`select $binlog_start_pos + 730`; --replace_result $pos ---exec grep 'InnoDB: Last MySQL binlog file position' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1 +--exec sed -ne 's/.*\(InnoDB: Last binlog file .* position.*\)/\1/p' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1 SET DEBUG_SYNC= 'RESET'; DROP TABLE t1; diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index 48eca018a86..e2b4e4d30fd 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -236,16 +236,12 @@ trx_sys_update_mysql_binlog_offset( /*===============================*/ const char* file_name,/*!< in: MySQL log file name */ int64_t offset, /*!< in: position in that log file */ - ulint field, /*!< in: offset of the MySQL log info field in - the trx sys header */ trx_sysf_t* sys_header, /*!< in: trx sys header */ mtr_t* mtr); /*!< in: mtr */ -/*****************************************************************//** -Prints to stderr the MySQL binlog offset info in the trx system header if -the magic number shows it valid. */ +/** Display the MySQL binlog offset info if it is present in the trx +system header. */ void -trx_sys_print_mysql_binlog_offset(void); -/*===================================*/ +trx_sys_print_mysql_binlog_offset(); #ifdef WITH_WSREP /** Update WSREP checkpoint XID in sys header. */ void @@ -420,9 +416,7 @@ impose the 7 bit restriction. e.g., mach_write_to_3() */ TRX_SYS_MYSQL_LOG_MAGIC_N if we have valid data in the MySQL binlog info */ -#define TRX_SYS_MYSQL_LOG_OFFSET_HIGH 4 /*!< high 4 bytes of the offset - within that file */ -#define TRX_SYS_MYSQL_LOG_OFFSET_LOW 8 /*!< low 4 bytes of the offset +#define TRX_SYS_MYSQL_LOG_OFFSET 4 /*!< the 64-bit offset within that file */ #define TRX_SYS_MYSQL_LOG_NAME 12 /*!< MySQL log file name */ diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index ec144db5feb..c35faede4b9 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -176,95 +176,67 @@ trx_sys_update_mysql_binlog_offset( /*===============================*/ const char* file_name,/*!< in: MySQL log file name */ int64_t offset, /*!< in: position in that log file */ - ulint field, /*!< in: offset of the MySQL log info field in - the trx sys header */ trx_sysf_t* sys_header, /*!< in: trx sys header */ mtr_t* mtr) /*!< in: mtr */ { DBUG_PRINT("InnoDB",("trx_mysql_binlog_offset: %lld", (longlong) offset)); - if (ut_strlen(file_name) >= TRX_SYS_MYSQL_LOG_NAME_LEN) { + const size_t len = strlen(file_name) + 1; + + if (len > TRX_SYS_MYSQL_LOG_NAME_LEN) { /* We cannot fit the name to the 512 bytes we have reserved */ return; } - if (mach_read_from_4(sys_header + field - + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD) + if (mach_read_from_4(TRX_SYS_MYSQL_LOG_MAGIC_N_FLD + + TRX_SYS_MYSQL_LOG_INFO + sys_header) != TRX_SYS_MYSQL_LOG_MAGIC_N) { - mlog_write_ulint(sys_header + field - + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD, + mlog_write_ulint(TRX_SYS_MYSQL_LOG_MAGIC_N_FLD + + TRX_SYS_MYSQL_LOG_INFO + sys_header, TRX_SYS_MYSQL_LOG_MAGIC_N, MLOG_4BYTES, mtr); } - if (0 != strcmp((char*) (sys_header + field + TRX_SYS_MYSQL_LOG_NAME), - file_name)) { - - mlog_write_string(sys_header + field - + TRX_SYS_MYSQL_LOG_NAME, - (byte*) file_name, 1 + ut_strlen(file_name), - mtr); + if (memcmp(file_name, TRX_SYS_MYSQL_LOG_NAME + TRX_SYS_MYSQL_LOG_INFO + + sys_header, len)) { + mlog_write_string(TRX_SYS_MYSQL_LOG_NAME + + TRX_SYS_MYSQL_LOG_INFO + + sys_header, + reinterpret_cast(file_name), + len, mtr); } - if (mach_read_from_4(sys_header + field - + TRX_SYS_MYSQL_LOG_OFFSET_HIGH) > 0 - || (offset >> 32) > 0) { - - mlog_write_ulint(sys_header + field - + TRX_SYS_MYSQL_LOG_OFFSET_HIGH, - (ulint)(offset >> 32), - MLOG_4BYTES, mtr); - } - - mlog_write_ulint(sys_header + field - + TRX_SYS_MYSQL_LOG_OFFSET_LOW, - (ulint)(offset & 0xFFFFFFFFUL), - MLOG_4BYTES, mtr); + mlog_write_ull(TRX_SYS_MYSQL_LOG_INFO + TRX_SYS_MYSQL_LOG_OFFSET + + sys_header, offset, mtr); } -/*****************************************************************//** -Stores the MySQL binlog offset info in the trx system header if -the magic number shows it valid, and print the info to stderr */ +/** Display the MySQL binlog offset info if it is present in the trx +system header. */ void -trx_sys_print_mysql_binlog_offset(void) -/*===================================*/ +trx_sys_print_mysql_binlog_offset() { - trx_sysf_t* sys_header; mtr_t mtr; - ulint trx_sys_mysql_bin_log_pos_high; - ulint trx_sys_mysql_bin_log_pos_low; - mtr_start(&mtr); + mtr.start(); - sys_header = trx_sysf_get(&mtr); + const trx_sysf_t* sys_header = trx_sysf_get(&mtr); - if (mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO - + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD) - != TRX_SYS_MYSQL_LOG_MAGIC_N) { - - mtr_commit(&mtr); - - return; + if (mach_read_from_4(TRX_SYS_MYSQL_LOG_INFO + + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD + sys_header) + == TRX_SYS_MYSQL_LOG_MAGIC_N) { + ib::info() << "Last binlog file '" + << TRX_SYS_MYSQL_LOG_INFO + TRX_SYS_MYSQL_LOG_NAME + + sys_header + << "', position " + << mach_read_from_8(TRX_SYS_MYSQL_LOG_INFO + + TRX_SYS_MYSQL_LOG_OFFSET + + sys_header); } - trx_sys_mysql_bin_log_pos_high = mach_read_from_4( - sys_header + TRX_SYS_MYSQL_LOG_INFO - + TRX_SYS_MYSQL_LOG_OFFSET_HIGH); - trx_sys_mysql_bin_log_pos_low = mach_read_from_4( - sys_header + TRX_SYS_MYSQL_LOG_INFO - + TRX_SYS_MYSQL_LOG_OFFSET_LOW); - - fprintf(stderr, - "InnoDB: Last MySQL binlog file position " ULINTPF " " ULINTPF - ", file name %s\n", - trx_sys_mysql_bin_log_pos_high, trx_sys_mysql_bin_log_pos_low, - sys_header + TRX_SYS_MYSQL_LOG_INFO - + TRX_SYS_MYSQL_LOG_NAME); - - mtr_commit(&mtr); + mtr.commit(); } #ifdef WITH_WSREP diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index b84bc6b961a..d397a2d2880 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1496,7 +1496,6 @@ trx_write_serialisation_history( trx_sys_update_mysql_binlog_offset( trx->mysql_log_file_name, trx->mysql_log_offset, - TRX_SYS_MYSQL_LOG_INFO, sys_header, mtr); From e903d458bb5267df4c37a6862587c403aa87dc35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 29 Jun 2017 23:10:46 +0300 Subject: [PATCH 22/53] Clean up InnoDB shutdown Tablespace::shutdown(): Clear m_path. This was moved from Tablespace::~Tablespace(). LatchDebug::shutdown(): Remove a redundant condition. --- storage/innobase/fsp/fsp0space.cc | 3 ++- storage/innobase/include/fsp0space.h | 4 ---- storage/innobase/srv/srv0start.cc | 8 ++------ storage/innobase/sync/sync0debug.cc | 5 ----- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc index 7ca81898f70..ea9c45697dc 100644 --- a/storage/innobase/fsp/fsp0space.cc +++ b/storage/innobase/fsp/fsp0space.cc @@ -65,7 +65,8 @@ Tablespace::shutdown() } m_files.clear(); - + ut_free(m_path); + m_path = NULL; m_space_id = ULINT_UNDEFINED; } diff --git a/storage/innobase/include/fsp0space.h b/storage/innobase/include/fsp0space.h index 3928f8362b9..5b5293666b5 100644 --- a/storage/innobase/include/fsp0space.h +++ b/storage/innobase/include/fsp0space.h @@ -62,10 +62,6 @@ public: shutdown(); ut_ad(m_files.empty()); ut_ad(m_space_id == ULINT_UNDEFINED); - if (m_path != NULL) { - ut_free(m_path); - m_path = NULL; - } } // Disable copying diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 1d72a700bba..ccc0e89e67f 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -2788,11 +2788,7 @@ innodb_shutdown() ut_ad(!srv_running); ut_ad(!srv_undo_sources); - /* 1. Flush the buffer pool to disk, write the current lsn to - the tablespace header(s), and copy all log data to archive. - The step 1 is the real InnoDB shutdown. The remaining steps 2 - ... - just free data structures after the shutdown. */ - + /* Shut down the persistent files. */ logs_empty_and_mark_files_at_shutdown(); if (ulint n_threads = srv_conc_get_active_threads()) { @@ -2801,7 +2797,7 @@ innodb_shutdown() " inside InnoDB at shutdown"; } - /* 2. Make all threads created by InnoDB to exit */ + /* Exit any remaining threads. */ srv_shutdown_all_bg_threads(); if (srv_monitor_file) { diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc index e43e87eb14e..d6f3ef6c986 100644 --- a/storage/innobase/sync/sync0debug.cc +++ b/storage/innobase/sync/sync0debug.cc @@ -1267,11 +1267,6 @@ LatchDebug::shutdown() mutex_free(&rw_lock_debug_mutex); - if (instance() == NULL) { - - return; - } - ut_a(s_initialized); s_initialized = false; From 84e4e4506ffee95d71f1cac916176e9b64ba1bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 5 Jun 2017 22:47:20 +0300 Subject: [PATCH 23/53] Reduce the granularity of innodb_log_file_size In Mariabackup, we would want the backed-up redo log file size to be a multiple of 512 bytes, or OS_FILE_LOG_BLOCK_SIZE. However, at startup, InnoDB would be picky, requiring the file size to be a multiple of innodb_page_size. Furthermore, InnoDB would require the parameter to be a multiple of one megabyte, while the minimum granularity is 512 bytes. Because the data-file-oriented fil_io() API is being used for writing the InnoDB redo log, writes will for now require innodb_log_file_size to be a multiple of the maximum innodb_page_size (65536 bytes). To complicate matters, InnoDB startup divided srv_log_file_size by UNIV_PAGE_SIZE, so that initially, the unit was bytes, and later it was innodb_page_size. We will simplify this and keep srv_log_file_size in bytes at all times. innobase_log_file_size: Remove. Remove some obsolete checks against overflow on 32-bit systems. srv_log_file_size is always 64 bits, and the maximum size 512GiB in multiples of innodb_page_size always fits in ulint (which is 32 or 64 bits). 512GiB would be 8,388,608*64KiB or 134,217,728*4KiB. log_init(): Remove the parameter file_size that was always passed as srv_log_file_size. log_set_capacity(): Add a parameter for passing the requested file size. srv_log_file_size_requested: Declare static in srv0start.cc. create_log_file(), create_log_files(), innobase_start_or_create_for_mysql(): Invoke fil_node_create() with srv_log_file_size expressed in multiples of innodb_page_size. innobase_start_or_create_for_mysql(): Require the redo log file sizes to be multiples of 512 bytes. --- mysql-test/suite/innodb/r/log_file.result | 2 +- .../suite/innodb/r/log_file_size.result | 8 +- mysql-test/suite/innodb/t/log_file.test | 2 +- mysql-test/suite/innodb/t/log_file_size.test | 8 +- storage/innobase/handler/ha_innodb.cc | 10 +-- storage/innobase/include/log0log.h | 8 +- storage/innobase/include/srv0srv.h | 14 +--- storage/innobase/log/log0log.cc | 14 ++-- storage/innobase/srv/srv0srv.cc | 16 +--- storage/innobase/srv/srv0start.cc | 74 +++++++------------ 10 files changed, 59 insertions(+), 97 deletions(-) diff --git a/mysql-test/suite/innodb/r/log_file.result b/mysql-test/suite/innodb/r/log_file.result index f0f8007cb09..b93bfc0d02b 100644 --- a/mysql-test/suite/innodb/r/log_file.result +++ b/mysql-test/suite/innodb/r/log_file.result @@ -340,7 +340,7 @@ WHERE engine='innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); 1 1 -FOUND 1 /Resizing redo log from 1\*\d+ to 3\*\d+ pages; LSN=\d+/ in mysqld.1.err +FOUND 1 /Resizing redo log from 1\*\d+ to 3\*\d+ bytes; LSN=\d+/ in mysqld.1.err # Cleanup bak_ib_logfile0 bak_ib_logfile1 diff --git a/mysql-test/suite/innodb/r/log_file_size.result b/mysql-test/suite/innodb/r/log_file_size.result index 9e0cb4dbbf7..b576061e74b 100644 --- a/mysql-test/suite/innodb/r/log_file_size.result +++ b/mysql-test/suite/innodb/r/log_file_size.result @@ -33,16 +33,16 @@ ERROR 42000: Unknown storage engine 'InnoDB' FOUND 1 /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' -FOUND 2 /redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err +FOUND 2 /redo log from 3\*[0-9]+ to 2\*[0-9]+ bytes/ in mysqld.1.err SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' -FOUND 3 /redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err +FOUND 3 /redo log from 3\*[0-9]+ to 2\*[0-9]+ bytes/ in mysqld.1.err SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' FOUND 2 /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' -FOUND 4 /redo log from 3\*[0-9]+ to 2\*[0-9]+ pages/ in mysqld.1.err +FOUND 4 /redo log from 3\*[0-9]+ to 2\*[0-9]+ bytes/ in mysqld.1.err SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' SELECT * FROM t1; @@ -56,7 +56,7 @@ ERROR 42000: Unknown storage engine 'InnoDB' FOUND 1 /InnoDB: Setting log file .*ib_logfile[0-9]+ size to/ in mysqld.1.err SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' -FOUND 1 /InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of innodb_page_size/ in mysqld.1.err +FOUND 1 /InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of 512 bytes/ in mysqld.1.err SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' FOUND 1 /InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files/ in mysqld.1.err diff --git a/mysql-test/suite/innodb/t/log_file.test b/mysql-test/suite/innodb/t/log_file.test index f5d46b1db10..8a82ab7f29f 100644 --- a/mysql-test/suite/innodb/t/log_file.test +++ b/mysql-test/suite/innodb/t/log_file.test @@ -218,7 +218,7 @@ eval $check_no_innodb; --source include/start_mysqld.inc eval $check_yes_innodb; --source include/shutdown_mysqld.inc ---let SEARCH_PATTERN=Resizing redo log from 1\*\d+ to 3\*\d+ pages; LSN=\d+ +--let SEARCH_PATTERN=Resizing redo log from 1\*\d+ to 3\*\d+ bytes; LSN=\d+ --source include/search_pattern_in_file.inc --let $restart_parameters= diff --git a/mysql-test/suite/innodb/t/log_file_size.test b/mysql-test/suite/innodb/t/log_file_size.test index 14cc889e34b..2a7ca9e0e45 100644 --- a/mysql-test/suite/innodb/t/log_file_size.test +++ b/mysql-test/suite/innodb/t/log_file_size.test @@ -100,14 +100,14 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery; --source include/restart_mysqld.inc --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; -let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; +let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ bytes; --source include/search_pattern_in_file.inc --let $restart_parameters= --debug=d,innodb_log_abort_5 --source include/restart_mysqld.inc --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; -let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; +let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ bytes; --source include/search_pattern_in_file.inc --let $restart_parameters= --innodb-read-only @@ -122,7 +122,7 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery; --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; -let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; +let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ bytes; --source include/search_pattern_in_file.inc --let $restart_parameters= --debug=d,innodb_log_abort_7 @@ -170,7 +170,7 @@ EOF --source include/start_mysqld.inc --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; -let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of innodb_page_size; +let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of 512 bytes; --source include/search_pattern_in_file.inc --remove_file $MYSQLD_DATADIR/ib_logfile0 --move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0 diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d8a4d8d2742..56465ae1257 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -212,7 +212,7 @@ static ulong innobase_commit_concurrency = 0; static ulong innobase_read_io_threads; static ulong innobase_write_io_threads; -static long long innobase_buffer_pool_size, innobase_log_file_size; +static long long innobase_buffer_pool_size; /** Percentage of the buffer pool to reserve for 'old' blocks. Connected to buf_LRU_old_ratio. */ @@ -4240,8 +4240,6 @@ innobase_change_buffering_inited_ok: srv_file_flush_method_str = innobase_file_flush_method; - srv_log_file_size = (ib_uint64_t) innobase_log_file_size; - if (UNIV_PAGE_SIZE_DEF != srv_page_size) { ib::info() << "innodb_page_size=" << srv_page_size; @@ -21184,10 +21182,12 @@ static MYSQL_SYSVAR_LONG(log_buffer_size, innobase_log_buffer_size, "The size of the buffer which InnoDB uses to write log to the log files on disk.", NULL, NULL, 16*1024*1024L, 256*1024L, LONG_MAX, 1024); -static MYSQL_SYSVAR_LONGLONG(log_file_size, innobase_log_file_size, +static MYSQL_SYSVAR_ULONGLONG(log_file_size, srv_log_file_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Size of each log file in a log group.", - NULL, NULL, 48 << 20, 1 << 20, 512ULL << 30, 1 << 20); + NULL, NULL, 48 << 20, 1 << 20, 512ULL << 30, UNIV_PAGE_SIZE_MAX); +/* OS_FILE_LOG_BLOCK_SIZE would be more appropriate than UNIV_PAGE_SIZE_MAX, +but fil_space_t is being used for the redo log, and it uses data pages. */ static MYSQL_SYSVAR_ULONG(log_files_in_group, srv_n_log_files, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 32668d7b929..1062a785fdb 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -156,17 +156,17 @@ void log_sys_init(); /** Initialize the redo log. -@param[in] n_files number of files -@param[in] file_size file size in bytes */ +@param[in] n_files number of files */ void -log_init(ulint n_files, lsn_t file_size); +log_init(ulint n_files); /** Calculate the recommended highest values for lsn - last_checkpoint_lsn and lsn - buf_get_oldest_modification(). +@param[in] file_size requested innodb_log_file_size @retval true on success @retval false if the smallest log group is too small to accommodate the number of OS threads in the database server */ bool -log_set_capacity() +log_set_capacity(ulonglong file_size) MY_ATTRIBUTE((warn_unused_result)); /******************************************************//** diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 4704625e1fe..4ee8962a0c7 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -360,17 +360,9 @@ extern char* srv_log_group_home_dir; /** Maximum number of srv_n_log_files, or innodb_log_files_in_group */ #define SRV_N_LOG_FILES_MAX 100 extern ulong srv_n_log_files; -/** At startup, this is the current redo log file size. -During startup, if this is different from srv_log_file_size_requested -(innodb_log_file_size), the redo log will be rebuilt and this size -will be initialized to srv_log_file_size_requested. -When upgrading from a previous redo log format, this will be set to 0, -and writing to the redo log is not allowed. - -During startup, this is in bytes, and later converted to pages. */ -extern ib_uint64_t srv_log_file_size; -/** The value of the startup parameter innodb_log_file_size */ -extern ib_uint64_t srv_log_file_size_requested; +/** The InnoDB redo log file size, or 0 when changing the redo log format +at startup (while disallowing writes to the redo log). */ +extern ulonglong srv_log_file_size; extern ulint srv_log_buffer_size; extern ulong srv_flush_log_at_trx_commit; extern uint srv_flush_log_at_timeout; diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 71c9b23c439..182df269015 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -669,18 +669,17 @@ log_group_set_fields( /** Calculate the recommended highest values for lsn - last_checkpoint_lsn and lsn - buf_get_oldest_modification(). +@param[in] file_size requested innodb_log_file_size @retval true on success @retval false if the smallest log group is too small to accommodate the number of OS threads in the database server */ bool -log_set_capacity() +log_set_capacity(ulonglong file_size) { lsn_t margin; ulint free; - lsn_t smallest_capacity = ((srv_log_file_size_requested - << srv_page_size_shift) - - LOG_FILE_HDR_SIZE) + lsn_t smallest_capacity = (file_size - LOG_FILE_HDR_SIZE) * srv_n_log_files; /* Add extra safety */ smallest_capacity -= smallest_capacity / 10; @@ -798,10 +797,9 @@ log_sys_init() } /** Initialize the redo log. -@param[in] n_files number of files -@param[in] file_size file size in bytes */ +@param[in] n_files number of files */ void -log_init(ulint n_files, lsn_t file_size) +log_init(ulint n_files) { ulint i; log_group_t* group = &log_sys->log; @@ -810,7 +808,7 @@ log_init(ulint n_files, lsn_t file_size) group->format = srv_encrypt_log ? LOG_HEADER_FORMAT_CURRENT | LOG_HEADER_FORMAT_ENCRYPTED : LOG_HEADER_FORMAT_CURRENT; - group->file_size = file_size; + group->file_size = srv_log_file_size; group->state = LOG_GROUP_OK; group->lsn = LOG_START_LSN; group->lsn_offset = LOG_FILE_HDR_SIZE; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index d7b7711e402..53009ca7621 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -201,17 +201,9 @@ static os_event_t srv_master_thread_disabled_event; char* srv_log_group_home_dir; ulong srv_n_log_files; -/** At startup, this is the current redo log file size. -During startup, if this is different from srv_log_file_size_requested -(innodb_log_file_size), the redo log will be rebuilt and this size -will be initialized to srv_log_file_size_requested. -When upgrading from a previous redo log format, this will be set to 0, -and writing to the redo log is not allowed. - -During startup, this is in bytes, and later converted to pages. */ -ib_uint64_t srv_log_file_size; -/** The value of the startup parameter innodb_log_file_size */ -ib_uint64_t srv_log_file_size_requested; +/** The InnoDB redo log file size, or 0 when changing the redo log format +at startup (while disallowing writes to the redo log). */ +ulonglong srv_log_file_size; /** copy of innodb_log_buffer_size, but in database pages */ ulint srv_log_buffer_size; /** innodb_flush_log_at_trx_commit */ @@ -1161,8 +1153,6 @@ srv_normalize_init_values(void) srv_tmp_space.normalize(); - srv_log_file_size /= UNIV_PAGE_SIZE; - srv_log_buffer_size /= UNIV_PAGE_SIZE; srv_lock_table_size = 5 * (srv_buf_pool_size / UNIV_PAGE_SIZE); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index ccc0e89e67f..399d02e7395 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -138,6 +138,8 @@ bool srv_is_being_started; bool srv_sys_tablespaces_open; /** TRUE if the server was successfully started */ bool srv_was_started; +/** The original value of srv_log_file_size (innodb_log_file_size) */ +static ulonglong srv_log_file_size_requested; /** TRUE if innobase_start_or_create_for_mysql() has been called */ static bool srv_start_has_been_called; @@ -374,17 +376,13 @@ create_log_file( } ib::info() << "Setting log file " << name << " size to " - << (srv_log_file_size >> (20 - UNIV_PAGE_SIZE_SHIFT)) - << " MB"; + << srv_log_file_size << " bytes"; - ret = os_file_set_size(name, *file, - (os_offset_t) srv_log_file_size - << UNIV_PAGE_SIZE_SHIFT, + ret = os_file_set_size(name, *file, srv_log_file_size, srv_read_only_mode); if (!ret) { - ib::error() << "Cannot set log file " << name << " to size " - << (srv_log_file_size >> (20 - UNIV_PAGE_SIZE_SHIFT)) - << " MB"; + ib::error() << "Cannot set log file " << name << " size to " + << srv_log_file_size << " bytes"; return(DB_ERROR); } @@ -467,17 +465,17 @@ create_log_files( ut_a(fil_validate()); ut_a(log_space != NULL); + const ulint size = ulint(srv_log_file_size >> srv_page_size_shift); + logfile0 = fil_node_create( - logfilename, (ulint) srv_log_file_size, - log_space, false, false); + logfilename, size, log_space, false, false); ut_a(logfile0); for (unsigned i = 1; i < srv_n_log_files; i++) { sprintf(logfilename + dirnamelen, "ib_logfile%u", i); - if (!fil_node_create(logfilename, - (ulint) srv_log_file_size, + if (!fil_node_create(logfilename, size, log_space, false, false)) { ib::error() @@ -488,8 +486,8 @@ create_log_files( } } - log_init(srv_n_log_files, srv_log_file_size * UNIV_PAGE_SIZE); - if (!log_set_capacity()) { + log_init(srv_n_log_files); + if (!log_set_capacity(srv_log_file_size_requested)) { return(DB_ERROR); } @@ -1410,7 +1408,7 @@ srv_prepare_to_delete_redo_log_files( info << srv_n_log_files << "*" << srv_log_file_size_requested - << " pages; LSN=" << flushed_lsn; + << " bytes; LSN=" << flushed_lsn; } /* Flush the old log files. */ @@ -1863,8 +1861,7 @@ innobase_start_or_create_for_mysql() srv_start_state_set(SRV_START_STATE_IO); } - if (srv_n_log_files * srv_log_file_size * UNIV_PAGE_SIZE - >= 512ULL * 1024ULL * 1024ULL * 1024ULL) { + if (srv_n_log_files * srv_log_file_size >= 512ULL << 30) { /* log_block_convert_lsn_to_no() limits the returned block number to 1G and given that OS_FILE_LOG_BLOCK_SIZE is 512 bytes, then we have a limit of 512 GB. If that limit is to @@ -1875,18 +1872,8 @@ innobase_start_or_create_for_mysql() return(srv_init_abort(DB_ERROR)); } - if (srv_n_log_files * srv_log_file_size >= ULINT_MAX) { - /* fil_io() takes ulint as an argument and we are passing - (next_offset / UNIV_PAGE_SIZE) to it in log_group_write_buf(). - So (next_offset / UNIV_PAGE_SIZE) must be less than ULINT_MAX. - So next_offset must be < ULINT_MAX * UNIV_PAGE_SIZE. This - means that we are limited to ULINT_MAX * UNIV_PAGE_SIZE which - is 64 TB on 32 bit systems. */ - ib::error() << "Combined size of log files must be < " - << ULINT_MAX / 1073741824 * UNIV_PAGE_SIZE << " GB"; - - return(srv_init_abort(DB_ERROR)); - } + compile_time_assert(ulonglong(ULINT_MAX) * UNIV_PAGE_SIZE_MIN + >= 512ULL << 30); os_normalize_path(srv_data_home); @@ -2025,27 +2012,22 @@ innobase_start_or_create_for_mysql() ut_a(size != (os_offset_t) -1); - if (size & ((1 << UNIV_PAGE_SIZE_SHIFT) - 1)) { + if (size & (OS_FILE_LOG_BLOCK_SIZE - 1)) { ib::error() << "Log file " << logfilename << " size " << size << " is not a" - " multiple of innodb_page_size"; + " multiple of 512 bytes"; return(srv_init_abort(DB_ERROR)); } - size >>= UNIV_PAGE_SIZE_SHIFT; - if (i == 0) { srv_log_file_size = size; } else if (size != srv_log_file_size) { ib::error() << "Log file " << logfilename - << " is of different size " - << (size << UNIV_PAGE_SIZE_SHIFT) + << " is of different size " << size << " bytes than other log files " - << (srv_log_file_size - << UNIV_PAGE_SIZE_SHIFT) - << " bytes!"; + << srv_log_file_size << " bytes!"; return(srv_init_abort(DB_ERROR)); } } @@ -2066,23 +2048,23 @@ innobase_start_or_create_for_mysql() ut_a(fil_validate()); ut_a(log_space); - /* srv_log_file_size is measured in pages; if page size is 16KB, - then we have a limit of 64TB on 32 bit systems */ - ut_a(srv_log_file_size <= ULINT_MAX); + ut_a(srv_log_file_size <= 512ULL << 30); - for (unsigned j = 0; j < i; j++) { + const ulint size = 1 + ulint((srv_log_file_size - 1) + >> srv_page_size_shift); + + for (unsigned j = 0; j < srv_n_log_files_found; j++) { sprintf(logfilename + dirnamelen, "ib_logfile%u", j); - if (!fil_node_create(logfilename, - (ulint) srv_log_file_size, + if (!fil_node_create(logfilename, size, log_space, false, false)) { return(srv_init_abort(DB_ERROR)); } } - log_init(i, srv_log_file_size * UNIV_PAGE_SIZE); + log_init(srv_n_log_files_found); - if (!log_set_capacity()) { + if (!log_set_capacity(srv_log_file_size_requested)) { return(srv_init_abort(DB_ERROR)); } } From 9f0c1c0cf6a24a8613b3327c6f52a7d954e0e18b Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Thu, 29 Jun 2017 20:50:07 -0700 Subject: [PATCH 24/53] Fixed the bug mdev-13193. When an equality that can be pushed into a materialized derived table / view is extracted from multiple equalities and their operands are cloned then if they have some pointers to Item_equal objects those pointers must be set to NULL in the clones. Anyway they are not valid in the pushed predicates. --- mysql-test/r/derived_cond_pushdown.result | 57 +++++++++++++++++++++++ mysql-test/r/derived_view.result | 2 +- mysql-test/t/derived_cond_pushdown.test | 22 +++++++++ sql/table.cc | 4 ++ 4 files changed, 84 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result index c009a08b4f7..b94cb46acea 100644 --- a/mysql-test/r/derived_cond_pushdown.result +++ b/mysql-test/r/derived_cond_pushdown.result @@ -8709,3 +8709,60 @@ EXPLAIN } DROP VIEW v1; DROP TABLE t1; +# +# MDEV-13193: pushdown of equality extracted from multiple equality +# +CREATE TABLE t1 (i1 int, KEY(i1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2),(4); +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq +WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); +i1 i2 +explain format=json SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq +WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["i1"], + "key": "i1", + "key_length": "5", + "used_key_parts": ["i1"], + "ref": ["const"], + "rows": 1, + "filtered": 100, + "using_index": true + }, + "block-nl-join": { + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v2.i2 = 1" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.i2 = 1" + } + } + } + } + } +} +DROP VIEW v2; +DROP TABLE t1,t2; diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index f3964605b1a..df6ba084a87 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -1107,7 +1107,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 1 PRIMARY t2 ref a a 4 const 1 Using index 1 PRIMARY ref key0 key0 8 const,const 1 -2 DERIVED t3 ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort +2 DERIVED t3 ALL NULL NULL NULL NULL 12 Using temporary; Using filesort SELECT * FROM t1, t2, v1 WHERE t2.a=t1.a AND t2.a=v1.a AND t2.a=v1.b; a a a b c c c c diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test index beeaa7350f7..de8a479614e 100644 --- a/mysql-test/t/derived_cond_pushdown.test +++ b/mysql-test/t/derived_cond_pushdown.test @@ -1526,3 +1526,25 @@ eval explain format=json $q; DROP VIEW v1; DROP TABLE t1; + +--echo # +--echo # MDEV-13193: pushdown of equality extracted from multiple equality +--echo # + +CREATE TABLE t1 (i1 int, KEY(i1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2),(4); + +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +let $q= +SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq + WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); + +eval $q; +eval explain format=json $q; + +DROP VIEW v2; +DROP TABLE t1,t2; diff --git a/sql/table.cc b/sql/table.cc index 28fa34c5ad7..10a94dd8212 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -8237,8 +8237,12 @@ Item* TABLE_LIST::build_pushable_cond_for_table(THD *thd, Item *cond) Item *left_item_clone= left_item->build_clone(thd, thd->mem_root); Item *right_item_clone= item->build_clone(thd, thd->mem_root); if (left_item_clone && right_item_clone) + { + left_item_clone->set_item_equal(NULL); + right_item_clone->set_item_equal(NULL); eq= new (thd->mem_root) Item_func_eq(thd, right_item_clone, left_item_clone); + } if (eq) { i++; From 5ad46457799b775260b718439e73c382e1657888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Jun 2017 09:25:39 +0300 Subject: [PATCH 25/53] Adjust a test for the changed innodb_log_file_size limits --- mysql-test/suite/sys_vars/r/sysvars_innodb.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index b970292ff51..7402b84dc96 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1776,11 +1776,11 @@ GLOBAL_VALUE 5242880 GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 50331648 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT +VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Size of each log file in a log group. NUMERIC_MIN_VALUE 1048576 NUMERIC_MAX_VALUE 549755813888 -NUMERIC_BLOCK_SIZE 1048576 +NUMERIC_BLOCK_SIZE 65536 ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED From 61847b9d809d66928f297066f92c59ff280efeeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Jun 2017 09:31:19 +0300 Subject: [PATCH 26/53] Tablespace: Add iterator, const_iterator, begin(), end() --- storage/innobase/fsp/fsp0space.cc | 28 ++++++++-------------------- storage/innobase/include/fsp0space.h | 18 +++++++++++++++--- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc index ea9c45697dc..94fae3d973b 100644 --- a/storage/innobase/fsp/fsp0space.cc +++ b/storage/innobase/fsp/fsp0space.cc @@ -39,11 +39,8 @@ bool Tablespace::intersection( const Tablespace* other_space) { - files_t::const_iterator end = other_space->m_files.end(); - - for (files_t::const_iterator it = other_space->m_files.begin(); - it != end; - ++it) { + for (files_t::const_iterator it(other_space->begin()), + end(other_space->end()); it != end; ++it) { if (find(it->m_filename)) { @@ -58,9 +55,7 @@ Tablespace::intersection( void Tablespace::shutdown() { - files_t::iterator end = m_files.end(); - - for (files_t::iterator it = m_files.begin(); it != end; ++it) { + for (iterator it = begin(); it != end(); ++it) { it->shutdown(); } @@ -95,10 +90,7 @@ Tablespace::open_or_create(bool is_temp) ut_ad(!m_files.empty()); - files_t::iterator begin = m_files.begin(); - files_t::iterator end = m_files.end(); - - for (files_t::iterator it = begin; it != end; ++it) { + for (iterator it = begin(); it != end(); ++it) { if (it->m_exists) { err = it->open_or_create( @@ -124,7 +116,7 @@ Tablespace::open_or_create(bool is_temp) the proper way. */ it->close(); - if (it == begin) { + if (it == begin()) { /* First data file. */ /* Create the tablespace entry for the multi-file @@ -154,11 +146,9 @@ Tablespace::open_or_create(bool is_temp) /** Find a filename in the list of Datafiles for a tablespace @return true if the filename exists in the data files */ bool -Tablespace::find(const char* filename) +Tablespace::find(const char* filename) const { - files_t::const_iterator end = m_files.end(); - - for (files_t::const_iterator it = m_files.begin(); it != end; ++it) { + for (const_iterator it = begin(); it != end(); ++it) { if (innobase_strcasecmp(filename, it->m_filename) == 0) { return(true); @@ -172,9 +162,7 @@ Tablespace::find(const char* filename) void Tablespace::delete_files() { - files_t::iterator end = m_files.end(); - - for (files_t::iterator it = m_files.begin(); it != end; ++it) { + for (iterator it = begin(); it != end(); ++it) { it->close(); diff --git a/storage/innobase/include/fsp0space.h b/storage/innobase/include/fsp0space.h index 5b5293666b5..2c28ecc5c7b 100644 --- a/storage/innobase/include/fsp0space.h +++ b/storage/innobase/include/fsp0space.h @@ -44,6 +44,10 @@ public: /** Data file information - each Datafile can be accessed globally */ files_t m_files; + /** Data file iterator */ + typedef files_t::iterator iterator; + /** Data file iterator */ + typedef files_t::const_iterator const_iterator; Tablespace() : @@ -68,6 +72,15 @@ public: Tablespace(const Tablespace&); Tablespace& operator=(const Tablespace&); + /** Data file iterator */ + const_iterator begin() const { return m_files.begin(); } + /** Data file iterator */ + const_iterator end() const { return m_files.end(); } + /** Data file iterator */ + iterator begin() { return m_files.begin(); } + /** Data file iterator */ + iterator end() { return m_files.end(); } + void set_name(const char* name) { m_name = name; } const char* name() const { return m_name; } @@ -156,8 +169,7 @@ public: { ulint sum = 0; - for (files_t::const_iterator it = m_files.begin(); - it != m_files.end(); ++it) { + for (const_iterator it = begin(); it != end(); ++it) { sum += it->m_size; } @@ -200,7 +212,7 @@ private: /** @param[in] filename Name to lookup in the data files. @return true if the filename exists in the data files */ - bool find(const char* filename); + bool find(const char* filename) const; /** Note that the data file was found. @param[in] file data file object */ From dd75087993a182af70d00a11e899e555f9604aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Jun 2017 15:03:01 +0300 Subject: [PATCH 27/53] Fix a compilation warning --- storage/innobase/include/sync0types.h | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h index 8a68f3d0cc6..bcbcf70bfc7 100644 --- a/storage/innobase/include/sync0types.h +++ b/storage/innobase/include/sync0types.h @@ -1078,6 +1078,7 @@ struct latch_t { /** Subclass this to iterate over a thread's acquired latch levels. */ struct sync_check_functor_t { + virtual ~sync_check_functor_t() { } virtual bool operator()(const latch_level_t) const = 0; }; From bf262bd957025e1161e989e0431615858ee2d8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 24 May 2017 14:39:27 +0300 Subject: [PATCH 28/53] MDEV-11649 Uninitialized field fts_token->position in innodb_fts.innodb_fts_plugin The field fts_token->position is not initialized in row_merge_fts_doc_tokenize(). We cannot have that field without changing the fulltext parser plugin ABI (adding st_mysql_ftparser_boolean_info::position, as it was done in MySQL 5.7 in WL#6943). The InnoDB fulltext parser plugins "ngram" and "Mecab" that were introduced in MySQL 5.7 do depend on that field. But the simple_parser does not. Apparently, simple_parser is leaving the field as 0. So, in our fix we will assume that the missing position field is 0. --- .../innodb_fts/r/innodb_fts_plugin.result | 21 ++++++++++++++-- .../suite/innodb_fts/t/innodb_fts_plugin.test | 9 +++++-- storage/innobase/include/row0ftsort.h | 3 +-- storage/innobase/row/row0ftsort.cc | 25 ++++++++----------- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result index f057db1d284..b7688e9ef0f 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result @@ -135,12 +135,29 @@ INSERT INTO articles (title, body) VALUES ('How To Use MySQL Well','After you went through a ...'), ('Optimizing MySQL','In this tutorial we will show ...'), ('1001 MySQL Tricks','How to use full-text search engine'), -('Go MySQL Tricks','How to use full text search engine'); +('Go MariaDB Tricks','How to use full text search engine'); +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('MySQL'); +id title body +6 MySQL Tutorial DBMS stands for MySQL DataBase ... +7 How To Use MySQL Well After you went through a ... +8 Optimizing MySQL In this tutorial we will show ... +9 1001 MySQL Tricks How to use full-text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('tutorial'); +id title body +6 MySQL Tutorial DBMS stands for MySQL DataBase ... +8 Optimizing MySQL In this tutorial we will show ... SELECT * FROM articles WHERE MATCH(title, body) AGAINST('Tricks'); id title body 9 1001 MySQL Tricks How to use full-text search engine -10 Go MySQL Tricks How to use full text search engine +10 Go MariaDB Tricks How to use full text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('full text search'); +id title body +10 Go MariaDB Tricks How to use full text search engine +9 1001 MySQL Tricks How to use full-text search engine SELECT COUNT(*) FROM articles; COUNT(*) 5 diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test b/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test index 9cc1afd4e60..cd31500b23f 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_plugin.test @@ -145,13 +145,18 @@ INSERT INTO articles (title, body) VALUES ('How To Use MySQL Well','After you went through a ...'), ('Optimizing MySQL','In this tutorial we will show ...'), ('1001 MySQL Tricks','How to use full-text search engine'), - ('Go MySQL Tricks','How to use full text search engine'); + ('Go MariaDB Tricks','How to use full text search engine'); --source include/restart_mysqld.inc -# Simple term search - 4 records expected +SELECT * FROM articles WHERE + MATCH(title, body) AGAINST('MySQL'); +SELECT * FROM articles WHERE + MATCH(title, body) AGAINST('tutorial'); SELECT * FROM articles WHERE MATCH(title, body) AGAINST('Tricks'); +SELECT * FROM articles WHERE + MATCH(title, body) AGAINST('full text search'); SELECT COUNT(*) FROM articles; DROP TABLE articles; diff --git a/storage/innobase/include/row0ftsort.h b/storage/innobase/include/row0ftsort.h index 207fd783cac..b1f3b8ab328 100644 --- a/storage/innobase/include/row0ftsort.h +++ b/storage/innobase/include/row0ftsort.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2016, MariaDB Corporation. +Copyright (c) 2015, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -103,7 +103,6 @@ struct fts_psort_t { /** Row fts token for plugin parser */ struct row_fts_token_t { fts_string_t* text; /*!< token */ - ulint position; /*!< token position in the document */ UT_LIST_NODE_T(row_fts_token_t) token_list; /*!< next token link */ }; diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index 321b55e9894..da5d96ccc18 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -527,7 +527,6 @@ row_merge_fts_doc_tokenize( doc id and position to sort buffer */ while (t_ctx->processed_len < doc->text.f_len) { ulint idx = 0; - ib_uint32_t position; ulint cur_len; doc_id_t write_doc_id; row_fts_token_t* fts_token = NULL; @@ -679,20 +678,18 @@ row_merge_fts_doc_tokenize( ++field; - /* The third field is the position */ - if (parser != NULL) { - mach_write_to_4( - reinterpret_cast(&position), - (fts_token->position + t_ctx->init_pos)); - } else { - mach_write_to_4( - reinterpret_cast(&position), - (t_ctx->processed_len + inc - str.f_len + t_ctx->init_pos)); + /* The third field is the position. + MySQL 5.7 changed the fulltext parser plugin interface + by adding MYSQL_FTPARSER_BOOLEAN_INFO::position. + Below we assume that the field is always 0. */ + unsigned pos = t_ctx->init_pos; + byte position[4]; + if (parser == NULL) { + pos += t_ctx->processed_len + inc - str.f_len; } - - dfield_set_data(field, &position, sizeof(position)); - len = dfield_get_len(field); - ut_ad(len == sizeof(ib_uint32_t)); + len = 4; + mach_write_to_4(position, pos); + dfield_set_data(field, &position, len); field->type.mtype = DATA_INT; field->type.prtype = DATA_NOT_NULL; From 505a11d9ac83bc6ac97f238b183253878f7fd7cf Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 30 Jun 2017 16:26:15 +0400 Subject: [PATCH 29/53] Adding the "const" qualifier to st_sp_chistics parameters in a few functions. --- sql/sp.cc | 8 ++++---- sql/sp.h | 4 ++-- sql/sp_head.cc | 2 +- sql/sp_head.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sql/sp.cc b/sql/sp.cc index 9c130eac52d..da1b9e9212f 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -41,7 +41,7 @@ static int db_load_routine(THD *thd, stored_procedure_type type, const sp_name *name, sp_head **sphp, sql_mode_t sql_mode, const char *params, const char *returns, - const char *body, st_sp_chistics &chistics, + const char *body, const st_sp_chistics &chistics, LEX_CSTRING *definer_user_name, LEX_CSTRING *definer_host_name, longlong created, longlong modified, @@ -813,7 +813,7 @@ static int db_load_routine(THD *thd, stored_procedure_type type, const sp_name *name, sp_head **sphp, sql_mode_t sql_mode, const char *params, const char *returns, - const char *body, st_sp_chistics &chistics, + const char *body, const st_sp_chistics &chistics, LEX_CSTRING *definer_user_name, LEX_CSTRING *definer_host_name, longlong created, longlong modified, @@ -1392,7 +1392,7 @@ sp_drop_routine(THD *thd, stored_procedure_type type, const sp_name *name) int sp_update_routine(THD *thd, stored_procedure_type type, const sp_name *name, - st_sp_chistics *chistics) + const st_sp_chistics *chistics) { TABLE *table; int ret; @@ -2201,7 +2201,7 @@ show_create_sp(THD *thd, String *buf, const char *params, ulong paramslen, const char *returns, ulong returnslen, const char *body, ulong bodylen, - st_sp_chistics *chistics, + const st_sp_chistics *chistics, const LEX_CSTRING *definer_user, const LEX_CSTRING *definer_host, sql_mode_t sql_mode) diff --git a/sql/sp.h b/sql/sp.h index 748610c1a9c..d33c767369e 100644 --- a/sql/sp.h +++ b/sql/sp.h @@ -145,7 +145,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp); int sp_update_routine(THD *thd, stored_procedure_type type, const sp_name *name, - st_sp_chistics *chistics); + const st_sp_chistics *chistics); int sp_drop_routine(THD *thd, stored_procedure_type type, const sp_name *name); @@ -240,7 +240,7 @@ bool show_create_sp(THD *thd, String *buf, const char *params, ulong paramslen, const char *returns, ulong returnslen, const char *body, ulong bodylen, - st_sp_chistics *chistics, + const st_sp_chistics *chistics, const LEX_CSTRING *definer_user, const LEX_CSTRING *definer_host, sql_mode_t sql_mode); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index c87a15ff927..aa69de3f024 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -2455,7 +2455,7 @@ sp_head::sp_add_instr_cpush_for_cursors(THD *thd, sp_pcontext *pcontext) void sp_head::set_info(longlong created, longlong modified, - st_sp_chistics *chistics, sql_mode_t sql_mode) + const st_sp_chistics *chistics, sql_mode_t sql_mode) { m_created= created; m_modified= modified; diff --git a/sql/sp_head.h b/sql/sp_head.h index a96ef514429..f9d14378b7b 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -673,7 +673,7 @@ public: } void set_info(longlong created, longlong modified, - st_sp_chistics *chistics, sql_mode_t sql_mode); + const st_sp_chistics *chistics, sql_mode_t sql_mode); void set_definer(const char *definer, uint definerlen); void set_definer(const LEX_CSTRING *user_name, const LEX_CSTRING *host_name); From 4877659006757904624f5e97c67eec2d64f67f59 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 30 Jun 2017 15:19:26 +0000 Subject: [PATCH 30/53] MDEV-12097 : avoid too large memory allocation in innodb buffer pool on Windows Align innodb_pool_size up to the innodb_buf_pool_chunk_unit. --- storage/innobase/srv/srv0start.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 399d02e7395..072a5c67bc7 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1636,10 +1636,10 @@ innobase_start_or_create_for_mysql() /* Do not allocate too large of a buffer pool on Windows 32-bit systems, which can have trouble allocating larger single contiguous memory blocks. */ + srv_buf_pool_size = static_cast(ut_uint64_align_up(srv_buf_pool_size, srv_buf_pool_chunk_unit)); srv_buf_pool_instances = ut_min( static_cast(MAX_BUFFER_POOLS), - static_cast(srv_buf_pool_size - / (128 * 1024 * 1024))); + static_cast(srv_buf_pool_size / srv_buf_pool_chunk_unit)); #else /* defined(_WIN32) && !defined(_WIN64) */ /* Default to 8 instances when size > 1GB. */ srv_buf_pool_instances = 8; From f27e1a318c9d1959e1f7b5da4fe379b72350ff8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Jun 2017 18:39:23 +0300 Subject: [PATCH 31/53] Remove duplicated tests --- mysql-test/suite/innodb_zip/r/bug36172.result | 5 +- .../suite/innodb_zip/r/innodb_bug36169.result | 1 - .../suite/innodb_zip/r/innodb_bug36172.result | 1 - .../suite/innodb_zip/r/innodb_bug52745.result | 127 -- .../suite/innodb_zip/r/innodb_bug53591.result | 11 - .../suite/innodb_zip/r/innodb_bug56680.result | 119 -- .../innodb_zip/r/innodb_cmp_drop_table.result | 18 - .../r/innodb_index_large_prefix.result | 538 -------- .../suite/innodb_zip/t/innodb_bug36169.opt | 1 - .../suite/innodb_zip/t/innodb_bug36169.test | 1153 ----------------- .../suite/innodb_zip/t/innodb_bug36172.test | 22 - .../suite/innodb_zip/t/innodb_bug52745.test | 100 -- .../suite/innodb_zip/t/innodb_bug53591.test | 16 - .../suite/innodb_zip/t/innodb_bug56680.test | 133 -- .../t/innodb_cmp_drop_table-master.opt | 1 - .../innodb_zip/t/innodb_cmp_drop_table.test | 63 - .../t/innodb_index_large_prefix.test | 434 ------- 17 files changed, 4 insertions(+), 2739 deletions(-) delete mode 100644 mysql-test/suite/innodb_zip/r/innodb_bug36169.result delete mode 100644 mysql-test/suite/innodb_zip/r/innodb_bug36172.result delete mode 100644 mysql-test/suite/innodb_zip/r/innodb_bug52745.result delete mode 100644 mysql-test/suite/innodb_zip/r/innodb_bug53591.result delete mode 100644 mysql-test/suite/innodb_zip/r/innodb_bug56680.result delete mode 100644 mysql-test/suite/innodb_zip/r/innodb_cmp_drop_table.result delete mode 100644 mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result delete mode 100644 mysql-test/suite/innodb_zip/t/innodb_bug36169.opt delete mode 100644 mysql-test/suite/innodb_zip/t/innodb_bug36169.test delete mode 100644 mysql-test/suite/innodb_zip/t/innodb_bug36172.test delete mode 100644 mysql-test/suite/innodb_zip/t/innodb_bug52745.test delete mode 100644 mysql-test/suite/innodb_zip/t/innodb_bug53591.test delete mode 100644 mysql-test/suite/innodb_zip/t/innodb_bug56680.test delete mode 100644 mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table-master.opt delete mode 100644 mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table.test delete mode 100644 mysql-test/suite/innodb_zip/t/innodb_index_large_prefix.test diff --git a/mysql-test/suite/innodb_zip/r/bug36172.result b/mysql-test/suite/innodb_zip/r/bug36172.result index 23c5b0cc2f7..727f100d064 100644 --- a/mysql-test/suite/innodb_zip/r/bug36172.result +++ b/mysql-test/suite/innodb_zip/r/bug36172.result @@ -1 +1,4 @@ -SET default_storage_engine=InnoDB; +set @file_per_table=@@global.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=on; +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +SET GLOBAL innodb_file_per_table=@file_per_table; diff --git a/mysql-test/suite/innodb_zip/r/innodb_bug36169.result b/mysql-test/suite/innodb_zip/r/innodb_bug36169.result deleted file mode 100644 index bae08bd54a2..00000000000 --- a/mysql-test/suite/innodb_zip/r/innodb_bug36169.result +++ /dev/null @@ -1 +0,0 @@ -call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size .* for a record on index leaf page."); diff --git a/mysql-test/suite/innodb_zip/r/innodb_bug36172.result b/mysql-test/suite/innodb_zip/r/innodb_bug36172.result deleted file mode 100644 index 195775f74c8..00000000000 --- a/mysql-test/suite/innodb_zip/r/innodb_bug36172.result +++ /dev/null @@ -1 +0,0 @@ -SET storage_engine=InnoDB; diff --git a/mysql-test/suite/innodb_zip/r/innodb_bug52745.result b/mysql-test/suite/innodb_zip/r/innodb_bug52745.result deleted file mode 100644 index 1556c313994..00000000000 --- a/mysql-test/suite/innodb_zip/r/innodb_bug52745.result +++ /dev/null @@ -1,127 +0,0 @@ -SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR -CREATE TABLE bug52745 ( -a2 int(10) unsigned DEFAULT NULL, -col37 time DEFAULT NULL, -col38 char(229) CHARACTER SET utf8 DEFAULT NULL, -col39 text, -col40 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -col41 int(10) unsigned DEFAULT NULL, -col42 varchar(248) CHARACTER SET utf8 DEFAULT NULL, -col43 smallint(5) unsigned zerofill DEFAULT NULL, -col44 varchar(150) CHARACTER SET utf8 DEFAULT NULL, -col45 float unsigned zerofill DEFAULT NULL, -col46 binary(1) DEFAULT NULL, -col47 tinyint(4) DEFAULT NULL, -col48 tinyint(1) DEFAULT NULL, -col49 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', -col50 binary(1) DEFAULT NULL, -col51 double unsigned zerofill DEFAULT NULL, -col52 int(10) unsigned DEFAULT NULL, -col53 time DEFAULT NULL, -col54 double unsigned DEFAULT NULL, -col55 time DEFAULT NULL, -col56 mediumtext CHARACTER SET latin2, -col57 blob, -col58 decimal(52,16) unsigned zerofill NOT NULL DEFAULT '000000000000000000000000000000000000.0000000000000000', -col59 binary(1) DEFAULT NULL, -col60 longblob, -col61 time DEFAULT NULL, -col62 longtext CHARACTER SET utf8 COLLATE utf8_persian_ci, -col63 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', -col64 int(10) unsigned DEFAULT NULL, -col65 date DEFAULT NULL, -col66 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', -col67 binary(1) DEFAULT NULL, -col68 tinyblob, -col69 date DEFAULT NULL, -col70 tinyint(3) unsigned zerofill DEFAULT NULL, -col71 varchar(44) CHARACTER SET utf8 DEFAULT NULL, -col72 datetime DEFAULT NULL, -col73 smallint(5) unsigned zerofill DEFAULT NULL, -col74 longblob, -col75 bit(34) DEFAULT NULL, -col76 float unsigned zerofill DEFAULT NULL, -col77 year(2) DEFAULT NULL, -col78 tinyint(3) unsigned DEFAULT NULL, -col79 set('msfheowh','tbpxbgf','by','wahnrjw','myqfasxz','rsokyumrt') CHARACTER SET latin2 DEFAULT NULL, -col80 datetime DEFAULT NULL, -col81 smallint(6) DEFAULT NULL, -col82 enum('xtaurnqfqz','rifrse','kuzwpbvb','niisabk','zxavro','rbvasv','','uulrfaove','','') DEFAULT NULL, -col83 bigint(20) unsigned zerofill DEFAULT NULL, -col84 float unsigned zerofill DEFAULT NULL, -col85 double DEFAULT NULL, -col86 enum('ylannv','','vlkhycqc','snke','cxifustp','xiaxaswzp','oxl') CHARACTER SET latin1 COLLATE latin1_german2_ci DEFAULT NULL, -col87 varbinary(221) DEFAULT NULL, -col88 double unsigned DEFAULT NULL, -col89 float unsigned zerofill DEFAULT NULL, -col90 tinyblob -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; -Warnings: -Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead -Note 1291 Column 'col82' has duplicated value '' in ENUM -Note 1291 Column 'col82' has duplicated value '' in ENUM -INSERT IGNORE INTO bug52745 SET -col40='0000-00-00 00:00:00', -col51=16547, -col53='7711484', -col54=-28604, -col55='7112612', -col56='wakefulness\'', -col57=repeat('absorbefacient\'',106), -col58=11027, -col59='AM09gW7', -col60=repeat('Noelani\'',16), -col61='2520576', -col62='substitutiv', -col63='19950106155112', -col64=-12038, -col65='86238806', -col66='19600719080256', -col68=repeat('Sagittarius\'',54), -col69='38943902', -col70=1232, -col71='Elora\'', -col74=repeat('zipp',11), -col75='0', -col76=23254, -col78=13247, -col79='56219', -col80='20500609035724', -col81=11632, -col82=7, -col84=-23863, -col85=6341, -col87='HZdkf.4 s7t,5Rmq 8so fmr,ruGLUG25TrtI.yQ 2SuHq0ML7rw7.4 b2yf2E5TJxOtBBZImezDnzpj,uPYfznnEUDN1e9aQoO 2DsplB7TFWy oQJ br HLF :F,eQ p4i1oWsr lL3PG,hjCz6hYqN h1QTjLCjrv:QCdSzpYBibJAtZCxLOk3l6Blsh.W', -col88=16894, -col89=6161, -col90=repeat('gale',48); -Warnings: -Warning 1265 Data truncated for column 'col53' at row 1 -Warning 1264 Out of range value for column 'col54' at row 1 -Warning 1265 Data truncated for column 'col59' at row 1 -Warning 1265 Data truncated for column 'col61' at row 1 -Warning 1264 Out of range value for column 'col64' at row 1 -Warning 1265 Data truncated for column 'col65' at row 1 -Warning 1264 Out of range value for column 'col66' at row 1 -Warning 1265 Data truncated for column 'col68' at row 1 -Warning 1265 Data truncated for column 'col69' at row 1 -Warning 1264 Out of range value for column 'col70' at row 1 -Warning 1264 Out of range value for column 'col78' at row 1 -Warning 1265 Data truncated for column 'col79' at row 1 -Warning 1264 Out of range value for column 'col84' at row 1 -SHOW WARNINGS; -Level Code Message -Warning 1265 Data truncated for column 'col53' at row 1 -Warning 1264 Out of range value for column 'col54' at row 1 -Warning 1265 Data truncated for column 'col59' at row 1 -Warning 1265 Data truncated for column 'col61' at row 1 -Warning 1264 Out of range value for column 'col64' at row 1 -Warning 1265 Data truncated for column 'col65' at row 1 -Warning 1264 Out of range value for column 'col66' at row 1 -Warning 1265 Data truncated for column 'col68' at row 1 -Warning 1265 Data truncated for column 'col69' at row 1 -Warning 1264 Out of range value for column 'col70' at row 1 -Warning 1264 Out of range value for column 'col78' at row 1 -Warning 1265 Data truncated for column 'col79' at row 1 -Warning 1264 Out of range value for column 'col84' at row 1 -DROP TABLE bug52745; diff --git a/mysql-test/suite/innodb_zip/r/innodb_bug53591.result b/mysql-test/suite/innodb_zip/r/innodb_bug53591.result deleted file mode 100644 index 0222ad64fa2..00000000000 --- a/mysql-test/suite/innodb_zip/r/innodb_bug53591.result +++ /dev/null @@ -1,11 +0,0 @@ -SET GLOBAL innodb_strict_mode=on; -set old_alter_table=0; -CREATE TABLE bug53591(a text charset utf8 not null) -ENGINE=InnoDB KEY_BLOCK_SIZE=1; -ALTER TABLE bug53591 ADD PRIMARY KEY(a(220)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is {checked_valid}. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -SHOW WARNINGS; -Level Code Message -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is {checked_valid}. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -DROP TABLE bug53591; -SET GLOBAL innodb_strict_mode=DEFAULT; diff --git a/mysql-test/suite/innodb_zip/r/innodb_bug56680.result b/mysql-test/suite/innodb_zip/r/innodb_bug56680.result deleted file mode 100644 index c509c5bad21..00000000000 --- a/mysql-test/suite/innodb_zip/r/innodb_bug56680.result +++ /dev/null @@ -1,119 +0,0 @@ -SET GLOBAL tx_isolation='REPEATABLE-READ'; -CREATE TABLE bug56680( -a INT AUTO_INCREMENT PRIMARY KEY, -b CHAR(1), -c INT, -INDEX(b)) -ENGINE=InnoDB; -INSERT INTO bug56680 VALUES(0,'x',1); -BEGIN; -SELECT b FROM bug56680; -b -x -connect con1,localhost,root,,; -connection con1; -BEGIN; -UPDATE bug56680 SET b='X'; -connection default; -SELECT b FROM bug56680; -b -x -SELECT * FROM bug56680; -a b c -1 x 1 -connection con1; -ROLLBACK; -disconnect con1; -connection default; -SELECT b FROM bug56680; -b -x -SET GLOBAL tx_isolation='READ-UNCOMMITTED'; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -BEGIN; -SELECT b FROM bug56680 LIMIT 2; -b -x -x -connect con1,localhost,root,,; -connection con1; -BEGIN; -DELETE FROM bug56680 WHERE a=1; -INSERT INTO bug56680 VALUES(1,'X',1); -SELECT b FROM bug56680 LIMIT 3; -b -X -x -x -connection default; -SELECT b FROM bug56680 LIMIT 2; -b -x -x -CHECK TABLE bug56680; -Table Op Msg_type Msg_text -test.bug56680 check status OK -connection con1; -ROLLBACK; -SELECT b FROM bug56680 LIMIT 2; -b -x -x -CHECK TABLE bug56680; -Table Op Msg_type Msg_text -test.bug56680 check status OK -connection default; -disconnect con1; -SELECT b FROM bug56680 LIMIT 2; -b -x -x -CREATE TABLE bug56680_2( -a INT AUTO_INCREMENT PRIMARY KEY, -b VARCHAR(2) CHARSET latin1 COLLATE latin1_german2_ci, -c INT, -INDEX(b)) -ENGINE=InnoDB; -INSERT INTO bug56680_2 SELECT 0,_latin1 0xdf,c FROM bug56680; -BEGIN; -SELECT HEX(b) FROM bug56680_2 LIMIT 2; -HEX(b) -DF -DF -DELETE FROM bug56680_2 WHERE a=1; -INSERT INTO bug56680_2 VALUES(1,'SS',1); -SELECT HEX(b) FROM bug56680_2 LIMIT 3; -HEX(b) -5353 -DF -DF -CHECK TABLE bug56680_2; -Table Op Msg_type Msg_text -test.bug56680_2 check status OK -ALTER TABLE bug56680_2 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; -SELECT HEX(b) FROM bug56680_2 LIMIT 2; -HEX(b) -5353 -DF -DELETE FROM bug56680_2 WHERE a=1; -INSERT INTO bug56680_2 VALUES(1,_latin1 0xdf,1); -SELECT HEX(b) FROM bug56680_2 LIMIT 3; -HEX(b) -DF -DF -DF -CHECK TABLE bug56680_2; -Table Op Msg_type Msg_text -test.bug56680_2 check status OK -DROP TABLE bug56680_2; -DROP TABLE bug56680; diff --git a/mysql-test/suite/innodb_zip/r/innodb_cmp_drop_table.result b/mysql-test/suite/innodb_zip/r/innodb_cmp_drop_table.result deleted file mode 100644 index 11e90b9e7d6..00000000000 --- a/mysql-test/suite/innodb_zip/r/innodb_cmp_drop_table.result +++ /dev/null @@ -1,18 +0,0 @@ -set global innodb_file_per_table=on; -set global innodb_file_format=`1`; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create table t1(a text) engine=innodb key_block_size=8; -SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0; -page_size -8192 -drop table t1; -SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0; -page_size -8192 -create table t2(a text) engine=innodb; -SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0; -page_size -drop table t2; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html diff --git a/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result b/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result deleted file mode 100644 index 5be18b84065..00000000000 --- a/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result +++ /dev/null @@ -1,538 +0,0 @@ -SET default_storage_engine=InnoDB; -call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page."); -set global innodb_large_prefix=1; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -set global innodb_strict_mode=1; -### Test 1 ### -create table worklog5743(a TEXT not null, primary key (a(1000))) ROW_FORMAT=DYNAMIC; -show warnings; -Level Code Message -insert into worklog5743 values(repeat("a", 20000)); -update worklog5743 set a = (repeat("b", 16000)); -create index idx on worklog5743(a(2000)); -show warnings; -Level Code Message -begin; -update worklog5743 set a = (repeat("x", 17000)); -select @@session.tx_isolation; -@@session.tx_isolation -REPEATABLE-READ -connect con1,localhost,root,,; -select a = repeat("x", 17000) from worklog5743; -a = repeat("x", 17000) -0 -select a = repeat("b", 16000) from worklog5743; -a = repeat("b", 16000) -1 -connect con2,localhost,root,,; -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -@@session.tx_isolation -READ-UNCOMMITTED -select a = repeat("x", 17000) from worklog5743; -a = repeat("x", 17000) -1 -connection default; -rollback; -drop table worklog5743; -### Test 2 ### -create table worklog5743(a1 int, a2 TEXT not null) ROW_FORMAT=DYNAMIC; -show warnings; -Level Code Message -create index idx on worklog5743(a1, a2(2000)); -show warnings; -Level Code Message -insert into worklog5743 values(9, repeat("a", 10000)); -begin; -update worklog5743 set a1 = 1000; -connection con1; -select @@session.tx_isolation; -@@session.tx_isolation -REPEATABLE-READ -explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743 ref idx idx 5 const 1 -select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; -a1 a2 = repeat("a", 10000) -9 1 -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -@@session.tx_isolation -READ-UNCOMMITTED -select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; -a1 a2 = repeat("a", 10000) -connection default; -rollback; -drop table worklog5743; -### Test 3 ### -create table worklog5743(a1 int, a2 TEXT not null) ROW_FORMAT=DYNAMIC; -create index idx on worklog5743(a1, a2(50)); -insert into worklog5743 values(9, repeat("a", 10000)); -begin; -update worklog5743 set a1 = 1000; -connection con1; -select @@session.tx_isolation; -@@session.tx_isolation -REPEATABLE-READ -explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743 ref idx idx 5 const 1 -select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; -a1 a2 = repeat("a", 10000) -9 1 -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -@@session.tx_isolation -READ-UNCOMMITTED -select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; -a1 a2 = repeat("a", 10000) -connection default; -rollback; -drop table worklog5743; -### Test 4 ### -create table worklog5743_1(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=1; -create table worklog5743_2(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=2; -create table worklog5743_4(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=4; -create table worklog5743_8(a1 int, a2 TEXT, a3 TEXT) KEY_BLOCK_SIZE=8; -create table worklog5743_16(a1 int, a2 TEXT, a3 TEXT) KEY_BLOCK_SIZE=16; -set sql_mode=''; -set global innodb_large_prefix=0; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create index idx1 on worklog5743_1(a2(4000)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -show warnings; -Level Code Message -Note 1071 Specified key was too long; max key length is 767 bytes -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -set global innodb_large_prefix=1; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create index idx2 on worklog5743_1(a2(4000)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -show warnings; -Level Code Message -Note 1071 Specified key was too long; max key length is 3072 bytes -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx3 on worklog5743_1(a2(436)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -show warnings; -Level Code Message -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx4 on worklog5743_1(a2(434)); -show warnings; -Level Code Message -create index idx5 on worklog5743_1(a1, a2(430)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -show warnings; -Level Code Message -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx6 on worklog5743_1(a1, a2(428)); -show warnings; -Level Code Message -set global innodb_large_prefix=0; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create index idx1 on worklog5743_2(a2(4000)); -Warnings: -Note 1071 Specified key was too long; max key length is 767 bytes -show warnings; -Level Code Message -Note 1071 Specified key was too long; max key length is 767 bytes -set global innodb_large_prefix=1; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create index idx2 on worklog5743_2(a2(4000)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -show warnings; -Level Code Message -Note 1071 Specified key was too long; max key length is 3072 bytes -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx3 on worklog5743_2(a2(948)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -show warnings; -Level Code Message -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx4 on worklog5743_2(a2(946)); -show warnings; -Level Code Message -create index idx5 on worklog5743_2(a1, a2(942)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -show warnings; -Level Code Message -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx6 on worklog5743_2(a1, a2(940)); -show warnings; -Level Code Message -set global innodb_large_prefix=0; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create index idx1 on worklog5743_4(a2(4000)); -Warnings: -Note 1071 Specified key was too long; max key length is 767 bytes -show warnings; -Level Code Message -Note 1071 Specified key was too long; max key length is 767 bytes -set global innodb_large_prefix=1; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create index idx2 on worklog5743_4(a2(4000)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -show warnings; -Level Code Message -Note 1071 Specified key was too long; max key length is 3072 bytes -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx3 on worklog5743_4(a2(1972)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -show warnings; -Level Code Message -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx4 on worklog5743_4(a2(1970)); -show warnings; -Level Code Message -create index idx5 on worklog5743_4(a1, a2(1966)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -show warnings; -Level Code Message -Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs -create index idx6 on worklog5743_4(a1, a2(1964)); -show warnings; -Level Code Message -set global innodb_large_prefix=0; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create index idx1 on worklog5743_8(a2(1000)); -Warnings: -Note 1071 Specified key was too long; max key length is 767 bytes -show warnings; -Level Code Message -Note 1071 Specified key was too long; max key length is 767 bytes -set global innodb_large_prefix=1; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create index idx2 on worklog5743_8(a2(3073)); -Warnings: -Note 1071 Specified key was too long; max key length is 3072 bytes -show warnings; -Level Code Message -Note 1071 Specified key was too long; max key length is 3072 bytes -create index idx3 on worklog5743_8(a2(3072)); -Warnings: -Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release -show warnings; -Level Code Message -Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release -create index idx4 on worklog5743_8(a1, a2(3069)); -ERROR 42000: Specified key was too long; max key length is 3072 bytes -show warnings; -Level Code Message -Error 1071 Specified key was too long; max key length is 3072 bytes -create index idx5 on worklog5743_8(a1, a2(3068)); -show warnings; -Level Code Message -create index idx6 on worklog5743_8(a1, a2(2000), a3(1069)); -ERROR 42000: Specified key was too long; max key length is 3072 bytes -show warnings; -Level Code Message -Error 1071 Specified key was too long; max key length is 3072 bytes -create index idx7 on worklog5743_8(a1, a2(2000), a3(1068)); -show warnings; -Level Code Message -set global innodb_large_prefix=0; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create index idx1 on worklog5743_16(a2(1000)); -Warnings: -Note 1071 Specified key was too long; max key length is 767 bytes -show warnings; -Level Code Message -Note 1071 Specified key was too long; max key length is 767 bytes -set global innodb_large_prefix=1; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create index idx2 on worklog5743_16(a2(3073)); -Warnings: -Note 1071 Specified key was too long; max key length is 3072 bytes -show warnings; -Level Code Message -Note 1071 Specified key was too long; max key length is 3072 bytes -create index idx3 on worklog5743_16(a2(3072)); -Warnings: -Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release -show warnings; -Level Code Message -Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release -create index idx4 on worklog5743_16(a1, a2(3069)); -ERROR 42000: Specified key was too long; max key length is 3072 bytes -show warnings; -Level Code Message -Error 1071 Specified key was too long; max key length is 3072 bytes -create index idx5 on worklog5743_16(a1, a2(3068)); -show warnings; -Level Code Message -create index idx6 on worklog5743_16(a1, a2(2000), a3(1069)); -ERROR 42000: Specified key was too long; max key length is 3072 bytes -show warnings; -Level Code Message -Error 1071 Specified key was too long; max key length is 3072 bytes -create index idx7 on worklog5743_16(a1, a2(2000), a3(1068)); -show warnings; -Level Code Message -set sql_mode=default; -insert into worklog5743_1 values(9, repeat("a", 10000)); -insert into worklog5743_2 values(9, repeat("a", 10000)); -insert into worklog5743_4 values(9, repeat("a", 10000)); -insert into worklog5743_8 values(9, repeat("a", 10000), repeat("a", 10000)); -insert into worklog5743_16 values(9, repeat("a", 10000), repeat("a", 10000)); -set global innodb_large_prefix=0; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -insert into worklog5743_1 values(2, repeat("b", 10000)); -insert into worklog5743_2 values(2, repeat("b", 10000)); -insert into worklog5743_4 values(2, repeat("b", 10000)); -insert into worklog5743_8 values(2, repeat("b", 10000), repeat("b", 10000)); -insert into worklog5743_16 values(2, repeat("b", 10000), repeat("b", 10000)); -set global innodb_large_prefix=1; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -select a1, left(a2, 20) from worklog5743_1; -a1 left(a2, 20) -9 aaaaaaaaaaaaaaaaaaaa -2 bbbbbbbbbbbbbbbbbbbb -select a1, left(a2, 20) from worklog5743_2; -a1 left(a2, 20) -9 aaaaaaaaaaaaaaaaaaaa -2 bbbbbbbbbbbbbbbbbbbb -select a1, left(a2, 20) from worklog5743_4; -a1 left(a2, 20) -9 aaaaaaaaaaaaaaaaaaaa -2 bbbbbbbbbbbbbbbbbbbb -select a1, left(a2, 20) from worklog5743_8; -a1 left(a2, 20) -9 aaaaaaaaaaaaaaaaaaaa -2 bbbbbbbbbbbbbbbbbbbb -select a1, left(a2, 20) from worklog5743_16; -a1 left(a2, 20) -9 aaaaaaaaaaaaaaaaaaaa -2 bbbbbbbbbbbbbbbbbbbb -begin; -update worklog5743_1 set a1 = 1000; -update worklog5743_2 set a1 = 1000; -update worklog5743_4 set a1 = 1000; -update worklog5743_8 set a1 = 1000; -update worklog5743_16 set a1 = 1000; -select a1, left(a2, 20) from worklog5743_1; -a1 left(a2, 20) -1000 aaaaaaaaaaaaaaaaaaaa -1000 bbbbbbbbbbbbbbbbbbbb -select a1, left(a2, 20) from worklog5743_2; -a1 left(a2, 20) -1000 aaaaaaaaaaaaaaaaaaaa -1000 bbbbbbbbbbbbbbbbbbbb -select a1, left(a2, 20) from worklog5743_4; -a1 left(a2, 20) -1000 aaaaaaaaaaaaaaaaaaaa -1000 bbbbbbbbbbbbbbbbbbbb -select a1, left(a2, 20) from worklog5743_8; -a1 left(a2, 20) -1000 aaaaaaaaaaaaaaaaaaaa -1000 bbbbbbbbbbbbbbbbbbbb -select a1, left(a2, 20) from worklog5743_16; -a1 left(a2, 20) -1000 aaaaaaaaaaaaaaaaaaaa -1000 bbbbbbbbbbbbbbbbbbbb -connection con1; -select @@session.tx_isolation; -@@session.tx_isolation -REPEATABLE-READ -explain select a1, left(a2, 20) from worklog5743_1 where a1 = 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743_1 ref idx6 idx6 5 const 1 -explain select a1, left(a2, 20) from worklog5743_2 where a1 = 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743_2 ref idx6 idx6 5 const 1 -explain select a1, left(a2, 20) from worklog5743_4 where a1 = 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743_4 ref idx6 idx6 5 const 1 -explain select a1, left(a2, 20) from worklog5743_8 where a1 = 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743_8 ref idx5,idx7 idx5 5 const 1 -explain select a1, left(a2, 20) from worklog5743_16 where a1 = 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743_16 ref idx5,idx7 idx5 5 const 1 -select a1, left(a2, 20) from worklog5743_1 where a1 = 9; -a1 left(a2, 20) -9 aaaaaaaaaaaaaaaaaaaa -select a1, left(a2, 20) from worklog5743_2 where a1 = 9; -a1 left(a2, 20) -9 aaaaaaaaaaaaaaaaaaaa -select a1, left(a2, 20) from worklog5743_4 where a1 = 9; -a1 left(a2, 20) -9 aaaaaaaaaaaaaaaaaaaa -select a1, left(a2, 20) from worklog5743_8 where a1 = 9; -a1 left(a2, 20) -9 aaaaaaaaaaaaaaaaaaaa -select a1, left(a2, 20) from worklog5743_16 where a1 = 9; -a1 left(a2, 20) -9 aaaaaaaaaaaaaaaaaaaa -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -@@session.tx_isolation -READ-UNCOMMITTED -select a1, left(a2, 20) from worklog5743_1 where a1 = 9; -a1 left(a2, 20) -select a1, left(a2, 20) from worklog5743_2 where a1 = 9; -a1 left(a2, 20) -select a1, left(a2, 20) from worklog5743_4 where a1 = 9; -a1 left(a2, 20) -select a1, left(a2, 20) from worklog5743_8 where a1 = 9; -a1 left(a2, 20) -select a1, left(a2, 20) from worklog5743_16 where a1 = 9; -a1 left(a2, 20) -connection default; -rollback; -drop table worklog5743_1; -drop table worklog5743_2; -drop table worklog5743_4; -drop table worklog5743_8; -drop table worklog5743_16; -### Test 5 ### -create table worklog5743(a1 int, -a2 varchar(20000), -a3 varchar(3073), -a4 varchar(3072), -a5 varchar(3069), -a6 varchar(3068)) -ROW_FORMAT=DYNAMIC; -set sql_mode=''; -create index idx1 on worklog5743(a2); -Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes -create index idx2 on worklog5743(a3); -Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes -create index idx3 on worklog5743(a4); -show warnings; -Level Code Message -create index idx4 on worklog5743(a1, a2); -ERROR 42000: Specified key was too long; max key length is 3072 bytes -show warnings; -Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes -Error 1071 Specified key was too long; max key length is 3072 bytes -create index idx5 on worklog5743(a1, a5); -ERROR 42000: Specified key was too long; max key length is 3072 bytes -show warnings; -Level Code Message -Error 1071 Specified key was too long; max key length is 3072 bytes -create index idx6 on worklog5743(a1, a6); -show warnings; -Level Code Message -show create table worklog5743; -Table Create Table -worklog5743 CREATE TABLE `worklog5743` ( - `a1` int(11) DEFAULT NULL, - `a2` varchar(20000) DEFAULT NULL, - `a3` varchar(3073) DEFAULT NULL, - `a4` varchar(3072) DEFAULT NULL, - `a5` varchar(3069) DEFAULT NULL, - `a6` varchar(3068) DEFAULT NULL, - KEY `idx1` (`a2`(3072)), - KEY `idx2` (`a3`(3072)), - KEY `idx3` (`a4`), - KEY `idx6` (`a1`,`a6`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -set sql_mode=default; -insert into worklog5743 values(9, -repeat("a", 20000), repeat("a", 3073), -repeat("a", 3072), repeat("a", 3069), -repeat("a", 3068)); -begin; -update worklog5743 set a1 = 1000; -connection con1; -select @@session.tx_isolation; -@@session.tx_isolation -REPEATABLE-READ -explain select a1 from worklog5743 where a1 = 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743 ref idx6 idx6 5 const 1 Using index -select a1 from worklog5743 where a1 = 9; -a1 -9 -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -@@session.tx_isolation -READ-UNCOMMITTED -select a1 from worklog5743 where a1 = 9; -a1 -connection default; -rollback; -drop table worklog5743; -### Test 6 ### -create table worklog5743(a TEXT not null, primary key (a(1000))) row_format=COMPACT; -ERROR HY000: Index column size too large. The maximum column size is 767 bytes -create table worklog5743(a TEXT) row_format=COMPACT; -create index idx on worklog5743(a(768)); -ERROR HY000: Index column size too large. The maximum column size is 767 bytes -create index idx on worklog5743(a(767)); -insert into worklog5743 values(repeat("a", 20000)); -begin; -insert into worklog5743 values(repeat("b", 20000)); -update worklog5743 set a = (repeat("x", 25000)); -select @@session.tx_isolation; -@@session.tx_isolation -REPEATABLE-READ -connection con1; -select a = repeat("a", 20000) from worklog5743; -a = repeat("a", 20000) -1 -disconnect con1; -connection con2; -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -@@session.tx_isolation -READ-UNCOMMITTED -select a = repeat("x", 25000) from worklog5743; -a = repeat("x", 25000) -1 -1 -disconnect con2; -connection default; -rollback; -drop table worklog5743; -### Test 7 ### -create table worklog5743(a TEXT not null) ROW_FORMAT=DYNAMIC; -set statement sql_mode = '' for -create index idx1 on worklog5743(a(3073)); -Warnings: -Note 1071 Specified key was too long; max key length is 3072 bytes -create index idx2 on worklog5743(a(3072)); -Warnings: -Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release -show create table worklog5743; -Table Create Table -worklog5743 CREATE TABLE `worklog5743` ( - `a` text NOT NULL, - KEY `idx1` (`a`(3072)), - KEY `idx2` (`a`(3072)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -drop table worklog5743; -create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT; -create index idx on worklog5743(a(768)); -ERROR HY000: Index column size too large. The maximum column size is 767 bytes -create index idx2 on worklog5743(a(767)); -drop table worklog5743; -create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT; -create index idx on worklog5743(a(768)); -ERROR HY000: Index column size too large. The maximum column size is 767 bytes -create index idx2 on worklog5743(a(767)); -drop table worklog5743; -SET GLOBAL innodb_large_prefix=1; -Warnings: -Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -SET GLOBAL innodb_strict_mode = DEFAULT; diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug36169.opt b/mysql-test/suite/innodb_zip/t/innodb_bug36169.opt deleted file mode 100644 index 3a4e594f382..00000000000 --- a/mysql-test/suite/innodb_zip/t/innodb_bug36169.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_large_prefix=ON \ No newline at end of file diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug36169.test b/mysql-test/suite/innodb_zip/t/innodb_bug36169.test deleted file mode 100644 index 6a9b2099fa8..00000000000 --- a/mysql-test/suite/innodb_zip/t/innodb_bug36169.test +++ /dev/null @@ -1,1153 +0,0 @@ ---source include/innodb_page_size_small.inc -# -# Bug#36169 create innodb compressed table with too large row size crashed -# http://bugs.mysql.com/36169 -# - -call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size .* for a record on index leaf page."); - -# -# The following is copied from http://bugs.mysql.com/36169 -# (http://bugs.mysql.com/file.php?id=9121) -# Probably it can be simplified but that is not obvious. -# - -# we care only that the following SQL commands do produce errors -# as expected and do not crash the server --- disable_query_log --- disable_result_log - -# Generating 10 tables -# Creating a table with 94 columns and 24 indexes -DROP TABLE IF EXISTS `table0`; -set innodb_strict_mode=on; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table0` -(`col0` BOOL, -`col1` BOOL, -`col2` TINYINT, -`col3` DATE, -`col4` TIME, -`col5` SET ('test1','test2','test3'), -`col6` TIME, -`col7` TEXT, -`col8` DECIMAL, -`col9` SET ('test1','test2','test3'), -`col10` FLOAT, -`col11` DOUBLE PRECISION, -`col12` ENUM ('test1','test2','test3'), -`col13` TINYBLOB, -`col14` YEAR, -`col15` SET ('test1','test2','test3'), -`col16` NUMERIC, -`col17` NUMERIC, -`col18` BLOB, -`col19` DATETIME, -`col20` DOUBLE PRECISION, -`col21` DECIMAL, -`col22` DATETIME, -`col23` NUMERIC, -`col24` NUMERIC, -`col25` LONGTEXT, -`col26` TINYBLOB, -`col27` TIME, -`col28` TINYBLOB, -`col29` ENUM ('test1','test2','test3'), -`col30` SMALLINT, -`col31` REAL, -`col32` FLOAT, -`col33` CHAR (175), -`col34` TINYTEXT, -`col35` TINYTEXT, -`col36` TINYBLOB, -`col37` TINYBLOB, -`col38` TINYTEXT, -`col39` MEDIUMBLOB, -`col40` TIMESTAMP, -`col41` DOUBLE, -`col42` SMALLINT, -`col43` LONGBLOB, -`col44` VARCHAR (80), -`col45` MEDIUMTEXT, -`col46` NUMERIC, -`col47` BIGINT, -`col48` DATE, -`col49` TINYBLOB, -`col50` DATE, -`col51` BOOL, -`col52` MEDIUMINT, -`col53` FLOAT, -`col54` TINYBLOB, -`col55` LONGTEXT, -`col56` SMALLINT, -`col57` ENUM ('test1','test2','test3'), -`col58` DATETIME, -`col59` MEDIUMTEXT, -`col60` VARCHAR (232), -`col61` NUMERIC, -`col62` YEAR, -`col63` SMALLINT, -`col64` TIMESTAMP, -`col65` BLOB, -`col66` LONGBLOB, -`col67` INT, -`col68` LONGTEXT, -`col69` ENUM ('test1','test2','test3'), -`col70` INT, -`col71` TIME, -`col72` TIMESTAMP, -`col73` TIMESTAMP, -`col74` VARCHAR (170), -`col75` SET ('test1','test2','test3'), -`col76` TINYBLOB, -`col77` BIGINT, -`col78` NUMERIC, -`col79` DATETIME, -`col80` YEAR, -`col81` NUMERIC, -`col82` LONGBLOB, -`col83` TEXT, -`col84` CHAR (83), -`col85` DECIMAL, -`col86` FLOAT, -`col87` INT, -`col88` VARCHAR (145), -`col89` DATE, -`col90` DECIMAL, -`col91` DECIMAL, -`col92` MEDIUMBLOB, -`col93` TIME, -KEY `idx0` (`col69`,`col90`,`col8`), -KEY `idx1` (`col60`), -KEY `idx2` (`col60`,`col70`,`col74`), -KEY `idx3` (`col22`,`col32`,`col72`,`col30`), -KEY `idx4` (`col29`), -KEY `idx5` (`col19`,`col45`(143)), -KEY `idx6` (`col46`,`col48`,`col5`,`col39`(118)), -KEY `idx7` (`col48`,`col61`), -KEY `idx8` (`col93`), -KEY `idx9` (`col31`), -KEY `idx10` (`col30`,`col21`), -KEY `idx11` (`col67`), -KEY `idx12` (`col44`,`col6`,`col8`,`col38`(226)), -KEY `idx13` (`col71`,`col41`,`col15`,`col49`(88)), -KEY `idx14` (`col78`), -KEY `idx15` (`col63`,`col67`,`col64`), -KEY `idx16` (`col17`,`col86`), -KEY `idx17` (`col77`,`col56`,`col10`,`col55`(24)), -KEY `idx18` (`col62`), -KEY `idx19` (`col31`,`col57`,`col56`,`col53`), -KEY `idx20` (`col46`), -KEY `idx21` (`col83`(54)), -KEY `idx22` (`col51`,`col7`(120)), -KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 10 columns and 32 indexes -DROP TABLE IF EXISTS `table1`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table1` -(`col0` CHAR (113), -`col1` FLOAT, -`col2` BIGINT, -`col3` DECIMAL, -`col4` BLOB, -`col5` LONGTEXT, -`col6` SET ('test1','test2','test3'), -`col7` BIGINT, -`col8` BIGINT, -`col9` TINYBLOB, -KEY `idx0` (`col5`(101),`col7`,`col8`), -KEY `idx1` (`col8`), -KEY `idx2` (`col4`(177),`col9`(126),`col6`,`col3`), -KEY `idx3` (`col5`(160)), -KEY `idx4` (`col9`(242)), -KEY `idx5` (`col4`(139),`col2`,`col3`), -KEY `idx6` (`col7`), -KEY `idx7` (`col6`,`col2`,`col0`,`col3`), -KEY `idx8` (`col9`(66)), -KEY `idx9` (`col5`(253)), -KEY `idx10` (`col1`,`col7`,`col2`), -KEY `idx11` (`col9`(242),`col0`,`col8`,`col5`(163)), -KEY `idx12` (`col8`), -KEY `idx13` (`col0`,`col9`(37)), -KEY `idx14` (`col0`), -KEY `idx15` (`col5`(111)), -KEY `idx16` (`col8`,`col0`,`col5`(13)), -KEY `idx17` (`col4`(139)), -KEY `idx18` (`col5`(189),`col2`,`col3`,`col9`(136)), -KEY `idx19` (`col0`,`col3`,`col1`,`col8`), -KEY `idx20` (`col8`), -KEY `idx21` (`col0`,`col7`,`col9`(227),`col3`), -KEY `idx22` (`col0`), -KEY `idx23` (`col2`), -KEY `idx24` (`col3`), -KEY `idx25` (`col2`,`col3`), -KEY `idx26` (`col0`), -KEY `idx27` (`col5`(254)), -KEY `idx28` (`col3`), -KEY `idx29` (`col3`), -KEY `idx30` (`col7`,`col3`,`col0`,`col4`(220)), -KEY `idx31` (`col4`(1),`col0`) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 141 columns and 18 indexes -DROP TABLE IF EXISTS `table2`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table2` -(`col0` BOOL, -`col1` MEDIUMINT, -`col2` VARCHAR (209), -`col3` MEDIUMBLOB, -`col4` CHAR (13), -`col5` DOUBLE, -`col6` TINYTEXT, -`col7` REAL, -`col8` SMALLINT, -`col9` BLOB, -`col10` TINYINT, -`col11` DECIMAL, -`col12` BLOB, -`col13` DECIMAL, -`col14` LONGBLOB, -`col15` SMALLINT, -`col16` LONGBLOB, -`col17` TINYTEXT, -`col18` FLOAT, -`col19` CHAR (78), -`col20` MEDIUMTEXT, -`col21` SET ('test1','test2','test3'), -`col22` MEDIUMINT, -`col23` INT, -`col24` MEDIUMBLOB, -`col25` ENUM ('test1','test2','test3'), -`col26` TINYBLOB, -`col27` VARCHAR (116), -`col28` TIMESTAMP, -`col29` BLOB, -`col30` SMALLINT, -`col31` DOUBLE PRECISION, -`col32` DECIMAL, -`col33` DECIMAL, -`col34` TEXT, -`col35` MEDIUMINT, -`col36` MEDIUMINT, -`col37` BIGINT, -`col38` VARCHAR (253), -`col39` TINYBLOB, -`col40` MEDIUMBLOB, -`col41` BIGINT, -`col42` DOUBLE, -`col43` TEXT, -`col44` BLOB, -`col45` TIME, -`col46` MEDIUMINT, -`col47` DOUBLE PRECISION, -`col48` SET ('test1','test2','test3'), -`col49` DOUBLE PRECISION, -`col50` VARCHAR (97), -`col51` TEXT, -`col52` NUMERIC, -`col53` ENUM ('test1','test2','test3'), -`col54` MEDIUMTEXT, -`col55` MEDIUMINT, -`col56` DATETIME, -`col57` DATETIME, -`col58` MEDIUMTEXT, -`col59` CHAR (244), -`col60` LONGBLOB, -`col61` MEDIUMBLOB, -`col62` DOUBLE, -`col63` SMALLINT, -`col64` BOOL, -`col65` SMALLINT, -`col66` VARCHAR (212), -`col67` TIME, -`col68` REAL, -`col69` BOOL, -`col70` BIGINT, -`col71` DATE, -`col72` TINYINT, -`col73` ENUM ('test1','test2','test3'), -`col74` DATE, -`col75` TIME, -`col76` DATETIME, -`col77` BOOL, -`col78` TINYTEXT, -`col79` MEDIUMINT, -`col80` NUMERIC, -`col81` LONGTEXT, -`col82` SET ('test1','test2','test3'), -`col83` DOUBLE PRECISION, -`col84` NUMERIC, -`col85` VARCHAR (184), -`col86` DOUBLE PRECISION, -`col87` MEDIUMTEXT, -`col88` MEDIUMBLOB, -`col89` BOOL, -`col90` SMALLINT, -`col91` TINYINT, -`col92` ENUM ('test1','test2','test3'), -`col93` BOOL, -`col94` TIMESTAMP, -`col95` BOOL, -`col96` MEDIUMTEXT, -`col97` DECIMAL, -`col98` BOOL, -`col99` DECIMAL, -`col100` MEDIUMINT, -`col101` DOUBLE PRECISION, -`col102` TINYINT, -`col103` BOOL, -`col104` MEDIUMINT, -`col105` DECIMAL, -`col106` NUMERIC, -`col107` TIMESTAMP, -`col108` MEDIUMBLOB, -`col109` TINYBLOB, -`col110` SET ('test1','test2','test3'), -`col111` YEAR, -`col112` TIMESTAMP, -`col113` CHAR (201), -`col114` BOOL, -`col115` TINYINT, -`col116` DOUBLE, -`col117` TINYINT, -`col118` TIMESTAMP, -`col119` SET ('test1','test2','test3'), -`col120` SMALLINT, -`col121` TINYBLOB, -`col122` TIMESTAMP, -`col123` BLOB, -`col124` DATE, -`col125` SMALLINT, -`col126` ENUM ('test1','test2','test3'), -`col127` MEDIUMBLOB, -`col128` DOUBLE PRECISION, -`col129` REAL, -`col130` VARCHAR (159), -`col131` MEDIUMBLOB, -`col132` BIGINT, -`col133` INT, -`col134` SET ('test1','test2','test3'), -`col135` CHAR (198), -`col136` SET ('test1','test2','test3'), -`col137` MEDIUMTEXT, -`col138` SMALLINT, -`col139` BLOB, -`col140` LONGBLOB, -KEY `idx0` (`col14`(139),`col24`(208),`col38`,`col35`), -KEY `idx1` (`col48`,`col118`,`col29`(131),`col100`), -KEY `idx2` (`col86`,`col67`,`col43`(175)), -KEY `idx3` (`col19`), -KEY `idx4` (`col40`(220),`col67`), -KEY `idx5` (`col99`,`col56`), -KEY `idx6` (`col68`,`col28`,`col137`(157)), -KEY `idx7` (`col51`(160),`col99`,`col45`,`col39`(9)), -KEY `idx8` (`col15`,`col52`,`col90`,`col94`), -KEY `idx9` (`col24`(3),`col139`(248),`col108`(118),`col41`), -KEY `idx10` (`col36`,`col92`,`col114`), -KEY `idx11` (`col115`,`col9`(116)), -KEY `idx12` (`col130`,`col93`,`col134`), -KEY `idx13` (`col123`(65)), -KEY `idx14` (`col44`(90),`col86`,`col119`), -KEY `idx15` (`col69`), -KEY `idx16` (`col132`,`col81`(118),`col18`), -KEY `idx17` (`col24`(250),`col7`,`col92`,`col45`) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 199 columns and 1 indexes -DROP TABLE IF EXISTS `table3`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table3` -(`col0` SMALLINT, -`col1` SET ('test1','test2','test3'), -`col2` TINYTEXT, -`col3` DOUBLE, -`col4` NUMERIC, -`col5` DATE, -`col6` BIGINT, -`col7` DOUBLE, -`col8` TEXT, -`col9` INT, -`col10` REAL, -`col11` TINYINT, -`col12` NUMERIC, -`col13` NUMERIC, -`col14` TIME, -`col15` DOUBLE, -`col16` REAL, -`col17` MEDIUMBLOB, -`col18` YEAR, -`col19` TINYTEXT, -`col20` YEAR, -`col21` CHAR (250), -`col22` TINYINT, -`col23` TINYINT, -`col24` SMALLINT, -`col25` DATETIME, -`col26` MEDIUMINT, -`col27` LONGBLOB, -`col28` VARCHAR (106), -`col29` FLOAT, -`col30` MEDIUMTEXT, -`col31` TINYBLOB, -`col32` BIGINT, -`col33` YEAR, -`col34` REAL, -`col35` MEDIUMBLOB, -`col36` LONGTEXT, -`col37` LONGBLOB, -`col38` BIGINT, -`col39` FLOAT, -`col40` TIME, -`col41` DATETIME, -`col42` BOOL, -`col43` BIGINT, -`col44` SMALLINT, -`col45` TIME, -`col46` DOUBLE PRECISION, -`col47` TIME, -`col48` TINYTEXT, -`col49` DOUBLE PRECISION, -`col50` BIGINT, -`col51` NUMERIC, -`col52` TINYBLOB, -`col53` DATE, -`col54` DECIMAL, -`col55` SMALLINT, -`col56` TINYTEXT, -`col57` ENUM ('test1','test2','test3'), -`col58` YEAR, -`col59` TIME, -`col60` TINYINT, -`col61` DECIMAL, -`col62` DOUBLE, -`col63` DATE, -`col64` LONGTEXT, -`col65` DOUBLE, -`col66` VARCHAR (88), -`col67` MEDIUMTEXT, -`col68` DATE, -`col69` MEDIUMINT, -`col70` DECIMAL, -`col71` MEDIUMTEXT, -`col72` LONGTEXT, -`col73` REAL, -`col74` DOUBLE, -`col75` TIME, -`col76` DATE, -`col77` DECIMAL, -`col78` MEDIUMBLOB, -`col79` NUMERIC, -`col80` BIGINT, -`col81` YEAR, -`col82` SMALLINT, -`col83` MEDIUMINT, -`col84` TINYINT, -`col85` MEDIUMBLOB, -`col86` TIME, -`col87` MEDIUMBLOB, -`col88` LONGTEXT, -`col89` BOOL, -`col90` BLOB, -`col91` LONGBLOB, -`col92` YEAR, -`col93` BLOB, -`col94` INT, -`col95` TINYTEXT, -`col96` TINYINT, -`col97` DECIMAL, -`col98` ENUM ('test1','test2','test3'), -`col99` MEDIUMINT, -`col100` TINYINT, -`col101` MEDIUMBLOB, -`col102` TINYINT, -`col103` SET ('test1','test2','test3'), -`col104` TIMESTAMP, -`col105` TEXT, -`col106` DATETIME, -`col107` MEDIUMTEXT, -`col108` CHAR (220), -`col109` TIME, -`col110` VARCHAR (131), -`col111` DECIMAL, -`col112` FLOAT, -`col113` SMALLINT, -`col114` BIGINT, -`col115` LONGBLOB, -`col116` SET ('test1','test2','test3'), -`col117` ENUM ('test1','test2','test3'), -`col118` BLOB, -`col119` MEDIUMTEXT, -`col120` SET ('test1','test2','test3'), -`col121` DATETIME, -`col122` FLOAT, -`col123` VARCHAR (242), -`col124` YEAR, -`col125` MEDIUMBLOB, -`col126` TIME, -`col127` BOOL, -`col128` TINYBLOB, -`col129` DOUBLE, -`col130` TINYINT, -`col131` BIGINT, -`col132` SMALLINT, -`col133` INT, -`col134` DOUBLE PRECISION, -`col135` MEDIUMBLOB, -`col136` SET ('test1','test2','test3'), -`col137` TINYTEXT, -`col138` DOUBLE PRECISION, -`col139` NUMERIC, -`col140` BLOB, -`col141` SET ('test1','test2','test3'), -`col142` INT, -`col143` VARCHAR (26), -`col144` BLOB, -`col145` REAL, -`col146` SET ('test1','test2','test3'), -`col147` LONGBLOB, -`col148` TEXT, -`col149` BLOB, -`col150` CHAR (189), -`col151` LONGTEXT, -`col152` INT, -`col153` FLOAT, -`col154` LONGTEXT, -`col155` DATE, -`col156` LONGBLOB, -`col157` TINYBLOB, -`col158` REAL, -`col159` DATE, -`col160` TIME, -`col161` YEAR, -`col162` DOUBLE, -`col163` VARCHAR (90), -`col164` FLOAT, -`col165` NUMERIC, -`col166` ENUM ('test1','test2','test3'), -`col167` DOUBLE PRECISION, -`col168` DOUBLE PRECISION, -`col169` TINYBLOB, -`col170` TIME, -`col171` SMALLINT, -`col172` TINYTEXT, -`col173` SMALLINT, -`col174` DOUBLE, -`col175` VARCHAR (14), -`col176` VARCHAR (90), -`col177` REAL, -`col178` MEDIUMINT, -`col179` TINYBLOB, -`col180` FLOAT, -`col181` TIMESTAMP, -`col182` REAL, -`col183` DOUBLE PRECISION, -`col184` BIGINT, -`col185` INT, -`col186` MEDIUMTEXT, -`col187` TIME, -`col188` FLOAT, -`col189` TIME, -`col190` INT, -`col191` FLOAT, -`col192` MEDIUMINT, -`col193` TINYINT, -`col194` MEDIUMTEXT, -`col195` DATE, -`col196` TIME, -`col197` YEAR, -`col198` CHAR (206), -KEY `idx0` (`col39`,`col23`) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 133 columns and 16 indexes -DROP TABLE IF EXISTS `table4`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table4` -(`col0` VARCHAR (60), -`col1` NUMERIC, -`col2` LONGTEXT, -`col3` MEDIUMTEXT, -`col4` LONGTEXT, -`col5` LONGBLOB, -`col6` LONGBLOB, -`col7` DATETIME, -`col8` TINYTEXT, -`col9` BLOB, -`col10` BOOL, -`col11` BIGINT, -`col12` TEXT, -`col13` VARCHAR (213), -`col14` TINYBLOB, -`col15` BOOL, -`col16` MEDIUMTEXT, -`col17` DOUBLE, -`col18` TEXT, -`col19` BLOB, -`col20` SET ('test1','test2','test3'), -`col21` TINYINT, -`col22` DATETIME, -`col23` TINYINT, -`col24` ENUM ('test1','test2','test3'), -`col25` REAL, -`col26` BOOL, -`col27` FLOAT, -`col28` LONGBLOB, -`col29` DATETIME, -`col30` FLOAT, -`col31` SET ('test1','test2','test3'), -`col32` LONGBLOB, -`col33` NUMERIC, -`col34` YEAR, -`col35` VARCHAR (146), -`col36` BIGINT, -`col37` DATETIME, -`col38` DATE, -`col39` SET ('test1','test2','test3'), -`col40` CHAR (112), -`col41` FLOAT, -`col42` YEAR, -`col43` TIME, -`col44` DOUBLE, -`col45` NUMERIC, -`col46` FLOAT, -`col47` DECIMAL, -`col48` BIGINT, -`col49` DECIMAL, -`col50` YEAR, -`col51` MEDIUMTEXT, -`col52` LONGBLOB, -`col53` SET ('test1','test2','test3'), -`col54` BLOB, -`col55` FLOAT, -`col56` REAL, -`col57` REAL, -`col58` TEXT, -`col59` MEDIUMBLOB, -`col60` INT, -`col61` INT, -`col62` DATE, -`col63` TEXT, -`col64` DATE, -`col65` ENUM ('test1','test2','test3'), -`col66` DOUBLE PRECISION, -`col67` TINYTEXT, -`col68` TINYBLOB, -`col69` FLOAT, -`col70` BLOB, -`col71` DATETIME, -`col72` DOUBLE, -`col73` LONGTEXT, -`col74` TIME, -`col75` DATETIME, -`col76` VARCHAR (122), -`col77` MEDIUMTEXT, -`col78` MEDIUMTEXT, -`col79` BOOL, -`col80` LONGTEXT, -`col81` TINYTEXT, -`col82` NUMERIC, -`col83` DOUBLE PRECISION, -`col84` DATE, -`col85` YEAR, -`col86` BLOB, -`col87` TINYTEXT, -`col88` DOUBLE PRECISION, -`col89` MEDIUMINT, -`col90` MEDIUMTEXT, -`col91` NUMERIC, -`col92` DATETIME, -`col93` NUMERIC, -`col94` SET ('test1','test2','test3'), -`col95` TINYTEXT, -`col96` SET ('test1','test2','test3'), -`col97` YEAR, -`col98` MEDIUMINT, -`col99` TEXT, -`col100` TEXT, -`col101` TIME, -`col102` VARCHAR (225), -`col103` TINYTEXT, -`col104` TEXT, -`col105` MEDIUMTEXT, -`col106` TINYINT, -`col107` TEXT, -`col108` LONGBLOB, -`col109` LONGTEXT, -`col110` TINYTEXT, -`col111` CHAR (56), -`col112` YEAR, -`col113` ENUM ('test1','test2','test3'), -`col114` TINYBLOB, -`col115` DATETIME, -`col116` DATE, -`col117` TIME, -`col118` MEDIUMTEXT, -`col119` DOUBLE PRECISION, -`col120` FLOAT, -`col121` TIMESTAMP, -`col122` MEDIUMINT, -`col123` YEAR, -`col124` DATE, -`col125` TEXT, -`col126` FLOAT, -`col127` TINYTEXT, -`col128` BOOL, -`col129` NUMERIC, -`col130` TIMESTAMP, -`col131` INT, -`col132` MEDIUMBLOB, -KEY `idx0` (`col130`), -KEY `idx1` (`col30`,`col55`,`col19`(31)), -KEY `idx2` (`col104`(186)), -KEY `idx3` (`col131`), -KEY `idx4` (`col64`,`col93`,`col2`(11)), -KEY `idx5` (`col34`,`col121`,`col22`), -KEY `idx6` (`col33`,`col55`,`col83`), -KEY `idx7` (`col17`,`col87`(245),`col99`(17)), -KEY `idx8` (`col65`,`col120`), -KEY `idx9` (`col82`), -KEY `idx10` (`col9`(72)), -KEY `idx11` (`col88`), -KEY `idx12` (`col128`,`col9`(200),`col71`,`col66`), -KEY `idx13` (`col77`(126)), -KEY `idx14` (`col105`(26),`col13`,`col117`), -KEY `idx15` (`col4`(246),`col130`,`col115`,`col3`(141)) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 176 columns and 13 indexes -DROP TABLE IF EXISTS `table5`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table5` -(`col0` MEDIUMTEXT, -`col1` VARCHAR (90), -`col2` TINYTEXT, -`col3` TIME, -`col4` BOOL, -`col5` TINYTEXT, -`col6` BOOL, -`col7` TIMESTAMP, -`col8` TINYBLOB, -`col9` TINYINT, -`col10` YEAR, -`col11` SET ('test1','test2','test3'), -`col12` TEXT, -`col13` CHAR (248), -`col14` BIGINT, -`col15` TEXT, -`col16` TINYINT, -`col17` NUMERIC, -`col18` SET ('test1','test2','test3'), -`col19` LONGBLOB, -`col20` FLOAT, -`col21` INT, -`col22` TEXT, -`col23` BOOL, -`col24` DECIMAL, -`col25` DOUBLE PRECISION, -`col26` FLOAT, -`col27` TINYBLOB, -`col28` NUMERIC, -`col29` MEDIUMBLOB, -`col30` DATE, -`col31` LONGTEXT, -`col32` DATE, -`col33` FLOAT, -`col34` BIGINT, -`col35` TINYTEXT, -`col36` MEDIUMTEXT, -`col37` TIME, -`col38` INT, -`col39` TINYINT, -`col40` SET ('test1','test2','test3'), -`col41` CHAR (130), -`col42` SMALLINT, -`col43` INT, -`col44` MEDIUMTEXT, -`col45` VARCHAR (126), -`col46` INT, -`col47` DOUBLE PRECISION, -`col48` BIGINT, -`col49` MEDIUMTEXT, -`col50` TINYBLOB, -`col51` MEDIUMINT, -`col52` TEXT, -`col53` VARCHAR (208), -`col54` VARCHAR (207), -`col55` NUMERIC, -`col56` DATETIME, -`col57` ENUM ('test1','test2','test3'), -`col58` NUMERIC, -`col59` TINYBLOB, -`col60` VARCHAR (73), -`col61` MEDIUMTEXT, -`col62` TINYBLOB, -`col63` DATETIME, -`col64` NUMERIC, -`col65` MEDIUMINT, -`col66` DATETIME, -`col67` NUMERIC, -`col68` TINYINT, -`col69` VARCHAR (58), -`col70` DECIMAL, -`col71` MEDIUMTEXT, -`col72` DATE, -`col73` TIME, -`col74` DOUBLE PRECISION, -`col75` DECIMAL, -`col76` MEDIUMBLOB, -`col77` REAL, -`col78` YEAR, -`col79` YEAR, -`col80` LONGBLOB, -`col81` BLOB, -`col82` BIGINT, -`col83` ENUM ('test1','test2','test3'), -`col84` NUMERIC, -`col85` SET ('test1','test2','test3'), -`col86` MEDIUMTEXT, -`col87` LONGBLOB, -`col88` TIME, -`col89` ENUM ('test1','test2','test3'), -`col90` DECIMAL, -`col91` FLOAT, -`col92` DATETIME, -`col93` TINYTEXT, -`col94` TIMESTAMP, -`col95` TIMESTAMP, -`col96` TEXT, -`col97` REAL, -`col98` VARCHAR (198), -`col99` TIME, -`col100` TINYINT, -`col101` BIGINT, -`col102` LONGBLOB, -`col103` LONGBLOB, -`col104` MEDIUMINT, -`col105` MEDIUMTEXT, -`col106` TIMESTAMP, -`col107` SMALLINT, -`col108` NUMERIC, -`col109` DECIMAL, -`col110` FLOAT, -`col111` DECIMAL, -`col112` REAL, -`col113` TINYTEXT, -`col114` FLOAT, -`col115` VARCHAR (7), -`col116` LONGTEXT, -`col117` DATE, -`col118` BIGINT, -`col119` TEXT, -`col120` BIGINT, -`col121` BLOB, -`col122` CHAR (110), -`col123` NUMERIC, -`col124` MEDIUMBLOB, -`col125` NUMERIC, -`col126` NUMERIC, -`col127` BOOL, -`col128` TIME, -`col129` TINYBLOB, -`col130` TINYBLOB, -`col131` DATE, -`col132` INT, -`col133` VARCHAR (123), -`col134` CHAR (238), -`col135` VARCHAR (225), -`col136` LONGTEXT, -`col137` LONGBLOB, -`col138` REAL, -`col139` TINYBLOB, -`col140` DATETIME, -`col141` TINYTEXT, -`col142` LONGBLOB, -`col143` BIGINT, -`col144` VARCHAR (236), -`col145` TEXT, -`col146` YEAR, -`col147` DECIMAL, -`col148` TEXT, -`col149` MEDIUMBLOB, -`col150` TINYINT, -`col151` BOOL, -`col152` VARCHAR (72), -`col153` INT, -`col154` VARCHAR (165), -`col155` TINYINT, -`col156` MEDIUMTEXT, -`col157` DOUBLE PRECISION, -`col158` TIME, -`col159` MEDIUMBLOB, -`col160` LONGBLOB, -`col161` DATETIME, -`col162` DOUBLE PRECISION, -`col163` BLOB, -`col164` ENUM ('test1','test2','test3'), -`col165` TIMESTAMP, -`col166` DATE, -`col167` TINYBLOB, -`col168` TINYBLOB, -`col169` LONGBLOB, -`col170` DATETIME, -`col171` BIGINT, -`col172` VARCHAR (30), -`col173` LONGTEXT, -`col174` TIME, -`col175` FLOAT, -KEY `idx0` (`col16`,`col156`(139),`col97`,`col120`), -KEY `idx1` (`col24`,`col0`(108)), -KEY `idx2` (`col117`,`col173`(34),`col132`,`col82`), -KEY `idx3` (`col2`(86)), -KEY `idx4` (`col2`(43)), -KEY `idx5` (`col83`,`col35`(87),`col111`), -KEY `idx6` (`col6`,`col134`,`col92`), -KEY `idx7` (`col56`), -KEY `idx8` (`col30`,`col53`,`col129`(66)), -KEY `idx9` (`col53`,`col113`(211),`col32`,`col15`(75)), -KEY `idx10` (`col34`), -KEY `idx11` (`col126`), -KEY `idx12` (`col24`) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 179 columns and 46 indexes -DROP TABLE IF EXISTS `table6`; --- error ER_TOO_BIG_ROWSIZE ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table6` -(`col0` ENUM ('test1','test2','test3'), -`col1` MEDIUMBLOB, -`col2` MEDIUMBLOB, -`col3` DATETIME, -`col4` DATE, -`col5` YEAR, -`col6` REAL, -`col7` NUMERIC, -`col8` MEDIUMBLOB, -`col9` TEXT, -`col10` TIMESTAMP, -`col11` DOUBLE, -`col12` DOUBLE, -`col13` SMALLINT, -`col14` TIMESTAMP, -`col15` DECIMAL, -`col16` DATE, -`col17` TEXT, -`col18` LONGBLOB, -`col19` BIGINT, -`col20` FLOAT, -`col21` DATETIME, -`col22` TINYINT, -`col23` MEDIUMBLOB, -`col24` SET ('test1','test2','test3'), -`col25` TIME, -`col26` TEXT, -`col27` LONGTEXT, -`col28` BIGINT, -`col29` REAL, -`col30` YEAR, -`col31` MEDIUMBLOB, -`col32` MEDIUMINT, -`col33` FLOAT, -`col34` TEXT, -`col35` DATE, -`col36` TIMESTAMP, -`col37` REAL, -`col38` BLOB, -`col39` BLOB, -`col40` BLOB, -`col41` TINYBLOB, -`col42` INT, -`col43` TINYINT, -`col44` REAL, -`col45` BIGINT, -`col46` TIMESTAMP, -`col47` BLOB, -`col48` ENUM ('test1','test2','test3'), -`col49` BOOL, -`col50` CHAR (109), -`col51` DOUBLE, -`col52` DOUBLE PRECISION, -`col53` ENUM ('test1','test2','test3'), -`col54` FLOAT, -`col55` DOUBLE PRECISION, -`col56` CHAR (166), -`col57` TEXT, -`col58` TIME, -`col59` DECIMAL, -`col60` TEXT, -`col61` ENUM ('test1','test2','test3'), -`col62` LONGTEXT, -`col63` YEAR, -`col64` DOUBLE, -`col65` CHAR (87), -`col66` DATE, -`col67` BOOL, -`col68` MEDIUMBLOB, -`col69` DATETIME, -`col70` DECIMAL, -`col71` TIME, -`col72` REAL, -`col73` LONGTEXT, -`col74` BLOB, -`col75` REAL, -`col76` INT, -`col77` INT, -`col78` FLOAT, -`col79` DOUBLE, -`col80` MEDIUMINT, -`col81` ENUM ('test1','test2','test3'), -`col82` VARCHAR (221), -`col83` BIGINT, -`col84` TINYINT, -`col85` BIGINT, -`col86` FLOAT, -`col87` MEDIUMBLOB, -`col88` CHAR (126), -`col89` MEDIUMBLOB, -`col90` DATETIME, -`col91` TINYINT, -`col92` DOUBLE, -`col93` NUMERIC, -`col94` DATE, -`col95` BLOB, -`col96` DATETIME, -`col97` TIME, -`col98` LONGBLOB, -`col99` INT, -`col100` SET ('test1','test2','test3'), -`col101` TINYBLOB, -`col102` INT, -`col103` MEDIUMBLOB, -`col104` MEDIUMTEXT, -`col105` FLOAT, -`col106` TINYBLOB, -`col107` VARCHAR (26), -`col108` TINYINT, -`col109` TIME, -`col110` TINYBLOB, -`col111` LONGBLOB, -`col112` TINYTEXT, -`col113` FLOAT, -`col114` TINYINT, -`col115` NUMERIC, -`col116` TIME, -`col117` SET ('test1','test2','test3'), -`col118` DATE, -`col119` SMALLINT, -`col120` BLOB, -`col121` TINYTEXT, -`col122` REAL, -`col123` YEAR, -`col124` REAL, -`col125` BOOL, -`col126` BLOB, -`col127` REAL, -`col128` MEDIUMBLOB, -`col129` TIMESTAMP, -`col130` LONGBLOB, -`col131` MEDIUMBLOB, -`col132` YEAR, -`col133` YEAR, -`col134` INT, -`col135` MEDIUMINT, -`col136` MEDIUMINT, -`col137` TINYTEXT, -`col138` TINYBLOB, -`col139` BLOB, -`col140` SET ('test1','test2','test3'), -`col141` ENUM ('test1','test2','test3'), -`col142` ENUM ('test1','test2','test3'), -`col143` TINYTEXT, -`col144` DATETIME, -`col145` TEXT, -`col146` DOUBLE PRECISION, -`col147` DECIMAL, -`col148` MEDIUMTEXT, -`col149` TINYTEXT, -`col150` SET ('test1','test2','test3'), -`col151` MEDIUMTEXT, -`col152` CHAR (126), -`col153` DOUBLE, -`col154` CHAR (243), -`col155` SET ('test1','test2','test3'), -`col156` SET ('test1','test2','test3'), -`col157` DATETIME, -`col158` DOUBLE, -`col159` NUMERIC, -`col160` DECIMAL, -`col161` FLOAT, -`col162` LONGBLOB, -`col163` LONGTEXT, -`col164` INT, -`col165` TIME, -`col166` CHAR (27), -`col167` VARCHAR (63), -`col168` TEXT, -`col169` TINYBLOB, -`col170` TINYBLOB, -`col171` ENUM ('test1','test2','test3'), -`col172` INT, -`col173` TIME, -`col174` DECIMAL, -`col175` DOUBLE, -`col176` MEDIUMBLOB, -`col177` LONGBLOB, -`col178` CHAR (43), -KEY `idx0` (`col131`(219)), -KEY `idx1` (`col67`,`col122`,`col59`,`col87`(33)), -KEY `idx2` (`col83`,`col42`,`col57`(152)), -KEY `idx3` (`col106`(124)), -KEY `idx4` (`col173`,`col80`,`col165`,`col89`(78)), -KEY `idx5` (`col174`,`col145`(108),`col23`(228),`col141`), -KEY `idx6` (`col157`,`col140`), -KEY `idx7` (`col130`(188),`col15`), -KEY `idx8` (`col52`), -KEY `idx9` (`col144`), -KEY `idx10` (`col155`), -KEY `idx11` (`col62`(230),`col1`(109)), -KEY `idx12` (`col151`(24),`col95`(85)), -KEY `idx13` (`col114`), -KEY `idx14` (`col42`,`col98`(56),`col146`), -KEY `idx15` (`col147`,`col39`(254),`col35`), -KEY `idx16` (`col79`), -KEY `idx17` (`col65`), -KEY `idx18` (`col149`(165),`col168`(119),`col32`,`col117`), -KEY `idx19` (`col64`), -KEY `idx20` (`col93`), -KEY `idx21` (`col64`,`col113`,`col104`(182)), -KEY `idx22` (`col52`,`col111`(189)), -KEY `idx23` (`col45`), -KEY `idx24` (`col154`,`col107`,`col110`(159)), -KEY `idx25` (`col149`(1),`col87`(131)), -KEY `idx26` (`col58`,`col115`,`col63`), -KEY `idx27` (`col95`(9),`col0`,`col87`(113)), -KEY `idx28` (`col92`,`col130`(1)), -KEY `idx29` (`col151`(129),`col137`(254),`col13`), -KEY `idx30` (`col49`), -KEY `idx31` (`col28`), -KEY `idx32` (`col83`,`col146`), -KEY `idx33` (`col155`,`col90`,`col17`(245)), -KEY `idx34` (`col174`,`col169`(44),`col107`), -KEY `idx35` (`col113`), -KEY `idx36` (`col52`), -KEY `idx37` (`col16`,`col120`(190)), -KEY `idx38` (`col28`), -KEY `idx39` (`col131`(165)), -KEY `idx40` (`col135`,`col26`(86)), -KEY `idx41` (`col69`,`col94`), -KEY `idx42` (`col105`,`col151`(38),`col97`), -KEY `idx43` (`col88`), -KEY `idx44` (`col176`(100),`col42`,`col73`(189),`col94`), -KEY `idx45` (`col2`(27),`col27`(116)) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -DROP TABLE IF EXISTS table0; -DROP TABLE IF EXISTS table1; -DROP TABLE IF EXISTS table2; -DROP TABLE IF EXISTS table3; -DROP TABLE IF EXISTS table4; -DROP TABLE IF EXISTS table5; -DROP TABLE IF EXISTS table6; diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug36172.test b/mysql-test/suite/innodb_zip/t/innodb_bug36172.test deleted file mode 100644 index 6d21d656fd8..00000000000 --- a/mysql-test/suite/innodb_zip/t/innodb_bug36172.test +++ /dev/null @@ -1,22 +0,0 @@ ---source include/innodb_page_size_small.inc -# -# Test case for bug 36172 -# - --- source include/not_embedded.inc - -SET storage_engine=InnoDB; - -# we do not really care about what gets printed, we are only -# interested in getting success or failure according to our -# expectations - --- disable_query_log --- disable_result_log - -CREATE TABLE `table0` ( `col0` tinyint(1) DEFAULT NULL, `col1` tinyint(1) DEFAULT NULL, `col2` tinyint(4) DEFAULT NULL, `col3` date DEFAULT NULL, `col4` time DEFAULT NULL, `col5` set('test1','test2','test3') DEFAULT NULL, `col6` time DEFAULT NULL, `col7` text, `col8` decimal(10,0) DEFAULT NULL, `col9` set('test1','test2','test3') DEFAULT NULL, `col10` float DEFAULT NULL, `col11` double DEFAULT NULL, `col12` enum('test1','test2','test3') DEFAULT NULL, `col13` tinyblob, `col14` year(4) DEFAULT NULL, `col15` set('test1','test2','test3') DEFAULT NULL, `col16` decimal(10,0) DEFAULT NULL, `col17` decimal(10,0) DEFAULT NULL, `col18` blob, `col19` datetime DEFAULT NULL, `col20` double DEFAULT NULL, `col21` decimal(10,0) DEFAULT NULL, `col22` datetime DEFAULT NULL, `col23` decimal(10,0) DEFAULT NULL, `col24` decimal(10,0) DEFAULT NULL, `col25` longtext, `col26` tinyblob, `col27` time DEFAULT NULL, `col28` tinyblob, `col29` enum('test1','test2','test3') DEFAULT NULL, `col30` smallint(6) DEFAULT NULL, `col31` double DEFAULT NULL, `col32` float DEFAULT NULL, `col33` char(175) DEFAULT NULL, `col34` tinytext, `col35` tinytext, `col36` tinyblob, `col37` tinyblob, `col38` tinytext, `col39` mediumblob, `col40` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `col41` double DEFAULT NULL, `col42` smallint(6) DEFAULT NULL, `col43` longblob, `col44` varchar(80) DEFAULT NULL, `col45` mediumtext, `col46` decimal(10,0) DEFAULT NULL, `col47` bigint(20) DEFAULT NULL, `col48` date DEFAULT NULL, `col49` tinyblob, `col50` date DEFAULT NULL, `col51` tinyint(1) DEFAULT NULL, `col52` mediumint(9) DEFAULT NULL, `col53` float DEFAULT NULL, `col54` tinyblob, `col55` longtext, `col56` smallint(6) DEFAULT NULL, `col57` enum('test1','test2','test3') DEFAULT NULL, `col58` datetime DEFAULT NULL, `col59` mediumtext, `col60` varchar(232) DEFAULT NULL, `col61` decimal(10,0) DEFAULT NULL, `col62` year(4) DEFAULT NULL, `col63` smallint(6) DEFAULT NULL, `col64` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col65` blob, `col66` longblob, `col67` int(11) DEFAULT NULL, `col68` longtext, `col69` enum('test1','test2','test3') DEFAULT NULL, `col70` int(11) DEFAULT NULL, `col71` time DEFAULT NULL, `col72` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col73` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col74` varchar(170) DEFAULT NULL, `col75` set('test1','test2','test3') DEFAULT NULL, `col76` tinyblob, `col77` bigint(20) DEFAULT NULL, `col78` decimal(10,0) DEFAULT NULL, `col79` datetime DEFAULT NULL, `col80` year(4) DEFAULT NULL, `col81` decimal(10,0) DEFAULT NULL, `col82` longblob, `col83` text, `col84` char(83) DEFAULT NULL, `col85` decimal(10,0) DEFAULT NULL, `col86` float DEFAULT NULL, `col87` int(11) DEFAULT NULL, `col88` varchar(145) DEFAULT NULL, `col89` date DEFAULT NULL, `col90` decimal(10,0) DEFAULT NULL, `col91` decimal(10,0) DEFAULT NULL, `col92` mediumblob, `col93` time DEFAULT NULL, KEY `idx0` (`col69`,`col90`,`col8`), KEY `idx1` (`col60`), KEY `idx2` (`col60`,`col70`,`col74`), KEY `idx3` (`col22`,`col32`,`col72`,`col30`), KEY `idx4` (`col29`), KEY `idx5` (`col19`,`col45`(143)), KEY `idx6` (`col46`,`col48`,`col5`,`col39`(118)), KEY `idx7` (`col48`,`col61`), KEY `idx8` (`col93`), KEY `idx9` (`col31`), KEY `idx10` (`col30`,`col21`), KEY `idx11` (`col67`), KEY `idx12` (`col44`,`col6`,`col8`,`col38`(226)), KEY `idx13` (`col71`,`col41`,`col15`,`col49`(88)), KEY `idx14` (`col78`), KEY `idx15` (`col63`,`col67`,`col64`), KEY `idx16` (`col17`,`col86`), KEY `idx17` (`col77`,`col56`,`col10`,`col55`(24)), KEY `idx18` (`col62`), KEY `idx19` (`col31`,`col57`,`col56`,`col53`), KEY `idx20` (`col46`), KEY `idx21` (`col83`(54)), KEY `idx22` (`col51`,`col7`(120)), KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; -insert ignore into `table0` set `col23` = 7887371.5084383683, `col24` = 4293854615.6906948000, `col25` = 'vitalist', `col26` = 'widespread', `col27` = '3570490', `col28` = 'habitual', `col30` = -5471, `col31` = 4286985783.6771750000, `col32` = 6354540.9826654866, `col33` = 'defoliation', `col34` = 'logarithms', `col35` = 'tegument\'s', `col36` = 'scouting\'s', `col37` = 'intermittency', `col38` = 'elongates', `col39` = 'prophecies', `col40` = '20560103035939', `col41` = 4292809130.0544143000, `col42` = 22057, `col43` = 'Hess\'s', `col44` = 'bandstand', `col45` = 'phenylketonuria', `col46` = 6338767.4018677324, `col47` = 5310247, `col48` = '12592418', `col49` = 'churchman\'s', `col50` = '32226125', `col51` = -58, `col52` = -6207968, `col53` = 1244839.3255104220, `col54` = 'robotized', `col55` = 'monotonous', `col56` = -26909, `col58` = '20720107023550', `col59` = 'suggestiveness\'s', `col60` = 'gemology', `col61` = 4287800670.2229986000, `col62` = '1944', `col63` = -16827, `col64` = '20700107212324', `col65` = 'Nicolais', `col66` = 'apteryx', `col67` = 6935317, `col68` = 'stroganoff', `col70` = 3316430, `col71` = '3277608', `col72` = '19300511045918', `col73` = '20421201003327', `col74` = 'attenuant', `col75` = '15173', `col76` = 'upstroke\'s', `col77` = 8118987, `col78` = 6791516.2735374002, `col79` = '20780701144624', `col80` = '2134', `col81` = 4290682351.3127537000, `col82` = 'unexplainably', `col83` = 'Storm', `col84` = 'Greyso\'s', `col85` = 4289119212.4306774000, `col86` = 7617575.8796655172, `col87` = -6325335, `col88` = 'fondue\'s', `col89` = '40608940', `col90` = 1659421.8093508712, `col91` = 8346904.6584368423, `col92` = 'reloads', `col93` = '5188366'; -CHECK TABLE table0 EXTENDED; -INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.9055146948, `col21` = 4293243420.5621204000, `col22` = '20511211123705', `col23` = 4289899778.6573381000, `col24` = 4293449279.0540481000, `col25` = 'emphysemic', `col26` = 'dentally', `col27` = '2347406', `col28` = 'eruct', `col30` = 1222, `col31` = 4294372994.9941406000, `col32` = 4291385574.1173744000, `col33` = 'borrowing\'s', `col34` = 'septics', `col35` = 'ratter\'s', `col36` = 'Kaye', `col37` = 'Florentia', `col38` = 'allium', `col39` = 'barkeep', `col40` = '19510407003441', `col41` = 4293559200.4215522000, `col42` = 22482, `col43` = 'decussate', `col44` = 'Brom\'s', `col45` = 'violated', `col46` = 4925506.4635456400, `col47` = 930549, `col48` = '51296066', `col49` = 'voluminously', `col50` = '29306676', `col51` = -88, `col52` = -2153690, `col53` = 4290250202.1464887000, `col54` = 'expropriation', `col55` = 'Aberdeen\'s', `col56` = 20343, `col58` = '19640415171532', `col59` = 'extern', `col60` = 'Ubana', `col61` = 4290487961.8539081000, `col62` = '2147', `col63` = -24271, `col64` = '20750801194548', `col65` = 'Cunaxa\'s', `col66` = 'pasticcio', `col67` = 2795817, `col68` = 'Indore\'s', `col70` = 6864127, `col71` = '1817832', `col72` = '20540506114211', `col73` = '20040101012300', `col74` = 'rationalized', `col75` = '45522', `col76` = 'indene', `col77` = -6964559, `col78` = 4247535.5266884370, `col79` = '20720416124357', `col80` = '2143', `col81` = 4292060102.4466386000, `col82` = 'striving', `col83` = 'boneblack\'s', `col84` = 'redolent', `col85` = 6489697.9009369183, `col86` = 4287473465.9731131000, `col87` = 7726015, `col88` = 'perplexed', `col89` = '17153791', `col90` = 5478587.1108127078, `col91` = 4287091404.7004304000, `col92` = 'Boulez\'s', `col93` = '2931278'; -CHECK TABLE table0 EXTENDED; -DROP TABLE table0; diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug52745.test b/mysql-test/suite/innodb_zip/t/innodb_bug52745.test deleted file mode 100644 index b7efd0692ca..00000000000 --- a/mysql-test/suite/innodb_zip/t/innodb_bug52745.test +++ /dev/null @@ -1,100 +0,0 @@ ---source include/innodb_page_size_small.inc - -SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR -CREATE TABLE bug52745 ( - a2 int(10) unsigned DEFAULT NULL, - col37 time DEFAULT NULL, - col38 char(229) CHARACTER SET utf8 DEFAULT NULL, - col39 text, - col40 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - col41 int(10) unsigned DEFAULT NULL, - col42 varchar(248) CHARACTER SET utf8 DEFAULT NULL, - col43 smallint(5) unsigned zerofill DEFAULT NULL, - col44 varchar(150) CHARACTER SET utf8 DEFAULT NULL, - col45 float unsigned zerofill DEFAULT NULL, - col46 binary(1) DEFAULT NULL, - col47 tinyint(4) DEFAULT NULL, - col48 tinyint(1) DEFAULT NULL, - col49 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - col50 binary(1) DEFAULT NULL, - col51 double unsigned zerofill DEFAULT NULL, - col52 int(10) unsigned DEFAULT NULL, - col53 time DEFAULT NULL, - col54 double unsigned DEFAULT NULL, - col55 time DEFAULT NULL, - col56 mediumtext CHARACTER SET latin2, - col57 blob, - col58 decimal(52,16) unsigned zerofill NOT NULL DEFAULT '000000000000000000000000000000000000.0000000000000000', - col59 binary(1) DEFAULT NULL, - col60 longblob, - col61 time DEFAULT NULL, - col62 longtext CHARACTER SET utf8 COLLATE utf8_persian_ci, - col63 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - col64 int(10) unsigned DEFAULT NULL, - col65 date DEFAULT NULL, - col66 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - col67 binary(1) DEFAULT NULL, - col68 tinyblob, - col69 date DEFAULT NULL, - col70 tinyint(3) unsigned zerofill DEFAULT NULL, - col71 varchar(44) CHARACTER SET utf8 DEFAULT NULL, - col72 datetime DEFAULT NULL, - col73 smallint(5) unsigned zerofill DEFAULT NULL, - col74 longblob, - col75 bit(34) DEFAULT NULL, - col76 float unsigned zerofill DEFAULT NULL, - col77 year(2) DEFAULT NULL, - col78 tinyint(3) unsigned DEFAULT NULL, - col79 set('msfheowh','tbpxbgf','by','wahnrjw','myqfasxz','rsokyumrt') CHARACTER SET latin2 DEFAULT NULL, - col80 datetime DEFAULT NULL, - col81 smallint(6) DEFAULT NULL, - col82 enum('xtaurnqfqz','rifrse','kuzwpbvb','niisabk','zxavro','rbvasv','','uulrfaove','','') DEFAULT NULL, - col83 bigint(20) unsigned zerofill DEFAULT NULL, - col84 float unsigned zerofill DEFAULT NULL, - col85 double DEFAULT NULL, - col86 enum('ylannv','','vlkhycqc','snke','cxifustp','xiaxaswzp','oxl') CHARACTER SET latin1 COLLATE latin1_german2_ci DEFAULT NULL, - col87 varbinary(221) DEFAULT NULL, - col88 double unsigned DEFAULT NULL, - col89 float unsigned zerofill DEFAULT NULL, - col90 tinyblob -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -INSERT IGNORE INTO bug52745 SET -col40='0000-00-00 00:00:00', -col51=16547, -col53='7711484', -col54=-28604, -col55='7112612', -col56='wakefulness\'', -col57=repeat('absorbefacient\'',106), -col58=11027, -col59='AM09gW7', -col60=repeat('Noelani\'',16), -col61='2520576', -col62='substitutiv', -col63='19950106155112', -col64=-12038, -col65='86238806', -col66='19600719080256', -col68=repeat('Sagittarius\'',54), -col69='38943902', -col70=1232, -col71='Elora\'', -col74=repeat('zipp',11), -col75='0', -col76=23254, -col78=13247, -col79='56219', -col80='20500609035724', -col81=11632, -col82=7, -col84=-23863, -col85=6341, -col87='HZdkf.4 s7t,5Rmq 8so fmr,ruGLUG25TrtI.yQ 2SuHq0ML7rw7.4 b2yf2E5TJxOtBBZImezDnzpj,uPYfznnEUDN1e9aQoO 2DsplB7TFWy oQJ br HLF :F,eQ p4i1oWsr lL3PG,hjCz6hYqN h1QTjLCjrv:QCdSzpYBibJAtZCxLOk3l6Blsh.W', -col88=16894, -col89=6161, -col90=repeat('gale',48); - -SHOW WARNINGS; - -DROP TABLE bug52745; diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug53591.test b/mysql-test/suite/innodb_zip/t/innodb_bug53591.test deleted file mode 100644 index 0bce587f106..00000000000 --- a/mysql-test/suite/innodb_zip/t/innodb_bug53591.test +++ /dev/null @@ -1,16 +0,0 @@ ---source include/innodb_page_size_small.inc - -SET GLOBAL innodb_strict_mode=on; -set old_alter_table=0; - -CREATE TABLE bug53591(a text charset utf8 not null) -ENGINE=InnoDB KEY_BLOCK_SIZE=1; --- replace_result 8126 {checked_valid} 4030 {checked_valid} 1982 {checked_valid} --- error ER_TOO_BIG_ROWSIZE -ALTER TABLE bug53591 ADD PRIMARY KEY(a(220)); --- replace_result 8126 {checked_valid} 4030 {checked_valid} 1982 {checked_valid} -SHOW WARNINGS; - -DROP TABLE bug53591; - -SET GLOBAL innodb_strict_mode=DEFAULT; diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug56680.test b/mysql-test/suite/innodb_zip/t/innodb_bug56680.test deleted file mode 100644 index 0cb1c897f2e..00000000000 --- a/mysql-test/suite/innodb_zip/t/innodb_bug56680.test +++ /dev/null @@ -1,133 +0,0 @@ ---source include/innodb_page_size_small.inc -# -# Bug #56680 InnoDB may return wrong results from a case-insensitive index -# --- disable_query_log -SET @tx_isolation_orig = @@tx_isolation; -# The flag innodb_change_buffering_debug is only available in debug builds. -# It instructs InnoDB to try to evict pages from the buffer pool when -# change buffering is possible, so that the change buffer will be used -# whenever possible. --- error 0,ER_UNKNOWN_SYSTEM_VARIABLE -SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug; --- error 0,ER_UNKNOWN_SYSTEM_VARIABLE -SET GLOBAL innodb_change_buffering_debug = 1; --- enable_query_log -SET GLOBAL tx_isolation='REPEATABLE-READ'; - -CREATE TABLE bug56680( - a INT AUTO_INCREMENT PRIMARY KEY, - b CHAR(1), - c INT, - INDEX(b)) -ENGINE=InnoDB; - -INSERT INTO bug56680 VALUES(0,'x',1); -BEGIN; -SELECT b FROM bug56680; - -connect (con1,localhost,root,,); -connection con1; -BEGIN; -UPDATE bug56680 SET b='X'; - -connection default; -# This should return the last committed value 'x', but would return 'X' -# due to a bug in row_search_for_mysql(). -SELECT b FROM bug56680; -# This would always return the last committed value 'x'. -SELECT * FROM bug56680; - -connection con1; -ROLLBACK; -disconnect con1; - -connection default; - -SELECT b FROM bug56680; - -# For the rest of this test, use the READ UNCOMMITTED isolation level -# to see what exists in the secondary index. -SET GLOBAL tx_isolation='READ-UNCOMMITTED'; - -# Create enough rows for the table, so that the insert buffer will be -# used for modifying the secondary index page. There must be multiple -# index pages, because changes to the root page are never buffered. - -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; -INSERT INTO bug56680 SELECT 0,b,c FROM bug56680; - -BEGIN; -SELECT b FROM bug56680 LIMIT 2; - -connect (con1,localhost,root,,); -connection con1; -BEGIN; -DELETE FROM bug56680 WHERE a=1; -# This should be buffered, if innodb_change_buffering_debug = 1 is in effect. -INSERT INTO bug56680 VALUES(1,'X',1); - -# This should force an insert buffer merge, and return 'X' in the first row. -SELECT b FROM bug56680 LIMIT 3; - -connection default; -SELECT b FROM bug56680 LIMIT 2; -CHECK TABLE bug56680; - -connection con1; -ROLLBACK; -SELECT b FROM bug56680 LIMIT 2; -CHECK TABLE bug56680; - -connection default; -disconnect con1; - -SELECT b FROM bug56680 LIMIT 2; - -CREATE TABLE bug56680_2( - a INT AUTO_INCREMENT PRIMARY KEY, - b VARCHAR(2) CHARSET latin1 COLLATE latin1_german2_ci, - c INT, - INDEX(b)) -ENGINE=InnoDB; - -INSERT INTO bug56680_2 SELECT 0,_latin1 0xdf,c FROM bug56680; - -BEGIN; -SELECT HEX(b) FROM bug56680_2 LIMIT 2; -DELETE FROM bug56680_2 WHERE a=1; -# This should be buffered, if innodb_change_buffering_debug = 1 is in effect. -INSERT INTO bug56680_2 VALUES(1,'SS',1); - -# This should force an insert buffer merge, and return 'SS' in the first row. -SELECT HEX(b) FROM bug56680_2 LIMIT 3; -CHECK TABLE bug56680_2; - -# Test this with compressed tables. -ALTER TABLE bug56680_2 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -SELECT HEX(b) FROM bug56680_2 LIMIT 2; -DELETE FROM bug56680_2 WHERE a=1; -# This should be buffered, if innodb_change_buffering_debug = 1 is in effect. -INSERT INTO bug56680_2 VALUES(1,_latin1 0xdf,1); - -# This should force an insert buffer merge, and return 0xdf in the first row. -SELECT HEX(b) FROM bug56680_2 LIMIT 3; -CHECK TABLE bug56680_2; - -DROP TABLE bug56680_2; -DROP TABLE bug56680; - --- disable_query_log -SET GLOBAL tx_isolation = @tx_isolation_orig; --- error 0, ER_UNKNOWN_SYSTEM_VARIABLE -SET GLOBAL innodb_change_buffering_debug = @innodb_change_buffering_debug_orig; diff --git a/mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table-master.opt b/mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table-master.opt deleted file mode 100644 index a9a3d8c3db8..00000000000 --- a/mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-buffer-pool-size=8M diff --git a/mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table.test b/mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table.test deleted file mode 100644 index 35e4b2c6bf3..00000000000 --- a/mysql-test/suite/innodb_zip/t/innodb_cmp_drop_table.test +++ /dev/null @@ -1,63 +0,0 @@ ---source include/have_innodb.inc - -# lazy evition might not be lazy enough when key rotation -# scans through pages --- source include/not_encrypted.inc - -let $per_table=`select @@innodb_file_per_table`; -let $format=`select @@innodb_file_format`; - --- let $query_i_s = SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0 - -set global innodb_file_per_table=on; -set global innodb_file_format=`1`; - -create table t1(a text) engine=innodb key_block_size=8; - --- disable_query_log - -# insert some rows so we are using compressed pages --- let $i = 10 -while ($i) -{ - insert into t1 values(repeat('abcdefghijklmnopqrstuvwxyz',100)); - dec $i; -} --- enable_query_log - -# we should be using some 8K pages --- eval $query_i_s - -drop table t1; - -# because of lazy eviction at drop table in 5.5 there should be some -# used 8K pages --- eval $query_i_s - -# create a non-compressed table and insert enough into it to evict -# compressed pages -create table t2(a text) engine=innodb; - --- disable_query_log - --- let $i = 400 -while ($i) -{ - insert into t2 values(repeat('abcdefghijklmnopqrstuvwxyz',1000)); - dec $i; -} - --- enable_query_log - -# now there should be no 8K pages in the buffer pool --- eval $query_i_s - -drop table t2; - -# -# restore environment to the state it was before this test execution -# - --- disable_query_log -eval set global innodb_file_format=$format; -eval set global innodb_file_per_table=$per_table; diff --git a/mysql-test/suite/innodb_zip/t/innodb_index_large_prefix.test b/mysql-test/suite/innodb_zip/t/innodb_index_large_prefix.test deleted file mode 100644 index d071e3833e9..00000000000 --- a/mysql-test/suite/innodb_zip/t/innodb_index_large_prefix.test +++ /dev/null @@ -1,434 +0,0 @@ -# Testcase for worklog #5743: Lift the limit of index key prefixes - ---source include/have_innodb.inc ---source include/have_innodb_16k.inc -SET default_storage_engine=InnoDB; - -call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page."); - -let $innodb_large_prefix_orig=`select @@innodb_large_prefix`; - -set global innodb_large_prefix=1; -set global innodb_strict_mode=1; - --- echo ### Test 1 ### -# Create a table of DYNAMIC format, with a primary index of 1000 bytes in -# size -create table worklog5743(a TEXT not null, primary key (a(1000))) ROW_FORMAT=DYNAMIC; -show warnings; - -# Do some insertion and update to excercise the external cache -# code path -insert into worklog5743 values(repeat("a", 20000)); - -# default session, update the table -update worklog5743 set a = (repeat("b", 16000)); - -# Create a secondary index -create index idx on worklog5743(a(2000)); -show warnings; - -# Start a few sessions to do selections on table being updated in default -# session, so it would rebuild the previous version from undo log. -# 1) Default session: Initiate an update on the externally stored column -# 2) Session con1: Select from table with repeated read -# 3) Session con2: Select from table with read uncommitted -# 4) Default session: rollback updates - -begin; -update worklog5743 set a = (repeat("x", 17000)); - -# Start a new session to select the column to force it build -# an earlier version of the clustered index through undo log. So it should -# just see the result of repeat("b", 16000) -select @@session.tx_isolation; ---connect (con1,localhost,root,,) -select a = repeat("x", 17000) from worklog5743; -select a = repeat("b", 16000) from worklog5743; - -# Start another session doing "read uncommitted" query, it -# should see the uncommitted update ---connect (con2,localhost,root,,) -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -select a = repeat("x", 17000) from worklog5743; - -# Roll back the transaction ---connection default -rollback; - -drop table worklog5743; - --- echo ### Test 2 ### -# Create a table with only a secondary index has large prefix column -create table worklog5743(a1 int, a2 TEXT not null) ROW_FORMAT=DYNAMIC; -show warnings; -create index idx on worklog5743(a1, a2(2000)); -show warnings; - -insert into worklog5743 values(9, repeat("a", 10000)); - -begin; - -update worklog5743 set a1 = 1000; - -# Do a select from another connection that would use the secondary index ---connection con1 -select @@session.tx_isolation; -explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; -select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; - -# Do read uncommitted in another session, it would show there is no -# row with a1 = 9 ---connection con2 -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; - ---connection default -rollback; - -drop table worklog5743; - --- echo ### Test 3 ### -# Create a table with a secondary index has small (50 bytes) prefix column -create table worklog5743(a1 int, a2 TEXT not null) ROW_FORMAT=DYNAMIC; - -create index idx on worklog5743(a1, a2(50)); - -insert into worklog5743 values(9, repeat("a", 10000)); - -begin; - -update worklog5743 set a1 = 1000; - -# Do a select from another connection that would use the secondary index ---connection con1 -select @@session.tx_isolation; -explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; -select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; - -# Do read uncommitted in another session, it would show there is no -# row with a1 = 9 ---connection con2 -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; - ---connection default -rollback; - -drop table worklog5743; - --- echo ### Test 4 ### -# Create compressed tables with each KEY_BLOCK_SIZE. -create table worklog5743_1(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=1; -create table worklog5743_2(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=2; -create table worklog5743_4(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=4; -create table worklog5743_8(a1 int, a2 TEXT, a3 TEXT) KEY_BLOCK_SIZE=8; -create table worklog5743_16(a1 int, a2 TEXT, a3 TEXT) KEY_BLOCK_SIZE=16; - -# The maximum overall index record (not prefix) length of a -# compressed table is dependent on innodb-page-size (IPS), -# key_block_size (KBS) and the number of fields (NF). -# "Too big row" error (HA_ERR_TO_BIG_ROW) will be returned if this -# limit is exceeded. -# See page_zip_empty_size() and Bug #47495 for more detail. - -# Test edge cases for indexes using key_block_size=1 -set sql_mode=''; -set global innodb_large_prefix=0; --- error ER_TOO_BIG_ROWSIZE -create index idx1 on worklog5743_1(a2(4000)); -show warnings; -set global innodb_large_prefix=1; --- error ER_TOO_BIG_ROWSIZE -create index idx2 on worklog5743_1(a2(4000)); -show warnings; --- error ER_TOO_BIG_ROWSIZE -create index idx3 on worklog5743_1(a2(436)); -show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx4 on worklog5743_1(a2(434)); -show warnings; --- error ER_TOO_BIG_ROWSIZE -create index idx5 on worklog5743_1(a1, a2(430)); -show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx6 on worklog5743_1(a1, a2(428)); -show warnings; - -# Test edge cases for indexes using key_block_size=2 -set global innodb_large_prefix=0; -create index idx1 on worklog5743_2(a2(4000)); -show warnings; -set global innodb_large_prefix=1; --- error ER_TOO_BIG_ROWSIZE -create index idx2 on worklog5743_2(a2(4000)); -show warnings; --- error ER_TOO_BIG_ROWSIZE -create index idx3 on worklog5743_2(a2(948)); -show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx4 on worklog5743_2(a2(946)); -show warnings; --- error ER_TOO_BIG_ROWSIZE -create index idx5 on worklog5743_2(a1, a2(942)); -show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx6 on worklog5743_2(a1, a2(940)); -show warnings; - -# Test edge cases for indexes using key_block_size=4 -set global innodb_large_prefix=0; -create index idx1 on worklog5743_4(a2(4000)); -show warnings; -set global innodb_large_prefix=1; --- error ER_TOO_BIG_ROWSIZE -create index idx2 on worklog5743_4(a2(4000)); -show warnings; --- error ER_TOO_BIG_ROWSIZE -create index idx3 on worklog5743_4(a2(1972)); -show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx4 on worklog5743_4(a2(1970)); -show warnings; --- error ER_TOO_BIG_ROWSIZE -create index idx5 on worklog5743_4(a1, a2(1966)); -show warnings; -# Bug#13391353 Limit is one byte less on on 32bit-Linux only -create index idx6 on worklog5743_4(a1, a2(1964)); -show warnings; - -# Test edge cases for indexes using key_block_size=8 -set global innodb_large_prefix=0; -create index idx1 on worklog5743_8(a2(1000)); -show warnings; -set global innodb_large_prefix=1; -create index idx2 on worklog5743_8(a2(3073)); -show warnings; -create index idx3 on worklog5743_8(a2(3072)); -show warnings; --- error ER_TOO_LONG_KEY -create index idx4 on worklog5743_8(a1, a2(3069)); -show warnings; -create index idx5 on worklog5743_8(a1, a2(3068)); -show warnings; --- error ER_TOO_LONG_KEY -create index idx6 on worklog5743_8(a1, a2(2000), a3(1069)); -show warnings; -create index idx7 on worklog5743_8(a1, a2(2000), a3(1068)); -show warnings; - -# Test edge cases for indexes using key_block_size=16 -set global innodb_large_prefix=0; -create index idx1 on worklog5743_16(a2(1000)); -show warnings; -set global innodb_large_prefix=1; -create index idx2 on worklog5743_16(a2(3073)); -show warnings; -create index idx3 on worklog5743_16(a2(3072)); -show warnings; --- error ER_TOO_LONG_KEY -create index idx4 on worklog5743_16(a1, a2(3069)); -show warnings; -create index idx5 on worklog5743_16(a1, a2(3068)); -show warnings; --- error ER_TOO_LONG_KEY -create index idx6 on worklog5743_16(a1, a2(2000), a3(1069)); -show warnings; -create index idx7 on worklog5743_16(a1, a2(2000), a3(1068)); -show warnings; -set sql_mode=default; - -# Insert a large record into each of these tables. -insert into worklog5743_1 values(9, repeat("a", 10000)); -insert into worklog5743_2 values(9, repeat("a", 10000)); -insert into worklog5743_4 values(9, repeat("a", 10000)); -insert into worklog5743_8 values(9, repeat("a", 10000), repeat("a", 10000)); -insert into worklog5743_16 values(9, repeat("a", 10000), repeat("a", 10000)); - -# Now if we change the global innodb_large_prefix back to 767, -# updates to these indexes should still be allowed. -set global innodb_large_prefix=0; -insert into worklog5743_1 values(2, repeat("b", 10000)); -insert into worklog5743_2 values(2, repeat("b", 10000)); -insert into worklog5743_4 values(2, repeat("b", 10000)); -insert into worklog5743_8 values(2, repeat("b", 10000), repeat("b", 10000)); -insert into worklog5743_16 values(2, repeat("b", 10000), repeat("b", 10000)); -set global innodb_large_prefix=1; - -select a1, left(a2, 20) from worklog5743_1; -select a1, left(a2, 20) from worklog5743_2; -select a1, left(a2, 20) from worklog5743_4; -select a1, left(a2, 20) from worklog5743_8; -select a1, left(a2, 20) from worklog5743_16; - -begin; - -update worklog5743_1 set a1 = 1000; -update worklog5743_2 set a1 = 1000; -update worklog5743_4 set a1 = 1000; -update worklog5743_8 set a1 = 1000; -update worklog5743_16 set a1 = 1000; -select a1, left(a2, 20) from worklog5743_1; -select a1, left(a2, 20) from worklog5743_2; -select a1, left(a2, 20) from worklog5743_4; -select a1, left(a2, 20) from worklog5743_8; -select a1, left(a2, 20) from worklog5743_16; - - -# Do a select from another connection that would use the secondary index ---connection con1 -select @@session.tx_isolation; -explain select a1, left(a2, 20) from worklog5743_1 where a1 = 9; -explain select a1, left(a2, 20) from worklog5743_2 where a1 = 9; -explain select a1, left(a2, 20) from worklog5743_4 where a1 = 9; -explain select a1, left(a2, 20) from worklog5743_8 where a1 = 9; -explain select a1, left(a2, 20) from worklog5743_16 where a1 = 9; -select a1, left(a2, 20) from worklog5743_1 where a1 = 9; -select a1, left(a2, 20) from worklog5743_2 where a1 = 9; -select a1, left(a2, 20) from worklog5743_4 where a1 = 9; -select a1, left(a2, 20) from worklog5743_8 where a1 = 9; -select a1, left(a2, 20) from worklog5743_16 where a1 = 9; - -# Do read uncommitted in another session, it would show there is no -# row with a1 = 9 ---connection con2 -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -select a1, left(a2, 20) from worklog5743_1 where a1 = 9; -select a1, left(a2, 20) from worklog5743_2 where a1 = 9; -select a1, left(a2, 20) from worklog5743_4 where a1 = 9; -select a1, left(a2, 20) from worklog5743_8 where a1 = 9; -select a1, left(a2, 20) from worklog5743_16 where a1 = 9; - ---connection default -rollback; - -drop table worklog5743_1; -drop table worklog5743_2; -drop table worklog5743_4; -drop table worklog5743_8; -drop table worklog5743_16; - --- echo ### Test 5 ### -# Create a table with large varchar columns and create indexes -# directly on these large columns to show that prefix limit is -# automatically applied and to show that limit. -create table worklog5743(a1 int, - a2 varchar(20000), - a3 varchar(3073), - a4 varchar(3072), - a5 varchar(3069), - a6 varchar(3068)) - ROW_FORMAT=DYNAMIC; -set sql_mode=''; -create index idx1 on worklog5743(a2); -create index idx2 on worklog5743(a3); -create index idx3 on worklog5743(a4); -show warnings; --- error ER_TOO_LONG_KEY -create index idx4 on worklog5743(a1, a2); -show warnings; --- error ER_TOO_LONG_KEY -create index idx5 on worklog5743(a1, a5); -show warnings; -create index idx6 on worklog5743(a1, a6); -show warnings; -show create table worklog5743; -set sql_mode=default; - -insert into worklog5743 values(9, - repeat("a", 20000), repeat("a", 3073), - repeat("a", 3072), repeat("a", 3069), - repeat("a", 3068)); - -begin; - -update worklog5743 set a1 = 1000; - -# Do a select from another connection that would use the secondary index ---connection con1 -select @@session.tx_isolation; -explain select a1 from worklog5743 where a1 = 9; -select a1 from worklog5743 where a1 = 9; - -# Do read uncommitted, it would show there is no row with a1 = 9 ---connection con2 -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -select a1 from worklog5743 where a1 = 9; - ---connection default -rollback; - -drop table worklog5743; - --- echo ### Test 6 ### -# Create a table with old format, and the limit is 768 bytes. --- error ER_INDEX_COLUMN_TOO_LONG -create table worklog5743(a TEXT not null, primary key (a(1000))) row_format=COMPACT; - -create table worklog5743(a TEXT) row_format=COMPACT; - -# Excercise the column length check in ha_innobase::add_index() --- error ER_INDEX_COLUMN_TOO_LONG -create index idx on worklog5743(a(768)); - -# This should be successful -create index idx on worklog5743(a(767)); - -# Perform some DMLs -insert into worklog5743 values(repeat("a", 20000)); - -begin; -insert into worklog5743 values(repeat("b", 20000)); -update worklog5743 set a = (repeat("x", 25000)); - -# Start a new session to select the table to force it build -# an earlier version of the cluster index through undo log -select @@session.tx_isolation; ---connection con1 -select a = repeat("a", 20000) from worklog5743; ---disconnect con1 - ---connection con2 -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -select @@session.tx_isolation; -select a = repeat("x", 25000) from worklog5743; ---disconnect con2 - ---connection default -rollback; - -drop table worklog5743; - --- echo ### Test 7 ### -# Some border line tests on the column length. -# We have a limit of 3072 bytes for Barracuda table -create table worklog5743(a TEXT not null) ROW_FORMAT=DYNAMIC; - -# Length exceeds maximum supported key length -# It will be auto-truncated to 3072 -set statement sql_mode = '' for -create index idx1 on worklog5743(a(3073)); -create index idx2 on worklog5743(a(3072)); -show create table worklog5743; -drop table worklog5743; - -# We have a limit of 767 bytes for Antelope tables -create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT; --- error ER_INDEX_COLUMN_TOO_LONG -create index idx on worklog5743(a(768)); -create index idx2 on worklog5743(a(767)); -drop table worklog5743; - -create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT; --- error ER_INDEX_COLUMN_TOO_LONG -create index idx on worklog5743(a(768)); -create index idx2 on worklog5743(a(767)); -drop table worklog5743; - -eval SET GLOBAL innodb_large_prefix=$innodb_large_prefix_orig; -SET GLOBAL innodb_strict_mode = DEFAULT; From ebe4c65e1da711ead126e1f2619dc60ba6774ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Jun 2017 18:43:48 +0300 Subject: [PATCH 32/53] Enable more variants of some innodb_zip tests --- .../suite/innodb_zip/r/cmp_drop_table.result | 6 +++--- mysql-test/suite/innodb_zip/t/bug36172.test | 17 +++++++---------- .../suite/innodb_zip/t/cmp_drop_table.test | 16 +++++++++------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/innodb_zip/r/cmp_drop_table.result b/mysql-test/suite/innodb_zip/r/cmp_drop_table.result index c1743cac2e1..e1f63268d0b 100644 --- a/mysql-test/suite/innodb_zip/r/cmp_drop_table.result +++ b/mysql-test/suite/innodb_zip/r/cmp_drop_table.result @@ -1,12 +1,12 @@ set global innodb_file_per_table=on; -create table t1(a text) engine=innodb key_block_size=8; +create table t1(a text) engine=innodb key_block_size=4; SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0; page_size -8192 +4096 drop table t1; SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0; page_size -8192 +4096 create table t2(a text) engine=innodb; SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0; page_size diff --git a/mysql-test/suite/innodb_zip/t/bug36172.test b/mysql-test/suite/innodb_zip/t/bug36172.test index 49590f40192..1f6533d07bf 100644 --- a/mysql-test/suite/innodb_zip/t/bug36172.test +++ b/mysql-test/suite/innodb_zip/t/bug36172.test @@ -1,12 +1,12 @@ +--source include/innodb_page_size_small.inc # # Test case for bug 36172 # --- source include/not_embedded.inc --- source include/have_innodb.inc --- source include/have_innodb_16k.inc +set @file_per_table=@@global.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=on; -SET default_storage_engine=InnoDB; +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; # we do not really care about what gets printed, we are only # interested in getting success or failure according to our @@ -15,11 +15,6 @@ SET default_storage_engine=InnoDB; -- disable_query_log -- disable_result_log -let $file_per_table=`select @@innodb_file_per_table`; -SET GLOBAL innodb_file_per_table=on; - -DROP TABLE IF EXISTS `table0`; -SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; CREATE TABLE `table0` ( `col0` tinyint(1) DEFAULT NULL, `col1` tinyint(1) DEFAULT NULL, `col2` tinyint(4) DEFAULT NULL, `col3` date DEFAULT NULL, `col4` time DEFAULT NULL, `col5` set('test1','test2','test3') DEFAULT NULL, `col6` time DEFAULT NULL, `col7` text, `col8` decimal(10,0) DEFAULT NULL, `col9` set('test1','test2','test3') DEFAULT NULL, `col10` float DEFAULT NULL, `col11` double DEFAULT NULL, `col12` enum('test1','test2','test3') DEFAULT NULL, `col13` tinyblob, `col14` year(4) DEFAULT NULL, `col15` set('test1','test2','test3') DEFAULT NULL, `col16` decimal(10,0) DEFAULT NULL, `col17` decimal(10,0) DEFAULT NULL, `col18` blob, `col19` datetime DEFAULT NULL, `col20` double DEFAULT NULL, `col21` decimal(10,0) DEFAULT NULL, `col22` datetime DEFAULT NULL, `col23` decimal(10,0) DEFAULT NULL, `col24` decimal(10,0) DEFAULT NULL, `col25` longtext, `col26` tinyblob, `col27` time DEFAULT NULL, `col28` tinyblob, `col29` enum('test1','test2','test3') DEFAULT NULL, `col30` smallint(6) DEFAULT NULL, `col31` double DEFAULT NULL, `col32` float DEFAULT NULL, `col33` char(175) DEFAULT NULL, `col34` tinytext, `col35` tinytext, `col36` tinyblob, `col37` tinyblob, `col38` tinytext, `col39` mediumblob, `col40` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `col41` double DEFAULT NULL, `col42` smallint(6) DEFAULT NULL, `col43` longblob, `col44` varchar(80) DEFAULT NULL, `col45` mediumtext, `col46` decimal(10,0) DEFAULT NULL, `col47` bigint(20) DEFAULT NULL, `col48` date DEFAULT NULL, `col49` tinyblob, `col50` date DEFAULT NULL, `col51` tinyint(1) DEFAULT NULL, `col52` mediumint(9) DEFAULT NULL, `col53` float DEFAULT NULL, `col54` tinyblob, `col55` longtext, `col56` smallint(6) DEFAULT NULL, `col57` enum('test1','test2','test3') DEFAULT NULL, `col58` datetime DEFAULT NULL, `col59` mediumtext, `col60` varchar(232) DEFAULT NULL, `col61` decimal(10,0) DEFAULT NULL, `col62` year(4) DEFAULT NULL, `col63` smallint(6) DEFAULT NULL, `col64` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col65` blob, `col66` longblob, `col67` int(11) DEFAULT NULL, `col68` longtext, `col69` enum('test1','test2','test3') DEFAULT NULL, `col70` int(11) DEFAULT NULL, `col71` time DEFAULT NULL, `col72` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col73` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col74` varchar(170) DEFAULT NULL, `col75` set('test1','test2','test3') DEFAULT NULL, `col76` tinyblob, `col77` bigint(20) DEFAULT NULL, `col78` decimal(10,0) DEFAULT NULL, `col79` datetime DEFAULT NULL, `col80` year(4) DEFAULT NULL, `col81` decimal(10,0) DEFAULT NULL, `col82` longblob, `col83` text, `col84` char(83) DEFAULT NULL, `col85` decimal(10,0) DEFAULT NULL, `col86` float DEFAULT NULL, `col87` int(11) DEFAULT NULL, `col88` varchar(145) DEFAULT NULL, `col89` date DEFAULT NULL, `col90` decimal(10,0) DEFAULT NULL, `col91` decimal(10,0) DEFAULT NULL, `col92` mediumblob, `col93` time DEFAULT NULL, KEY `idx0` (`col69`,`col90`,`col8`), KEY `idx1` (`col60`), KEY `idx2` (`col60`,`col70`,`col74`), KEY `idx3` (`col22`,`col32`,`col72`,`col30`), KEY `idx4` (`col29`), KEY `idx5` (`col19`,`col45`(143)), KEY `idx6` (`col46`,`col48`,`col5`,`col39`(118)), KEY `idx7` (`col48`,`col61`), KEY `idx8` (`col93`), KEY `idx9` (`col31`), KEY `idx10` (`col30`,`col21`), KEY `idx11` (`col67`), KEY `idx12` (`col44`,`col6`,`col8`,`col38`(226)), KEY `idx13` (`col71`,`col41`,`col15`,`col49`(88)), KEY `idx14` (`col78`), KEY `idx15` (`col63`,`col67`,`col64`), KEY `idx16` (`col17`,`col86`), KEY `idx17` (`col77`,`col56`,`col10`,`col55`(24)), KEY `idx18` (`col62`), KEY `idx19` (`col31`,`col57`,`col56`,`col53`), KEY `idx20` (`col46`), KEY `idx21` (`col83`(54)), KEY `idx22` (`col51`,`col7`(120)), KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; SET sql_mode = default; insert ignore into `table0` set `col23` = 7887371.5084383683, `col24` = 4293854615.6906948000, `col25` = 'vitalist', `col26` = 'widespread', `col27` = '3570490', `col28` = 'habitual', `col30` = -5471, `col31` = 4286985783.6771750000, `col32` = 6354540.9826654866, `col33` = 'defoliation', `col34` = 'logarithms', `col35` = 'tegument\'s', `col36` = 'scouting\'s', `col37` = 'intermittency', `col38` = 'elongates', `col39` = 'prophecies', `col40` = '20560103035939', `col41` = 4292809130.0544143000, `col42` = 22057, `col43` = 'Hess\'s', `col44` = 'bandstand', `col45` = 'phenylketonuria', `col46` = 6338767.4018677324, `col47` = 5310247, `col48` = '12592418', `col49` = 'churchman\'s', `col50` = '32226125', `col51` = -58, `col52` = -6207968, `col53` = 1244839.3255104220, `col54` = 'robotized', `col55` = 'monotonous', `col56` = -26909, `col58` = '20720107023550', `col59` = 'suggestiveness\'s', `col60` = 'gemology', `col61` = 4287800670.2229986000, `col62` = '1944', `col63` = -16827, `col64` = '20700107212324', `col65` = 'Nicolais', `col66` = 'apteryx', `col67` = 6935317, `col68` = 'stroganoff', `col70` = 3316430, `col71` = '3277608', `col72` = '19300511045918', `col73` = '20421201003327', `col74` = 'attenuant', `col75` = '15173', `col76` = 'upstroke\'s', `col77` = 8118987, `col78` = 6791516.2735374002, `col79` = '20780701144624', `col80` = '2134', `col81` = 4290682351.3127537000, `col82` = 'unexplainably', `col83` = 'Storm', `col84` = 'Greyso\'s', `col85` = 4289119212.4306774000, `col86` = 7617575.8796655172, `col87` = -6325335, `col88` = 'fondue\'s', `col89` = '40608940', `col90` = 1659421.8093508712, `col91` = 8346904.6584368423, `col92` = 'reloads', `col93` = '5188366'; @@ -27,4 +22,6 @@ CHECK TABLE table0 EXTENDED; INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.9055146948, `col21` = 4293243420.5621204000, `col22` = '20511211123705', `col23` = 4289899778.6573381000, `col24` = 4293449279.0540481000, `col25` = 'emphysemic', `col26` = 'dentally', `col27` = '2347406', `col28` = 'eruct', `col30` = 1222, `col31` = 4294372994.9941406000, `col32` = 4291385574.1173744000, `col33` = 'borrowing\'s', `col34` = 'septics', `col35` = 'ratter\'s', `col36` = 'Kaye', `col37` = 'Florentia', `col38` = 'allium', `col39` = 'barkeep', `col40` = '19510407003441', `col41` = 4293559200.4215522000, `col42` = 22482, `col43` = 'decussate', `col44` = 'Brom\'s', `col45` = 'violated', `col46` = 4925506.4635456400, `col47` = 930549, `col48` = '51296066', `col49` = 'voluminously', `col50` = '29306676', `col51` = -88, `col52` = -2153690, `col53` = 4290250202.1464887000, `col54` = 'expropriation', `col55` = 'Aberdeen\'s', `col56` = 20343, `col58` = '19640415171532', `col59` = 'extern', `col60` = 'Ubana', `col61` = 4290487961.8539081000, `col62` = '2147', `col63` = -24271, `col64` = '20750801194548', `col65` = 'Cunaxa\'s', `col66` = 'pasticcio', `col67` = 2795817, `col68` = 'Indore\'s', `col70` = 6864127, `col71` = '1817832', `col72` = '20540506114211', `col73` = '20040101012300', `col74` = 'rationalized', `col75` = '45522', `col76` = 'indene', `col77` = -6964559, `col78` = 4247535.5266884370, `col79` = '20720416124357', `col80` = '2143', `col81` = 4292060102.4466386000, `col82` = 'striving', `col83` = 'boneblack\'s', `col84` = 'redolent', `col85` = 6489697.9009369183, `col86` = 4287473465.9731131000, `col87` = 7726015, `col88` = 'perplexed', `col89` = '17153791', `col90` = 5478587.1108127078, `col91` = 4287091404.7004304000, `col92` = 'Boulez\'s', `col93` = '2931278'; CHECK TABLE table0 EXTENDED; DROP TABLE table0; -EVAL SET GLOBAL innodb_file_per_table=$file_per_table; +-- enable_query_log +-- enable_result_log +SET GLOBAL innodb_file_per_table=@file_per_table; diff --git a/mysql-test/suite/innodb_zip/t/cmp_drop_table.test b/mysql-test/suite/innodb_zip/t/cmp_drop_table.test index 145f55bb160..ae6bfd9fb59 100644 --- a/mysql-test/suite/innodb_zip/t/cmp_drop_table.test +++ b/mysql-test/suite/innodb_zip/t/cmp_drop_table.test @@ -1,13 +1,15 @@ --- source include/have_innodb.inc --- source include/have_innodb_16k.inc +-- source include/innodb_page_size_small.inc +# lazy eviction might not be lazy enough when key rotation +# scans through pages +-- source include/not_encrypted.inc let $per_table=`select @@innodb_file_per_table`; -- let $query_i_s = SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0 set global innodb_file_per_table=on; - -create table t1(a text) engine=innodb key_block_size=8; + +create table t1(a text) engine=innodb key_block_size=4; -- disable_query_log @@ -20,13 +22,13 @@ while ($i) } -- enable_query_log -# we should be using some 8K pages +# we should be using some 4K pages -- eval $query_i_s drop table t1; # because of lazy eviction at drop table there should still be some -# used 8K pages +# used 4K pages -- eval $query_i_s # create a non-compressed table and insert enough into it to evict @@ -44,7 +46,7 @@ while ($i) -- enable_query_log -# now there should be no 8K pages in the buffer pool +# now there should be no 4K pages in the buffer pool -- eval $query_i_s drop table t2; From e16425ba97563650e0f627eb108a61df84759106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Jun 2017 18:50:30 +0300 Subject: [PATCH 33/53] Fix a compiler warning --- storage/innobase/handler/ha_innodb.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 56465ae1257..14b1cb477f4 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -13027,8 +13027,6 @@ create_table_info_t::set_tablespace_type( int create_table_info_t::initialize() { - trx_t* parent_trx; - DBUG_ENTER("create_table_info_t::initialize"); ut_ad(m_thd != NULL); @@ -13050,7 +13048,7 @@ create_table_info_t::initialize() /* Get the transaction associated with the current thd, or create one if not yet created */ - parent_trx = check_trx_exists(m_thd); + check_trx_exists(m_thd); DBUG_RETURN(0); } From 9f484b63f1b61e6ade1481cfb8465f8fe208386d Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 7 Jun 2017 17:17:51 +0300 Subject: [PATCH 34/53] Clean up replication check in open_temporary_table() --- sql/temporary_tables.cc | 46 ++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc index c05fc632a94..174d1b6e184 100644 --- a/sql/temporary_tables.cc +++ b/sql/temporary_tables.cc @@ -320,16 +320,6 @@ bool THD::open_temporary_table(TABLE_LIST *tl) TMP_TABLE_SHARE *share; TABLE *table= NULL; - /* - Since temporary tables are not safe for parallel replication, lets - wait for the prior commits in case the table is found to be in use. - */ - if (rgi_slave && - rgi_slave->is_parallel_exec && - find_temporary_table(tl) && - wait_for_prior_commit()) - DBUG_RETURN(true); - /* Code in open_table() assumes that TABLE_LIST::table can be non-zero only for pre-opened temporary tables. @@ -350,6 +340,22 @@ bool THD::open_temporary_table(TABLE_LIST *tl) DBUG_RETURN(false); } + /* + Temporary tables are not safe for parallel replication. They were + designed to be visible to one thread only, so have no table locking. + Thus there is no protection against two conflicting transactions + committing in parallel and things like that. + + So for now, anything that uses temporary tables will be serialised + with anything before it, when using parallel replication. + */ + + if (rgi_slave && + rgi_slave->is_parallel_exec && + find_temporary_table(tl) && + wait_for_prior_commit()) + DBUG_RETURN(true); + /* First check if there is a reusable open table available in the open table list. @@ -378,26 +384,6 @@ bool THD::open_temporary_table(TABLE_LIST *tl) DBUG_RETURN(false); } - /* - Temporary tables are not safe for parallel replication. They were - designed to be visible to one thread only, so have no table locking. - Thus there is no protection against two conflicting transactions - committing in parallel and things like that. - - So for now, anything that uses temporary tables will be serialised - with anything before it, when using parallel replication. - - TODO: We might be able to introduce a reference count or something - on temp tables, and have slave worker threads wait for it to reach - zero before being allowed to use the temp table. Might not be worth - it though, as statement-based replication using temporary tables is - in any case rather fragile. - */ - if (rgi_slave && - rgi_slave->is_parallel_exec && - wait_for_prior_commit()) - DBUG_RETURN(true); - #ifdef WITH_PARTITION_STORAGE_ENGINE if (tl->partition_names) { From dd8474b1dc556d0ea9491d1908a2d1237818e8c1 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 30 Jun 2017 17:56:58 +0300 Subject: [PATCH 35/53] Added tmp_disk_table_size to limit size of Aria temp tables in tmpdir - Added variable tmp_disk_table_size - Added variable tmp_memory_table_size as an alias for tmp_table_size - Changed internal variable tmp_table_size to tmp_memory_table_size - create_info.data_file_length is now set with tmp_disk_table_size - Fixed that Aria doesn't reset max_data_file_length for internal tables - Added status flag if table is full so that we can detect this on next insert. This ensures that the table is always 'correct', but we get the error one row after the row that grow the table too big. - Removed some mutex lock for internal temporary tables --- mysql-test/r/mysqld--help.result | 14 +- .../r/sysvars_server_notembedded.result | 30 ++- .../r/tmp_disk_table_size_basic.result | 146 ++++++++++++ .../r/tmp_disk_table_size_func.result | 25 +++ .../r/tmp_memory_table_size_basic.result | 165 ++++++++++++++ .../sys_vars/t/tmp_disk_table_size_basic.test | 207 +++++++++++++++++ .../sys_vars/t/tmp_disk_table_size_func.test | 26 +++ .../t/tmp_memory_table_size_basic.test | 209 ++++++++++++++++++ sql/item_sum.cc | 4 +- sql/opt_subselect.cc | 8 +- sql/sql_class.h | 3 +- sql/sql_select.cc | 19 +- sql/sys_vars.cc | 22 +- storage/maria/ma_create.c | 10 +- storage/maria/ma_open.c | 10 +- storage/maria/ma_state.c | 11 +- storage/maria/ma_write.c | 7 +- storage/maria/maria_def.h | 1 + 18 files changed, 882 insertions(+), 35 deletions(-) create mode 100644 mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result create mode 100644 mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result create mode 100644 mysql-test/suite/sys_vars/r/tmp_memory_table_size_basic.result create mode 100644 mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test create mode 100644 mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test create mode 100644 mysql-test/suite/sys_vars/t/tmp_memory_table_size_basic.test diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 24827da53be..bc4c96ed26f 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1146,9 +1146,17 @@ The following options may be given as the first argument: --time-format=name The TIME format (ignored) --timed-mutexes Specify whether to time mutexes. Deprecated, has no effect. - --tmp-table-size=# If an internal in-memory temporary table exceeds this + --tmp-disk-table-size=# + Max size for data for an internal temporary on-disk + MyISAM or Aria table. + --tmp-memory-table-size=# + If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk - MyISAM or Aria table + MyISAM or Aria table. Same as tmp_table_size. + --tmp-table-size=# Alias for tmp_memory_table_size. If an internal in-memory + temporary table exceeds this size, MySQL will + automatically convert it to an on-disk MyISAM or Aria + table. -t, --tmpdir=name Path for temporary files. Several paths may be specified, separated by a colon (:), in this case they are used in a round-robin fashion @@ -1499,6 +1507,8 @@ thread-pool-stall-limit 500 thread-stack 299008 time-format %H:%i:%s timed-mutexes FALSE +tmp-disk-table-size 18446744073709551615 +tmp-memory-table-size 16777216 tmp-table-size 16777216 transaction-alloc-block-size 8192 transaction-isolation REPEATABLE-READ diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 8b062075db8..6e36a67b96a 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -4951,6 +4951,34 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME TMP_DISK_TABLE_SIZE +SESSION_VALUE 18446744073709551615 +GLOBAL_VALUE 18446744073709551615 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 18446744073709551615 +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Max size for data for an internal temporary on-disk MyISAM or Aria table. +NUMERIC_MIN_VALUE 1024 +NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME TMP_MEMORY_TABLE_SIZE +SESSION_VALUE 16777216 +GLOBAL_VALUE 16777216 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 16777216 +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size. +NUMERIC_MIN_VALUE 1024 +NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME TMP_TABLE_SIZE SESSION_VALUE 16777216 GLOBAL_VALUE 16777216 @@ -4958,7 +4986,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16777216 VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table +VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 18446744073709551615 NUMERIC_BLOCK_SIZE 1 diff --git a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result new file mode 100644 index 00000000000..0acf8428100 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_basic.result @@ -0,0 +1,146 @@ +SET @start_global_value = @@global.tmp_disk_table_size; +SET @start_session_value = @@session.tmp_disk_table_size; +'#--------------------FN_DYNVARS_005_01-------------------------#' +SET @@global.tmp_disk_table_size = 100; +Warnings: +Warning 1292 Truncated incorrect tmp_disk_table_size value: '100' +SET @@global.tmp_disk_table_size = DEFAULT; +SET @@session.tmp_disk_table_size = 200; +Warnings: +Warning 1292 Truncated incorrect tmp_disk_table_size value: '200' +SET @@session.tmp_disk_table_size = DEFAULT; +'#--------------------FN_DYNVARS_005_02-------------------------#' +SELECT @@global.tmp_disk_table_size >= 16777216; +@@global.tmp_disk_table_size >= 16777216 +1 +SELECT @@session.tmp_disk_table_size >= 16777216; +@@session.tmp_disk_table_size >= 16777216 +1 +'#--------------------FN_DYNVARS_005_03-------------------------#' +SET @@global.tmp_disk_table_size = 1024; +SELECT @@global.tmp_disk_table_size; +@@global.tmp_disk_table_size +1024 +SET @@global.tmp_disk_table_size = 60020; +SELECT @@global.tmp_disk_table_size; +@@global.tmp_disk_table_size +60020 +SET @@global.tmp_disk_table_size = 4294967295; +SELECT @@global.tmp_disk_table_size; +@@global.tmp_disk_table_size +4294967295 +'#--------------------FN_DYNVARS_005_04-------------------------#' +SET @@session.tmp_disk_table_size = 1024; +SELECT @@session.tmp_disk_table_size; +@@session.tmp_disk_table_size +1024 +SET @@session.tmp_disk_table_size = 4294967295; +SELECT @@session.tmp_disk_table_size; +@@session.tmp_disk_table_size +4294967295 +SET @@session.tmp_disk_table_size = 65535; +SELECT @@session.tmp_disk_table_size; +@@session.tmp_disk_table_size +65535 +'#------------------FN_DYNVARS_005_05-----------------------#' +SET @@global.tmp_disk_table_size = 0; +Warnings: +Warning 1292 Truncated incorrect tmp_disk_table_size value: '0' +SELECT @@global.tmp_disk_table_size; +@@global.tmp_disk_table_size +1024 +SET @@global.tmp_disk_table_size = -1024; +Warnings: +Warning 1292 Truncated incorrect tmp_disk_table_size value: '-1024' +SELECT @@global.tmp_disk_table_size; +@@global.tmp_disk_table_size +1024 +SET @@global.tmp_disk_table_size = 1000; +Warnings: +Warning 1292 Truncated incorrect tmp_disk_table_size value: '1000' +SELECT @@global.tmp_disk_table_size; +@@global.tmp_disk_table_size +1024 +SET @@global.tmp_disk_table_size = ON; +ERROR 42000: Incorrect argument type to variable 'tmp_disk_table_size' +SET @@global.tmp_disk_table_size = OFF; +ERROR 42000: Incorrect argument type to variable 'tmp_disk_table_size' +SET @@global.tmp_disk_table_size = True; +Warnings: +Warning 1292 Truncated incorrect tmp_disk_table_size value: '1' +SELECT @@global.tmp_disk_table_size; +@@global.tmp_disk_table_size +1024 +SET @@global.tmp_disk_table_size = False; +Warnings: +Warning 1292 Truncated incorrect tmp_disk_table_size value: '0' +SELECT @@global.tmp_disk_table_size; +@@global.tmp_disk_table_size +1024 +SET @@global.tmp_disk_table_size = 65530.34; +ERROR 42000: Incorrect argument type to variable 'tmp_disk_table_size' +SET @@global.tmp_disk_table_size ="Test"; +ERROR 42000: Incorrect argument type to variable 'tmp_disk_table_size' +SET @@session.tmp_disk_table_size = ON; +ERROR 42000: Incorrect argument type to variable 'tmp_disk_table_size' +SET @@session.tmp_disk_table_size = OFF; +ERROR 42000: Incorrect argument type to variable 'tmp_disk_table_size' +SET @@session.tmp_disk_table_size = True; +Warnings: +Warning 1292 Truncated incorrect tmp_disk_table_size value: '1' +SELECT @@session.tmp_disk_table_size; +@@session.tmp_disk_table_size +1024 +SET @@session.tmp_disk_table_size = False; +Warnings: +Warning 1292 Truncated incorrect tmp_disk_table_size value: '0' +SELECT @@session.tmp_disk_table_size; +@@session.tmp_disk_table_size +1024 +SET @@session.tmp_disk_table_size = "Test"; +ERROR 42000: Incorrect argument type to variable 'tmp_disk_table_size' +SET @@session.tmp_disk_table_size = 12345678901; +SELECT @@session.tmp_disk_table_size IN (12345678901,4294967295); +@@session.tmp_disk_table_size IN (12345678901,4294967295) +1 +'#------------------FN_DYNVARS_005_06-----------------------#' +SELECT @@global.tmp_disk_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='tmp_disk_table_size'; +@@global.tmp_disk_table_size = VARIABLE_VALUE +1 +'#------------------FN_DYNVARS_005_07-----------------------#' +SELECT @@session.tmp_disk_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='tmp_disk_table_size'; +@@session.tmp_disk_table_size = VARIABLE_VALUE +1 +'#---------------------FN_DYNVARS_001_09----------------------#' +SET @@global.tmp_disk_table_size = 1024; +SET @@tmp_disk_table_size = 4294967295; +SELECT @@tmp_disk_table_size = @@global.tmp_disk_table_size; +@@tmp_disk_table_size = @@global.tmp_disk_table_size +0 +'#---------------------FN_DYNVARS_001_10----------------------#' +SET @@tmp_disk_table_size = 100; +Warnings: +Warning 1292 Truncated incorrect tmp_disk_table_size value: '100' +SELECT @@tmp_disk_table_size = @@local.tmp_disk_table_size; +@@tmp_disk_table_size = @@local.tmp_disk_table_size +1 +SELECT @@local.tmp_disk_table_size = @@session.tmp_disk_table_size; +@@local.tmp_disk_table_size = @@session.tmp_disk_table_size +1 +'#---------------------FN_DYNVARS_001_11----------------------#' +SET tmp_disk_table_size = 1027; +SELECT @@tmp_disk_table_size; +@@tmp_disk_table_size +1027 +SELECT local.tmp_disk_table_size; +ERROR 42S02: Unknown table 'local' in field list +SELECT global.tmp_disk_table_size; +ERROR 42S02: Unknown table 'global' in field list +SELECT tmp_disk_table_size = @@session.tmp_disk_table_size; +ERROR 42S22: Unknown column 'tmp_disk_table_size' in 'field list' +SET @@global.tmp_disk_table_size = @start_global_value; +SET @@session.tmp_disk_table_size = @start_session_value; diff --git a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result new file mode 100644 index 00000000000..d2a5ad46129 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result @@ -0,0 +1,25 @@ + +"Ensure that we get an error if we exceed tmp_disk_table_size" + +SET @start_tmp_memory_table_size=@@session.tmp_memory_table_size; +SET @start_tmp_disk_table_size=@@session.tmp_disk_table_size; +set @@session.tmp_memory_table_size=1000; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '1000' +set @@session.tmp_disk_table_size=3000000; +create table t1 (a int primary key, b varchar(2000)); +insert into t1 select seq,repeat(char(mod(seq,62)+64),seq) from seq_1_to_2000; +insert into t1 values (20000,"A"); +select count(*) as c from t1 group by b having c>1; +c +2 +show status like "created_tmp_disk%"; +Variable_name Value +Created_tmp_disk_tables 1 +set @@session.tmp_disk_table_size=1000000; +select count(*) as c from t1 group by b having c>1; +ERROR HY000: The table '#sql_xxx' is full +show status like "created_tmp_disk%"; +Variable_name Value +Created_tmp_disk_tables 2 +drop table t1; diff --git a/mysql-test/suite/sys_vars/r/tmp_memory_table_size_basic.result b/mysql-test/suite/sys_vars/r/tmp_memory_table_size_basic.result new file mode 100644 index 00000000000..dddba1a6dfe --- /dev/null +++ b/mysql-test/suite/sys_vars/r/tmp_memory_table_size_basic.result @@ -0,0 +1,165 @@ +SET @start_global_value = @@global.tmp_memory_table_size; +SET @start_session_value = @@session.tmp_memory_table_size; +'#--------------------FN_DYNVARS_005_01-------------------------#' +SET @@global.tmp_memory_table_size = 10000; +SELECT @@global.tmp_memory_table_size; +@@global.tmp_memory_table_size +10000 +SET @@global.tmp_memory_table_size = DEFAULT; +SELECT @@global.tmp_memory_table_size; +@@global.tmp_memory_table_size +16777216 +SET @@session.tmp_memory_table_size = 20000; +SELECT @@session.tmp_memory_table_size; +@@session.tmp_memory_table_size +20000 +SET @@session.tmp_memory_table_size = DEFAULT; +SELECT @@session.tmp_memory_table_size; +@@session.tmp_memory_table_size +16777216 +'#--------------------FN_DYNVARS_005_02-------------------------#' +SELECT @@global.tmp_memory_table_size >= 16777216; +@@global.tmp_memory_table_size >= 16777216 +1 +SELECT @@session.tmp_memory_table_size >= 16777216; +@@session.tmp_memory_table_size >= 16777216 +1 +'#--------------------FN_DYNVARS_005_03-------------------------#' +SET @@global.tmp_memory_table_size = 1024; +SELECT @@global.tmp_memory_table_size; +@@global.tmp_memory_table_size +1024 +SET @@global.tmp_memory_table_size = 60020; +SELECT @@global.tmp_memory_table_size; +@@global.tmp_memory_table_size +60020 +SET @@global.tmp_memory_table_size = 4294967295; +SELECT @@global.tmp_memory_table_size; +@@global.tmp_memory_table_size +4294967295 +'#--------------------FN_DYNVARS_005_04-------------------------#' +SET @@session.tmp_memory_table_size = 1024; +SELECT @@session.tmp_memory_table_size; +@@session.tmp_memory_table_size +1024 +SET @@session.tmp_memory_table_size = 4294967295; +SELECT @@session.tmp_memory_table_size; +@@session.tmp_memory_table_size +4294967295 +SET @@session.tmp_memory_table_size = 65535; +SELECT @@session.tmp_memory_table_size; +@@session.tmp_memory_table_size +65535 +'#------------------FN_DYNVARS_005_05-----------------------#' +SET @@global.tmp_memory_table_size = 0; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '0' +SELECT @@global.tmp_memory_table_size; +@@global.tmp_memory_table_size +1024 +SET @@global.tmp_memory_table_size = -1024; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '-1024' +SELECT @@global.tmp_memory_table_size; +@@global.tmp_memory_table_size +1024 +SET @@global.tmp_memory_table_size = 1000; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '1000' +SELECT @@global.tmp_memory_table_size; +@@global.tmp_memory_table_size +1024 +SET @@global.tmp_memory_table_size = ON; +ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size' +SET @@global.tmp_memory_table_size = OFF; +ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size' +SET @@global.tmp_memory_table_size = True; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '1' +SELECT @@global.tmp_memory_table_size; +@@global.tmp_memory_table_size +1024 +SET @@global.tmp_memory_table_size = False; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '0' +SELECT @@global.tmp_memory_table_size; +@@global.tmp_memory_table_size +1024 +SET @@global.tmp_memory_table_size = 65530.34; +ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size' +SET @@global.tmp_memory_table_size ="Test"; +ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size' +SET @@session.tmp_memory_table_size = ON; +ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size' +SET @@session.tmp_memory_table_size = OFF; +ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size' +SET @@session.tmp_memory_table_size = True; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '1' +SELECT @@session.tmp_memory_table_size; +@@session.tmp_memory_table_size +1024 +SET @@session.tmp_memory_table_size = False; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '0' +SELECT @@session.tmp_memory_table_size; +@@session.tmp_memory_table_size +1024 +SET @@session.tmp_memory_table_size = "Test"; +ERROR 42000: Incorrect argument type to variable 'tmp_memory_table_size' +SET @@session.tmp_memory_table_size = 12345678901; +SELECT @@session.tmp_memory_table_size IN (12345678901,4294967295); +@@session.tmp_memory_table_size IN (12345678901,4294967295) +1 +'#------------------FN_DYNVARS_005_06-----------------------#' +SELECT @@global.tmp_memory_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='tmp_memory_table_size'; +@@global.tmp_memory_table_size = VARIABLE_VALUE +1 +'#------------------FN_DYNVARS_005_07-----------------------#' +SELECT @@session.tmp_memory_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='tmp_memory_table_size'; +@@session.tmp_memory_table_size = VARIABLE_VALUE +1 +'#---------------------FN_DYNVARS_001_09----------------------#' +SET @@global.tmp_memory_table_size = 1024; +SET @@tmp_memory_table_size = 4294967295; +SELECT @@tmp_memory_table_size = @@global.tmp_memory_table_size; +@@tmp_memory_table_size = @@global.tmp_memory_table_size +0 +'#---------------------FN_DYNVARS_001_10----------------------#' +SET @@tmp_memory_table_size = 100; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '100' +SELECT @@tmp_memory_table_size = @@local.tmp_memory_table_size; +@@tmp_memory_table_size = @@local.tmp_memory_table_size +1 +SELECT @@local.tmp_memory_table_size = @@session.tmp_memory_table_size; +@@local.tmp_memory_table_size = @@session.tmp_memory_table_size +1 +'#---------------------FN_DYNVARS_001_11----------------------#' +SET tmp_memory_table_size = 1027; +SELECT @@tmp_memory_table_size; +@@tmp_memory_table_size +1027 +SELECT local.tmp_memory_table_size; +ERROR 42S02: Unknown table 'local' in field list +SELECT global.tmp_memory_table_size; +ERROR 42S02: Unknown table 'global' in field list +SELECT tmp_memory_table_size = @@session.tmp_memory_table_size; +ERROR 42S22: Unknown column 'tmp_memory_table_size' in 'field list' + +"Check that tmp_memory_table_size and tmp_table_size are the same" + +set @@session.tmp_memory_table_size=100000; +select @@session.tmp_memory_table_size,@@session.tmp_table_size; +@@session.tmp_memory_table_size @@session.tmp_table_size +100000 100000 +set @@session.tmp_memory_table_size=200000; +select @@session.tmp_memory_table_size,@@session.tmp_table_size; +@@session.tmp_memory_table_size @@session.tmp_table_size +200000 200000 +SET @@global.tmp_memory_table_size = @start_global_value; +SET @@session.tmp_memory_table_size = @start_session_value; diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test new file mode 100644 index 00000000000..123f522a3a4 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_basic.test @@ -0,0 +1,207 @@ +###################### tmp_disk_table_size_basic.test ###################### +# # +# Variable Name: tmp_disk_table_size # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: system dependend # +# Range: 1024-system dependend # +# # +# # +# Creation Date: 2008-02-13 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable tmp_table_size # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# Modified: 2008-12-04 HHunger # +# removed the differences between 64 and 32 bit platforms # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +############################################################## +# START OF tmp_disk_table_size TESTS # +############################################################## + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.tmp_disk_table_size; +SET @start_session_value = @@session.tmp_disk_table_size; + +--echo '#--------------------FN_DYNVARS_005_01-------------------------#' +############################################################## +# Display the DEFAULT value of tmp_disk_table_size # +############################################################## + +SET @@global.tmp_disk_table_size = 100; +SET @@global.tmp_disk_table_size = DEFAULT; + +SET @@session.tmp_disk_table_size = 200; +SET @@session.tmp_disk_table_size = DEFAULT; + +--echo '#--------------------FN_DYNVARS_005_02-------------------------#' +######################################################################## +# Check the DEFAULT value of tmp_disk_table_size # +######################################################################## +# The DEFAULT value is system dependend. +# Therefore we have only a plausibility check here +SELECT @@global.tmp_disk_table_size >= 16777216; +SELECT @@session.tmp_disk_table_size >= 16777216; + +--echo '#--------------------FN_DYNVARS_005_03-------------------------#' +######################################################################## +# Change the value of tmp_disk_table_size to a valid value for GLOBAL Scope # +######################################################################## + +SET @@global.tmp_disk_table_size = 1024; +SELECT @@global.tmp_disk_table_size; +SET @@global.tmp_disk_table_size = 60020; +SELECT @@global.tmp_disk_table_size; +SET @@global.tmp_disk_table_size = 4294967295; +SELECT @@global.tmp_disk_table_size; + + +--echo '#--------------------FN_DYNVARS_005_04-------------------------#' +######################################################################### +# Change the value of tmp_disk_table_size to a valid value for SESSION Scope # +######################################################################### + +SET @@session.tmp_disk_table_size = 1024; +SELECT @@session.tmp_disk_table_size; + +SET @@session.tmp_disk_table_size = 4294967295; +SELECT @@session.tmp_disk_table_size; +SET @@session.tmp_disk_table_size = 65535; +SELECT @@session.tmp_disk_table_size; + + +--echo '#------------------FN_DYNVARS_005_05-----------------------#' +########################################################## +# Change the value of tmp_disk_table_size to an invalid value # +########################################################## + +SET @@global.tmp_disk_table_size = 0; +SELECT @@global.tmp_disk_table_size; + +SET @@global.tmp_disk_table_size = -1024; +SELECT @@global.tmp_disk_table_size; + +SET @@global.tmp_disk_table_size = 1000; +SELECT @@global.tmp_disk_table_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_disk_table_size = ON; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_disk_table_size = OFF; + +SET @@global.tmp_disk_table_size = True; +SELECT @@global.tmp_disk_table_size; + +SET @@global.tmp_disk_table_size = False; +SELECT @@global.tmp_disk_table_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_disk_table_size = 65530.34; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_disk_table_size ="Test"; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.tmp_disk_table_size = ON; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.tmp_disk_table_size = OFF; + +SET @@session.tmp_disk_table_size = True; +SELECT @@session.tmp_disk_table_size; + +SET @@session.tmp_disk_table_size = False; +SELECT @@session.tmp_disk_table_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.tmp_disk_table_size = "Test"; + +--disable_warnings +SET @@session.tmp_disk_table_size = 12345678901; +--enable_warnings +# With a 64 bit mysqld:12345678901,with a 32 bit mysqld: 4294967295 +SELECT @@session.tmp_disk_table_size IN (12345678901,4294967295); + +--echo '#------------------FN_DYNVARS_005_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SELECT @@global.tmp_disk_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='tmp_disk_table_size'; + +--echo '#------------------FN_DYNVARS_005_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.tmp_disk_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='tmp_disk_table_size'; + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +######################################################################## +# Check if global and session variables are independent of each other # +######################################################################## + +SET @@global.tmp_disk_table_size = 1024; +SET @@tmp_disk_table_size = 4294967295; +SELECT @@tmp_disk_table_size = @@global.tmp_disk_table_size; + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +################################################################## +# Check if accessing variable with SESSION,LOCAL and without # +# SCOPE points to same session variable # +################################################################## + +SET @@tmp_disk_table_size = 100; +SELECT @@tmp_disk_table_size = @@local.tmp_disk_table_size; +SELECT @@local.tmp_disk_table_size = @@session.tmp_disk_table_size; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +######################################################################### +# Check if tmp_disk_table_size can be accessed with and without @@ sign # +######################################################################### + +SET tmp_disk_table_size = 1027; +SELECT @@tmp_disk_table_size; + +--Error ER_UNKNOWN_TABLE +SELECT local.tmp_disk_table_size; + +--Error ER_UNKNOWN_TABLE +SELECT global.tmp_disk_table_size; + +--Error ER_BAD_FIELD_ERROR +SELECT tmp_disk_table_size = @@session.tmp_disk_table_size; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.tmp_disk_table_size = @start_global_value; +SET @@session.tmp_disk_table_size = @start_session_value; + +################################################### +# END OF tmp_disk_table_size TESTS # +################################################### + diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test new file mode 100644 index 00000000000..bf93b4646d9 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test @@ -0,0 +1,26 @@ +###################### tmp_memory_table_size_func.test ######################## + +--source include/load_sysvars.inc +--source include/have_sequence.inc + +--echo +--echo "Ensure that we get an error if we exceed tmp_disk_table_size" +--echo + +SET @start_tmp_memory_table_size=@@session.tmp_memory_table_size; +SET @start_tmp_disk_table_size=@@session.tmp_disk_table_size; + +set @@session.tmp_memory_table_size=1000; +set @@session.tmp_disk_table_size=3000000; + +create table t1 (a int primary key, b varchar(2000)); +insert into t1 select seq,repeat(char(mod(seq,62)+64),seq) from seq_1_to_2000; +insert into t1 values (20000,"A"); +select count(*) as c from t1 group by b having c>1; +show status like "created_tmp_disk%"; +set @@session.tmp_disk_table_size=1000000; +--replace_regex /The table '.*' is full/The table '#sql_xxx' is full/ +--error ER_RECORD_FILE_FULL +select count(*) as c from t1 group by b having c>1; +show status like "created_tmp_disk%"; +drop table t1; diff --git a/mysql-test/suite/sys_vars/t/tmp_memory_table_size_basic.test b/mysql-test/suite/sys_vars/t/tmp_memory_table_size_basic.test new file mode 100644 index 00000000000..f5fcb17c8a5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/tmp_memory_table_size_basic.test @@ -0,0 +1,209 @@ +###################### tmp_memory_table_size_basic.test ###################### +# # +# Variable Name: tmp_memory_table_size # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# # +# Description: Test Cases of Dynamic System Variable tmp_table_size # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +############################################################################### + +--source include/load_sysvars.inc + +############################################################## +# START OF tmp_memory_table_size TESTS # +############################################################## + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.tmp_memory_table_size; +SET @start_session_value = @@session.tmp_memory_table_size; + +--echo '#--------------------FN_DYNVARS_005_01-------------------------#' +############################################################## +# Display the DEFAULT value of tmp_memory_table_size # +############################################################## + +SET @@global.tmp_memory_table_size = 10000; +SELECT @@global.tmp_memory_table_size; +SET @@global.tmp_memory_table_size = DEFAULT; +SELECT @@global.tmp_memory_table_size; + +SET @@session.tmp_memory_table_size = 20000; +SELECT @@session.tmp_memory_table_size; +SET @@session.tmp_memory_table_size = DEFAULT; +SELECT @@session.tmp_memory_table_size; + +--echo '#--------------------FN_DYNVARS_005_02-------------------------#' +######################################################################## +# Check the DEFAULT value of tmp_memory_table_size # +######################################################################## +# The DEFAULT value is system dependend. +# Therefore we have only a plausibility check here +SELECT @@global.tmp_memory_table_size >= 16777216; +SELECT @@session.tmp_memory_table_size >= 16777216; + +--echo '#--------------------FN_DYNVARS_005_03-------------------------#' +######################################################################## +# Change the value of tmp_memory_table_size to a valid value for GLOBAL Scope # +######################################################################## + +SET @@global.tmp_memory_table_size = 1024; +SELECT @@global.tmp_memory_table_size; +SET @@global.tmp_memory_table_size = 60020; +SELECT @@global.tmp_memory_table_size; +SET @@global.tmp_memory_table_size = 4294967295; +SELECT @@global.tmp_memory_table_size; + + +--echo '#--------------------FN_DYNVARS_005_04-------------------------#' +######################################################################### +# Change the value of tmp_memory_table_size to a valid value for SESSION Scope # +######################################################################### + +SET @@session.tmp_memory_table_size = 1024; +SELECT @@session.tmp_memory_table_size; + +SET @@session.tmp_memory_table_size = 4294967295; +SELECT @@session.tmp_memory_table_size; +SET @@session.tmp_memory_table_size = 65535; +SELECT @@session.tmp_memory_table_size; + + +--echo '#------------------FN_DYNVARS_005_05-----------------------#' +########################################################## +# Change the value of tmp_memory_table_size to an invalid value # +########################################################## + +SET @@global.tmp_memory_table_size = 0; +SELECT @@global.tmp_memory_table_size; + +SET @@global.tmp_memory_table_size = -1024; +SELECT @@global.tmp_memory_table_size; + +SET @@global.tmp_memory_table_size = 1000; +SELECT @@global.tmp_memory_table_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_memory_table_size = ON; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_memory_table_size = OFF; + +SET @@global.tmp_memory_table_size = True; +SELECT @@global.tmp_memory_table_size; + +SET @@global.tmp_memory_table_size = False; +SELECT @@global.tmp_memory_table_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_memory_table_size = 65530.34; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_memory_table_size ="Test"; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.tmp_memory_table_size = ON; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.tmp_memory_table_size = OFF; + +SET @@session.tmp_memory_table_size = True; +SELECT @@session.tmp_memory_table_size; + +SET @@session.tmp_memory_table_size = False; +SELECT @@session.tmp_memory_table_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.tmp_memory_table_size = "Test"; + +--disable_warnings +SET @@session.tmp_memory_table_size = 12345678901; +--enable_warnings +# With a 64 bit mysqld:12345678901,with a 32 bit mysqld: 4294967295 +SELECT @@session.tmp_memory_table_size IN (12345678901,4294967295); + +--echo '#------------------FN_DYNVARS_005_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SELECT @@global.tmp_memory_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='tmp_memory_table_size'; + +--echo '#------------------FN_DYNVARS_005_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.tmp_memory_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='tmp_memory_table_size'; + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +######################################################################## +# Check if global and session variables are independent of each other # +######################################################################## + +SET @@global.tmp_memory_table_size = 1024; +SET @@tmp_memory_table_size = 4294967295; +SELECT @@tmp_memory_table_size = @@global.tmp_memory_table_size; + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +################################################################## +# Check if accessing variable with SESSION,LOCAL and without # +# SCOPE points to same session variable # +################################################################## + +SET @@tmp_memory_table_size = 100; +SELECT @@tmp_memory_table_size = @@local.tmp_memory_table_size; +SELECT @@local.tmp_memory_table_size = @@session.tmp_memory_table_size; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +######################################################################### +# Check if tmp_memory_table_size can be accessed with and without @@ sign # +######################################################################### + +SET tmp_memory_table_size = 1027; +SELECT @@tmp_memory_table_size; + +--Error ER_UNKNOWN_TABLE +SELECT local.tmp_memory_table_size; + +--Error ER_UNKNOWN_TABLE +SELECT global.tmp_memory_table_size; + +--Error ER_BAD_FIELD_ERROR +SELECT tmp_memory_table_size = @@session.tmp_memory_table_size; + +--echo +--echo "Check that tmp_memory_table_size and tmp_table_size are the same" +--echo + +set @@session.tmp_memory_table_size=100000; +select @@session.tmp_memory_table_size,@@session.tmp_table_size; +set @@session.tmp_memory_table_size=200000; +select @@session.tmp_memory_table_size,@@session.tmp_table_size; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.tmp_memory_table_size = @start_global_value; +SET @@session.tmp_memory_table_size = @start_session_value; + +################################################### +# END OF tmp_memory_table_size TESTS # +################################################### + diff --git a/sql/item_sum.cc b/sql/item_sum.cc index cb2d3e839b8..35e8dea46a7 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -38,8 +38,8 @@ ulonglong Item_sum::ram_limitation(THD *thd) { - return MY_MIN(thd->variables.tmp_table_size, - thd->variables.max_heap_table_size); + return MY_MIN(thd->variables.tmp_memory_table_size, + thd->variables.max_heap_table_size); } diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 027d696a14f..0b01925ba93 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -4238,13 +4238,13 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd) field->set_table_name(&table->alias); } - if (thd->variables.tmp_table_size == ~ (ulonglong) 0) // No limit + if (thd->variables.tmp_memory_table_size == ~ (ulonglong) 0) // No limit share->max_rows= ~(ha_rows) 0; else share->max_rows= (ha_rows) (((share->db_type() == heap_hton) ? - MY_MIN(thd->variables.tmp_table_size, - thd->variables.max_heap_table_size) : - thd->variables.tmp_table_size) / + MY_MIN(thd->variables.tmp_memory_table_size, + thd->variables.max_heap_table_size) : + thd->variables.tmp_memory_table_size) / share->reclength); set_if_bigger(share->max_rows,1); // For dummy start options diff --git a/sql/sql_class.h b/sql/sql_class.h index 0a1be8c13c8..8052e28fbb4 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -536,7 +536,8 @@ typedef struct system_variables uint dynamic_variables_size; /* how many bytes are in use */ ulonglong max_heap_table_size; - ulonglong tmp_table_size; + ulonglong tmp_memory_table_size; + ulonglong tmp_disk_table_size; ulonglong long_query_time; ulonglong max_statement_time; ulonglong optimizer_switch; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6c56f0115ca..540271bc961 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -16703,7 +16703,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, if (blob_count || using_unique_constraint || (thd->variables.big_tables && !(select_options & SELECT_SMALL_RESULT)) || (select_options & TMP_TABLE_FORCE_MYISAM) - || thd->variables.tmp_table_size == 0) + || thd->variables.tmp_memory_table_size == 0) { share->db_plugin= ha_lock_engine(0, TMP_ENGINE_HTON); table->file= get_new_handler(share, &table->mem_root, @@ -16867,14 +16867,14 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, param->recinfo= recinfo; // Pointer to after last field store_record(table,s->default_values); // Make empty default record - if (thd->variables.tmp_table_size == ~ (ulonglong) 0) // No limit + if (thd->variables.tmp_memory_table_size == ~ (ulonglong) 0) // No limit share->max_rows= ~(ha_rows) 0; else share->max_rows= (ha_rows) (((share->db_type() == heap_hton) ? - MY_MIN(thd->variables.tmp_table_size, + MY_MIN(thd->variables.tmp_memory_table_size, thd->variables.max_heap_table_size) : - thd->variables.tmp_table_size) / - share->reclength); + thd->variables.tmp_memory_table_size) / + share->reclength); set_if_bigger(share->max_rows,1); // For dummy start options /* Push the LIMIT clause to the temporary table creation, so that we @@ -17412,10 +17412,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo, } } bzero((char*) &create_info,sizeof(create_info)); - - /* Use long data format, to ensure we never get a 'table is full' error */ - if (!(options & SELECT_SMALL_RESULT)) - create_info.data_file_length= ~(ulonglong) 0; + create_info.data_file_length= table->in_use->variables.tmp_disk_table_size; /* The logic for choosing the record format: @@ -17611,9 +17608,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo, } MI_CREATE_INFO create_info; bzero((char*) &create_info,sizeof(create_info)); - - if (!(options & SELECT_SMALL_RESULT)) - create_info.data_file_length= ~(ulonglong) 0; + create_info.data_file_length= table->in_use->variables.tmp_disk_table_size; if ((error=mi_create(share->table_name.str, share->keys, &keydef, (uint) (*recinfo-start_recinfo), diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 9ab5e42755e..2c74ad5cb29 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3421,12 +3421,30 @@ static Sys_var_tx_read_only Sys_tx_read_only( static Sys_var_ulonglong Sys_tmp_table_size( "tmp_table_size", + "Alias for tmp_memory_table_size. " "If an internal in-memory temporary table exceeds this size, MySQL " - "will automatically convert it to an on-disk MyISAM or Aria table", - SESSION_VAR(tmp_table_size), CMD_LINE(REQUIRED_ARG), + "will automatically convert it to an on-disk MyISAM or Aria table.", + SESSION_VAR(tmp_memory_table_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(1024, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024), BLOCK_SIZE(1)); +static Sys_var_ulonglong Sys_tmp_memory_table_size( + "tmp_memory_table_size", + "If an internal in-memory temporary table exceeds this size, MySQL " + "will automatically convert it to an on-disk MyISAM or Aria table. " + "Same as tmp_table_size.", + SESSION_VAR(tmp_memory_table_size), CMD_LINE(REQUIRED_ARG), + VALID_RANGE(1024, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024), + BLOCK_SIZE(1)); + +static Sys_var_ulonglong Sys_tmp_disk_table_size( + "tmp_disk_table_size", + "Max size for data for an internal temporary on-disk MyISAM or Aria table.", + SESSION_VAR(tmp_disk_table_size), CMD_LINE(REQUIRED_ARG), + VALID_RANGE(1024, (ulonglong)~(intptr)0), + DEFAULT((ulonglong)~(intptr)0), + BLOCK_SIZE(1)); + static Sys_var_mybool Sys_timed_mutexes( "timed_mutexes", "Specify whether to time mutexes. Deprecated, has no effect.", diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index 0ddd8b226e2..80e38fc2b00 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -375,18 +375,18 @@ int maria_create(const char *name, enum data_file_type datafile_type, if (rows_per_page > 0) { set_if_smaller(rows_per_page, MAX_ROWS_PER_PAGE); - ci->max_rows= data_file_length / maria_block_size * rows_per_page; + ci->max_rows= (data_file_length / maria_block_size+1) * rows_per_page; } else ci->max_rows= data_file_length / (min_pack_length + extra_header_size + - DIR_ENTRY_SIZE); + DIR_ENTRY_SIZE)+1; } else ci->max_rows=(ha_rows) (ci->data_file_length/(min_pack_length + ((options & HA_OPTION_PACK_RECORD) ? - 3 : 0))); + 3 : 0)))+1; } max_rows= (ulonglong) ci->max_rows; if (datafile_type == BLOCK_RECORD) @@ -1204,7 +1204,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, if (mysql_file_chsize(file,(ulong) share.base.keystart,0,MYF(0))) goto err; - if (sync_dir && mysql_file_sync(file, MYF(0))) + if (!internal_table && sync_dir && mysql_file_sync(file, MYF(0))) goto err; if (! (flags & HA_DONT_TOUCH_DATA)) @@ -1214,7 +1214,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, share.base.min_pack_length*ci->reloc_rows,0,MYF(0))) goto err; #endif - if (sync_dir && mysql_file_sync(dfile, MYF(0))) + if (!internal_table && sync_dir && mysql_file_sync(dfile, MYF(0))) goto err; if (mysql_file_close(dfile,MYF(0))) goto err; diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index c4a7df4443c..5c5e41be1f8 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -565,7 +565,10 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) set_if_smaller(max_data_file_length, INT_MAX32); set_if_smaller(max_key_file_length, INT_MAX32); #endif - share->base.max_data_file_length=(my_off_t) max_data_file_length; + /* For internal temporary tables, max_data_file_length is already set */ + if (!internal_table || !share->base.max_data_file_length) + share->base.max_data_file_length=(my_off_t) max_data_file_length; + DBUG_ASSERT(share->base.max_data_file_length); share->base.max_key_file_length=(my_off_t) max_key_file_length; if (share->options & HA_OPTION_COMPRESS_RECORD) @@ -909,9 +912,12 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) share->block_size * keys : 0)); my_free(disk_cache); _ma_setup_functions(share); + max_data_file_length= share->base.max_data_file_length; if ((*share->once_init)(share, info.dfile.file)) goto err; - if (share->now_transactional) + if (internal_table) + set_if_smaller(share->base.max_data_file_length, + max_data_file_length); { /* Setup initial state that is visible for all */ MARIA_STATE_HISTORY_CLOSED *history; diff --git a/storage/maria/ma_state.c b/storage/maria/ma_state.c index 88ce88b8f98..15cc48ad468 100644 --- a/storage/maria/ma_state.c +++ b/storage/maria/ma_state.c @@ -750,9 +750,18 @@ void maria_versioning(MARIA_HA *info, my_bool versioning) void _ma_set_share_data_file_length(MARIA_SHARE *share, ulonglong new_length) { - mysql_mutex_lock(&share->intern_lock); + if (!share->internal_table) + mysql_mutex_lock(&share->intern_lock); if (share->state.state.data_file_length < new_length) + { share->state.state.data_file_length= new_length; + if (new_length >= share->base.max_data_file_length) + { + /* Give an error on next insert */ + share->state.changed|= STATE_DATA_FILE_FULL; + } + } + if (!share->internal_table) mysql_mutex_unlock(&share->intern_lock); } diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c index fdcb5abd090..06aa2da7ae2 100644 --- a/storage/maria/ma_write.c +++ b/storage/maria/ma_write.c @@ -107,9 +107,10 @@ int maria_write(MARIA_HA *info, uchar *record) if (_ma_readinfo(info,F_WRLCK,1)) DBUG_RETURN(my_errno); - if (share->base.reloc == (ha_rows) 1 && - share->base.records == (ha_rows) 1 && - share->state.state.records == (ha_rows) 1) + if ((share->state.changed & STATE_DATA_FILE_FULL) || + (share->base.reloc == (ha_rows) 1 && + share->base.records == (ha_rows) 1 && + share->state.state.records == (ha_rows) 1)) { /* System file */ my_errno=HA_ERR_RECORD_FILE_FULL; goto err2; diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 8664157a65a..cc100b3706c 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -734,6 +734,7 @@ struct st_maria_handler #define STATE_MOVED 512U /* set if base->uuid != maria_uuid */ #define STATE_IN_REPAIR 1024U /* We are running repair on table */ #define STATE_CRASHED_PRINTED 2048U +#define STATE_DATA_FILE_FULL 4096U #define STATE_CRASHED_FLAGS (STATE_CRASHED | STATE_CRASHED_ON_REPAIR | STATE_CRASHED_PRINTED) From b356eae8a9a326a2ca8049b55c6506f8fa311c6f Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 30 Jun 2017 18:00:37 +0300 Subject: [PATCH 36/53] Don't create tags for .xz files --- support-files/build-tags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support-files/build-tags b/support-files/build-tags index 03b243ee8cc..e94b7bed298 100755 --- a/support-files/build-tags +++ b/support-files/build-tags @@ -8,7 +8,7 @@ then echo client storage dbug libmysql sql-common \ sql extra mysys mysys_ssl strings regex pcre vio include \ tools unittest plugin libmysqld | \ - xargs -n1 git ls-files | grep -v '\.jar$' | \ + xargs -n1 git ls-files | grep -v '\.jar$' | grep -v '\.xz$' | \ xargs etags -o TAGS --append else find . -type f ! -name "*.jar" | From a2d5bd96bf65c3a03b77c65b7acb38d9fb4318dc Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 30 Jun 2017 18:01:55 +0300 Subject: [PATCH 37/53] Fixed wrong results in show_all_plugins.test - Crude hack to get it to work. Hope Serg has a better solution at some point.. --- mysql-test/suite/plugins/t/show_all_plugins.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/plugins/t/show_all_plugins.test b/mysql-test/suite/plugins/t/show_all_plugins.test index 74f9a99aef3..f8f375976fe 100644 --- a/mysql-test/suite/plugins/t/show_all_plugins.test +++ b/mysql-test/suite/plugins/t/show_all_plugins.test @@ -21,6 +21,7 @@ show status like '%libraries%'; --sorted_result --replace_result .dll .so show plugins soname like '%example%'; +--replace_result 8 7 show status like '%libraries%'; --sorted_result --replace_result .dll .so From f99b83571a2b56a929476f657d97212580301d62 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 30 Jun 2017 18:06:21 +0300 Subject: [PATCH 38/53] Added submodule updates to BUILD scripts --- BUILD/FINISH.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh index b41c5c5139d..20784c49f0b 100644 --- a/BUILD/FINISH.sh +++ b/BUILD/FINISH.sh @@ -35,6 +35,11 @@ fi # git clean -fdX removes all ignored (build) files commands="\ git clean -fdX +cd ./libmariadb +git submodule update +cd ../storage/rocksdb/rocksdb +git submodule update +cd ../../.. path=`dirname $0` . \"$path/autorun.sh\"" From 53235cbb1f0d41654935563633a5c61a2caa9495 Mon Sep 17 00:00:00 2001 From: Jacob Mathew Date: Fri, 30 Jun 2017 14:58:05 -0700 Subject: [PATCH 39/53] Updated spider/bg and spider/handler mtr suites. --- storage/spider/mysql-test/spider/bg/suite.pm | 2 + .../spider/handler/r/basic_sql.result | 179 +++++++---- .../spider/handler/r/basic_sql_part.result | 141 +++++++++ .../spider/handler/r/direct_aggregate.result | 60 +--- .../handler/r/direct_aggregate_part.result | 90 ++++++ .../spider/handler/r/direct_update.result | 113 +------ .../handler/r/direct_update_part.result | 137 +++++++++ .../spider/handler/r/function.result | 11 + .../mysql-test/spider/handler/r/ha.result | 219 ++------------ .../spider/handler/r/ha_part.result | 286 ++++++++++++++++++ .../spider/handler/r/spider3_fixes.result | 191 +----------- .../handler/r/spider3_fixes_part.result | 238 +++++++++++++++ .../spider/handler/r/spider_fixes.result | 228 +++++--------- .../spider/handler/r/spider_fixes_part.result | 241 +++++++++++++++ .../spider/handler/r/vp_fixes.result | 13 + .../mysql-test/spider/handler/suite.opt | 1 + .../spider/mysql-test/spider/handler/suite.pm | 12 + 17 files changed, 1419 insertions(+), 743 deletions(-) create mode 100644 storage/spider/mysql-test/spider/handler/r/basic_sql_part.result create mode 100644 storage/spider/mysql-test/spider/handler/r/direct_aggregate_part.result create mode 100644 storage/spider/mysql-test/spider/handler/r/direct_update_part.result create mode 100644 storage/spider/mysql-test/spider/handler/r/ha_part.result create mode 100644 storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result create mode 100644 storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result create mode 100644 storage/spider/mysql-test/spider/handler/suite.opt create mode 100644 storage/spider/mysql-test/spider/handler/suite.pm diff --git a/storage/spider/mysql-test/spider/bg/suite.pm b/storage/spider/mysql-test/spider/bg/suite.pm index 1bb6d7592c8..f106147deb6 100644 --- a/storage/spider/mysql-test/spider/bg/suite.pm +++ b/storage/spider/mysql-test/spider/bg/suite.pm @@ -6,5 +6,7 @@ return "No Spider engine" unless $ENV{HA_SPIDER_SO}; return "Not run for embedded server" if $::opt_embedded_server; return "Test needs --big-test" unless $::opt_big_test; +sub is_default { 1 } + bless { }; diff --git a/storage/spider/mysql-test/spider/handler/r/basic_sql.result b/storage/spider/mysql-test/spider/handler/r/basic_sql.result index da24c08e9fd..94a09fc317b 100644 --- a/storage/spider/mysql-test/spider/handler/r/basic_sql.result +++ b/storage/spider/mysql-test/spider/handler/r/basic_sql.result @@ -9,22 +9,27 @@ child3_2 child3_3 drop and create databases +connection master_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; test select 1 +connection master_1; SELECT 1; 1 1 create table select test +connection master_1; DROP TABLE IF EXISTS tb_l; CREATE TABLE tb_l ( a INT, @@ -43,6 +48,7 @@ CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 SELECT a, b, c FROM tb_l +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-01 10:21:39 @@ -52,6 +58,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 c 2001-12-31 23:59:59 create table ignore select test +connection master_1; DROP TABLE IF EXISTS ta_l; DROP TABLE IF EXISTS tb_l; CREATE TABLE tb_l ( @@ -70,6 +77,13 @@ CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 IGNORE SELECT a, b, c FROM tb_l +Warnings: +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +Warning 1062 Duplicate entry '3' for key 'PRIMARY' +Warning 1062 Duplicate entry '4' for key 'PRIMARY' +Warning 1062 Duplicate entry '5' for key 'PRIMARY' +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-01 10:21:39 @@ -79,11 +93,13 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 c 2001-12-31 23:59:59 create table ignore select test +connection master_1; DROP TABLE IF EXISTS ta_l; CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 REPLACE SELECT a, b, c FROM tb_l +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 f 2008-07-01 10:21:39 @@ -92,24 +108,13 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 4 i 2003-10-30 05:01:03 5 h 2001-10-31 23:59:59 -create table with partition and select test -CREATE TABLE ta_l2 ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 -SELECT a, b, c FROM tb_l -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - create no index table +connection master_1; DROP TABLE IF EXISTS ta_l_no_idx; CREATE TABLE ta_l_no_idx MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1 SELECT a, b, c FROM tb_l +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 f 2008-07-01 10:21:39 @@ -119,6 +124,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select table +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 f 2008-07-01 10:21:39 @@ -128,6 +134,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select table shared mode +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a LOCK IN SHARE MODE; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -138,6 +145,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select table for update +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a FOR UPDATE; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -148,6 +156,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select table join +connection master_1; SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; a b date_format(b.c, '%Y-%m-%d %H:%i:%s') @@ -158,6 +167,7 @@ a b date_format(b.c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select table straight_join +connection master_1; SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; a b date_format(b.c, '%Y-%m-%d %H:%i:%s') @@ -168,6 +178,7 @@ a b date_format(b.c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select sql_small_result +connection master_1; SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -178,6 +189,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select sql_big_result +connection master_1; SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -188,6 +200,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select sql_buffer_result +connection master_1; SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -198,6 +211,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select sql_cache +connection master_1; SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -208,6 +222,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select sql_no_cache +connection master_1; SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -218,6 +233,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select sql_calc_found_rows +connection master_1; SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a LIMIT 4; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -225,11 +241,13 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 2 g 2000-02-01 00:00:00 3 j 2007-05-04 20:03:11 4 i 2003-10-30 05:01:03 +connection master_1; SELECT found_rows(); found_rows() 5 select high_priority +connection master_1; SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -240,6 +258,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select distinct +connection master_1; SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -250,11 +269,13 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select count +connection master_1; SELECT count(*) FROM ta_l ORDER BY a; count(*) 5 select table join not use index +connection master_1; SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a; a b date_format(a.c, '%Y-%m-%d %H:%i:%s') @@ -265,39 +286,35 @@ a b date_format(a.c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 select using pushdown +connection master_1; SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE a.b = 'g' ORDER BY a.a; a b date_format(a.c, '%Y-%m-%d %H:%i:%s') 2 g 2000-02-01 00:00:00 select using index and pushdown +connection master_1; SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE a.a > 0 AND a.b = 'g' ORDER BY a.a; a b date_format(a.c, '%Y-%m-%d %H:%i:%s') 2 g 2000-02-01 00:00:00 -select partition using pushdown -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE -a.b = 'g' ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -2 g 2000-02-01 00:00:00 - -select partition using index pushdown -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE -a.a > 0 AND a.b = 'g' ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -2 g 2000-02-01 00:00:00 - insert +connection master_1; TRUNCATE TABLE ta_l; +connection master_1; INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 2 e 2008-01-01 23:59:59 insert select +connection master_1; TRUNCATE TABLE ta_l; +connection master_1; INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 f 2008-07-01 10:21:39 @@ -307,59 +324,82 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 insert select a +connection master_1; TRUNCATE TABLE ta_l; +connection master_1; INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), 'e', '2008-01-01 23:59:59'); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 e 2008-01-01 23:59:59 insert low_priority +connection master_1; TRUNCATE TABLE ta_l; +connection master_1; INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59'); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 2 e 2008-01-01 23:59:59 insert high_priority +connection master_1; TRUNCATE TABLE ta_l; +connection master_1; INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 2 e 2008-01-01 23:59:59 insert ignore +connection master_1; INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01'); +Warnings: +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 2 e 2008-01-01 23:59:59 insert update (insert) +connection master_1; TRUNCATE TABLE ta_l; +connection master_1; INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 2 e 2008-01-01 23:59:59 insert update (update) +connection master_1; INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 2 f 2005-08-08 11:11:11 replace +connection master_1; TRUNCATE TABLE ta_l; INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); +connection master_1; REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02'); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 2 f 2008-02-02 02:02:02 replace select +connection master_1; REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 f 2008-07-01 10:21:39 @@ -369,8 +409,10 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 replace select a +connection master_1; REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), 'e', '2008-01-01 23:59:59'); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 e 2008-01-01 23:59:59 @@ -380,8 +422,10 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 h 2001-10-31 23:59:59 replace low_priority +connection master_1; REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g', '2009-03-03 03:03:03'); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 e 2008-01-01 23:59:59 @@ -394,91 +438,89 @@ update TRUNCATE TABLE ta_l; INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (2, 'e', '2008-01-01 23:59:59'); +connection master_1; UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 e 2008-01-01 23:59:59 2 f 2008-02-02 02:02:02 update select +connection master_1; UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM tb_l); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 g 2009-03-03 03:03:03 2 g 2009-03-03 03:03:03 update select a +connection master_1; UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 h 2010-04-04 04:04:04 2 g 2009-03-03 03:03:03 update join +connection master_1; UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 f 2008-07-01 10:21:39 2 g 2000-02-01 00:00:00 update join a +connection master_1; UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE a.a = b.a; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 g 2009-03-03 03:03:03 2 g 2009-03-03 03:03:03 update low_priority +connection master_1; UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 g 2009-03-03 03:03:03 2 f 2008-02-02 02:02:02 update ignore +connection master_1; UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 g 2009-03-03 03:03:03 2 f 2008-02-02 02:02:02 update pushdown +connection master_1; update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f'; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 g 2009-03-03 03:03:03 2 j 2009-03-03 03:03:03 update index pushdown +connection master_1; UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j'; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 g 2009-03-03 03:03:03 2 g 2009-03-03 03:03:03 -update partition pushdown -UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 e 2009-03-03 03:03:03 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -update partition index pushdown -UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2009-03-03 03:03:03 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - delete TRUNCATE TABLE ta_l; INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), @@ -487,7 +529,9 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); +connection master_1; DELETE FROM ta_l WHERE a = 2; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 e 2008-01-01 23:59:59 @@ -501,7 +545,9 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 10 j 2008-01-01 23:59:59 delete all +connection master_1; DELETE FROM ta_l; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -513,7 +559,9 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); +connection master_1; DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 6 e 2008-01-01 23:59:59 @@ -530,7 +578,9 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); +connection master_1; DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 2 e 2008-01-01 23:59:59 @@ -551,7 +601,9 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); +connection master_1; DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 6 e 2008-01-01 23:59:59 @@ -568,7 +620,9 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); +connection master_1; DELETE LOW_PRIORITY FROM ta_l WHERE a = 2; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 e 2008-01-01 23:59:59 @@ -589,7 +643,9 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); +connection master_1; DELETE IGNORE FROM ta_l WHERE a = 2; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 e 2008-01-01 23:59:59 @@ -610,7 +666,9 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); +connection master_1; DELETE QUICK FROM ta_l WHERE a = 2; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 e 2008-01-01 23:59:59 @@ -631,7 +689,9 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); +connection master_1; DELETE FROM ta_l WHERE b = 'e'; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 10 j 2008-01-01 23:59:59 @@ -644,41 +704,26 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); +connection master_1; DELETE FROM ta_l WHERE a > 0 AND b = 'e'; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 10 j 2008-01-01 23:59:59 -delete partition pushdown -TRUNCATE TABLE ta_l2; -INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; -DELETE FROM ta_l2 WHERE b = 'g'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -delete partition index pushdown -TRUNCATE TABLE ta_l2; -INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; -DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - truncate +connection master_1; TRUNCATE TABLE ta_l; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') deinit +connection master_1; DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; for master_1 for child2 diff --git a/storage/spider/mysql-test/spider/handler/r/basic_sql_part.result b/storage/spider/mysql-test/spider/handler/r/basic_sql_part.result new file mode 100644 index 00000000000..0f4029404a7 --- /dev/null +++ b/storage/spider/mysql-test/spider/handler/r/basic_sql_part.result @@ -0,0 +1,141 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +connection master_1; +SELECT 1; +1 +1 +connection master_1; +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +INSERT INTO tb_l (a, b, c) VALUES +(1, 'f', '2008-07-01 10:21:39'), +(2, 'g', '2000-02-01 00:00:00'), +(3, 'j', '2007-05-04 20:03:11'), +(4, 'i', '2003-10-30 05:01:03'), +(5, 'h', '2001-10-31 23:59:59'); + +create table with partition and select test +connection master_1; +CREATE TABLE ta_l2 ( +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 +SELECT a, b, c FROM tb_l +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +select partition using pushdown +connection master_1; +SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE +a.b = 'g' ORDER BY a.a; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +2 g 2000-02-01 00:00:00 + +select partition using index pushdown +connection master_1; +SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE +a.a > 0 AND a.b = 'g' ORDER BY a.a; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +2 g 2000-02-01 00:00:00 + +update partition pushdown +connection master_1; +UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 e 2009-03-03 03:03:03 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +update partition index pushdown +connection master_1; +UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +2 g 2000-02-01 00:00:00 +3 j 2009-03-03 03:03:03 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +delete partition pushdown +TRUNCATE TABLE ta_l2; +INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; +connection master_1; +DELETE FROM ta_l2 WHERE b = 'g'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +delete partition index pushdown +TRUNCATE TABLE ta_l2; +INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; +connection master_1; +DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 10:21:39 +3 j 2007-05-04 20:03:11 +4 i 2003-10-30 05:01:03 +5 h 2001-10-31 23:59:59 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/handler/r/direct_aggregate.result b/storage/spider/mysql-test/spider/handler/r/direct_aggregate.result index 0e845fabda1..9a8660ba79e 100644 --- a/storage/spider/mysql-test/spider/handler/r/direct_aggregate.result +++ b/storage/spider/mysql-test/spider/handler/r/direct_aggregate.result @@ -9,22 +9,27 @@ child3_2 child3_3 drop and create databases +connection master_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; test select 1 +connection master_1; SELECT 1; 1 1 create table select test +connection master_1; DROP TABLE IF EXISTS ta_l; CREATE TABLE ta_l ( a INT, @@ -40,6 +45,7 @@ INSERT INTO ta_l (a, b, c) VALUES (5, 'c', '2001-12-31 23:59:59'); direct_aggregating test +connection master_1; SHOW STATUS LIKE 'Spider_direct_aggregate'; Variable_name Value Spider_direct_aggregate 0 @@ -48,76 +54,38 @@ COUNT(*) 5 SHOW STATUS LIKE 'Spider_direct_aggregate'; Variable_name Value -Spider_direct_aggregate 1 +Spider_direct_aggregate 0 SELECT MAX(a) FROM ta_l; MAX(a) 5 SHOW STATUS LIKE 'Spider_direct_aggregate'; Variable_name Value -Spider_direct_aggregate 2 +Spider_direct_aggregate 0 SELECT MIN(a) FROM ta_l; MIN(a) 1 SHOW STATUS LIKE 'Spider_direct_aggregate'; Variable_name Value -Spider_direct_aggregate 3 +Spider_direct_aggregate 0 SELECT MAX(a) FROM ta_l WHERE a < 5; MAX(a) 4 SHOW STATUS LIKE 'Spider_direct_aggregate'; Variable_name Value -Spider_direct_aggregate 4 +Spider_direct_aggregate 0 SELECT MIN(a) FROM ta_l WHERE a > 1; MIN(a) 2 SHOW STATUS LIKE 'Spider_direct_aggregate'; Variable_name Value -Spider_direct_aggregate 5 - -handler with partition test -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -SHOW STATUS LIKE 'Spider_direct_aggregate'; -Variable_name Value -Spider_direct_aggregate 5 -SELECT COUNT(*) FROM ta_l2; -COUNT(*) -5 -SHOW STATUS LIKE 'Spider_direct_aggregate'; -Variable_name Value -Spider_direct_aggregate 7 -SELECT MAX(a) FROM ta_l2; -MAX(a) -5 -SHOW STATUS LIKE 'Spider_direct_aggregate'; -Variable_name Value -Spider_direct_aggregate 9 -SELECT MIN(a) FROM ta_l2; -MIN(a) -1 -SHOW STATUS LIKE 'Spider_direct_aggregate'; -Variable_name Value -Spider_direct_aggregate 11 -SELECT MAX(a) FROM ta_l2 WHERE a < 5; -MAX(a) -4 -SHOW STATUS LIKE 'Spider_direct_aggregate'; -Variable_name Value -Spider_direct_aggregate 13 -SELECT MIN(a) FROM ta_l2 WHERE a > 1; -MIN(a) -2 -SHOW STATUS LIKE 'Spider_direct_aggregate'; -Variable_name Value -Spider_direct_aggregate 15 +Spider_direct_aggregate 0 deinit +connection master_1; DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; for master_1 for child2 diff --git a/storage/spider/mysql-test/spider/handler/r/direct_aggregate_part.result b/storage/spider/mysql-test/spider/handler/r/direct_aggregate_part.result new file mode 100644 index 00000000000..760b39e16d5 --- /dev/null +++ b/storage/spider/mysql-test/spider/handler/r/direct_aggregate_part.result @@ -0,0 +1,90 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +with partition test +connection master_1; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 +SHOW STATUS LIKE 'Spider_direct_aggregate'; +Variable_name Value +Spider_direct_aggregate 0 +SELECT COUNT(*) FROM ta_l2; +COUNT(*) +5 +SHOW STATUS LIKE 'Spider_direct_aggregate'; +Variable_name Value +Spider_direct_aggregate 0 +SELECT MAX(a) FROM ta_l2; +MAX(a) +5 +SHOW STATUS LIKE 'Spider_direct_aggregate'; +Variable_name Value +Spider_direct_aggregate 0 +SELECT MIN(a) FROM ta_l2; +MIN(a) +1 +SHOW STATUS LIKE 'Spider_direct_aggregate'; +Variable_name Value +Spider_direct_aggregate 0 +SELECT MAX(a) FROM ta_l2 WHERE a < 5; +MAX(a) +4 +SHOW STATUS LIKE 'Spider_direct_aggregate'; +Variable_name Value +Spider_direct_aggregate 0 +SELECT MIN(a) FROM ta_l2 WHERE a > 1; +MIN(a) +2 +SHOW STATUS LIKE 'Spider_direct_aggregate'; +Variable_name Value +Spider_direct_aggregate 0 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/handler/r/direct_update.result b/storage/spider/mysql-test/spider/handler/r/direct_update.result index ea3a23eb8b8..74dae7aec2e 100644 --- a/storage/spider/mysql-test/spider/handler/r/direct_update.result +++ b/storage/spider/mysql-test/spider/handler/r/direct_update.result @@ -9,22 +9,27 @@ child3_2 child3_3 drop and create databases +connection master_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; test select 1 +connection master_1; SELECT 1; 1 1 create table select test +connection master_1; DROP TABLE IF EXISTS ta_l; CREATE TABLE ta_l ( a INT, @@ -40,9 +45,9 @@ INSERT INTO ta_l (a, b, c) VALUES (5, 'c', '2001-12-31 23:59:59'); direct_updating test +connection master_1; SHOW STATUS LIKE 'Spider_direct_update'; Variable_name Value -Spider_direct_update 0 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-01 10:21:39 @@ -54,7 +59,6 @@ update all rows with function UPDATE ta_l SET c = ADDDATE(c, 1); SHOW STATUS LIKE 'Spider_direct_update'; Variable_name Value -Spider_direct_update 1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-02 10:21:39 @@ -66,7 +70,6 @@ update by primary key UPDATE ta_l SET b = 'x' WHERE a = 3; SHOW STATUS LIKE 'Spider_direct_update'; Variable_name Value -Spider_direct_update 2 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-02 10:21:39 @@ -78,7 +81,6 @@ update by a column without index UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x'; SHOW STATUS LIKE 'Spider_direct_update'; Variable_name Value -Spider_direct_update 3 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-02 10:21:39 @@ -90,7 +92,6 @@ update by primary key with order and limit UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; SHOW STATUS LIKE 'Spider_direct_update'; Variable_name Value -Spider_direct_update 4 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-02 10:21:39 @@ -102,7 +103,6 @@ delete by primary key with order and limit DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1; SHOW STATUS LIKE 'Spider_direct_delete'; Variable_name Value -Spider_direct_delete 1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-02 10:21:39 @@ -113,7 +113,6 @@ delete by a column without index DELETE FROM ta_l WHERE b = 'c'; SHOW STATUS LIKE 'Spider_direct_delete'; Variable_name Value -Spider_direct_delete 2 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-02 10:21:39 @@ -123,111 +122,17 @@ delete by primary key DELETE FROM ta_l WHERE a = 3; SHOW STATUS LIKE 'Spider_direct_delete'; Variable_name Value -Spider_direct_delete 3 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-02 10:21:39 4 d 2003-12-01 05:01:03 -handler with partition test -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -SHOW STATUS LIKE 'Spider_direct_update'; -Variable_name Value -Spider_direct_update 4 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -update all rows with function -UPDATE ta_l2 SET c = ADDDATE(c, 1); -SHOW STATUS LIKE 'Spider_direct_update'; -Variable_name Value -Spider_direct_update 6 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 e 2007-06-05 20:03:11 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by primary key -UPDATE ta_l2 SET b = 'x' WHERE a = 3; -SHOW STATUS LIKE 'Spider_direct_update'; -Variable_name Value -Spider_direct_update 7 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2007-06-05 20:03:11 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by a column without index -UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; -SHOW STATUS LIKE 'Spider_direct_update'; -Variable_name Value -Spider_direct_update 9 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2011-10-17 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by primary key with order and limit -UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; -SHOW STATUS LIKE 'Spider_direct_update'; -Variable_name Value -Spider_direct_update 10 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -delete by primary key with order and limit -DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; -SHOW STATUS LIKE 'Spider_direct_delete'; -Variable_name Value -Spider_direct_delete 4 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -delete by a column without index -DELETE FROM ta_l2 WHERE b = 'c'; -SHOW STATUS LIKE 'Spider_direct_delete'; -Variable_name Value -Spider_direct_delete 6 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -delete by primary key -DELETE FROM ta_l2 WHERE a = 3; -SHOW STATUS LIKE 'Spider_direct_delete'; -Variable_name Value -Spider_direct_delete 7 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -4 d 2003-12-01 05:01:03 - deinit +connection master_1; DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; for master_1 for child2 diff --git a/storage/spider/mysql-test/spider/handler/r/direct_update_part.result b/storage/spider/mysql-test/spider/handler/r/direct_update_part.result new file mode 100644 index 00000000000..6db7c01f563 --- /dev/null +++ b/storage/spider/mysql-test/spider/handler/r/direct_update_part.result @@ -0,0 +1,137 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +with partition test +connection master_1; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 +SHOW STATUS LIKE 'Spider_direct_update'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 +update all rows with function +UPDATE ta_l2 SET c = ADDDATE(c, 1); +SHOW STATUS LIKE 'Spider_direct_update'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 e 2007-06-05 20:03:11 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +update by primary key +UPDATE ta_l2 SET b = 'x' WHERE a = 3; +SHOW STATUS LIKE 'Spider_direct_update'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 x 2007-06-05 20:03:11 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +update by a column without index +UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; +SHOW STATUS LIKE 'Spider_direct_update'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 x 2011-10-17 00:00:00 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +update by primary key with order and limit +UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; +SHOW STATUS LIKE 'Spider_direct_update'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +2 b 2000-01-02 00:00:00 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +delete by primary key with order and limit +DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; +SHOW STATUS LIKE 'Spider_direct_delete'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 05:01:03 +5 c 2002-01-01 23:59:59 +delete by a column without index +DELETE FROM ta_l2 WHERE b = 'c'; +SHOW STATUS LIKE 'Spider_direct_delete'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 05:01:03 +delete by primary key +DELETE FROM ta_l2 WHERE a = 3; +SHOW STATUS LIKE 'Spider_direct_delete'; +Variable_name Value +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 10:21:39 +4 d 2003-12-01 05:01:03 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/handler/r/function.result b/storage/spider/mysql-test/spider/handler/r/function.result index 764c774514b..c088a8a9541 100644 --- a/storage/spider/mysql-test/spider/handler/r/function.result +++ b/storage/spider/mysql-test/spider/handler/r/function.result @@ -9,22 +9,27 @@ child3_2 child3_3 drop and create databases +connection master_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; test select 1 +connection master_1; SELECT 1; 1 1 in() +connection master_1; CREATE TABLE t1 ( a VARCHAR(255), PRIMARY KEY(a) @@ -41,12 +46,14 @@ insert into t1 select a + 128 from t1; insert into t1 select a + 256 from t1; insert into t1 select a + 512 from t1; flush tables; +connection master_1; select a from t1 where a in ('15', '120'); a 120 15 date_sub() +connection master_1; DROP TABLE IF EXISTS ta_l; CREATE TABLE ta_l ( a INT, @@ -124,6 +131,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 4 d 2003-02-03 06:00:03 5 c 2001-03-07 00:58:59 UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2007-10-07 11:20:40 @@ -133,8 +141,11 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 c 2001-03-07 00:59:00 deinit +connection master_1; DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; for master_1 for child2 diff --git a/storage/spider/mysql-test/spider/handler/r/ha.result b/storage/spider/mysql-test/spider/handler/r/ha.result index e05ecb32e1b..f8833c229ef 100644 --- a/storage/spider/mysql-test/spider/handler/r/ha.result +++ b/storage/spider/mysql-test/spider/handler/r/ha.result @@ -18,34 +18,43 @@ child3_2 child3_3 drop and create databases +connection master_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; +connection child2_3; DROP DATABASE IF EXISTS auto_test_remote3; CREATE DATABASE auto_test_remote3; USE auto_test_remote3; +connection child3_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection child3_2; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection child3_3; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; test select 1 +connection master_1; SELECT 1; 1 1 create table test +connection master_1; DROP TABLE IF EXISTS ta_l; CREATE TABLE ta_l ( a INT, @@ -61,6 +70,7 @@ INSERT INTO ta_l (a, b, c) VALUES (5, 'c', '2001-12-31 23:59:59'); select test +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-01 10:21:39 @@ -70,6 +80,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 c 2001-12-31 23:59:59 fail-over test +connection master_1; SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; Variable_name Value Spider_mon_table_cache_version 0 @@ -101,6 +112,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 6 e 2011-05-05 20:04:05 recovery test +connection master_1; ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", @@ -113,6 +125,7 @@ auto_test_local ta_l 1 2 SELECT spider_copy_tables('ta_l', '0', '1'); spider_copy_tables('ta_l', '0', '1') 1 +connection master_1; ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", @@ -134,117 +147,14 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 6 e 2011-05-05 20:04:05 8 g 2011-05-05 21:33:30 DROP TABLE ta_l; +connection master_1; SELECT spider_flush_table_mon_cache(); spider_flush_table_mon_cache() 1 -create table with partition test -DROP TABLE IF EXISTS ta_l2; -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1 -INSERT INTO ta_l2 (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -select test -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -fail-over test -SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 2 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -ERROR HY000: Table 'auto_test_remote3.ta_r4' get a problem -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 3 -SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -db_name table_name link_id -auto_test_local ta_l 1 -auto_test_local ta_l2#P#pt2 1 -SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 2 -Spider_mon_table_cache_version_req 2 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 - -recovery test -ALTER TABLE ta_l2 -PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 2 -SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); -spider_copy_tables('ta_l2#P#pt2', '0', '1') -1 -ALTER TABLE ta_l2 -PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(8, 'g', '2011-05-05 21:33:30'), -(9, 'h', '2011-05-05 22:32:10'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 -8 g 2011-05-05 21:33:30 -9 h 2011-05-05 22:32:10 -DROP TABLE ta_l2; - active standby test create table test +connection master_1; DROP TABLE IF EXISTS ta_l; CREATE TABLE ta_l ( a INT, @@ -260,6 +170,7 @@ INSERT INTO ta_l (a, b, c) VALUES (5, 'c', '2001-12-31 23:59:59'); select test +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-01 10:21:39 @@ -269,9 +180,10 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 5 c 2001-12-31 23:59:59 fail-over test +connection master_1; SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; Variable_name Value -Spider_mon_table_cache_version 2 +Spider_mon_table_cache_version 1 Spider_mon_table_cache_version_req 2 INSERT INTO ta_l (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); @@ -284,7 +196,6 @@ auto_test_local ta_l 1 1 SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; db_name table_name link_id auto_test_local ta_l 1 -auto_test_local ta_l2#P#pt2 1 auto_test_local ta_l 0 SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; Variable_name Value @@ -297,6 +208,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 6 e 2011-05-05 20:04:05 recovery test +connection master_1; ALTER TABLE ta_l CONNECTION='host "localhost", user "root", password "", msi "5", mkd "2", alc "1", @@ -312,102 +224,25 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 8 g 2011-05-05 21:33:30 DROP TABLE ta_l; +connection master_1; SELECT spider_flush_table_mon_cache(); spider_flush_table_mon_cache() 1 -create table with partition test -DROP TABLE IF EXISTS ta_l2; -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1 -INSERT INTO ta_l2 (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -select test -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -fail-over test -SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 2 -Spider_mon_table_cache_version_req 3 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -ERROR HY000: Table 'auto_test_remote.ta_r2' get a problem -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 3 -auto_test_local ta_l2#P#pt2 1 1 -SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -db_name table_name link_id -auto_test_local ta_l 1 -auto_test_local ta_l2#P#pt2 1 -auto_test_local ta_l 0 -auto_test_local ta_l2#P#pt2 0 -SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 3 -Spider_mon_table_cache_version_req 3 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -3 e 2007-06-04 20:03:11 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 - -recovery test -ALTER TABLE ta_l2 -PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(8, 'g', '2011-05-05 21:33:30'), -(9, 'h', '2011-05-05 22:32:10'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -3 e 2007-06-04 20:03:11 -5 c 2001-12-31 23:59:59 -8 g 2011-05-05 21:33:30 -9 h 2011-05-05 22:32:10 -DROP TABLE ta_l2; - deinit +connection master_1; DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; +connection child2_3; DROP DATABASE IF EXISTS auto_test_remote3; +connection child3_1; DROP DATABASE IF EXISTS auto_test_local; +connection child3_2; DROP DATABASE IF EXISTS auto_test_local; +connection child3_3; DROP DATABASE IF EXISTS auto_test_local; for master_1 for child2 diff --git a/storage/spider/mysql-test/spider/handler/r/ha_part.result b/storage/spider/mysql-test/spider/handler/r/ha_part.result new file mode 100644 index 00000000000..315f37298bc --- /dev/null +++ b/storage/spider/mysql-test/spider/handler/r/ha_part.result @@ -0,0 +1,286 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; +connection child2_3; +DROP DATABASE IF EXISTS auto_test_remote3; +CREATE DATABASE auto_test_remote3; +USE auto_test_remote3; +connection child3_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child3_2; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child3_3; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +create table with partition test +connection master_1; +DROP TABLE IF EXISTS ta_l2; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1 +INSERT INTO ta_l2 (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); + +select test +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +fail-over test +connection master_1; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 0 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +ERROR HY000: Table 'auto_test_remote3.ta_r4' get a problem +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 3 +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +db_name table_name link_id +auto_test_local ta_l2#P#pt2 1 +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 +6 e 2011-05-05 20:04:05 + +recovery test +connection master_1; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 2 +SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); +spider_copy_tables('ta_l2#P#pt2', '0', '1') +1 +connection master_1; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(8, 'g', '2011-05-05 21:33:30'), +(9, 'h', '2011-05-05 22:32:10'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 +6 e 2011-05-05 20:04:05 +8 g 2011-05-05 21:33:30 +9 h 2011-05-05 22:32:10 +DROP TABLE ta_l2; + +create table with partition test +connection master_1; +DROP TABLE IF EXISTS ta_l2; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1 +INSERT INTO ta_l2 (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); + +select test +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +fail-over test +connection master_1; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +ERROR HY000: Table 'auto_test_remote.ta_r2' get a problem +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 3 +auto_test_local ta_l2#P#pt2 1 1 +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +db_name table_name link_id +auto_test_local ta_l2#P#pt2 1 +auto_test_local ta_l2#P#pt2 0 +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +3 e 2007-06-04 20:03:11 +5 c 2001-12-31 23:59:59 +6 e 2011-05-05 20:04:05 + +recovery test +connection master_1; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(8, 'g', '2011-05-05 21:33:30'), +(9, 'h', '2011-05-05 22:32:10'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 10:21:39 +3 e 2007-06-04 20:03:11 +5 c 2001-12-31 23:59:59 +8 g 2011-05-05 21:33:30 +9 h 2011-05-05 22:32:10 +DROP TABLE ta_l2; + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +connection child2_3; +DROP DATABASE IF EXISTS auto_test_remote3; +connection child3_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child3_2; +DROP DATABASE IF EXISTS auto_test_local; +connection child3_3; +DROP DATABASE IF EXISTS auto_test_local; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result b/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result index 6de174e1a2d..9a8a59153f0 100644 --- a/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result +++ b/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result @@ -10,26 +10,34 @@ child3_3 for slave1_1 drop and create databases +connection master_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection slave1_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; test select 1 +connection master_1; SELECT 1; 1 1 3.1 auto_increment +connection master_1; +connection slave1_1; +connection master_1; DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, @@ -198,6 +206,7 @@ LAST_INSERT_ID() SELECT MAX(id) FROM t2; MAX(id) 46 +connection slave1_1; SELECT id FROM t1 ORDER BY id; id 2 @@ -206,188 +215,16 @@ id 1554 2331 10000 -auto_increment with partition -DROP TABLE IF EXISTS t1, t2; -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 -CREATE TABLE t2 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 -MASTER_1_AUTO_INCREMENT_INCREMENT2 -MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', -'srv "s_2_1"') -1 -spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', -'srv "s_2_2"') -1 -spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', -'srv "s_2_1"') -1 -spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', -'srv "s_2_2"') -1 -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1 -CREATE TABLE t2 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2 -SELECT MAX(id) FROM t1; -MAX(id) -2 -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3 -SELECT MAX(id) FROM t2; -MAX(id) -3 -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -7 -SELECT MAX(id) FROM t1; -MAX(id) -7 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6 -SELECT MAX(id) FROM t2; -MAX(id) -7 -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -10 -SELECT id FROM t1 ORDER BY id; -id -2 -3 -6 -7 -10 -11 -14 -15 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -18 -SELECT id FROM t2 ORDER BY id; -id -2 -3 -6 -7 -10 -11 -14 -15 -18 -19 -22 -23 -TRUNCATE TABLE t1; -TRUNCATE TABLE t2; -INSERT INTO t1 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2 -SELECT id FROM t1 ORDER BY id; -id -2 -3 -6 -7 -INSERT INTO t2 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -10 -SELECT id FROM t2 ORDER BY id; -id -2 -3 -6 -7 -10 -11 -14 -15 -SET INSERT_ID=5000; -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -18 -SELECT MAX(id) FROM t1; -MAX(id) -18 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -19 -SELECT MAX(id) FROM t2; -MAX(id) -19 -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -22 -SELECT MAX(id) FROM t1; -MAX(id) -22 -INSERT INTO t2 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -26 -SELECT MAX(id) FROM t2; -MAX(id) -26 -SELECT id FROM t1 ORDER BY id; -id -2 -18 -777 -1554 -2331 -10000 +connection master_1; deinit +connection master_1; DROP DATABASE IF EXISTS auto_test_local; +connection slave1_1; DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; for slave1_1 for master_1 diff --git a/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result new file mode 100644 index 00000000000..f8747cff5ea --- /dev/null +++ b/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result @@ -0,0 +1,238 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for slave1_1 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection slave1_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +connection master_1; +SELECT 1; +1 +1 +auto_increment with partition +connection master_1; +connection slave1_1; +connection master_1; +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 +MASTER_1_AUTO_INCREMENT_INCREMENT2 +MASTER_1_AUTO_INCREMENT_OFFSET2 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_1"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_2"') +1 +spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', +'srv "s_2_1"') +1 +spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', +'srv "s_2_2"') +1 +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1 +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3 +SELECT MAX(id) FROM t1; +MAX(id) +3 +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +7 +SELECT MAX(id) FROM t2; +MAX(id) +7 +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2 +SELECT MAX(id) FROM t1; +MAX(id) +7 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6 +SELECT MAX(id) FROM t2; +MAX(id) +7 +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +10 +SELECT id FROM t1 ORDER BY id; +id +2 +3 +6 +7 +10 +11 +14 +15 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +18 +SELECT id FROM t2 ORDER BY id; +id +2 +3 +6 +7 +10 +11 +14 +15 +18 +19 +22 +23 +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +INSERT INTO t1 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2 +SELECT id FROM t1 ORDER BY id; +id +2 +3 +6 +7 +INSERT INTO t2 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +10 +SELECT id FROM t2 ORDER BY id; +id +2 +3 +6 +7 +10 +11 +14 +15 +SET INSERT_ID=5000; +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +18 +SELECT MAX(id) FROM t1; +MAX(id) +18 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +19 +SELECT MAX(id) FROM t2; +MAX(id) +19 +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +22 +SELECT MAX(id) FROM t1; +MAX(id) +22 +INSERT INTO t2 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +26 +SELECT MAX(id) FROM t2; +MAX(id) +26 +connection slave1_1; +SELECT id FROM t1 ORDER BY id; +id +2 +18 +777 +1554 +2331 +10000 +connection master_1; + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection slave1_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +for slave1_1 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/handler/r/spider_fixes.result b/storage/spider/mysql-test/spider/handler/r/spider_fixes.result index 9fd24bcc43f..9b14817eee4 100644 --- a/storage/spider/mysql-test/spider/handler/r/spider_fixes.result +++ b/storage/spider/mysql-test/spider/handler/r/spider_fixes.result @@ -10,25 +10,31 @@ child3_3 for slave1_1 drop and create databases +connection master_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection slave1_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; test select 1 +connection master_1; SELECT 1; 1 1 create table and insert +connection master_1; DROP TABLE IF EXISTS tb_l; CREATE TABLE tb_l ( a INT, @@ -50,6 +56,7 @@ INSERT INTO ta_l SELECT a, b, c FROM tb_l; 2.13 select table with "order by desc" and "<" +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a < 5 ORDER BY a DESC LIMIT 3; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -58,6 +65,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 2 b 2000-01-01 00:00:00 select table with "order by desc" and "<=" +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a <= 5 ORDER BY a DESC LIMIT 3; a b date_format(c, '%Y-%m-%d %H:%i:%s') @@ -67,7 +75,9 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 2.14 update table with range scan and split_read +connection master_1; UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-01 10:21:39 @@ -80,6 +90,7 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') select table with range scan TRUNCATE TABLE ta_l; DROP TABLE IF EXISTS ta_l; +connection master_1; CREATE TABLE ta_l ( a int(11) NOT NULL DEFAULT '0', b char(1) DEFAULT NULL, @@ -87,50 +98,62 @@ c datetime DEFAULT NULL, PRIMARY KEY (a, b, c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1 INSERT INTO ta_l SELECT a, b, c FROM tb_l; +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' AND c = '2003-11-30 05:01:03'; a b c 4 d 2003-11-30 05:01:03 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' AND c = '2003-11-30 05:01:03'; a b c 4 d 2003-11-30 05:01:03 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd' AND c = '2003-11-30 05:01:03'; a b c 4 d 2003-11-30 05:01:03 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c' AND c = '2001-12-31 23:59:59'; a b c 5 c 2001-12-31 23:59:59 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd' AND c = '2003-11-30 05:01:03'; a b c 4 d 2003-11-30 05:01:03 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e' AND c = '2003-11-30 05:01:03'; a b c 4 d 2003-11-30 05:01:03 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b' AND c = '2000-01-01 00:00:00'; a b c 2 b 2000-01-01 00:00:00 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b' AND c = '2000-01-01 00:00:00'; a b c 2 b 2000-01-01 00:00:00 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' AND b <= 'd' AND c = '2003-11-30 05:01:03'; a b c 4 d 2003-11-30 05:01:03 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' AND b < 'e' AND c = '2003-11-30 05:01:03'; a b c 4 d 2003-11-30 05:01:03 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1 AND b >= 'b' AND c = '2003-11-30 05:01:03'; a b c 4 d 2003-11-30 05:01:03 +connection master_1; SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1 AND b >= 'b' AND c = '2000-01-01 00:00:00'; a b c @@ -138,6 +161,7 @@ a b c 2.16 auto_increment insert with trigger +connection master_1; CREATE TABLE ta_l_auto_inc ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', @@ -151,14 +175,17 @@ c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2 CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;; +connection master_1; INSERT INTO ta_l_auto_inc (a, b, c) VALUES (NULL, 's', '2008-12-31 20:59:59'); +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 s 2008-12-31 20:59:59 2.17 engine-condition-pushdown with "or" and joining +connection master_1; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l); a b date_format(c, '%Y-%m-%d %H:%i:%s') 1 a 2008-08-01 10:21:39 @@ -166,37 +193,10 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 3 e 2007-06-04 20:03:11 4 d 2003-11-30 05:01:03 5 c 2001-12-31 23:59:59 -partition with sort -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1 -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 2.23 -partition update with moving partition -DROP TABLE IF EXISTS ta_l2; -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00'); -UPDATE ta_l2 SET a = 4 WHERE a = 3; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -4 B 2010-09-26 00:00:00 index merge +connection master_1; CREATE TABLE ta_l_int ( a INT AUTO_INCREMENT, b INT DEFAULT 10, @@ -210,27 +210,7 @@ INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; -SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) -WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; -a b c -3 4 5 -4 5 6 -5 6 7 -index merge with partition -DROP TABLE IF EXISTS ta_l_int; -CREATE TABLE ta_l_int ( -a INT AUTO_INCREMENT, -b INT DEFAULT 10, -c INT DEFAULT 11, -PRIMARY KEY(a), -KEY idx1(b), -KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1 -INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); -INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; +connection master_1; SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; a b c @@ -240,6 +220,7 @@ a b c 2.24 index scan update without PK +connection master_1; DROP TABLE IF EXISTS ta_l_int; CREATE TABLE ta_l_int ( a INT NOT NULL, @@ -250,32 +231,51 @@ KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 SELECT a, b, c FROM ta_l_int ORDER BY a; a b c +1 2 3 2 3 4 +3 4 5 4 5 6 +5 6 7 6 7 8 +7 8 9 8 9 10 +9 10 11 10 11 12 +11 12 13 12 13 14 +13 14 15 14 15 16 +15 16 17 16 17 18 INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); -INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); +INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3); +connection master_1; UPDATE ta_l_int SET c = 4 WHERE b = 2; +connection master_1; SELECT a, b, c FROM ta_l_int ORDER BY a; a b c 1 2 4 2 3 4 +3 4 5 4 5 6 +5 6 7 6 7 8 +7 8 9 8 9 10 +9 10 11 10 11 12 +11 12 13 12 13 14 +13 14 15 14 15 16 +15 16 17 16 17 18 17 2 4 +18 2 4 2.25 direct order limit +connection master_1; SHOW STATUS LIKE 'Spider_direct_order_limit'; Variable_name Value Spider_direct_order_limit 2 @@ -283,13 +283,14 @@ SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; a b c 1 2 4 2 3 4 -4 5 6 +3 4 5 SHOW STATUS LIKE 'Spider_direct_order_limit'; Variable_name Value Spider_direct_order_limit 3 2.26 lock tables +connection master_1; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; CREATE TABLE t1 ( @@ -304,6 +305,9 @@ LOCK TABLES t1 READ, t2 READ; UNLOCK TABLES; auto_increment +connection master_1; +connection slave1_1; +connection master_1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, @@ -395,6 +399,7 @@ LAST_INSERT_ID() SELECT MAX(id) FROM t1; MAX(id) 42 +connection slave1_1; SELECT id FROM t1 ORDER BY id; id 2 @@ -408,114 +413,10 @@ id 1554 2331 10000 - -auto_increment with partition -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 -MASTER_1_AUTO_INCREMENT_INCREMENT2 -MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', -'srv "s_2_1"') -1 -spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', -'srv "s_2_2"') -1 -spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', -'srv "s_2_1"') -1 -spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', -'srv "s_2_2"') -1 -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2 -SELECT MAX(id) FROM t1; -MAX(id) -2 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3 -SELECT MAX(id) FROM t1; -MAX(id) -3 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6 -SELECT MAX(id) FROM t1; -MAX(id) -6 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -7 -SELECT MAX(id) FROM t1; -MAX(id) -7 -INSERT INTO t1 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -10 -SELECT id FROM t1 ORDER BY id; -id -2 -3 -6 -7 -10 -11 -14 -15 -SET INSERT_ID=5000; -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -18 -SELECT MAX(id) FROM t1; -MAX(id) -18 -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -22 -SELECT MAX(id) FROM t1; -MAX(id) -22 -INSERT INTO t1 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -26 -SELECT MAX(id) FROM t1; -MAX(id) -26 -SELECT id FROM t1 ORDER BY id; -id -2 -3 -6 -7 -10 -18 -777 -1000 -1554 -2331 -10000 +connection master_1; read only +connection master_1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( id int(11) NOT NULL, @@ -530,6 +431,10 @@ id 18 22 26 +30 +34 +38 +42 INSERT INTO t1 (id) VALUES (1); ERROR HY000: Table 'auto_test_local.t1' is read only UPDATE t1 SET id = 4 WHERE id = 2; @@ -543,6 +448,7 @@ ERROR HY000: Table 'auto_test_local.t1' is read only 2.27 error mode +connection master_1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( id int(11) NOT NULL, @@ -566,6 +472,7 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist 3.0 is null +connection master_1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a VARCHAR(255), @@ -588,6 +495,7 @@ insert into t1 select a + 128, b + 128, c + 128 from t1; insert into t1 select a + 256, b + 256, c + 256 from t1; insert into t1 select a + 512, b + 512, c + 512 from t1; flush tables; +connection master_1; select a from t1 where a is null order by a limit 30; a NULL @@ -654,6 +562,7 @@ NULL NULL direct_order_limit +connection master_1; TRUNCATE TABLE t1; insert into t1 values ('1', '1', '1'); insert into t1 select a + 1, b + 1, c + 1 from t1; @@ -665,6 +574,7 @@ insert into t1 select a, b + 32, c + 32 from t1; insert into t1 select a, b + 64, c + 64 from t1; insert into t1 select a, b + 128, c + 128 from t1; flush tables; +connection master_1; select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5; a b c 10 74 74 @@ -681,9 +591,13 @@ a c 10 170 deinit +connection master_1; DROP DATABASE IF EXISTS auto_test_local; +connection slave1_1; DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; for slave1_1 for master_1 diff --git a/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result new file mode 100644 index 00000000000..c99c02071b6 --- /dev/null +++ b/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result @@ -0,0 +1,241 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for slave1_1 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection slave1_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +CREATE DATABASE auto_test_remote2; +USE auto_test_remote2; + +test select 1 +connection master_1; +SELECT 1; +1 +1 +connection master_1; +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +INSERT INTO tb_l (a, b, c) VALUES +(1, 'a', '2008-08-01 10:21:39'), +(2, 'b', '2000-01-01 00:00:00'), +(3, 'e', '2007-06-04 20:03:11'), +(4, 'd', '2003-11-30 05:01:03'), +(5, 'c', '2001-12-31 23:59:59'); + +2.17 +partition with sort +connection master_1; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 +INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1 +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 20:03:11 +4 d 2003-11-30 05:01:03 +5 c 2001-12-31 23:59:59 + +2.23 +partition update with moving partition +connection master_1; +DROP TABLE IF EXISTS ta_l2; +connection master_1; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 +INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00'); +UPDATE ta_l2 SET a = 4 WHERE a = 3; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +4 B 2010-09-26 00:00:00 +index merge with partition +connection master_1; +DROP TABLE IF EXISTS ta_l_int; +connection master_1; +CREATE TABLE ta_l_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1 +INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); +INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; +connection master_1; +SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) +WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; +a b c +3 4 5 +4 5 6 +5 6 7 + +2.26 +auto_increment with partition +connection master_1; +connection slave1_1; +connection master_1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 +MASTER_1_AUTO_INCREMENT_INCREMENT2 +MASTER_1_AUTO_INCREMENT_OFFSET2 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_1"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_2"') +1 +spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', +'srv "s_2_1"') +1 +spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', +'srv "s_2_2"') +1 +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3 +SELECT MAX(id) FROM t1; +MAX(id) +3 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2 +SELECT MAX(id) FROM t1; +MAX(id) +3 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +7 +SELECT MAX(id) FROM t1; +MAX(id) +7 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6 +SELECT MAX(id) FROM t1; +MAX(id) +7 +INSERT INTO t1 () VALUES (),(),(),(); +Warnings: +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +10 +SELECT id FROM t1 ORDER BY id; +id +2 +3 +6 +7 +10 +11 +14 +15 +SET INSERT_ID=5000; +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +18 +SELECT MAX(id) FROM t1; +MAX(id) +18 +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +22 +SELECT MAX(id) FROM t1; +MAX(id) +22 +INSERT INTO t1 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +26 +SELECT MAX(id) FROM t1; +MAX(id) +26 +connection slave1_1; +SELECT id FROM t1 ORDER BY id; +id +2 +3 +6 +7 +10 +18 +777 +1000 +1554 +2331 +10000 +connection master_1; + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection slave1_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; +DROP DATABASE IF EXISTS auto_test_remote2; +for slave1_1 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/handler/r/vp_fixes.result b/storage/spider/mysql-test/spider/handler/r/vp_fixes.result index 15dd29aa4d3..cc0e4105d61 100644 --- a/storage/spider/mysql-test/spider/handler/r/vp_fixes.result +++ b/storage/spider/mysql-test/spider/handler/r/vp_fixes.result @@ -9,22 +9,27 @@ child3_2 child3_3 drop and create databases +connection master_1; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; test select 1 +connection master_1; SELECT 1; 1 1 create table and insert +connection master_1; DROP TABLE IF EXISTS tb_l; CREATE TABLE tb_l ( a INT, @@ -46,26 +51,34 @@ INSERT INTO ta_l SELECT a, b, c FROM tb_l; 0.9 create different primary key table +connection master_1; CREATE TABLE ta_l_int ( a INT DEFAULT 10, b INT AUTO_INCREMENT, c INT DEFAULT 11, PRIMARY KEY(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 +connection master_1; INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); create un-correspond primary key table +connection master_1; DROP TABLE IF EXISTS ta_l_int; +connection master_1; CREATE TABLE ta_l_int ( a INT DEFAULT 10, b INT DEFAULT 12, c INT DEFAULT 11, PRIMARY KEY(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 +connection master_1; INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); deinit +connection master_1; DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; DROP DATABASE IF EXISTS auto_test_remote; +connection child2_2; DROP DATABASE IF EXISTS auto_test_remote2; for master_1 for child2 diff --git a/storage/spider/mysql-test/spider/handler/suite.opt b/storage/spider/mysql-test/spider/handler/suite.opt new file mode 100644 index 00000000000..48457b17309 --- /dev/null +++ b/storage/spider/mysql-test/spider/handler/suite.opt @@ -0,0 +1 @@ +--loose-innodb diff --git a/storage/spider/mysql-test/spider/handler/suite.pm b/storage/spider/mysql-test/spider/handler/suite.pm new file mode 100644 index 00000000000..f106147deb6 --- /dev/null +++ b/storage/spider/mysql-test/spider/handler/suite.pm @@ -0,0 +1,12 @@ +package My::Suite::Spider; + +@ISA = qw(My::Suite); + +return "No Spider engine" unless $ENV{HA_SPIDER_SO}; +return "Not run for embedded server" if $::opt_embedded_server; +return "Test needs --big-test" unless $::opt_big_test; + +sub is_default { 1 } + +bless { }; + From c436338d9d535aac7692d27ec1dc068e9ce6c9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Jun 2017 18:51:51 +0300 Subject: [PATCH 40/53] Assert that DB_TRX_ID must be set on delete-marked records This is preparation for MDEV-12288, which would set DB_TRX_ID=0 when purging history. Also with that change in place, delete-marked records must always refer to an undo log record via a nonzero DB_TRX_ID column. (The DB_TRX_ID is only present in clustered index leaf page records.) btr_cur_parse_del_mark_set_clust_rec(), rec_get_trx_id(): Statically allocate the offsets (should never use the heap). Add some debug assertions. Replace some use of rec_get_trx_id() with row_get_rec_trx_id(). trx_undo_report_row_operation(): Add some sanity checks that are common for all operations that produce undo log. --- storage/innobase/btr/btr0cur.cc | 58 ++++++++++++++++++++++-------- storage/innobase/include/rem0rec.h | 10 +++--- storage/innobase/page/page0zip.cc | 4 +++ storage/innobase/rem/rem0rec.cc | 19 +++++----- storage/innobase/row/row0ins.cc | 13 ++++++- storage/innobase/row/row0merge.cc | 16 +++++++-- storage/innobase/row/row0purge.cc | 3 ++ storage/innobase/row/row0sel.cc | 15 ++++++++ storage/innobase/row/row0uins.cc | 17 +++++---- storage/innobase/row/row0umod.cc | 9 +++-- storage/innobase/row/row0upd.cc | 3 +- storage/innobase/trx/trx0rec.cc | 9 +++++ 12 files changed, 130 insertions(+), 46 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 3bef25e945c..a672f451ea9 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3679,6 +3679,11 @@ btr_cur_update_in_place( was_delete_marked = rec_get_deleted_flag( rec, page_is_comp(buf_block_get_frame(block))); + /* In delete-marked records, DB_TRX_ID must always refer to an + existing undo log record. */ + ut_ad(!was_delete_marked + || !dict_index_is_clust(index) + || row_get_rec_trx_id(rec, index, offsets)); #ifdef BTR_CUR_HASH_ADAPT if (block->index) { @@ -4321,6 +4326,10 @@ btr_cur_pessimistic_update( stored fields */ btr_cur_unmark_extern_fields( page_zip, rec, index, *offsets, mtr); + } else { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(row_get_rec_trx_id(rec, index, *offsets)); } bool adjust = big_rec_vec && (flags & BTR_KEEP_POS_FLAG); @@ -4448,6 +4457,10 @@ btr_cur_pessimistic_update( btr_cur_unmark_extern_fields(page_zip, rec, index, *offsets, mtr); + } else { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(row_get_rec_trx_id(rec, index, *offsets)); } if (!dict_table_is_locking_disabled(index->table)) { @@ -4573,6 +4586,10 @@ btr_cur_parse_del_mark_set_clust_rec( ut_a(offset <= UNIV_PAGE_SIZE); + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(trx_id || (flags & BTR_KEEP_SYS_FLAG)); + if (page) { rec = page + offset; @@ -4582,20 +4599,33 @@ btr_cur_parse_del_mark_set_clust_rec( and the adaptive hash index does not depend on them. */ btr_rec_set_deleted_flag(rec, page_zip, val); + ut_ad(pos <= MAX_REF_PARTS); + + ulint offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; + rec_offs_init(offsets); + mem_heap_t* heap = NULL; if (!(flags & BTR_KEEP_SYS_FLAG)) { - mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - rec_offs_init(offsets_); - row_upd_rec_sys_fields_in_recovery( rec, page_zip, - rec_get_offsets(rec, index, offsets_, - ULINT_UNDEFINED, &heap), + rec_get_offsets(rec, index, offsets, + pos + 1, &heap), pos, trx_id, roll_ptr); - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } + } else { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(memcmp(rec_get_nth_field( + rec, + rec_get_offsets(rec, index, + offsets, pos, + &heap), + pos, &offset), + field_ref_zero, DATA_TRX_ID_LEN)); + ut_ad(offset == DATA_TRX_ID_LEN); + } + + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); } } @@ -4633,8 +4663,10 @@ btr_cur_del_mark_set_clust_rec( ut_ad(mtr->is_named_space(index->space)); if (rec_get_deleted_flag(rec, rec_offs_comp(offsets))) { - /* While cascading delete operations, this becomes possible. */ - ut_ad(rec_get_trx_id(rec, index) == thr_get_trx(thr)->id); + /* We may already have delete-marked this record + when executing an ON DELETE CASCADE operation. */ + ut_ad(row_get_rec_trx_id(rec, index, offsets) + == thr_get_trx(thr)->id); return(DB_SUCCESS); } @@ -4663,10 +4695,6 @@ btr_cur_del_mark_set_clust_rec( btr_rec_set_deleted_flag(rec, page_zip, TRUE); trx = thr_get_trx(thr); - /* This function must not be invoked during rollback - (of a TRX_STATE_PREPARE transaction or otherwise). */ - ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); - ut_ad(!trx->in_rollback); DBUG_LOG("ib_cur", "delete-mark clust " << index->table->name diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index 916222d5fdb..96d3bdfab8f 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -1080,14 +1080,14 @@ private: # endif /* !DBUG_OFF */ # ifdef UNIV_DEBUG -/************************************************************//** -Reads the DB_TRX_ID of a clustered index record. +/** Read the DB_TRX_ID of a clustered index record. +@param[in] rec clustered index record +@param[in] index clustered index @return the value of DB_TRX_ID */ trx_id_t rec_get_trx_id( -/*===========*/ - const rec_t* rec, /*!< in: record */ - const dict_index_t* index) /*!< in: clustered index */ + const rec_t* rec, + const dict_index_t* index) MY_ATTRIBUTE((nonnull, warn_unused_result)); # endif /* UNIV_DEBUG */ diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 59022dbe301..f556c887520 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -3711,6 +3711,10 @@ page_zip_write_rec( ut_a(slot); /* Copy the delete mark. */ if (rec_get_deleted_flag(rec, TRUE)) { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(!dict_index_is_clust(index) + || row_get_rec_trx_id(rec, index, offsets)); *slot |= PAGE_ZIP_DIR_SLOT_DEL >> 8; } else { *slot &= ~(PAGE_ZIP_DIR_SLOT_DEL >> 8); diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index c78df489179..b7d7a30f4dc 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -2104,8 +2104,6 @@ rec_print_mbr_rec( rec_validate(rec, offsets); } -/***************************************************************//** -Prints a physical record. */ /***************************************************************//** Prints a physical record. */ void @@ -2254,14 +2252,14 @@ operator<<(std::ostream& o, const rec_offsets_print& r) } #ifdef UNIV_DEBUG -/************************************************************//** -Reads the DB_TRX_ID of a clustered index record. +/** Read the DB_TRX_ID of a clustered index record. +@param[in] rec clustered index record +@param[in] index clustered index @return the value of DB_TRX_ID */ trx_id_t rec_get_trx_id( -/*===========*/ - const rec_t* rec, /*!< in: record */ - const dict_index_t* index) /*!< in: clustered index */ + const rec_t* rec, + const dict_index_t* index) { const page_t* page = page_align(rec); @@ -2270,10 +2268,11 @@ rec_get_trx_id( const byte* trx_id; ulint len; mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; + ulint offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; rec_offs_init(offsets_); + ulint* offsets = offsets_; + ut_ad(trx_id_col <= MAX_REF_PARTS); ut_ad(fil_page_index_page_check(page)); ut_ad(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID) == index->id); @@ -2287,7 +2286,7 @@ rec_get_trx_id( ut_ad(len == DATA_TRX_ID_LEN); - if (heap) { + if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 4d13051c985..439b253e80d 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -346,6 +346,9 @@ row_ins_clust_index_entry_by_modify( ut_ad(rec_get_deleted_flag(rec, dict_table_is_comp(cursor->index->table))); + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(rec_get_trx_id(rec, cursor->index)); /* Build an update vector containing all the fields to be modified; NOTE that this vector may NOT contain system columns trx_id or @@ -1266,6 +1269,9 @@ row_ins_foreign_check_on_constraint( } if (rec_get_deleted_flag(clust_rec, dict_table_is_comp(table))) { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(rec_get_trx_id(clust_rec, clust_index)); /* This can happen if there is a circular reference of rows such that cascading delete comes to delete a row already in the process of being delete marked */ @@ -1274,7 +1280,6 @@ row_ins_foreign_check_on_constraint( goto nonstandard_exit_func; } - if (table->fts) { doc_id = fts_get_doc_id_from_rec(table, clust_rec, clust_index, tmp_heap); @@ -1758,6 +1763,12 @@ row_ins_check_foreign_constraint( if (rec_get_deleted_flag(rec, rec_offs_comp(offsets))) { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(!dict_index_is_clust(check_index) + || row_get_rec_trx_id(rec, check_index, + offsets)); + err = row_ins_set_shared_rec_lock( lock_type, block, rec, check_index, offsets, thr); diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index ea332adfdc3..4250634baec 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2130,10 +2130,10 @@ end_of_index: rec = page_cur_get_rec(cur); - offsets = rec_get_offsets(rec, clust_index, NULL, - ULINT_UNDEFINED, &row_heap); - if (online) { + offsets = rec_get_offsets(rec, clust_index, NULL, + ULINT_UNDEFINED, &row_heap); + /* Perform a REPEATABLE READ. When rebuilding the table online, @@ -2176,6 +2176,10 @@ end_of_index: if (rec_get_deleted_flag( rec, dict_table_is_comp(old_table))) { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(row_get_rec_trx_id(rec, clust_index, + offsets)); /* This record was deleted in the latest committed version, or it was deleted and then reinserted-by-update before purge @@ -2186,6 +2190,9 @@ end_of_index: ut_ad(!rec_offs_any_null_extern(rec, offsets)); } else if (rec_get_deleted_flag( rec, dict_table_is_comp(old_table))) { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(rec_get_trx_id(rec, clust_index)); /* Skip delete-marked records. Skipping delete-marked records will make the @@ -2195,6 +2202,9 @@ end_of_index: would make it tricky to detect duplicate keys. */ continue; + } else { + offsets = rec_get_offsets(rec, clust_index, NULL, + ULINT_UNDEFINED, &row_heap); } /* When !online, we are holding a lock on old_table, preventing diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 86a9e1259ac..cecd127e71e 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -160,6 +160,9 @@ row_purge_remove_clust_if_poss_low( } ut_ad(rec_get_deleted_flag(rec, rec_offs_comp(offsets))); + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(row_get_rec_trx_id(rec, index, offsets)); if (mode == BTR_MODIFY_LEAF) { success = btr_cur_optimistic_delete( diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 52af4bd1828..a8f250bf6dd 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -183,6 +183,9 @@ row_sel_sec_rec_is_for_clust_rec( if (rec_get_deleted_flag(clust_rec, dict_table_is_comp(clust_index->table))) { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(rec_get_trx_id(clust_rec, clust_index)); /* The clustered index record is delete-marked; it is not visible in the read view. Besides, @@ -2042,6 +2045,11 @@ skip_lock: if (rec_get_deleted_flag(clust_rec, dict_table_is_comp(plan->table))) { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing update_undo log record. */ + ut_ad(rec_get_trx_id(clust_rec, + dict_table_get_first_index( + plan->table))); /* The record is delete marked: we can skip it */ @@ -3934,6 +3942,9 @@ row_sel_try_search_shortcut_for_mysql( } if (rec_get_deleted_flag(rec, dict_table_is_comp(index->table))) { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(row_get_rec_trx_id(rec, index, *offsets)); return(SEL_EXHAUSTED); } @@ -5119,6 +5130,10 @@ locks_ok: page_rec_is_comp() cannot be used! */ if (rec_get_deleted_flag(rec, comp)) { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing undo log record. */ + ut_ad(index != clust_index + || row_get_rec_trx_id(rec, index, offsets)); /* The record is delete-marked: we can skip it */ diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc index 934b5ad5a7a..ef0c3ed9cc3 100644 --- a/storage/innobase/row/row0uins.cc +++ b/storage/innobase/row/row0uins.cc @@ -230,6 +230,14 @@ row_undo_ins_remove_sec_low( case ROW_NOT_FOUND: goto func_exit; case ROW_FOUND: + if (dict_index_is_spatial(index) + && rec_get_deleted_flag( + btr_pcur_get_rec(&pcur), + dict_table_is_comp(index->table))) { + ib::error() << "Record found in index " << index->name + << " is deleted marked on insert rollback."; + ut_ad(0); + } break; case ROW_BUFFERED: @@ -240,15 +248,6 @@ row_undo_ins_remove_sec_low( ut_error; } - if (search_result == ROW_FOUND && dict_index_is_spatial(index)) { - rec_t* rec = btr_pcur_get_rec(&pcur); - if (rec_get_deleted_flag(rec, - dict_table_is_comp(index->table))) { - ib::error() << "Record found in index " << index->name - << " is deleted marked on insert rollback."; - } - } - btr_cur = btr_pcur_get_btr_cur(&pcur); if (modify_leaf) { diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index 8fa5c2ccbff..a0c69fb97f9 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -215,6 +215,9 @@ row_undo_mod_remove_clust_low( than the rolling-back one. */ ut_ad(rec_get_deleted_flag(btr_cur_get_rec(btr_cur), dict_table_is_comp(node->table))); + /* In delete-marked records, DB_TRX_ID must + always refer to an existing update_undo log record. */ + ut_ad(rec_get_trx_id(btr_cur_get_rec(btr_cur), btr_cur->index)); if (mode == BTR_MODIFY_LEAF) { err = btr_cur_optimistic_delete(btr_cur, 0, mtr) @@ -350,8 +353,9 @@ row_undo_mod_clust( * it can be reallocated at any time after this mtr-commits * which is just below */ - ut_ad(srv_immediate_scrub_data_uncompressed || - rec_get_trx_id(btr_pcur_get_rec(pcur), index) == node->new_trx_id); + ut_ad(srv_immediate_scrub_data_uncompressed + || row_get_rec_trx_id(btr_pcur_get_rec(pcur), index, offsets) + == node->new_trx_id); btr_pcur_commit_specify_mtr(pcur, &mtr); @@ -515,6 +519,7 @@ row_undo_mod_del_mark_or_remove_sec_low( ib::error() << "Record found in index " << index->name << " is deleted marked" " on rollback update."; + ut_ad(0); } } diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 0ca5d14084c..4f57136db0b 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -2663,7 +2663,8 @@ row_upd_clust_rec_by_insert( marked, then we are here after a DB_LOCK_WAIT. Skip delete marking clustered index and disowning its blobs. */ - ut_ad(rec_get_trx_id(rec, index) == trx->id); + ut_ad(row_get_rec_trx_id(rec, index, offsets) + == trx->id); ut_ad(!trx_undo_roll_ptr_is_insert( row_get_rec_roll_ptr(rec, index, offsets))); diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 6d3ade289bb..02aee500e02 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -906,6 +906,10 @@ trx_undo_page_report_modify( ut_ad(!rec_get_deleted_flag(rec, dict_table_is_comp(table))); type_cmpl = TRX_UNDO_DEL_MARK_REC; } else if (rec_get_deleted_flag(rec, dict_table_is_comp(table))) { + /* In delete-marked records, DB_TRX_ID must + always refer to an existing update_undo log record. */ + ut_ad(row_get_rec_trx_id(rec, index, offsets)); + type_cmpl = TRX_UNDO_UPD_DEL_REC; /* We are about to update a delete marked record. We don't typically need the prefix in this case unless @@ -1875,6 +1879,10 @@ trx_undo_report_row_operation( ut_ad(!srv_read_only_mode); trx = thr_get_trx(thr); + /* This function must not be invoked during rollback + (of a TRX_STATE_PREPARE transaction or otherwise). */ + ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); + ut_ad(!trx->in_rollback); mtr.start(); trx_undo_t** pundo; @@ -1888,6 +1896,7 @@ trx_undo_report_row_operation( pundo = &trx->rsegs.m_noredo.undo; } else { ut_ad(!trx->read_only); + ut_ad(trx->id); /* Keep INFORMATION_SCHEMA.TABLES.UPDATE_TIME up-to-date for persistent tables. Temporary tables are not listed there. */ From 96d1cdecbe438c3fc4bf5403c16909dfeed9c970 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Sat, 1 Jul 2017 14:37:12 +0400 Subject: [PATCH 41/53] MDEV-13197 Parser refactoring for CREATE VIEW,TRIGGER,SP,UDF,EVENT --- mysql-test/r/view.result | 11 ++ mysql-test/t/view.test | 16 +++ sql/sql_lex.cc | 47 +++++++ sql/sql_lex.h | 53 ++++++-- sql/sql_parse.cc | 4 +- sql/sql_prepare.cc | 4 +- sql/sql_view.cc | 24 ++-- sql/sql_yacc.yy | 279 ++++++++++++++++++-------------------- sql/sql_yacc_ora.yy | 281 ++++++++++++++++++--------------------- sql/table.h | 4 - sql/wsrep_mysqld.cc | 14 +- 11 files changed, 392 insertions(+), 345 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 37c3fe55a52..9c28636a280 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -6501,3 +6501,14 @@ DROP VIEW v; # # End of 10.2 tests # +# +# Start of 10.3 tests +# +# +# MDEV-13197 Parser refactoring for CREATE VIEW,TRIGGER,SP,UDF,EVENT +# +ALTER VIEW IF NOT EXISTS v1 AS SELECT 1; +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 'IF NOT EXISTS v1 AS SELECT 1' at line 1 +# +# End of 10.3 tests +# diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index f63290b7841..226ea06fd1f 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -6213,3 +6213,19 @@ DROP VIEW v; --echo # --echo # End of 10.2 tests --echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-13197 Parser refactoring for CREATE VIEW,TRIGGER,SP,UDF,EVENT +--echo # + +--error ER_PARSE_ERROR +ALTER VIEW IF NOT EXISTS v1 AS SELECT 1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index e982d857854..4bec1b97d47 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -689,6 +689,7 @@ void LEX::start(THD *thd_arg) curr_with_clause= 0; with_clauses_list= 0; with_clauses_list_last_next= &with_clauses_list; + create_view= NULL; value_list.empty(); update_list.empty(); set_var_list.empty(); @@ -7057,3 +7058,49 @@ bool LEX::sp_add_cfetch(THD *thd, const LEX_CSTRING *name) return true; return false; } + + +bool LEX::create_or_alter_view_finalize(THD *thd, Table_ident *table_ident) +{ + sql_command= SQLCOM_CREATE_VIEW; + /* first table in list is target VIEW name */ + if (!select_lex.add_table_to_list(thd, table_ident, NULL, + TL_OPTION_UPDATING, + TL_IGNORE, + MDL_EXCLUSIVE)) + return true; + query_tables->open_strategy= TABLE_LIST::OPEN_STUB; + return false; +} + + +bool LEX::add_alter_view(THD *thd, uint16 algorithm, + enum_view_suid suid, + Table_ident *table_ident) +{ + if (sphead) + { + my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW"); + return true; + } + if (!(create_view= new (thd->mem_root) + Create_view_info(VIEW_ALTER, algorithm, suid))) + return true; + return create_or_alter_view_finalize(thd, table_ident); +} + + +bool LEX::add_create_view(THD *thd, DDL_options_st ddl, + uint16 algorithm, enum_view_suid suid, + Table_ident *table_ident) +{ + if (set_create_options_with_check(ddl)) + return true; + if (!(create_view= new (thd->mem_root) + Create_view_info(ddl.or_replace() ? + VIEW_CREATE_OR_REPLACE : + VIEW_CREATE_NEW, + algorithm, suid))) + return true; + return create_or_alter_view_finalize(thd, table_ident); +} diff --git a/sql/sql_lex.h b/sql/sql_lex.h index f4b9e28bba8..695a397c25f 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -75,6 +75,14 @@ enum sub_select_type GLOBAL_OPTIONS_TYPE, DERIVED_TABLE_TYPE, OLAP_TYPE }; enum unit_common_op {OP_MIX, OP_UNION, OP_INTERSECT, OP_EXCEPT}; + +enum enum_view_suid +{ + VIEW_SUID_INVOKER= 0, + VIEW_SUID_DEFINER= 1, + VIEW_SUID_DEFAULT= 2 +}; + /* These may not be declared yet */ class Table_ident; class sql_exchange; @@ -98,7 +106,6 @@ struct sql_digest_state; class With_clause; class my_var; - #define ALLOC_ROOT_SET 1024 #ifdef MYSQL_SERVER @@ -239,6 +246,27 @@ enum enum_view_create_mode VIEW_CREATE_OR_REPLACE // check only that there are not such table }; + +class Create_view_info: public Sql_alloc +{ +public: + LEX_CSTRING select; // The SELECT statement of CREATE VIEW + enum enum_view_create_mode mode; + uint16 algorithm; + uint8 check; + enum enum_view_suid suid; + Create_view_info(enum_view_create_mode mode_arg, + uint16 algorithm_arg, + enum_view_suid suid_arg) + :select(null_clex_str), + mode(mode_arg), + algorithm(algorithm_arg), + check(VIEW_CHECK_NONE), + suid(suid_arg) + { } +}; + + enum enum_drop_mode { DROP_DEFAULT, // mode is not specified @@ -2607,6 +2635,8 @@ struct LEX: public Query_tables_list */ With_clause **with_clauses_list_last_next; + Create_view_info *create_view; + /* Query Plan Footprint of a currently running select */ Explain_query *explain; @@ -2630,9 +2660,6 @@ struct LEX: public Query_tables_list DYNAMIC_ARRAY plugins; plugin_ref plugins_static_buffer[INITIAL_LEX_PLUGIN_LIST_SIZE]; - /** SELECT of CREATE VIEW statement */ - LEX_CSTRING create_view_select; - uint number_of_selects; // valid only for view /** Start of 'ON table', in trigger statements. */ @@ -2759,7 +2786,6 @@ public: bool with_persistent_for_clause; // uses PERSISTENT FOR clause (in ANALYZE) }; enum enum_var_type option_type; - enum enum_view_create_mode create_view_mode; enum enum_drop_mode drop_mode; uint profile_query_id; @@ -2785,8 +2811,6 @@ public: DERIVED_SUBQUERY and DERIVED_VIEW). */ uint8 derived_tables; - uint16 create_view_algorithm; - uint8 create_view_check; uint8 context_analysis_only; bool local_file; bool check_exists; @@ -2827,10 +2851,6 @@ public: rexecuton */ bool empty_field_list_on_rset; - /* - view created to be run from definer (standard behaviour) - */ - uint8 create_view_suid; /* Characterstics of trigger being created */ st_trg_chistics trg_chistics; /* @@ -3582,6 +3602,11 @@ public: } return false; } + bool set_create_options_with_check(DDL_options_st options) + { + create_info.set(options); + return check_create_options(create_info); + } bool add_create_options_with_check(DDL_options_st options) { create_info.add(options); @@ -3613,6 +3638,12 @@ public: SELECT_LEX *exclude_last_select(); bool add_unit_in_brackets(SELECT_LEX *nselect); void check_automatic_up(enum sub_select_type type); + bool create_or_alter_view_finalize(THD *thd, Table_ident *table_ident); + bool add_alter_view(THD *thd, uint16 algorithm, enum_view_suid suid, + Table_ident *table_ident); + bool add_create_view(THD *thd, DDL_options_st ddl, + uint16 algorithm, enum_view_suid suid, + Table_ident *table_ident); }; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index bab670fd8fc..5a36574e3ea 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6033,10 +6033,10 @@ end_with_restore_list: { /* Note: SQLCOM_CREATE_VIEW also handles 'ALTER VIEW' commands - as specified through the thd->lex->create_view_mode flag. + as specified through the thd->lex->create_view->mode flag. */ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - res= mysql_create_view(thd, first_table, thd->lex->create_view_mode); + res= mysql_create_view(thd, first_table, thd->lex->create_view->mode); break; } case SQLCOM_DROP_VIEW: diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 8206e04f6c2..4d7a3d81bd6 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2072,7 +2072,7 @@ static bool mysql_test_create_view(Prepared_statement *stmt) TABLE_LIST *view= lex->unlink_first_table(&link_to_local); TABLE_LIST *tables= lex->query_tables; - if (create_view_precheck(thd, tables, view, lex->create_view_mode)) + if (create_view_precheck(thd, tables, view, lex->create_view->mode)) goto err; /* @@ -2448,7 +2448,7 @@ static bool check_prepared_statement(Prepared_statement *stmt) } break; case SQLCOM_CREATE_VIEW: - if (lex->create_view_mode == VIEW_ALTER) + if (lex->create_view->mode == VIEW_ALTER) { my_message(ER_UNSUPPORTED_PS, ER_THD(thd, ER_UNSUPPORTED_PS), MYF(0)); goto error; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index af597c48264..5e0cd57f2d9 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -225,10 +225,10 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view) view->definer.user= decoy.definer.user; lex->definer= &view->definer; } - if (lex->create_view_algorithm == VIEW_ALGORITHM_INHERIT) - lex->create_view_algorithm= (uint8) decoy.algorithm; - if (lex->create_view_suid == VIEW_SUID_DEFAULT) - lex->create_view_suid= decoy.view_suid ? + if (lex->create_view->algorithm == VIEW_ALGORITHM_INHERIT) + lex->create_view->algorithm= (uint8) decoy.algorithm; + if (lex->create_view->suid == VIEW_SUID_DEFAULT) + lex->create_view->suid= decoy.view_suid ? VIEW_SUID_DEFINER : VIEW_SUID_INVOKER; return FALSE; @@ -647,8 +647,8 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, { C_STRING_WITH_LEN("ALTER ") }, { C_STRING_WITH_LEN("CREATE OR REPLACE ") }}; - buff.append(command[thd->lex->create_view_mode].str, - command[thd->lex->create_view_mode].length); + buff.append(command[thd->lex->create_view->mode].str, + command[thd->lex->create_view->mode].length); view_store_options(thd, views, &buff); buff.append(STRING_WITH_LEN("VIEW ")); @@ -934,7 +934,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, DBUG_PRINT("info", ("View: %.*s", view_query.length(), view_query.ptr())); /* fill structure */ - view->source= thd->lex->create_view_select; + view->source= thd->lex->create_view->select; if (!thd->make_lex_string(&view->select_stmt, view_query.ptr(), view_query.length())) @@ -959,18 +959,18 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, } view->md5.length= 32; can_be_merged= lex->can_be_merged(); - if (lex->create_view_algorithm == VIEW_ALGORITHM_MERGE && + if (lex->create_view->algorithm == VIEW_ALGORITHM_MERGE && !lex->can_be_merged()) { push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_VIEW_MERGE, ER_THD(thd, ER_WARN_VIEW_MERGE)); - lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED; + lex->create_view->algorithm= DTYPE_ALGORITHM_UNDEFINED; } - view->algorithm= lex->create_view_algorithm; + view->algorithm= lex->create_view->algorithm; view->definer.user= lex->definer->user; view->definer.host= lex->definer->host; - view->view_suid= lex->create_view_suid; - view->with_check= lex->create_view_check; + view->view_suid= lex->create_view->suid; + view->with_check= lex->create_view->check; DBUG_EXECUTE_IF("simulate_register_view_failure", { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index bda8d3fc7f3..384ac0859c3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -828,6 +828,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr) st_trg_execution_order trg_execution_order; /* enums */ + enum enum_view_suid view_suid; enum sub_select_type unit_type; enum Condition_information_item::Name cond_info_item_name; enum enum_diag_condition_item_name diag_condition_item_name; @@ -1679,7 +1680,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); opt_recursive %type - create_or_replace + create_or_replace opt_if_not_exists opt_if_exists @@ -1886,11 +1887,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); statement sp_suid sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa opt_field_or_var_spec fields_or_vars opt_load_data_set_spec - view_algorithm view_or_trigger_or_sp_or_event - definer_tail no_definer_tail - view_suid view_tail view_list_opt view_list view_select - view_check_option trigger_tail sp_tail sf_tail event_tail - udf_tail udf_tail2 + view_list_opt view_list view_select + trigger_tail sp_tail sf_tail event_tail + udf_tail create_function_tail install uninstall partition_entry binlog_base64_event normal_key_options normal_key_opts all_key_opt spatial_key_options fulltext_key_options normal_key_opt @@ -1919,6 +1918,9 @@ END_OF_INPUT %type case_stmt_specification %type loop_body while_body repeat_body +%type view_algorithm view_check_option +%type view_suid opt_view_suid + %type sp_decl_idents sp_decl_idents_init_vars %type sp_handler_type sp_hcond_list %type sp_cond sp_hcond sqlstate signal_value opt_signal_value @@ -2580,15 +2582,50 @@ create: MYSQL_YYABORT; lex->name= $4; } - | create_or_replace + | create_or_replace definer_opt opt_view_suid VIEW_SYM + opt_if_not_exists table_ident + { + if (Lex->add_create_view(thd, $1 | $5, + DTYPE_ALGORITHM_UNDEFINED, $3, $6)) + MYSQL_YYABORT; + } + view_list_opt AS view_select + { } + | create_or_replace view_algorithm definer_opt opt_view_suid VIEW_SYM + opt_if_not_exists table_ident + { + if (Lex->add_create_view(thd, $1 | $6, $2, $4, $7)) + MYSQL_YYABORT; + } + view_list_opt AS view_select + { } + | create_or_replace definer_opt TRIGGER_SYM + { Lex->create_info.set($1); } + trigger_tail + { } + | create_or_replace definer_opt PROCEDURE_SYM + { Lex->create_info.set($1); } + sp_tail + { } + | create_or_replace definer_opt EVENT_SYM + { Lex->create_info.set($1); } + event_tail + { } + | create_or_replace definer FUNCTION_SYM + { Lex->create_info.set($1); } + sf_tail + { } + | create_or_replace no_definer FUNCTION_SYM + { Lex->create_info.set($1); } + create_function_tail + { } + | create_or_replace no_definer AGGREGATE_SYM FUNCTION_SYM { Lex->create_info.set($1); - Lex->create_view_mode= ($1.or_replace() ? VIEW_CREATE_OR_REPLACE : - VIEW_CREATE_NEW); - Lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED; - Lex->create_view_suid= TRUE; + Lex->udf.type= UDFTYPE_AGGREGATE; } - view_or_trigger_or_sp_or_event { } + udf_tail + { } | create_or_replace USER_SYM opt_if_not_exists clear_privileges grant_list opt_require_clause opt_resource_options { @@ -2614,6 +2651,11 @@ create: { } ; +create_function_tail: + sf_tail { } + | udf_tail { Lex->udf.type= UDFTYPE_FUNCTION; } + ; + opt_sequence: /* empty */ { } | sequence_defs @@ -2767,16 +2809,16 @@ server_option: ; event_tail: - remember_name EVENT_SYM opt_if_not_exists sp_name + remember_name opt_if_not_exists sp_name { LEX *lex=Lex; lex->stmt_definition_begin= $1; - if (lex->add_create_options_with_check($3)) + if (lex->add_create_options_with_check($2)) MYSQL_YYABORT; if (!(lex->event_parse_data= Event_parse_data::new_instance(thd))) MYSQL_YYABORT; - lex->event_parse_data->identifier= $4; + lex->event_parse_data->identifier= $3; lex->event_parse_data->on_completion= Event_parse_data::ON_COMPLETION_DROP; @@ -7223,31 +7265,24 @@ alter: lex->sql_command= SQLCOM_ALTER_FUNCTION; lex->spname= $3; } - | ALTER view_algorithm definer_opt + | ALTER view_algorithm definer_opt opt_view_suid VIEW_SYM table_ident { - LEX *lex= Lex; - - if (lex->sphead) - my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW")); - lex->create_view_mode= VIEW_ALTER; + if (Lex->add_alter_view(thd, $2, $4, $6)) + MYSQL_YYABORT; } - view_tail + view_list_opt AS view_select {} - | ALTER definer_opt + | ALTER definer_opt opt_view_suid VIEW_SYM table_ident /* We have two separate rules for ALTER VIEW rather that optional view_algorithm above, to resolve the ambiguity with the ALTER EVENT below. */ { - LEX *lex= Lex; - - if (lex->sphead) - my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW")); - lex->create_view_algorithm= VIEW_ALGORITHM_INHERIT; - lex->create_view_mode= VIEW_ALTER; + if (Lex->add_alter_view(thd, VIEW_ALGORITHM_INHERIT, $3, $5)) + MYSQL_YYABORT; } - view_tail + view_list_opt AS view_select {} | ALTER definer_opt remember_name EVENT_SYM sp_name { @@ -16364,38 +16399,6 @@ query_expression_option: | ALL { Select->options|= SELECT_ALL; } ; -/************************************************************************** - - CREATE VIEW | TRIGGER | PROCEDURE statements. - -**************************************************************************/ - -view_or_trigger_or_sp_or_event: - definer definer_tail - {} - | no_definer no_definer_tail - {} - | view_algorithm definer_opt view_tail - {} - ; - -definer_tail: - view_tail - | trigger_tail - | sp_tail - | sf_tail - | event_tail - ; - -no_definer_tail: - view_tail - | trigger_tail - | sp_tail - | sf_tail - | udf_tail - | event_tail - ; - /************************************************************************** DEFINER clause support. @@ -16438,39 +16441,19 @@ definer: **************************************************************************/ view_algorithm: - ALGORITHM_SYM '=' UNDEFINED_SYM - { Lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED; } - | ALGORITHM_SYM '=' MERGE_SYM - { Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; } - | ALGORITHM_SYM '=' TEMPTABLE_SYM - { Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; } + ALGORITHM_SYM '=' UNDEFINED_SYM { $$= DTYPE_ALGORITHM_UNDEFINED; } + | ALGORITHM_SYM '=' MERGE_SYM { $$= VIEW_ALGORITHM_MERGE; } + | ALGORITHM_SYM '=' TEMPTABLE_SYM { $$= VIEW_ALGORITHM_TMPTABLE; } + ; + +opt_view_suid: + /* empty */ { $$= VIEW_SUID_DEFAULT; } + | view_suid { $$= $1; } ; view_suid: - /* empty */ - { Lex->create_view_suid= VIEW_SUID_DEFAULT; } - | SQL_SYM SECURITY_SYM DEFINER_SYM - { Lex->create_view_suid= VIEW_SUID_DEFINER; } - | SQL_SYM SECURITY_SYM INVOKER_SYM - { Lex->create_view_suid= VIEW_SUID_INVOKER; } - ; - -view_tail: - view_suid VIEW_SYM opt_if_not_exists table_ident - { - LEX *lex= thd->lex; - if (lex->add_create_options_with_check($3)) - MYSQL_YYABORT; - lex->sql_command= SQLCOM_CREATE_VIEW; - /* first table in list is target VIEW name */ - if (!lex->select_lex.add_table_to_list(thd, $4, NULL, - TL_OPTION_UPDATING, - TL_IGNORE, - MDL_EXCLUSIVE)) - MYSQL_YYABORT; - lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB; - } - view_list_opt AS view_select + SQL_SYM SECURITY_SYM DEFINER_SYM { $$= VIEW_SUID_DEFINER; } + | SQL_SYM SECURITY_SYM INVOKER_SYM { $$= VIEW_SUID_INVOKER; } ; view_list_opt: @@ -16498,19 +16481,20 @@ view_select: { LEX *lex= Lex; lex->parsing_options.allows_variable= FALSE; - lex->create_view_select.str= (char *) YYLIP->get_cpp_ptr(); + lex->create_view->select.str= (char *) YYLIP->get_cpp_ptr(); } opt_with_clause query_expression_body_view view_check_option { LEX *lex= Lex; - uint len= YYLIP->get_cpp_ptr() - lex->create_view_select.str; + uint len= YYLIP->get_cpp_ptr() - lex->create_view->select.str; uint not_used; - void *create_view_select= thd->memdup(lex->create_view_select.str, len); - lex->create_view_select.length= len; - lex->create_view_select.str= (char *) create_view_select; + void *create_view_select= thd->memdup(lex->create_view->select.str, len); + lex->create_view->select.length= len; + lex->create_view->select.str= (char *) create_view_select; trim_whitespace(thd->charset(), - &lex->create_view_select, + &lex->create_view->select, ¬_used); + lex->create_view->check= $4; lex->parsing_options.allows_variable= TRUE; lex->current_select->set_with_clause($2); } @@ -16528,14 +16512,10 @@ query_expression_body_view: ; view_check_option: - /* empty */ - { Lex->create_view_check= VIEW_CHECK_NONE; } - | WITH CHECK_SYM OPTION - { Lex->create_view_check= VIEW_CHECK_CASCADED; } - | WITH CASCADED CHECK_SYM OPTION - { Lex->create_view_check= VIEW_CHECK_CASCADED; } - | WITH LOCAL_SYM CHECK_SYM OPTION - { Lex->create_view_check= VIEW_CHECK_LOCAL; } + /* empty */ { $$= VIEW_CHECK_NONE; } + | WITH CHECK_SYM OPTION { $$= VIEW_CHECK_CASCADED; } + | WITH CASCADED CHECK_SYM OPTION { $$= VIEW_CHECK_CASCADED; } + | WITH LOCAL_SYM CHECK_SYM OPTION { $$= VIEW_CHECK_LOCAL; } ; /************************************************************************** @@ -16567,25 +16547,24 @@ trigger_follows_precedes_clause: ; trigger_tail: - TRIGGER_SYM remember_name opt_if_not_exists { - if (Lex->add_create_options_with_check($3)) + if (Lex->add_create_options_with_check($2)) MYSQL_YYABORT; } sp_name trg_action_time trg_event ON - remember_name /* $9 */ - { /* $10 */ + remember_name /* $8 */ + { /* $9 */ Lex->raw_trg_on_table_name_begin= YYLIP->get_tok_start(); } - table_ident /* $11 */ + table_ident /* $10 */ FOR_SYM - remember_name /* $13 */ - { /* $14 */ + remember_name /* $12 */ + { /* $13 */ Lex->raw_trg_on_table_name_end= YYLIP->get_tok_start(); } EACH_SYM @@ -16593,28 +16572,28 @@ trigger_tail: { Lex->trg_chistics.ordering_clause_begin= YYLIP->get_cpp_ptr(); } - trigger_follows_precedes_clause /* $18 */ - { /* $19 */ + trigger_follows_precedes_clause /* $17 */ + { /* $18 */ LEX *lex= thd->lex; Lex_input_stream *lip= YYLIP; if (lex->sphead) my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER")); - lex->stmt_definition_begin= $2; - lex->ident.str= $9; - lex->ident.length= $13 - $9; - lex->spname= $5; - (*static_cast(&lex->trg_chistics))= ($18); + lex->stmt_definition_begin= $1; + lex->ident.str= $8; + lex->ident.length= $12 - $8; + lex->spname= $4; + (*static_cast(&lex->trg_chistics))= ($17); lex->trg_chistics.ordering_clause_end= lip->get_cpp_ptr(); - if (!lex->make_sp_head(thd, $5, TYPE_ENUM_TRIGGER)) + if (!lex->make_sp_head(thd, $4, TYPE_ENUM_TRIGGER)) MYSQL_YYABORT; lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } - sp_proc_stmt /* $20 */ - { /* $21 */ + sp_proc_stmt /* $19 */ + { /* $20 */ LEX *lex= Lex; sp_head *sp= lex->sphead; @@ -16630,7 +16609,7 @@ trigger_tail: sp_proc_stmt alternatives are not saving/restoring LEX, so lex->query_tables can be wiped out. */ - if (!lex->select_lex.add_table_to_list(thd, $11, + if (!lex->select_lex.add_table_to_list(thd, $10, (LEX_CSTRING*) 0, TL_OPTION_UPDATING, TL_READ_NO_INSERT, @@ -16646,57 +16625,51 @@ trigger_tail: **************************************************************************/ udf_tail: - AGGREGATE_SYM udf_tail2 { thd->lex->udf.type= UDFTYPE_AGGREGATE; } - | udf_tail2 { thd->lex->udf.type= UDFTYPE_FUNCTION; } - ; - -udf_tail2: - FUNCTION_SYM opt_if_not_exists ident + opt_if_not_exists ident RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys { LEX *lex= thd->lex; - if (lex->add_create_options_with_check($2)) + if (lex->add_create_options_with_check($1)) MYSQL_YYABORT; - if (is_native_function(thd, & $3)) - my_yyabort_error((ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $3.str)); + if (is_native_function(thd, & $2)) + my_yyabort_error((ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $2.str)); lex->sql_command= SQLCOM_CREATE_FUNCTION; - lex->udf.name= $3; - lex->udf.returns= (Item_result) $5; - lex->udf.dl= $7.str; + lex->udf.name= $2; + lex->udf.returns= (Item_result) $4; + lex->udf.dl= $6.str; } ; sf_tail: - FUNCTION_SYM /* $1 */ - opt_if_not_exists /* $2 */ - sp_name /* $3 */ - { /* $4 */ - if (!Lex->make_sp_head_no_recursive(thd, $2, $3, + opt_if_not_exists /* $1 */ + sp_name /* $2 */ + { /* $3 */ + if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; - Lex->spname= $3; + Lex->spname= $2; } - sp_parenthesized_fdparam_list /* $5 */ - RETURNS_SYM /* $6 */ - { /* $7 */ + sp_parenthesized_fdparam_list /* $4 */ + RETURNS_SYM /* $5 */ + { /* $6 */ LEX *lex= Lex; lex->init_last_field(&lex->sphead->m_return_field_def, &empty_clex_str, thd->variables.collation_database); } - type_with_opt_collate /* $8 */ - { /* $9 */ + type_with_opt_collate /* $7 */ + { /* $8 */ if (Lex->sphead->fill_field_definition(thd, Lex->last_field)) MYSQL_YYABORT; } - sp_c_chistics /* $10 */ - { /* $11 */ + sp_c_chistics /* $9 */ + { /* $10 */ LEX *lex= thd->lex; Lex_input_stream *lip= YYLIP; lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } - sp_proc_stmt_in_returns_clause /* $12 */ + sp_proc_stmt_in_returns_clause /* $11 */ { LEX *lex= thd->lex; sp_head *sp= lex->sphead; @@ -16715,12 +16688,12 @@ sf_tail: ; sp_tail: - PROCEDURE_SYM opt_if_not_exists sp_name + opt_if_not_exists sp_name { - if (!Lex->make_sp_head_no_recursive(thd, $2, $3, + if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_PROCEDURE)) MYSQL_YYABORT; - Lex->spname= $3; + Lex->spname= $2; } sp_parenthesized_pdparam_list sp_c_chistics diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index acf6c0b1326..37465439816 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -237,6 +237,7 @@ void ORAerror(THD *thd, const char *s) st_trg_execution_order trg_execution_order; /* enums */ + enum enum_view_suid view_suid; enum sub_select_type unit_type; enum Condition_information_item::Name cond_info_item_name; enum enum_diag_condition_item_name diag_condition_item_name; @@ -1097,7 +1098,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); type_or_rowtype %type - create_or_replace + create_or_replace opt_if_not_exists opt_if_exists @@ -1312,11 +1313,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); statement sp_suid sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa opt_field_or_var_spec fields_or_vars opt_load_data_set_spec - view_algorithm view_or_trigger_or_sp_or_event - definer_tail no_definer_tail - view_suid view_tail view_list_opt view_list view_select - view_check_option trigger_tail sp_tail sf_tail event_tail - udf_tail udf_tail2 + view_list_opt view_list view_select + trigger_tail sp_tail sf_tail event_tail + udf_tail create_function_tail install uninstall partition_entry binlog_base64_event normal_key_options normal_key_opts all_key_opt spatial_key_options fulltext_key_options normal_key_opt @@ -1351,6 +1350,9 @@ END_OF_INPUT %type case_stmt_specification %type loop_body while_body repeat_body +%type view_algorithm view_check_option +%type view_suid opt_view_suid + %type sp_decl_idents sp_handler_type sp_hcond_list %type sp_cond sp_hcond sqlstate signal_value opt_signal_value %type sp_decl_body_list opt_sp_decl_body_list @@ -2021,15 +2023,50 @@ create: MYSQL_YYABORT; lex->name= $4; } - | create_or_replace + | create_or_replace definer_opt opt_view_suid VIEW_SYM + opt_if_not_exists table_ident + { + if (Lex->add_create_view(thd, $1 | $5, + DTYPE_ALGORITHM_UNDEFINED, $3, $6)) + MYSQL_YYABORT; + } + view_list_opt AS view_select + { } + | create_or_replace view_algorithm definer_opt opt_view_suid VIEW_SYM + opt_if_not_exists table_ident + { + if (Lex->add_create_view(thd, $1 | $6, $2, $4, $7)) + MYSQL_YYABORT; + } + view_list_opt AS view_select + { } + | create_or_replace definer_opt TRIGGER_SYM + { Lex->create_info.set($1); } + trigger_tail + { } + | create_or_replace definer_opt PROCEDURE_SYM + { Lex->create_info.set($1); } + sp_tail_standalone + { } + | create_or_replace definer_opt EVENT_SYM + { Lex->create_info.set($1); } + event_tail + { } + | create_or_replace definer FUNCTION_SYM + { Lex->create_info.set($1); } + sf_tail_standalone + { } + | create_or_replace no_definer FUNCTION_SYM + { Lex->create_info.set($1); } + create_function_tail + { } + | create_or_replace no_definer AGGREGATE_SYM FUNCTION_SYM { Lex->create_info.set($1); - Lex->create_view_mode= ($1.or_replace() ? VIEW_CREATE_OR_REPLACE : - VIEW_CREATE_NEW); - Lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED; - Lex->create_view_suid= TRUE; + Lex->udf.type= UDFTYPE_AGGREGATE; } - view_or_trigger_or_sp_or_event { } + udf_tail + { } | create_or_replace USER_SYM opt_if_not_exists clear_privileges grant_list opt_require_clause opt_resource_options { @@ -2055,6 +2092,11 @@ create: { } ; +create_function_tail: + sf_tail_standalone { } + | udf_tail { Lex->udf.type= UDFTYPE_FUNCTION; } + ; + opt_sequence: /* empty */ { } | sequence_defs @@ -2208,16 +2250,16 @@ server_option: ; event_tail: - remember_name EVENT_SYM opt_if_not_exists sp_name + remember_name opt_if_not_exists sp_name { LEX *lex=Lex; lex->stmt_definition_begin= $1; - if (lex->add_create_options_with_check($3)) + if (lex->add_create_options_with_check($2)) MYSQL_YYABORT; if (!(lex->event_parse_data= Event_parse_data::new_instance(thd))) MYSQL_YYABORT; - lex->event_parse_data->identifier= $4; + lex->event_parse_data->identifier= $3; lex->event_parse_data->on_completion= Event_parse_data::ON_COMPLETION_DROP; @@ -7203,31 +7245,24 @@ alter: lex->sql_command= SQLCOM_ALTER_FUNCTION; lex->spname= $3; } - | ALTER view_algorithm definer_opt + | ALTER view_algorithm definer_opt opt_view_suid VIEW_SYM table_ident { - LEX *lex= Lex; - - if (lex->sphead) - my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW")); - lex->create_view_mode= VIEW_ALTER; + if (Lex->add_alter_view(thd, $2, $4, $6)) + MYSQL_YYABORT; } - view_tail + view_list_opt AS view_select {} - | ALTER definer_opt + | ALTER definer_opt opt_view_suid VIEW_SYM table_ident /* We have two separate rules for ALTER VIEW rather that optional view_algorithm above, to resolve the ambiguity with the ALTER EVENT below. */ { - LEX *lex= Lex; - - if (lex->sphead) - my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW")); - lex->create_view_algorithm= VIEW_ALGORITHM_INHERIT; - lex->create_view_mode= VIEW_ALTER; + if (Lex->add_alter_view(thd, VIEW_ALGORITHM_INHERIT, $3, $5)) + MYSQL_YYABORT; } - view_tail + view_list_opt AS view_select {} | ALTER definer_opt remember_name EVENT_SYM sp_name { @@ -16600,38 +16635,6 @@ query_expression_option: | ALL { Select->options|= SELECT_ALL; } ; -/************************************************************************** - - CREATE VIEW | TRIGGER | PROCEDURE statements. - -**************************************************************************/ - -view_or_trigger_or_sp_or_event: - definer definer_tail - {} - | no_definer no_definer_tail - {} - | view_algorithm definer_opt view_tail - {} - ; - -definer_tail: - view_tail - | trigger_tail - | sp_tail_standalone - | sf_tail_standalone - | event_tail - ; - -no_definer_tail: - view_tail - | trigger_tail - | sp_tail_standalone - | sf_tail_standalone - | udf_tail - | event_tail - ; - /************************************************************************** DEFINER clause support. @@ -16674,39 +16677,19 @@ definer: **************************************************************************/ view_algorithm: - ALGORITHM_SYM '=' UNDEFINED_SYM - { Lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED; } - | ALGORITHM_SYM '=' MERGE_SYM - { Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; } - | ALGORITHM_SYM '=' TEMPTABLE_SYM - { Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; } + ALGORITHM_SYM '=' UNDEFINED_SYM { $$= DTYPE_ALGORITHM_UNDEFINED; } + | ALGORITHM_SYM '=' MERGE_SYM { $$= VIEW_ALGORITHM_MERGE; } + | ALGORITHM_SYM '=' TEMPTABLE_SYM { $$= VIEW_ALGORITHM_TMPTABLE; } + ; + +opt_view_suid: + /* empty */ { $$= VIEW_SUID_DEFAULT; } + | view_suid { $$= $1; } ; view_suid: - /* empty */ - { Lex->create_view_suid= VIEW_SUID_DEFAULT; } - | SQL_SYM SECURITY_SYM DEFINER_SYM - { Lex->create_view_suid= VIEW_SUID_DEFINER; } - | SQL_SYM SECURITY_SYM INVOKER_SYM - { Lex->create_view_suid= VIEW_SUID_INVOKER; } - ; - -view_tail: - view_suid VIEW_SYM opt_if_not_exists table_ident - { - LEX *lex= thd->lex; - if (lex->add_create_options_with_check($3)) - MYSQL_YYABORT; - lex->sql_command= SQLCOM_CREATE_VIEW; - /* first table in list is target VIEW name */ - if (!lex->select_lex.add_table_to_list(thd, $4, NULL, - TL_OPTION_UPDATING, - TL_IGNORE, - MDL_EXCLUSIVE)) - MYSQL_YYABORT; - lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB; - } - view_list_opt AS view_select + SQL_SYM SECURITY_SYM DEFINER_SYM { $$= VIEW_SUID_DEFINER; } + | SQL_SYM SECURITY_SYM INVOKER_SYM { $$= VIEW_SUID_INVOKER; } ; view_list_opt: @@ -16734,19 +16717,20 @@ view_select: { LEX *lex= Lex; lex->parsing_options.allows_variable= FALSE; - lex->create_view_select.str= (char *) YYLIP->get_cpp_ptr(); + lex->create_view->select.str= (char *) YYLIP->get_cpp_ptr(); } opt_with_clause query_expression_body_view view_check_option { LEX *lex= Lex; - uint len= YYLIP->get_cpp_ptr() - lex->create_view_select.str; + uint len= YYLIP->get_cpp_ptr() - lex->create_view->select.str; uint not_used; - void *create_view_select= thd->memdup(lex->create_view_select.str, len); - lex->create_view_select.length= len; - lex->create_view_select.str= (char *) create_view_select; + void *create_view_select= thd->memdup(lex->create_view->select.str, len); + lex->create_view->select.length= len; + lex->create_view->select.str= (char *) create_view_select; trim_whitespace(thd->charset(), - &lex->create_view_select, + &lex->create_view->select, ¬_used); + lex->create_view->check= $4; lex->parsing_options.allows_variable= TRUE; lex->current_select->set_with_clause($2); } @@ -16764,14 +16748,10 @@ query_expression_body_view: ; view_check_option: - /* empty */ - { Lex->create_view_check= VIEW_CHECK_NONE; } - | WITH CHECK_SYM OPTION - { Lex->create_view_check= VIEW_CHECK_CASCADED; } - | WITH CASCADED CHECK_SYM OPTION - { Lex->create_view_check= VIEW_CHECK_CASCADED; } - | WITH LOCAL_SYM CHECK_SYM OPTION - { Lex->create_view_check= VIEW_CHECK_LOCAL; } + /* empty */ { $$= VIEW_CHECK_NONE; } + | WITH CHECK_SYM OPTION { $$= VIEW_CHECK_CASCADED; } + | WITH CASCADED CHECK_SYM OPTION { $$= VIEW_CHECK_CASCADED; } + | WITH LOCAL_SYM CHECK_SYM OPTION { $$= VIEW_CHECK_LOCAL; } ; /************************************************************************** @@ -16803,25 +16783,24 @@ trigger_follows_precedes_clause: ; trigger_tail: - TRIGGER_SYM remember_name opt_if_not_exists { - if (Lex->add_create_options_with_check($3)) + if (Lex->add_create_options_with_check($2)) MYSQL_YYABORT; } sp_name trg_action_time trg_event ON - remember_name /* $9 */ - { /* $10 */ + remember_name /* $8 */ + { /* $9 */ Lex->raw_trg_on_table_name_begin= YYLIP->get_tok_start(); } - table_ident /* $11 */ + table_ident /* $10 */ FOR_SYM - remember_name /* $13 */ - { /* $14 */ + remember_name /* $12 */ + { /* $13 */ Lex->raw_trg_on_table_name_end= YYLIP->get_tok_start(); } EACH_SYM @@ -16829,28 +16808,28 @@ trigger_tail: { Lex->trg_chistics.ordering_clause_begin= YYLIP->get_cpp_ptr(); } - trigger_follows_precedes_clause /* $18 */ - { /* $19 */ + trigger_follows_precedes_clause /* $17 */ + { /* $18 */ LEX *lex= thd->lex; Lex_input_stream *lip= YYLIP; if (lex->sphead) my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER")); - lex->stmt_definition_begin= $2; - lex->ident.str= $9; - lex->ident.length= $13 - $9; - lex->spname= $5; - (*static_cast(&lex->trg_chistics))= ($18); + lex->stmt_definition_begin= $1; + lex->ident.str= $8; + lex->ident.length= $12 - $8; + lex->spname= $4; + (*static_cast(&lex->trg_chistics))= ($17); lex->trg_chistics.ordering_clause_end= lip->get_cpp_ptr(); - if (!lex->make_sp_head(thd, $5, TYPE_ENUM_TRIGGER)) + if (!lex->make_sp_head(thd, $4, TYPE_ENUM_TRIGGER)) MYSQL_YYABORT; lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } - sp_proc_stmt /* $20 */ - { /* $21 */ + sp_proc_stmt /* $19 */ + { /* $20 */ LEX *lex= Lex; sp_head *sp= lex->sphead; if (sp->check_unresolved_goto()) @@ -16868,7 +16847,7 @@ trigger_tail: sp_proc_stmt alternatives are not saving/restoring LEX, so lex->query_tables can be wiped out. */ - if (!lex->select_lex.add_table_to_list(thd, $11, + if (!lex->select_lex.add_table_to_list(thd, $10, (LEX_CSTRING*) 0, TL_OPTION_UPDATING, TL_READ_NO_INSERT, @@ -16884,58 +16863,52 @@ trigger_tail: **************************************************************************/ udf_tail: - AGGREGATE_SYM udf_tail2 { thd->lex->udf.type= UDFTYPE_AGGREGATE; } - | udf_tail2 { thd->lex->udf.type= UDFTYPE_FUNCTION; } - ; - -udf_tail2: - FUNCTION_SYM opt_if_not_exists ident + opt_if_not_exists ident RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys { LEX *lex= thd->lex; - if (lex->add_create_options_with_check($2)) + if (lex->add_create_options_with_check($1)) MYSQL_YYABORT; - if (is_native_function(thd, & $3)) - my_yyabort_error((ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $3.str)); + if (is_native_function(thd, & $2)) + my_yyabort_error((ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $2.str)); lex->sql_command= SQLCOM_CREATE_FUNCTION; - lex->udf.name= $3; - lex->udf.returns= (Item_result) $5; - lex->udf.dl= $7.str; + lex->udf.name= $2; + lex->udf.returns= (Item_result) $4; + lex->udf.dl= $6.str; } ; sf_tail: - FUNCTION_SYM /* $1 */ - opt_if_not_exists /* $2 */ - sp_name /* $3 */ - { /* $4 */ - if (!Lex->make_sp_head_no_recursive(thd, $2, $3, + opt_if_not_exists /* $1 */ + sp_name /* $2 */ + { /* $3 */ + if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; - Lex->spname= $3; + Lex->spname= $2; } - opt_sp_parenthesized_fdparam_list /* $5 */ - RETURN_SYM /* $6 */ - { /* $7 */ + opt_sp_parenthesized_fdparam_list /* $4 */ + RETURN_SYM /* $5 */ + { /* $6 */ LEX *lex= Lex; lex->init_last_field(&lex->sphead->m_return_field_def, &empty_clex_str, thd->variables.collation_database); } - sp_param_type_with_opt_collate /* $8 */ - { /* $9 */ + sp_param_type_with_opt_collate /* $7 */ + { /* $8 */ if (Lex->sphead->fill_field_definition(thd, Lex->last_field)) MYSQL_YYABORT; } - sp_c_chistics /* $10 */ - { /* $11 */ + sp_c_chistics /* $9 */ + { /* $10 */ LEX *lex= thd->lex; Lex_input_stream *lip= YYLIP; lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } - sp_tail_is /* $12 */ - sp_body /* $13 */ + sp_tail_is /* $11 */ + sp_body /* $12 */ { LEX *lex= thd->lex; sp_head *sp= lex->sphead; @@ -16956,12 +16929,12 @@ sf_tail: ; sp_tail: - PROCEDURE_SYM opt_if_not_exists sp_name + opt_if_not_exists sp_name { - if (!Lex->make_sp_head_no_recursive(thd, $2, $3, + if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_PROCEDURE)) MYSQL_YYABORT; - Lex->spname= $3; + Lex->spname= $2; } opt_sp_parenthesized_pdparam_list sp_c_chistics diff --git a/sql/table.h b/sql/table.h index a3690b0e8ca..dcf5723b3b9 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1626,10 +1626,6 @@ class IS_table_read_plan; #define JOIN_TYPE_RIGHT 2U #define JOIN_TYPE_OUTER 4U /* Marker that this is an outer join */ -#define VIEW_SUID_INVOKER 0 -#define VIEW_SUID_DEFINER 1 -#define VIEW_SUID_DEFAULT 2 - /* view WITH CHECK OPTION parameter options */ #define VIEW_CHECK_NONE 0 #define VIEW_CHECK_LOCAL 1 diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 1cdcb30d8ed..40a0e4f00a6 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1331,8 +1331,8 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len) { C_STRING_WITH_LEN("ALTER ") }, { C_STRING_WITH_LEN("CREATE OR REPLACE ") }}; - buff.append(command[thd->lex->create_view_mode].str, - command[thd->lex->create_view_mode].length); + buff.append(command[thd->lex->create_view->mode].str, + command[thd->lex->create_view->mode].length); LEX_USER *definer; @@ -1360,9 +1360,9 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len) return 1; } - views->algorithm = lex->create_view_algorithm; - views->view_suid = lex->create_view_suid; - views->with_check = lex->create_view_check; + views->algorithm = lex->create_view->algorithm; + views->view_suid = lex->create_view->suid; + views->with_check = lex->create_view->check; view_store_options(thd, views, &buff); buff.append(STRING_WITH_LEN("VIEW ")); @@ -1391,8 +1391,8 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len) } buff.append(STRING_WITH_LEN(" AS ")); //buff.append(views->source.str, views->source.length); - buff.append(thd->lex->create_view_select.str, - thd->lex->create_view_select.length); + buff.append(thd->lex->create_view->select.str, + thd->lex->create_view->select.length); //int errcode= query_error_code(thd, TRUE); //if (thd->binlog_query(THD::STMT_QUERY_TYPE, // buff.ptr(), buff.length(), FALSE, FALSE, FALSE, errcod From 2e9b55f763441b1879c4d9980d25f73a43949115 Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 1 Jul 2017 12:00:02 +0300 Subject: [PATCH 42/53] MDEV-13226 Server crashes when tmpdir runs out of space There was a missing test in CTE handling if creating a temporary table failed (in this case as a result of out of space). This caused a table handler to be used even if it was not allocated. --- sql/sql_select.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 540271bc961..2c7ccbf3e2b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -26304,7 +26304,8 @@ AGGR_OP::put_record(bool end_of_records) { // Lasy tmp table creation/initialization if (!join_tab->table->file->inited) - prepare_tmp_table(); + if (prepare_tmp_table()) + return NESTED_LOOP_ERROR; enum_nested_loop_state rc= (*write_func)(join_tab->join, join_tab, end_of_records); return rc; From 3833097463afee3498dda810405f7df33200c72e Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 1 Jul 2017 14:02:29 +0300 Subject: [PATCH 43/53] Clean up BUILD script - Removed some not old, not used build scipts - Removed tokudb and rocksdb from 32 bit builds This enables one now to easily build 32 bit binaries on 64 bit systems --- BUILD/SETUP.sh | 5 ++++ BUILD/compile-amd64-debug-max-no-ndb | 25 ------------------ BUILD/compile-amd64-gprof-no-ndb | 7 ------ BUILD/compile-pentium | 2 +- BUILD/compile-pentium-debug | 2 +- BUILD/compile-pentium-debug-all | 2 +- BUILD/compile-pentium-debug-max | 2 +- BUILD/compile-pentium-debug-max-no-embedded | 2 +- BUILD/compile-pentium-debug-max-no-ndb | 24 ------------------ BUILD/compile-pentium-debug-max-no-qc | 10 -------- BUILD/compile-pentium-debug-openssl | 2 +- BUILD/compile-pentium-debug-wsrep | 2 +- BUILD/compile-pentium-gcov | 2 +- BUILD/compile-pentium-gprof | 2 +- BUILD/compile-pentium-icc | 2 +- BUILD/compile-pentium-max | 2 +- BUILD/compile-pentium-myodbc | 28 --------------------- BUILD/compile-pentium-valgrind-max | 2 +- BUILD/compile-pentium-valgrind-max-no-ndb | 26 ------------------- BUILD/compile-pentium-wsrep | 2 +- BUILD/compile-ppc-debug-max-no-ndb | 25 ------------------ 21 files changed, 18 insertions(+), 158 deletions(-) delete mode 100755 BUILD/compile-amd64-debug-max-no-ndb delete mode 100755 BUILD/compile-amd64-gprof-no-ndb delete mode 100755 BUILD/compile-pentium-debug-max-no-ndb delete mode 100755 BUILD/compile-pentium-debug-max-no-qc delete mode 100755 BUILD/compile-pentium-myodbc delete mode 100755 BUILD/compile-pentium-valgrind-max-no-ndb delete mode 100755 BUILD/compile-ppc-debug-max-no-ndb diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 8aeefe39120..2d6548dda0e 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -289,6 +289,11 @@ gcov_compile_flags="-fprofile-arcs -ftest-coverage" gcov_compile_flags="$gcov_compile_flags -DDISABLE_TAO_ASM" gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov" +# +# The following plugins doesn't work on 32 bit systems +disable_64_bit_plugins="--without-plugin-tokudb --without-plugin-rocksdb" + + # GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well # as on the compiler command line), and this requires setting LDFLAGS for BDB. diff --git a/BUILD/compile-amd64-debug-max-no-ndb b/BUILD/compile-amd64-debug-max-no-ndb deleted file mode 100755 index d45a51eba54..00000000000 --- a/BUILD/compile-amd64-debug-max-no-ndb +++ /dev/null @@ -1,25 +0,0 @@ -#! /bin/sh - -# Copyright (C) 2005, 2006 MySQL AB -# Use is subject to license terms -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public -# License along with this library; if not, write to the Free -# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA - -path=`dirname $0` -. "$path/SETUP.sh" -extra_flags="$amd64_cflags $debug_cflags" -extra_configs="$amd64_configs $debug_configs $max_configs" - -. "$path/FINISH.sh" diff --git a/BUILD/compile-amd64-gprof-no-ndb b/BUILD/compile-amd64-gprof-no-ndb deleted file mode 100755 index ef684274658..00000000000 --- a/BUILD/compile-amd64-gprof-no-ndb +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/sh -path=`dirname $0` -. "$path/SETUP.sh" -extra_flags="$amd64_cflags -pg -g" -extra_configs="$amd64_configs $max_configs --disable-shared $static_link" - -. "$path/FINISH.sh" diff --git a/BUILD/compile-pentium b/BUILD/compile-pentium index c197d9b49bf..af8e5b53a30 100755 --- a/BUILD/compile-pentium +++ b/BUILD/compile-pentium @@ -20,7 +20,7 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $fast_cflags" -extra_configs="$pentium_configs" +extra_configs="$pentium_configs $disable_64_bit_plugins" strip=yes . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug b/BUILD/compile-pentium-debug index faeb1b89597..ecbe04087c3 100755 --- a/BUILD/compile-pentium-debug +++ b/BUILD/compile-pentium-debug @@ -19,6 +19,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags" -extra_configs="$pentium_configs $debug_configs" +extra_configs="$pentium_configs $debug_configs $disable_64_bit_plugins" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug-all b/BUILD/compile-pentium-debug-all index 710ce8af63c..9ed5bf6b2cd 100755 --- a/BUILD/compile-pentium-debug-all +++ b/BUILD/compile-pentium-debug-all @@ -5,6 +5,6 @@ set -- "$@" --with-debug=full . "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags" -extra_configs="$pentium_configs $debug_configs $all_configs $error_inject --with-experimental-collations" +extra_configs="$pentium_configs $debug_configs $all_configs $error_inject --with-experimental-collations $disable_64_bit_plugins" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug-max b/BUILD/compile-pentium-debug-max index 0c925d8426f..68784eb34ea 100755 --- a/BUILD/compile-pentium-debug-max +++ b/BUILD/compile-pentium-debug-max @@ -19,6 +19,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags" -extra_configs="$pentium_configs $debug_configs $max_configs $error_inject --with-experimental-collations" +extra_configs="$pentium_configs $debug_configs $max_configs $error_inject --with-experimental-collations $disable_64_bit_plugins" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug-max-no-embedded b/BUILD/compile-pentium-debug-max-no-embedded index 2394c8aa2c7..d8bc896f89c 100755 --- a/BUILD/compile-pentium-debug-max-no-embedded +++ b/BUILD/compile-pentium-debug-max-no-embedded @@ -20,6 +20,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags" -extra_configs="$pentium_configs $debug_configs $max_no_embedded_configs" +extra_configs="$pentium_configs $debug_configs $max_no_embedded_configs $disable_64_bit_plugins" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug-max-no-ndb b/BUILD/compile-pentium-debug-max-no-ndb deleted file mode 100755 index 705164c20bc..00000000000 --- a/BUILD/compile-pentium-debug-max-no-ndb +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/sh - -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -path=`dirname $0` -. "$path/SETUP.sh" - -extra_flags="$pentium_cflags $debug_cflags" -extra_configs="$pentium_configs $debug_configs $max_configs" - -. "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug-max-no-qc b/BUILD/compile-pentium-debug-max-no-qc deleted file mode 100755 index 6407b4b09ad..00000000000 --- a/BUILD/compile-pentium-debug-max-no-qc +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# Builds server without query cache support - -path=`dirname $0` -. "$path/SETUP.sh" - -extra_flags="$pentium_cflags $debug_cflags" -extra_configs="$pentium_configs $debug_configs $max_no_qc_configs" - -. "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug-openssl b/BUILD/compile-pentium-debug-openssl index abf6b41a2d2..697b937bc93 100755 --- a/BUILD/compile-pentium-debug-openssl +++ b/BUILD/compile-pentium-debug-openssl @@ -19,7 +19,7 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags" -extra_configs="$pentium_configs $debug_configs" +extra_configs="$pentium_configs $debug_configs $disable_64_bit_plugins" extra_configs="$extra_configs --with-debug --with-ssl=/usr" diff --git a/BUILD/compile-pentium-debug-wsrep b/BUILD/compile-pentium-debug-wsrep index ee68e3fd0c1..6528ed77f95 100644 --- a/BUILD/compile-pentium-debug-wsrep +++ b/BUILD/compile-pentium-debug-wsrep @@ -7,6 +7,6 @@ set -- "$@" --with-debug=full extra_flags="$pentium_cflags $debug_cflags -g -O0 $wsrep_cflags" c_warnings="$c_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings" -extra_configs="$pentium_configs $debug_configs $wsrep_configs --with-wsrep" +extra_configs="$pentium_configs $debug_configs $wsrep_configs --with-wsrep $disable_64_bit_plugins" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-gcov b/BUILD/compile-pentium-gcov index 56072f619e5..9c5a61e9089 100755 --- a/BUILD/compile-pentium-gcov +++ b/BUILD/compile-pentium-gcov @@ -40,6 +40,6 @@ export LDFLAGS="$gcov_link_flags" extra_flags="$pentium_cflags $debug_cflags $max_cflags $gcov_compile_flags" c_warnings="$c_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings" -extra_configs="$pentium_configs $debug_configs $gcov_configs $max_configs" +extra_configs="$pentium_configs $debug_configs $gcov_configs $max_configs $disable_64_bit_plugins" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-gprof b/BUILD/compile-pentium-gprof index 52231e7832a..de014e3ae8b 100755 --- a/BUILD/compile-pentium-gprof +++ b/BUILD/compile-pentium-gprof @@ -19,6 +19,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $gprof_compile_flags" -extra_configs="$pentium_configs $debug_configs $gprof_link_flags" +extra_configs="$pentium_configs $debug_configs $gprof_link_flags $disable_64_bit_plugins" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-icc b/BUILD/compile-pentium-icc index 23333a13c15..4fdc37b0667 100755 --- a/BUILD/compile-pentium-icc +++ b/BUILD/compile-pentium-icc @@ -35,6 +35,6 @@ extra_flags="$fast_cflags -unroll2 -ip -mp -restrict" # icpc: error: problem during multi-file optimization compilation (code 1) extra_flags="$extra_flags -no-ipo" base_cxxflags="-fno-exceptions -fno-rtti" -extra_configs="$pentium_configs $static_link" +extra_configs="$pentium_configs $static_link $disable_64_bit_plugins" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-max b/BUILD/compile-pentium-max index 470596f8eb9..d2a61de8e13 100755 --- a/BUILD/compile-pentium-max +++ b/BUILD/compile-pentium-max @@ -20,6 +20,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $fast_cflags -g" -extra_configs="$pentium_configs $max_configs" +extra_configs="$pentium_configs $max_configs $disable_64_bit_plugins" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-myodbc b/BUILD/compile-pentium-myodbc deleted file mode 100755 index d9b1dd47129..00000000000 --- a/BUILD/compile-pentium-myodbc +++ /dev/null @@ -1,28 +0,0 @@ -#! /bin/sh - -# Copyright (C) 2000 MySQL AB -# Use is subject to license terms -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -path=`dirname $0` -. "$path/SETUP.sh" - -extra_flags="$pentium_cflags $fast_cflags" -extra_configs="$pentium_configs --without-server" - -make=no -strip=yes - -. "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-valgrind-max b/BUILD/compile-pentium-valgrind-max index c4cb1845ba1..4f21e3574ff 100755 --- a/BUILD/compile-pentium-valgrind-max +++ b/BUILD/compile-pentium-valgrind-max @@ -33,6 +33,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags $valgrind_flags" -extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs" +extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs $disable_64_bit_plugins" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-valgrind-max-no-ndb b/BUILD/compile-pentium-valgrind-max-no-ndb deleted file mode 100755 index 4eb47cb2fe2..00000000000 --- a/BUILD/compile-pentium-valgrind-max-no-ndb +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public -# License along with this library; if not, write to the Free -# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA - -path=`dirname $0` -. "$path/SETUP.sh" - -extra_flags="$pentium_cflags $debug_cflags $valgrind_flags" -extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs" - -. "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-wsrep b/BUILD/compile-pentium-wsrep index eeb14310e4e..b0b8e408370 100644 --- a/BUILD/compile-pentium-wsrep +++ b/BUILD/compile-pentium-wsrep @@ -4,7 +4,7 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $fast_cflags $wsrep_cflags" -extra_configs="$pentium_configs $wsrep_configs --with-wsrep" +extra_configs="$pentium_configs $wsrep_configs --with-wsrep $disable_64_bit_plugins" #strip=yes diff --git a/BUILD/compile-ppc-debug-max-no-ndb b/BUILD/compile-ppc-debug-max-no-ndb deleted file mode 100755 index 0642ddf7a57..00000000000 --- a/BUILD/compile-ppc-debug-max-no-ndb +++ /dev/null @@ -1,25 +0,0 @@ -#! /bin/sh - -# Copyright (c) 2005, 2006 MySQL AB -# Use is subject to license terms -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -path=`dirname $0` -. "$path/SETUP.sh" - -extra_flags="$ppc_cflags $debug_cflags" -extra_configs="$debug_configs $max_configs" - -. "$path/FINISH.sh" From cc8912f2230e4c351e0e5f62e2f11972f127a472 Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 1 Jul 2017 14:05:22 +0300 Subject: [PATCH 44/53] Fixed failing test on 32 bit systems --- .../r/sysvars_server_notembedded,32bit.rdiff | 223 ++++++++++-------- 1 file changed, 126 insertions(+), 97 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff index 88216992587..61dfdf5205f 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff @@ -1,5 +1,5 @@ ---- suite/sys_vars/r/sysvars_server_notembedded.result 2016-11-03 17:27:47.664855681 +0100 -+++ suite/sys_vars/r/sysvars_server_notembedded.reject 2016-11-03 17:23:05.686196749 +0100 +--- /home/my/maria-10.2/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result 2017-06-30 22:31:37.562118657 +0300 ++++ /home/my/maria-10.2/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.reject 2017-07-01 13:56:47.396950309 +0300 @@ -57,7 +57,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 1 @@ -226,7 +226,7 @@ NUMERIC_MAX_VALUE 1000 @@ -1040,7 +1040,7 @@ VARIABLE_TYPE BIGINT UNSIGNED - VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT() + VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT() NUMERIC_MIN_VALUE 4 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 4294967295 @@ -289,7 +289,7 @@ READ_ONLY NO @@ -1723,7 +1723,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME - DEFAULT_VALUE 31536000 + DEFAULT_VALUE 86400 VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED @@ -307,7 +307,7 @@ NUMERIC_MAX_VALUE 4294967295 @@ -1947,7 +1947,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME - DEFAULT_VALUE 1 + DEFAULT_VALUE 2 VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED @@ -316,7 +316,7 @@ NUMERIC_MAX_VALUE 4294967295 @@ -2003,7 +2003,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME - DEFAULT_VALUE 4194304 + DEFAULT_VALUE 16777216 VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED @@ -467,7 +467,7 @@ VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2255,7 +2255,7 @@ +@@ -2269,7 +2269,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -476,7 +476,7 @@ VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored) NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -2269,7 +2269,7 @@ +@@ -2283,7 +2283,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -485,7 +485,7 @@ VARIABLE_COMMENT Maximum stored procedure recursion depth NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -2297,7 +2297,7 @@ +@@ -2311,7 +2311,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32 VARIABLE_SCOPE SESSION @@ -494,7 +494,7 @@ VARIABLE_COMMENT Unused, will be removed. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2325,7 +2325,7 @@ +@@ -2339,7 +2339,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL @@ -503,7 +503,7 @@ VARIABLE_COMMENT After this many write locks, allow some read locks to run in between NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2339,7 +2339,7 @@ +@@ -2353,7 +2353,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -512,7 +512,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -2353,7 +2353,7 @@ +@@ -2367,7 +2367,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8 VARIABLE_SCOPE GLOBAL @@ -521,7 +521,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1024 -@@ -2367,7 +2367,7 @@ +@@ -2381,7 +2381,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -530,7 +530,7 @@ VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2381,7 +2381,7 @@ +@@ -2395,7 +2395,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -539,7 +539,7 @@ VARIABLE_COMMENT Size of buffer to use when using MRR with range access NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -2395,10 +2395,10 @@ +@@ -2409,10 +2409,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE SESSION @@ -552,7 +552,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2409,7 +2409,7 @@ +@@ -2423,7 +2423,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -561,7 +561,7 @@ VARIABLE_COMMENT Block size to be used for MyISAM index pages NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 16384 -@@ -2423,7 +2423,7 @@ +@@ -2437,7 +2437,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 6 VARIABLE_SCOPE GLOBAL @@ -570,7 +570,7 @@ VARIABLE_COMMENT Default pointer size to be used for MyISAM tables NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 7 -@@ -2433,9 +2433,9 @@ +@@ -2447,9 +2447,9 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MAX_SORT_FILE_SIZE SESSION_VALUE NULL @@ -582,7 +582,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't use the fast sort index method to created index if the temporary file would get bigger than this -@@ -2447,14 +2447,14 @@ +@@ -2461,14 +2461,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MMAP_SIZE SESSION_VALUE NULL @@ -600,7 +600,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -2479,10 +2479,10 @@ +@@ -2493,10 +2493,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -613,7 +613,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2496,7 +2496,7 @@ +@@ -2510,7 +2510,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE NUMERIC_MIN_VALUE 4096 @@ -622,7 +622,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2549,7 +2549,7 @@ +@@ -2563,7 +2563,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -631,7 +631,7 @@ VARIABLE_COMMENT Buffer length for TCP/IP and socket communication NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1048576 -@@ -2563,7 +2563,7 @@ +@@ -2577,7 +2577,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 30 VARIABLE_SCOPE SESSION @@ -640,7 +640,7 @@ VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2577,7 +2577,7 @@ +@@ -2591,7 +2591,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE SESSION @@ -649,7 +649,7 @@ VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2591,7 +2591,7 @@ +@@ -2605,7 +2605,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 60 VARIABLE_SCOPE SESSION @@ -658,7 +658,7 @@ VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2661,7 +2661,7 @@ +@@ -2675,7 +2675,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -667,7 +667,7 @@ VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1 -@@ -2675,7 +2675,7 @@ +@@ -2689,7 +2689,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 62 VARIABLE_SCOPE SESSION @@ -676,7 +676,7 @@ VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 62 -@@ -2689,7 +2689,7 @@ +@@ -2703,7 +2703,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE SESSION @@ -685,7 +685,7 @@ VARIABLE_COMMENT Controls number of record samples to check condition selectivity NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 4294967295 -@@ -2717,7 +2717,7 @@ +@@ -2731,7 +2731,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -694,7 +694,7 @@ VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5 -@@ -2745,7 +2745,7 @@ +@@ -2759,7 +2759,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -703,7 +703,7 @@ VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2759,7 +2759,7 @@ +@@ -2773,7 +2773,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -712,7 +712,7 @@ VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 200 -@@ -2773,7 +2773,7 @@ +@@ -2787,7 +2787,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -721,7 +721,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2787,7 +2787,7 @@ +@@ -2801,7 +2801,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -730,7 +730,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2801,7 +2801,7 @@ +@@ -2815,7 +2815,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -739,7 +739,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2815,7 +2815,7 @@ +@@ -2829,7 +2829,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -748,7 +748,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2829,7 +2829,7 @@ +@@ -2843,7 +2843,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -757,7 +757,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2843,7 +2843,7 @@ +@@ -2857,7 +2857,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -766,7 +766,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2857,7 +2857,7 @@ +@@ -2871,7 +2871,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -775,7 +775,7 @@ VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2871,7 +2871,7 @@ +@@ -2885,7 +2885,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 80 VARIABLE_SCOPE GLOBAL @@ -784,7 +784,7 @@ VARIABLE_COMMENT Maximum number of condition instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2885,7 +2885,7 @@ +@@ -2899,7 +2899,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -793,7 +793,7 @@ VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2899,7 +2899,7 @@ +@@ -2913,7 +2913,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -802,7 +802,7 @@ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2913,7 +2913,7 @@ +@@ -2927,7 +2927,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -811,7 +811,7 @@ VARIABLE_COMMENT Maximum number of file instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2927,7 +2927,7 @@ +@@ -2941,7 +2941,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE GLOBAL @@ -820,7 +820,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented files. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2941,7 +2941,7 @@ +@@ -2955,7 +2955,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -829,7 +829,7 @@ VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2955,7 +2955,7 @@ +@@ -2969,7 +2969,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -838,7 +838,7 @@ VARIABLE_COMMENT Maximum number of mutex instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2969,7 +2969,7 @@ +@@ -2983,7 +2983,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -847,7 +847,7 @@ VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2983,7 +2983,7 @@ +@@ -2997,7 +2997,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 40 VARIABLE_SCOPE GLOBAL @@ -856,7 +856,7 @@ VARIABLE_COMMENT Maximum number of rwlock instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2997,7 +2997,7 @@ +@@ -3011,7 +3011,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -865,7 +865,7 @@ VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -3011,7 +3011,7 @@ +@@ -3025,7 +3025,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -874,7 +874,7 @@ VARIABLE_COMMENT Maximum number of socket instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -3025,7 +3025,7 @@ +@@ -3039,7 +3039,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -883,7 +883,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3039,7 +3039,7 @@ +@@ -3053,7 +3053,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 150 VARIABLE_SCOPE GLOBAL @@ -892,16 +892,16 @@ VARIABLE_COMMENT Maximum number of stage instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -3053,7 +3053,7 @@ +@@ -3067,7 +3067,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME - DEFAULT_VALUE 185 + DEFAULT_VALUE 188 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Maximum number of statement instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -3067,7 +3067,7 @@ +@@ -3081,7 +3081,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -910,7 +910,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3081,7 +3081,7 @@ +@@ -3095,7 +3095,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -919,7 +919,7 @@ VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3095,7 +3095,7 @@ +@@ -3109,7 +3109,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -928,7 +928,7 @@ VARIABLE_COMMENT Maximum number of thread instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -3109,7 +3109,7 @@ +@@ -3123,7 +3123,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -937,7 +937,7 @@ VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3123,7 +3123,7 @@ +@@ -3137,7 +3137,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -946,7 +946,7 @@ VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3137,7 +3137,7 @@ +@@ -3151,7 +3151,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -955,7 +955,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1024 -@@ -3151,7 +3151,7 @@ +@@ -3165,7 +3165,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -964,7 +964,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -3165,7 +3165,7 @@ +@@ -3179,7 +3179,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -973,7 +973,7 @@ VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3235,7 +3235,7 @@ +@@ -3249,7 +3249,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE SESSION @@ -982,7 +982,7 @@ VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3263,7 +3263,7 @@ +@@ -3277,7 +3277,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 15 VARIABLE_SCOPE SESSION @@ -991,7 +991,7 @@ VARIABLE_COMMENT Limit of query profiling memory NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -3277,7 +3277,7 @@ +@@ -3291,7 +3291,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 5 VARIABLE_SCOPE SESSION @@ -1000,7 +1000,7 @@ VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3347,7 +3347,7 @@ +@@ -3361,7 +3361,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -1009,7 +1009,7 @@ VARIABLE_COMMENT Allocation block size for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3361,7 +3361,7 @@ +@@ -3375,7 +3375,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -1018,7 +1018,7 @@ VARIABLE_COMMENT Don't cache results that are bigger than this NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3375,7 +3375,7 @@ +@@ -3389,7 +3389,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE GLOBAL @@ -1027,7 +1027,7 @@ VARIABLE_COMMENT The minimum size for blocks allocated by the query cache NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3392,7 +3392,7 @@ +@@ -3406,7 +3406,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The memory allocated to store results from old queries NUMERIC_MIN_VALUE 0 @@ -1036,7 +1036,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3445,7 +3445,7 @@ +@@ -3459,7 +3459,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 24576 VARIABLE_SCOPE SESSION @@ -1045,7 +1045,7 @@ VARIABLE_COMMENT Persistent buffer for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3459,7 +3459,7 @@ +@@ -3473,7 +3473,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1054,7 +1054,7 @@ VARIABLE_COMMENT Allocation block size for storing ranges during optimization NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 4294967295 -@@ -3476,7 +3476,7 @@ +@@ -3490,7 +3490,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Maximum speed(KB/s) to read binlog from master (0 = no limit) NUMERIC_MIN_VALUE 0 @@ -1063,7 +1063,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3487,7 +3487,7 @@ +@@ -3501,7 +3501,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE SESSION @@ -1072,7 +1072,7 @@ VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -3515,7 +3515,7 @@ +@@ -3529,7 +3529,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -1081,7 +1081,7 @@ VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 2147483647 -@@ -3795,10 +3795,10 @@ +@@ -3809,10 +3809,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8388608 VARIABLE_SCOPE SESSION @@ -1094,7 +1094,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3837,7 +3837,7 @@ +@@ -3851,7 +3851,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -1103,7 +1103,7 @@ VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -4019,7 +4019,7 @@ +@@ -4033,7 +4033,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1112,7 +1112,7 @@ VARIABLE_COMMENT Maximum number of parallel threads to use on slave for events in a single replication domain. When using multiple domains, this can be used to limit a single domain from grabbing all threads and thus stalling other domains. The default of 0 means to allow a domain to grab as many threads as it wants, up to the value of slave_parallel_threads. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -4061,7 +4061,7 @@ +@@ -4075,7 +4075,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -1121,7 +1121,7 @@ VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -4089,7 +4089,7 @@ +@@ -4103,7 +4103,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE GLOBAL @@ -1130,7 +1130,7 @@ VARIABLE_COMMENT Limit on how much memory SQL threads should use per parallel replication thread when reading ahead in the relay log looking for opportunities for parallel replication. Only used when --slave-parallel-threads > 0. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2147483647 -@@ -4117,7 +4117,7 @@ +@@ -4131,7 +4131,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1139,7 +1139,7 @@ VARIABLE_COMMENT If non-zero, number of threads to spawn to apply in parallel events on the slave that were group-committed on the master or were logged with GTID in different replication domains. Note that these threads are in addition to the IO and SQL threads, which are always created by a replication slave NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -4131,7 +4131,7 @@ +@@ -4145,7 +4145,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1148,7 +1148,7 @@ VARIABLE_COMMENT Alias for slave_parallel_threads NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -4187,7 +4187,7 @@ +@@ -4201,7 +4201,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1157,7 +1157,7 @@ VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -4215,7 +4215,7 @@ +@@ -4229,7 +4229,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -1166,7 +1166,7 @@ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -4274,7 +4274,7 @@ +@@ -4288,7 +4288,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size NUMERIC_MIN_VALUE 1024 @@ -1175,7 +1175,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4579,7 +4579,7 @@ +@@ -4593,7 +4593,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1184,7 +1184,7 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -4677,7 +4677,7 @@ +@@ -4691,7 +4691,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 400 VARIABLE_SCOPE GLOBAL @@ -1193,7 +1193,7 @@ VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 NUMERIC_MAX_VALUE 524288 -@@ -4691,7 +4691,7 @@ +@@ -4705,7 +4705,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -1202,7 +1202,7 @@ VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -4719,7 +4719,7 @@ +@@ -4733,7 +4733,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1211,7 +1211,7 @@ VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -4733,7 +4733,7 @@ +@@ -4747,7 +4747,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1220,16 +1220,45 @@ VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -4946,7 +4946,7 @@ +@@ -4952,15 +4952,15 @@ + READ_ONLY YES + COMMAND_LINE_ARGUMENT REQUIRED + VARIABLE_NAME TMP_DISK_TABLE_SIZE +-SESSION_VALUE 18446744073709551615 +-GLOBAL_VALUE 18446744073709551615 ++SESSION_VALUE 4294967295 ++GLOBAL_VALUE 4294967295 + GLOBAL_VALUE_ORIGIN COMPILE-TIME +-DEFAULT_VALUE 18446744073709551615 ++DEFAULT_VALUE 4294967295 + VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED - VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table + VARIABLE_COMMENT Max size for data for an internal temporary on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 1024 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4957,7 +4957,7 @@ +@@ -4974,7 +4974,7 @@ + VARIABLE_TYPE BIGINT UNSIGNED + VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size. + NUMERIC_MIN_VALUE 1024 +-NUMERIC_MAX_VALUE 18446744073709551615 ++NUMERIC_MAX_VALUE 4294967295 + NUMERIC_BLOCK_SIZE 1 + ENUM_VALUE_LIST NULL + READ_ONLY NO +@@ -4988,7 +4988,7 @@ + VARIABLE_TYPE BIGINT UNSIGNED + VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table. + NUMERIC_MIN_VALUE 1024 +-NUMERIC_MAX_VALUE 18446744073709551615 ++NUMERIC_MAX_VALUE 4294967295 + NUMERIC_BLOCK_SIZE 1 + ENUM_VALUE_LIST NULL + READ_ONLY NO +@@ -4999,7 +4999,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8192 VARIABLE_SCOPE SESSION @@ -1238,7 +1267,7 @@ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4971,7 +4971,7 @@ +@@ -5013,7 +5013,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1247,7 +1276,7 @@ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -5069,7 +5069,7 @@ +@@ -5111,7 +5111,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -1256,7 +1285,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -5173,7 +5173,7 @@ +@@ -5215,7 +5215,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME OPEN_FILES_LIMIT VARIABLE_SCOPE GLOBAL @@ -1265,7 +1294,7 @@ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -5186,7 +5186,7 @@ +@@ -5228,7 +5228,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1274,7 +1303,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5196,7 +5196,7 @@ +@@ -5238,7 +5238,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1283,7 +1312,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5281,7 +5281,7 @@ +@@ -5323,7 +5323,7 @@ VARIABLE_NAME LOG_TC_SIZE GLOBAL_VALUE_ORIGIN AUTO VARIABLE_SCOPE GLOBAL From 92f1837a27f4b78a3e6c74ca33c3052211069af5 Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 1 Jul 2017 14:22:49 +0300 Subject: [PATCH 45/53] Fixed compilation warnings (while testing 32 bit builds) --- sql/item_func.cc | 2 +- storage/connect/fmdlex.c | 2 +- storage/connect/tabmysql.cpp | 2 +- storage/maria/ma_test2.c | 4 ++-- storage/tokudb/PerconaFT/ft/loader/dbufio.cc | 2 +- storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc | 4 ++-- storage/tokudb/PerconaFT/ft/txn/txn_manager.cc | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index 1b83f86d19c..4a9fa3342e6 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3918,7 +3918,7 @@ longlong Item_master_gtid_wait::val_int() { DBUG_ASSERT(fixed == 1); longlong result= 0; - String *gtid_pos = args[0]->val_str(&value); + String *gtid_pos __attribute__((unused)) = args[0]->val_str(&value); if (args[0]->null_value) { diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c index 548a7ae5b7e..ef4f7bfc65a 100644 --- a/storage/connect/fmdlex.c +++ b/storage/connect/fmdlex.c @@ -529,7 +529,7 @@ YY_DECL pp->Num = 0; if (pp->InFmt) {*pp->InFmt = '\0'; pp->InFmt[pp->Outsize -1] = '\0'; } if (pp->OutFmt) {*pp->OutFmt = '\0'; pp->OutFmt[pp->Outsize -1] = '\0'; } - pp->Curp = pp->Format; + pp->Curp = (char*) pp->Format; yy_init = 1; /* This is a new input */ diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index bdddcf64ca8..97ff7bc59f2 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -124,7 +124,7 @@ bool MYSQLDEF::GetServerInfo(PGLOBAL g, const char *server_name) DBUG_RETURN(true); } // endif server - DBUG_PRINT("info", ("get_server_by_name returned server at %lx", + DBUG_PRINT("info", ("get_server_by_name returned server at %zx", (size_t) server)); // TODO: We need to examine which of these can really be NULL diff --git a/storage/maria/ma_test2.c b/storage/maria/ma_test2.c index 6dfa04a5217..24c48c67210 100644 --- a/storage/maria/ma_test2.c +++ b/storage/maria/ma_test2.c @@ -1006,8 +1006,8 @@ w_requests: %10lu\n\ writes: %10lu\n\ r_requests: %10lu\n\ reads: %10lu\n", - maria_pagecache->blocks_used, - maria_pagecache->global_blocks_changed, + (ulong) maria_pagecache->blocks_used, + (ulong) maria_pagecache->global_blocks_changed, (ulong) maria_pagecache->global_cache_w_requests, (ulong) maria_pagecache->global_cache_write, (ulong) maria_pagecache->global_cache_r_requests, diff --git a/storage/tokudb/PerconaFT/ft/loader/dbufio.cc b/storage/tokudb/PerconaFT/ft/loader/dbufio.cc index 64722bd68f1..ad084a4fbdc 100644 --- a/storage/tokudb/PerconaFT/ft/loader/dbufio.cc +++ b/storage/tokudb/PerconaFT/ft/loader/dbufio.cc @@ -566,7 +566,7 @@ dbufio_print(DBUFIO_FILESET bfs) { fprintf(stderr, "%s:%d bfs=%p", __FILE__, __LINE__, bfs); if (bfs->panic) fprintf(stderr, " panic=%d", bfs->panic_errno); - fprintf(stderr, " N=%d %d %" PRIuMAX, bfs->N, bfs->n_not_done, bfs->bufsize); + fprintf(stderr, " N=%d %d %" PRIuMAX, bfs->N, bfs->n_not_done, (uintmax_t) bfs->bufsize); for (int i = 0; i < bfs->N; i++) { struct dbufio_file *dbf = &bfs->files[i]; if (dbf->error_code[0] || dbf->error_code[1]) diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc index 56876b474d4..9606db64632 100644 --- a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc +++ b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc @@ -761,7 +761,7 @@ int toku_serialize_ftnode_to_memory(FTNODE node, // Zero the rest of the buffer memset(data + total_node_size, 0, total_buffer_size - total_node_size); - assert(curr_ptr - data == total_node_size); + assert((uint32_t) (curr_ptr - data) == total_node_size); *bytes_to_write = data; *n_bytes_to_write = total_buffer_size; *n_uncompressed_bytes = total_uncompressed_size; @@ -2699,7 +2699,7 @@ decompress_from_raw_block_into_rbuf(uint8_t *raw_block, size_t raw_block_size, s // decompress all the compressed sub blocks into the uncompressed buffer r = decompress_all_sub_blocks(n_sub_blocks, sub_block, compressed_data, uncompressed_data, num_cores, ft_pool); if (r != 0) { - fprintf(stderr, "%s:%d block %" PRId64 " failed %d at %p size %lu\n", __FUNCTION__, __LINE__, blocknum.b, r, raw_block, raw_block_size); + fprintf(stderr, "%s:%d block %" PRId64 " failed %d at %p size %zu\n", __FUNCTION__, __LINE__, blocknum.b, r, raw_block, raw_block_size); dump_bad_block(raw_block, raw_block_size); goto exit; } diff --git a/storage/tokudb/PerconaFT/ft/txn/txn_manager.cc b/storage/tokudb/PerconaFT/ft/txn/txn_manager.cc index 88eca36a261..8fe52b10597 100644 --- a/storage/tokudb/PerconaFT/ft/txn/txn_manager.cc +++ b/storage/tokudb/PerconaFT/ft/txn/txn_manager.cc @@ -970,11 +970,11 @@ int toku_txn_manager_recover_root_txn ( txn_manager->last_xid_seen_for_recover = curr_txn->txnid.parent_id64; // if we found the maximum number of prepared transactions we are // allowed to find, then break - if (num_txns_returned >= count) { + if ((long) num_txns_returned >= count) { break; } } - invariant(num_txns_returned <= count); + invariant((long) num_txns_returned <= count); *retp = num_txns_returned; ret_val = 0; exit: From 306bc90ad798756c5c11ac7e077839664c001fdc Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 3 Jul 2017 09:15:28 +0400 Subject: [PATCH 46/53] Adding "const" qualifier to Column_definition::make_field() --- sql/field.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/field.h b/sql/field.h index bfdb06984af..4b0efd5702e 100644 --- a/sql/field.h +++ b/sql/field.h @@ -4011,7 +4011,7 @@ public: field_name_arg); } Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, - const LEX_CSTRING *field_name_arg) + const LEX_CSTRING *field_name_arg) const { return make_field(share, mem_root, (uchar *) 0, (uchar *) "", 0, field_name_arg); From cf2789bf0b8ddd6bbe4c90bbfe9a70492a3b4fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 3 Jul 2017 11:27:53 +0300 Subject: [PATCH 47/53] ha_innobase::write_row(): Test the cheaper condition first --- storage/innobase/handler/ha_innodb.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 14b1cb477f4..e4684719ff3 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -8496,15 +8496,15 @@ ha_innobase::write_row( || sql_command == SQLCOM_OPTIMIZE || sql_command == SQLCOM_CREATE_INDEX #ifdef WITH_WSREP - || (wsrep_on(m_user_thd) && wsrep_load_data_splitting && - sql_command == SQLCOM_LOAD && - !thd_test_options( - m_user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) + || (sql_command == SQLCOM_LOAD + && wsrep_load_data_splitting && wsrep_on(m_user_thd) + && !thd_test_options( + m_user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) #endif /* WITH_WSREP */ || sql_command == SQLCOM_DROP_INDEX) && m_num_write_row >= 10000) { #ifdef WITH_WSREP - if (wsrep_on(m_user_thd) && sql_command == SQLCOM_LOAD) { + if (sql_command == SQLCOM_LOAD && wsrep_on(m_user_thd)) { WSREP_DEBUG("forced trx split for LOAD: %s", wsrep_thd_query(m_user_thd)); } From 56ff6f1b0b248befb80675ba36a3251c7844f410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 3 Jul 2017 11:47:54 +0300 Subject: [PATCH 48/53] InnoDB: Remove dead code for DATA_POINT and DATA_VAR_POINT The POINT data type is being treated just like any other geometry data type in InnoDB. The fixed-length data type DATA_POINT had been introduced in WL#6942 based on a misunderstanding and without appropriate review. Because of fundamental design problems (such as a DEFAULT POINT(0 0) value secretly introduced by InnoDB), the code was disabled in Oracle Bug#20415831 fix. This patch removes the dead code and definitions that were left behind by the Oracle Bug#20415831 patch. --- storage/innobase/btr/btr0btr.cc | 21 ++---------- storage/innobase/data/data0type.cc | 8 ----- storage/innobase/dict/dict0dict.cc | 19 ++--------- storage/innobase/handler/ha_innodb.cc | 21 ------------ storage/innobase/handler/handler0alter.cc | 41 ----------------------- storage/innobase/include/data0type.h | 37 ++++---------------- storage/innobase/include/data0type.ic | 6 ---- storage/innobase/include/row0mysql.h | 6 ---- storage/innobase/rem/rem0cmp.cc | 7 ---- storage/innobase/rem/rem0rec.cc | 8 ----- storage/innobase/row/row0merge.cc | 4 +-- storage/innobase/row/row0mysql.cc | 2 -- storage/innobase/row/row0sel.cc | 24 +++---------- 13 files changed, 17 insertions(+), 187 deletions(-) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 89ebe5b8783..64a14d0e959 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -4673,29 +4673,12 @@ btr_index_rec_validate( rec_get_nth_field_offs(offsets, i, &len); /* Note that if fixed_size != 0, it equals the - length of a fixed-size column in the clustered index, - except the DATA_POINT, whose length would be MBR_LEN - when it's indexed in a R-TREE. We should adjust it here. + length of a fixed-size column in the clustered index. + We should adjust it here. A prefix index of the column is of fixed, but different length. When fixed_size == 0, prefix_len is the maximum length of the prefix index column. */ - if (dict_field_get_col(field)->mtype == DATA_POINT) { - ut_ad(fixed_size == DATA_POINT_LEN); - if (dict_index_is_spatial(index)) { - /* For DATA_POINT data, when it has R-tree - index, the fixed_len is the MBR of the point. - But if it's a primary key and on R-TREE - as the PK pointer, the length shall be - DATA_POINT_LEN as well. */ - ut_ad((field->fixed_len == DATA_MBR_LEN - && i == 0) - || (field->fixed_len == DATA_POINT_LEN - && i != 0)); - fixed_size = field->fixed_len; - } - } - if ((field->prefix_len == 0 && len != UNIV_SQL_NULL && fixed_size && len != fixed_size) diff --git a/storage/innobase/data/data0type.cc b/storage/innobase/data/data0type.cc index a40724b303d..d4b809c3f59 100644 --- a/storage/innobase/data/data0type.cc +++ b/storage/innobase/data/data0type.cc @@ -193,14 +193,6 @@ dtype_print(const dtype_t* type) fputs("DATA_BLOB", stderr); break; - case DATA_POINT: - fputs("DATA_POINT", stderr); - break; - - case DATA_VAR_POINT: - fputs("DATA_VAR_POINT", stderr); - break; - case DATA_GEOMETRY: fputs("DATA_GEOMETRY", stderr); break; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index b0ba04c7fbf..f54428b4fe6 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2891,22 +2891,9 @@ dict_index_add_col( field = dict_index_get_nth_field(index, index->n_def - 1); field->col = col; - /* DATA_POINT is a special type, whose fixed_len should be: - 1) DATA_MBR_LEN, when it's indexed in R-TREE. In this case, - it must be the first col to be added. - 2) DATA_POINT_LEN(be equal to fixed size of column), when it's - indexed in B-TREE, - 3) DATA_POINT_LEN, if a POINT col is the PRIMARY KEY, and we are - adding the PK col to other B-TREE/R-TREE. */ - /* TODO: We suppose the dimension is 2 now. */ - if (dict_index_is_spatial(index) && DATA_POINT_MTYPE(col->mtype) - && index->n_def == 1) { - field->fixed_len = DATA_MBR_LEN; - } else { - field->fixed_len = static_cast( - dict_col_get_fixed_size( - col, dict_table_is_comp(table))); - } + field->fixed_len = static_cast( + dict_col_get_fixed_size( + col, dict_table_is_comp(table))); if (prefix_len && field->fixed_len > prefix_len) { field->fixed_len = (unsigned int) prefix_len; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e4684719ff3..3bfff324ae4 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5971,14 +5971,6 @@ innobase_match_index_columns( spatial index on it and we intend to use DATA_GEOMETRY for legacy GIS data types which are of var-length. */ switch (col_type) { - case DATA_POINT: - case DATA_VAR_POINT: - if (DATA_POINT_MTYPE(mtype) - || mtype == DATA_GEOMETRY - || mtype == DATA_BLOB) { - break; - } - /* Fall through */ case DATA_GEOMETRY: if (mtype == DATA_BLOB) { break; @@ -7969,12 +7961,6 @@ build_template_field( prebuilt->templ_contains_blob = TRUE; } - if (templ->type == DATA_POINT) { - /* We set this only when it's DATA_POINT, but not - DATA_VAR_POINT */ - prebuilt->templ_contains_fixed_point = TRUE; - } - return(templ); } @@ -8059,7 +8045,6 @@ ha_innobase::build_template( /* Prepare to build m_prebuilt->mysql_template[]. */ m_prebuilt->templ_contains_blob = FALSE; - m_prebuilt->templ_contains_fixed_point = FALSE; m_prebuilt->mysql_prefix_len = 0; m_prebuilt->n_template = 0; m_prebuilt->idx_cond_n_cols = 0; @@ -8950,8 +8935,6 @@ calc_row_difference( switch (col_type) { case DATA_BLOB: - case DATA_POINT: - case DATA_VAR_POINT: case DATA_GEOMETRY: o_ptr = row_mysql_read_blob_ref(&o_len, o_ptr, o_len); n_ptr = row_mysql_read_blob_ref(&n_len, n_ptr, n_len); @@ -11714,10 +11697,6 @@ create_table_info_t::create_table_def() } } - if (col_type == DATA_POINT) { - col_len = DATA_POINT_LEN; - } - is_virtual = (innobase_is_v_fld(field)) ? DATA_VIRTUAL : 0; is_stored = innobase_is_s_fld(field); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 7c75711d2e3..c51ae212918 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1760,7 +1760,6 @@ innobase_col_to_mysql( memcpy(dest, data, len); break; - case DATA_VAR_POINT: case DATA_GEOMETRY: case DATA_BLOB: /* Skip MySQL BLOBs when reporting an erroneous row @@ -1785,7 +1784,6 @@ innobase_col_to_mysql( case DATA_FLOAT: case DATA_DOUBLE: case DATA_DECIMAL: - case DATA_POINT: /* Above are the valid column types for MySQL data. */ ut_ad(flen == len); /* fall through */ @@ -3011,29 +3009,6 @@ innobase_check_foreigns( return(false); } -/** Get the default POINT value in MySQL format -@param[in] heap memory heap where allocated -@param[in] length length of MySQL format -@return mysql format data */ -static -const byte* -innobase_build_default_mysql_point( - mem_heap_t* heap, - ulint length) -{ - byte* buf = static_cast(mem_heap_alloc( - heap, DATA_POINT_LEN + length)); - - byte* wkb = buf + length; - - ulint len = get_wkb_of_default_point(SPDIMS, wkb, DATA_POINT_LEN); - ut_ad(len == DATA_POINT_LEN); - - row_mysql_store_blob_ref(buf, length, wkb, len); - - return(buf); -} - /** Convert a default value for ADD COLUMN. @param heap Memory heap where allocated @@ -3060,16 +3035,6 @@ innobase_build_col_map_add( const byte* mysql_data = field->ptr; - if (dfield_get_type(dfield)->mtype == DATA_POINT) { - /** If the DATA_POINT field is NOT NULL, we need to - give it a default value, since DATA_POINT is a fixed length - type, we couldn't store a value of length 0, like other - geom types. Server doesn't provide the default value, and - we would use POINT(0 0) here instead. */ - - mysql_data = innobase_build_default_mysql_point(heap, size); - } - row_mysql_store_col_in_innobase_format( dfield, buf, true, mysql_data, size, comp); } @@ -4703,12 +4668,6 @@ prepare_inplace_alter_table_dict( } - if (col_type == DATA_POINT) { - /* DATA_POINT should be of fixed length, - instead of the pack_length(blob length). */ - col_len = DATA_POINT_LEN; - } - if (dict_col_name_is_reserved(field->field_name)) { dict_mem_table_free(ctx->new_table); my_error(ER_WRONG_COLUMN_NAME, MYF(0), diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index 3fa8320b5aa..35dcf2f3397 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.h @@ -77,28 +77,18 @@ binary strings */ charset-collation for tables created with it can also be latin1_swedish_ci */ -/* DATA_POINT&DATA_VAR_POINT are for standard geometry datatype 'point' and -DATA_GEOMETRY include all other standard geometry datatypes as described in -OGC standard(line_string, polygon, multi_point, multi_polygon, +/* DATA_GEOMETRY includes all standard geometry datatypes as described in +OGC standard(point, line_string, polygon, multi_point, multi_polygon, multi_line_string, geometry_collection, geometry). Currently, geometry data is stored in the standard Well-Known Binary(WKB) format (http://www.opengeospatial.org/standards/sfa). -We use BLOB as underlying datatype for DATA_GEOMETRY and DATA_VAR_POINT -while CHAR for DATA_POINT */ +We use BLOB as the underlying datatype. */ #define DATA_GEOMETRY 14 /* geometry datatype of variable length */ -/* The following two are disabled temporarily, we won't create them in -get_innobase_type_from_mysql_type(). -TODO: We will enable DATA_POINT/them when we come to the fixed-length POINT -again. */ -#define DATA_POINT 15 /* geometry datatype of fixed length POINT */ -#define DATA_VAR_POINT 16 /* geometry datatype of variable length - POINT, used when we want to store POINT - as BLOB internally */ #define DATA_MTYPE_MAX 63 /* dtype_store_for_order_and_null_size() requires the values are <= 63 */ #define DATA_MTYPE_CURRENT_MIN DATA_VARCHAR /* minimum value of mtype */ -#define DATA_MTYPE_CURRENT_MAX DATA_VAR_POINT /* maximum value of mtype */ +#define DATA_MTYPE_CURRENT_MAX DATA_GEOMETRY /* maximum value of mtype */ /*-------------------------------------------*/ /* The 'PRECISE TYPE' of a column */ /* @@ -211,15 +201,6 @@ store the charset-collation number; one byte is left unused, though */ /* Maximum multi-byte character length in bytes, plus 1 */ #define DATA_MBMAX 5 -/* For DATA_POINT of dimension 2, the length of value in btree is always 25, -which is the summary of: -SRID_SIZE(4) + WKB_HEADER_SIZE(1+4) + POINT_DATA_SIZE(8*2). -So the length of physical record or POINT KEYs on btree are 25. -GIS_TODO: When we support multi-dimensions DATA_POINT, we should get the -length from corresponding column or index definition, instead of this MACRO -*/ -#define DATA_POINT_LEN 25 - /* Pack mbminlen, mbmaxlen to mbminmaxlen. */ #define DATA_MBMINMAXLEN(mbminlen, mbmaxlen) \ unsigned((mbmaxlen) * DATA_MBMAX + (mbminlen)) @@ -229,18 +210,12 @@ length from corresponding column or index definition, instead of this MACRO /* Get mbmaxlen from mbminmaxlen. */ #define DATA_MBMAXLEN(mbminmaxlen) unsigned((mbminmaxlen) / DATA_MBMAX) -/* For checking if a geom_type is POINT */ -#define DATA_POINT_MTYPE(mtype) ((mtype) == DATA_POINT \ - || (mtype) == DATA_VAR_POINT) - /* For checking if mtype is GEOMETRY datatype */ -#define DATA_GEOMETRY_MTYPE(mtype) (DATA_POINT_MTYPE(mtype) \ - || (mtype) == DATA_GEOMETRY) +#define DATA_GEOMETRY_MTYPE(mtype) ((mtype) == DATA_GEOMETRY) /* For checking if mtype is BLOB or GEOMETRY, since we use BLOB as -the underling datatype of GEOMETRY(not DATA_POINT) data. */ +the underlying datatype of GEOMETRY data. */ #define DATA_LARGE_MTYPE(mtype) ((mtype) == DATA_BLOB \ - || (mtype) == DATA_VAR_POINT \ || (mtype) == DATA_GEOMETRY) /* For checking if data type is big length data type. */ diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic index b5a467455b9..3d2f46ed877 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.ic @@ -504,7 +504,6 @@ dtype_get_fixed_size_low( case DATA_INT: case DATA_FLOAT: case DATA_DOUBLE: - case DATA_POINT: return(len); case DATA_MYSQL: if (prtype & DATA_BINARY_TYPE) { @@ -533,7 +532,6 @@ dtype_get_fixed_size_low( case DATA_BINARY: case DATA_DECIMAL: case DATA_VARMYSQL: - case DATA_VAR_POINT: case DATA_GEOMETRY: case DATA_BLOB: return(0); @@ -580,7 +578,6 @@ dtype_get_min_size_low( case DATA_INT: case DATA_FLOAT: case DATA_DOUBLE: - case DATA_POINT: return(len); case DATA_MYSQL: if (prtype & DATA_BINARY_TYPE) { @@ -603,7 +600,6 @@ dtype_get_min_size_low( case DATA_BINARY: case DATA_DECIMAL: case DATA_VARMYSQL: - case DATA_VAR_POINT: case DATA_GEOMETRY: case DATA_BLOB: return(0); @@ -637,9 +633,7 @@ dtype_get_max_size_low( case DATA_BINARY: case DATA_DECIMAL: case DATA_VARMYSQL: - case DATA_POINT: return(len); - case DATA_VAR_POINT: case DATA_GEOMETRY: case DATA_BLOB: break; diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 6164366628e..8dfff46e78b 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -681,12 +681,6 @@ struct row_prebuilt_t { not to be confused with InnoDB externally stored columns (VARCHAR can be off-page too) */ - unsigned templ_contains_fixed_point:1;/*!< TRUE if the - template contains a column with - DATA_POINT. Since InnoDB regards - DATA_POINT as non-BLOB type, the - templ_contains_blob can't tell us - if there is DATA_POINT */ mysql_row_templ_t* mysql_template;/*!< template used to transform rows fast between MySQL and Innobase formats; memory for this template diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc index b14d9c77ad1..ffe93ac8612 100644 --- a/storage/innobase/rem/rem0cmp.cc +++ b/storage/innobase/rem/rem0cmp.cc @@ -378,8 +378,6 @@ cmp_whole_field( case DATA_MYSQL: return(innobase_mysql_cmp(prtype, a, a_length, b, b_length)); - case DATA_POINT: - case DATA_VAR_POINT: case DATA_GEOMETRY: return(cmp_geometry_field(mtype, prtype, a, a_length, b, b_length)); @@ -437,11 +435,6 @@ cmp_data( case DATA_SYS: pad = ULINT_UNDEFINED; break; - case DATA_POINT: - case DATA_VAR_POINT: - /* Since DATA_POINT has a fixed length of DATA_POINT_LEN, - currently, pad is not needed. Meanwhile, DATA_VAR_POINT acts - the same as DATA_GEOMETRY */ case DATA_GEOMETRY: ut_ad(prtype & DATA_BINARY_TYPE); pad = ULINT_UNDEFINED; diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index b7d7a30f4dc..4ad4730f37d 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -308,7 +308,6 @@ rec_init_offsets_comp_ordinary( if (!field->fixed_len || (temp && !dict_col_get_fixed_size(col, temp))) { - ut_ad(col->mtype != DATA_POINT); /* Variable-length field: read the length */ len = *lens--; /* If the maximum length of the field is up @@ -445,9 +444,6 @@ rec_init_offsets( if (UNIV_UNLIKELY(!field->fixed_len)) { const dict_col_t* col = dict_field_get_col(field); - /* DATA_POINT should always be a fixed - length column. */ - ut_ad(col->mtype != DATA_POINT); /* Variable-length field: read the length */ len = *lens--; /* If the maximum length of the field @@ -858,8 +854,6 @@ rec_get_converted_size_comp_prefix_low( } ut_ad(len <= col->len || DATA_LARGE_MTYPE(col->mtype) - || (DATA_POINT_MTYPE(col->mtype) - && len == DATA_MBR_LEN) || (col->len == 0 && col->mtype == DATA_VARCHAR)); fixed_len = field->fixed_len; @@ -1337,8 +1331,6 @@ rec_convert_dtuple_to_rec_comp( *lens-- = (byte) (len >> 8) | 0xc0; *lens-- = (byte) len; } else { - /* DATA_POINT would have a fixed_len */ - ut_ad(dtype_get_mtype(type) != DATA_POINT); ut_ad(len <= dtype_get_len(type) || DATA_LARGE_MTYPE(dtype_get_mtype(type)) || !strcmp(index->name, diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 4250634baec..73cb3fcea6f 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -840,9 +840,7 @@ row_merge_buf_add( } ut_ad(len <= col->len - || DATA_LARGE_MTYPE(col->mtype) - || (col->mtype == DATA_POINT - && len == DATA_MBR_LEN)); + || DATA_LARGE_MTYPE(col->mtype)); fixed_len = ifield->fixed_len; if (fixed_len && !dict_table_is_comp(index->table) diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index e74fdc7a5d7..08844bdd133 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -628,8 +628,6 @@ row_mysql_store_col_in_innobase_format( ptr = row_mysql_read_blob_ref(&col_len, mysql_data, col_len); } else if (DATA_GEOMETRY_MTYPE(type)) { - /* We use blob to store geometry data except DATA_POINT - internally, but in MySQL Layer the datatype is always blob. */ ptr = row_mysql_read_geometry(&col_len, mysql_data, col_len); } diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index a8f250bf6dd..55278dd9406 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -2619,10 +2619,9 @@ row_sel_convert_mysql_key_to_innobase( data_field_len = data_offset + data_len; } else { /* The key field is a column prefix of a BLOB - or TEXT, except DATA_POINT of GEOMETRY. */ + or TEXT. */ - ut_a(field->prefix_len > 0 - || DATA_POINT_MTYPE(type)); + ut_a(field->prefix_len > 0); /* MySQL stores the actual data length to the first 2 bytes after the optional SQL NULL @@ -2632,18 +2631,12 @@ row_sel_convert_mysql_key_to_innobase( seems to reserve field->prefix_len bytes for storing this field in the key value buffer, even though the actual value only takes data - len bytes from the start. - For POINT of GEOMETRY, which has no prefix - because it's now a fixed length type in - InnoDB, we have to get DATA_POINT_LEN bytes, - which is original prefix length of POINT. */ + len bytes from the start. */ data_len = key_ptr[data_offset] + 256 * key_ptr[data_offset + 1]; data_field_len = data_offset + 2 - + (type == DATA_POINT - ? DATA_POINT_LEN - : field->prefix_len); + + field->prefix_len; data_offset += 2; @@ -2905,8 +2898,6 @@ row_sel_field_store_in_mysql_format_func( len); break; - case DATA_POINT: - case DATA_VAR_POINT: case DATA_GEOMETRY: /* We store all geometry data as BLOB data at server layer. */ row_mysql_store_geometry(dest, templ->mysql_col_len, data, len); @@ -3027,7 +3018,6 @@ row_sel_store_mysql_field_func( /* Copy an externally stored field to a temporary heap */ ut_ad(field_no == templ->clust_rec_field_no); - ut_ad(templ->type != DATA_POINT); if (DATA_LARGE_MTYPE(templ->type)) { if (prebuilt->blob_heap == NULL) { @@ -3107,10 +3097,7 @@ row_sel_store_mysql_field_func( will be invalid as soon as the mini-transaction is committed and the page latch on the clustered index page is - released. - For DATA_POINT, it's stored like CHAR in InnoDB, - but it should be a BLOB field in MySQL layer. So we - still treated it as BLOB here. */ + released. */ if (prebuilt->blob_heap == NULL) { prebuilt->blob_heap = mem_heap_create( @@ -5369,7 +5356,6 @@ requires_clust_rec: && prebuilt->select_lock_type == LOCK_NONE && !prebuilt->m_no_prefetch && !prebuilt->templ_contains_blob - && !prebuilt->templ_contains_fixed_point && !prebuilt->clust_index_was_generated && !prebuilt->used_in_HANDLER && prebuilt->template_type != ROW_MYSQL_DUMMY_TEMPLATE From d438a448e61e3584145869c3f3305207d000fd0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 3 Jul 2017 12:13:01 +0300 Subject: [PATCH 49/53] MDEV-13228 Assertion `n < rec_offs_n_fields(offsets)' failed in rec_get_nth_field_offs upon crash recovery with compressed table In my preparatory patch for MDEV-12288, there was an off-by-one array initialization error that affected debug builds. --- storage/innobase/btr/btr0cur.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index a672f451ea9..14b24bcd9fd 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -4601,7 +4601,7 @@ btr_cur_parse_del_mark_set_clust_rec( btr_rec_set_deleted_flag(rec, page_zip, val); ut_ad(pos <= MAX_REF_PARTS); - ulint offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; + ulint offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 3]; rec_offs_init(offsets); mem_heap_t* heap = NULL; @@ -4609,7 +4609,7 @@ btr_cur_parse_del_mark_set_clust_rec( row_upd_rec_sys_fields_in_recovery( rec, page_zip, rec_get_offsets(rec, index, offsets, - pos + 1, &heap), + pos + 2, &heap), pos, trx_id, roll_ptr); } else { /* In delete-marked records, DB_TRX_ID must From ad2d722acd7bd7a816dff7838f3fa2dcaaeec8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 3 Jul 2017 13:13:54 +0300 Subject: [PATCH 50/53] MDEV-13228: Add a comment that clarifies the constants --- storage/innobase/btr/btr0cur.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 14b24bcd9fd..7bdd03c8a9e 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -4599,9 +4599,13 @@ btr_cur_parse_del_mark_set_clust_rec( and the adaptive hash index does not depend on them. */ btr_rec_set_deleted_flag(rec, page_zip, val); + /* pos is the offset of DB_TRX_ID in the clustered index. + Debug assertions may also access DB_ROLL_PTR at pos+1. + Therefore, we must compute offsets for the first pos+2 + clustered index fields. */ ut_ad(pos <= MAX_REF_PARTS); - ulint offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 3]; + ulint offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; rec_offs_init(offsets); mem_heap_t* heap = NULL; From 760127ac6ff428d4538733b3f99b743f7a802581 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 3 Jul 2017 14:56:33 +0400 Subject: [PATCH 51/53] Adding sf_return_type, improving sf_tail readability. 1. The "sf_tail" rule had a lot of rules with part markers, e.g: /* $1 */ They make the grammar really hard to read. Removing all these markers. 2. Moving the RETURNS clause into a separate sp_return_type rule, to make sf_tail even more simpler. Note, sp_return_type will be needed soon for packages anyway. --- sql/sql_yacc.yy | 43 ++++++++++++++++++++++++------------------- sql/sql_yacc_ora.yy | 41 +++++++++++++++++++++++------------------ 2 files changed, 47 insertions(+), 37 deletions(-) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 384ac0859c3..8b47568141d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -16640,36 +16640,41 @@ udf_tail: } ; + +sf_return_type: + RETURNS_SYM + { + LEX *lex= Lex; + lex->init_last_field(&lex->sphead->m_return_field_def, + &empty_clex_str, + thd->variables.collation_database); + } + type_with_opt_collate + { + if (Lex->sphead->fill_field_definition(thd, Lex->last_field)) + MYSQL_YYABORT; + } + ; + sf_tail: - opt_if_not_exists /* $1 */ - sp_name /* $2 */ - { /* $3 */ + opt_if_not_exists + sp_name + { if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; Lex->spname= $2; } - sp_parenthesized_fdparam_list /* $4 */ - RETURNS_SYM /* $5 */ - { /* $6 */ - LEX *lex= Lex; - lex->init_last_field(&lex->sphead->m_return_field_def, - &empty_clex_str, - thd->variables.collation_database); - } - type_with_opt_collate /* $7 */ - { /* $8 */ - if (Lex->sphead->fill_field_definition(thd, Lex->last_field)) - MYSQL_YYABORT; - } - sp_c_chistics /* $9 */ - { /* $10 */ + sp_parenthesized_fdparam_list + sf_return_type + sp_c_chistics + { LEX *lex= thd->lex; Lex_input_stream *lip= YYLIP; lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } - sp_proc_stmt_in_returns_clause /* $11 */ + sp_proc_stmt_in_returns_clause { LEX *lex= thd->lex; sp_head *sp= lex->sphead; diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index 37465439816..e7a995c727c 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -16878,37 +16878,42 @@ udf_tail: } ; -sf_tail: - opt_if_not_exists /* $1 */ - sp_name /* $2 */ - { /* $3 */ - if (!Lex->make_sp_head_no_recursive(thd, $1, $2, - TYPE_ENUM_FUNCTION)) - MYSQL_YYABORT; - Lex->spname= $2; - } - opt_sp_parenthesized_fdparam_list /* $4 */ - RETURN_SYM /* $5 */ - { /* $6 */ + +sf_return_type: + RETURN_SYM + { LEX *lex= Lex; lex->init_last_field(&lex->sphead->m_return_field_def, &empty_clex_str, thd->variables.collation_database); } - sp_param_type_with_opt_collate /* $7 */ - { /* $8 */ + sp_param_type_with_opt_collate + { if (Lex->sphead->fill_field_definition(thd, Lex->last_field)) MYSQL_YYABORT; } - sp_c_chistics /* $9 */ - { /* $10 */ + ; + +sf_tail: + opt_if_not_exists + sp_name + { + if (!Lex->make_sp_head_no_recursive(thd, $1, $2, + TYPE_ENUM_FUNCTION)) + MYSQL_YYABORT; + Lex->spname= $2; + } + opt_sp_parenthesized_fdparam_list + sf_return_type + sp_c_chistics + { LEX *lex= thd->lex; Lex_input_stream *lip= YYLIP; lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } - sp_tail_is /* $11 */ - sp_body /* $12 */ + sp_tail_is + sp_body { LEX *lex= thd->lex; sp_head *sp= lex->sphead; From 25ad623d64ebc34093544875e5b0ebd6101e975b Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 4 Jul 2017 14:14:30 +0400 Subject: [PATCH 52/53] MDEV-13240 Wrong warning with MAX(datetime_field) OVER (...) The problem resided in Item_window_func implementation, and it was revealed by bb-10.2-ext specific changes: Item_window_func::save_in_field() works differently in bb-10.2-ext vs 10.2: - 10.2 goes through val_str() - bb-10.2-ext goes through get_date(), due to Type_handler related changes. get_date() tries to convert empty string to DATETIME, hence the warning. During a discussion with Vicentiu, it was decided to fix Item_window_func::val_xxx() to return NULL (instead of an "empty" value, such as 0 for numbers and '' for strings) when force_return_blank is set. --- mysql-test/r/win.result | 12 ++++++++++++ mysql-test/r/win_insert_select.result | 4 ++-- mysql-test/t/win.test | 13 +++++++++++++ mysql-test/t/win_insert_select.test | 2 +- sql/item_windowfunc.h | 25 +++++++++++++++++-------- 5 files changed, 45 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index ec83998aa98..3aece252991 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3085,3 +3085,15 @@ select max(id), rank() over (order by max(id)) from t1 where id < 3; max(id) rank() over (order by max(id)) 2 1 drop table t1; +# +# Start of 10.3 tests +# +# +# MDEV-13240 Wrong warning with MAX(datetime_field) OVER (...) +# +CREATE TABLE t1 (dt DATETIME); +INSERT INTO t1 VALUES ('2017-05-17'); +SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t1; +MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) +NULL +DROP TABLE t1; diff --git a/mysql-test/r/win_insert_select.result b/mysql-test/r/win_insert_select.result index c86576df6ae..5eddbf78713 100644 --- a/mysql-test/r/win_insert_select.result +++ b/mysql-test/r/win_insert_select.result @@ -1,7 +1,7 @@ CREATE TABLE t1 (c1 INT, c2 VARCHAR(30)); PREPARE populate_table FROM "INSERT into t1 values (1, 'manual_insert_1'), (4, 'manual_insert_2')"; -INSERT INTO t1 SELECT row_number() over(), "should_have_0" FROM t1; +INSERT INTO t1 SELECT row_number() over(), "should_have_NULL" FROM t1; INSERT INTO t1 SELECT 1 + row_number() over(), "should_have_2" FROM t1; EXECUTE populate_table; INSERT INTO t1 SELECT 10 + row_number() over(), "should repeat 4 times [11-14]" FROM t1; @@ -13,8 +13,8 @@ c1 c2 12 should repeat 4 times [11-14] 13 should repeat 4 times [11-14] 14 should repeat 4 times [11-14] -0 should_have_0 2 should_have_2 +NULL should_have_NULL DELETE FROM t1; EXECUTE populate_table; INSERT INTO t1 diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index 95d32c5bd14..dfcf00cabf9 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -1877,3 +1877,16 @@ select count(max(id)) over (order by max(id)) from t1 where id < 3; select max(id), rank() over (order by max(id)) from t1 where id < 3; drop table t1; + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-13240 Wrong warning with MAX(datetime_field) OVER (...) +--echo # + +CREATE TABLE t1 (dt DATETIME); +INSERT INTO t1 VALUES ('2017-05-17'); +SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/win_insert_select.test b/mysql-test/t/win_insert_select.test index 66df7324c4f..a9e7e8f322f 100644 --- a/mysql-test/t/win_insert_select.test +++ b/mysql-test/t/win_insert_select.test @@ -3,7 +3,7 @@ CREATE TABLE t1 (c1 INT, c2 VARCHAR(30)); PREPARE populate_table FROM "INSERT into t1 values (1, 'manual_insert_1'), (4, 'manual_insert_2')"; -INSERT INTO t1 SELECT row_number() over(), "should_have_0" FROM t1; +INSERT INTO t1 SELECT row_number() over(), "should_have_NULL" FROM t1; INSERT INTO t1 SELECT 1 + row_number() over(), "should_have_2" FROM t1; EXECUTE populate_table; diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index 77cbd556e60..9fe95ed6cee 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -839,13 +839,24 @@ public: read_value_from_result_field= true; } + bool is_null() + { + if (force_return_blank) + return true; + + if (read_value_from_result_field) + return result_field->is_null(); + + return window_func()->is_null(); + } + double val_real() { double res; if (force_return_blank) { res= 0.0; - null_value= false; + null_value= true; } else if (read_value_from_result_field) { @@ -866,7 +877,7 @@ public: if (force_return_blank) { res= 0; - null_value= false; + null_value= true; } else if (read_value_from_result_field) { @@ -886,9 +897,8 @@ public: String *res; if (force_return_blank) { - null_value= false; - str->length(0); - res= str; + null_value= true; + res= NULL; } else if (read_value_from_result_field) { @@ -910,9 +920,8 @@ public: my_decimal *res; if (force_return_blank) { - my_decimal_set_zero(dec); - null_value= false; - res= dec; + null_value= true; + res= NULL; } else if (read_value_from_result_field) { From 58dd72f18cca5e706a5bd0dfcf3e22aba9bb8448 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 5 Jul 2017 17:18:33 +0400 Subject: [PATCH 53/53] MDEV-13245 Add struct AUTHID --- sql/sp.cc | 2 +- sql/sp_head.cc | 23 ++++++----------------- sql/sp_head.h | 8 +++++--- sql/sql_acl.cc | 2 +- sql/sql_class.cc | 19 +++++++++++++++---- sql/sql_class.h | 13 ++++++------- sql/sql_connect.h | 1 - sql/sql_trigger.cc | 4 ++-- sql/sql_yacc.yy | 6 +++--- sql/sql_yacc_ora.yy | 6 +++--- sql/structs.h | 18 ++++++++++++++---- sql/table.h | 2 +- 12 files changed, 57 insertions(+), 47 deletions(-) diff --git a/sql/sp.cc b/sql/sp.cc index da1b9e9212f..35b52c526a4 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1793,7 +1793,7 @@ sp_find_routine(THD *thd, stored_procedure_type type, const sp_name *name, if (db_load_routine(thd, type, name, &new_sp, sp->m_sql_mode, sp->m_params.str, returns, sp->m_body.str, *sp->m_chistics, - &sp->m_definer_user, &sp->m_definer_host, + &sp->m_definer.user, &sp->m_definer.host, sp->m_created, sp->m_modified, sp->get_creation_ctx()) == SP_OK) { diff --git a/sql/sp_head.cc b/sql/sp_head.cc index aa69de3f024..c6fd461b9d5 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1430,8 +1430,8 @@ set_routine_security_ctx(THD *thd, sp_head *sp, bool is_proc, { *save_ctx= 0; if (sp->m_chistics->suid != SP_IS_NOT_SUID && - sp->m_security_ctx.change_security_context(thd, &sp->m_definer_user, - &sp->m_definer_host, + sp->m_security_ctx.change_security_context(thd, &sp->m_definer.user, + &sp->m_definer.host, &sp->m_db, save_ctx)) return TRUE; @@ -1543,8 +1543,8 @@ sp_head::execute_trigger(THD *thd, if (m_chistics->suid != SP_IS_NOT_SUID && m_security_ctx.change_security_context(thd, - &m_definer_user, - &m_definer_host, + &m_definer.user, + &m_definer.host, &m_db, &save_ctx)) DBUG_RETURN(TRUE); @@ -2492,17 +2492,6 @@ sp_head::set_definer(const char *definer, uint definerlen) } -void -sp_head::set_definer(const LEX_CSTRING *user_name, const LEX_CSTRING *host_name) -{ - m_definer_user.str= strmake_root(mem_root, user_name->str, user_name->length); - m_definer_user.length= user_name->length; - - m_definer_host.str= strmake_root(mem_root, host_name->str, host_name->length); - m_definer_host.length= host_name->length; -} - - void sp_head::reset_thd_mem_root(THD *thd) { @@ -2571,9 +2560,9 @@ bool check_show_routine_access(THD *thd, sp_head *sp, bool *full_access) *full_access= ((!check_table_access(thd, SELECT_ACL, &tables, FALSE, 1, TRUE) && (tables.grant.privilege & SELECT_ACL) != 0) || - (!strcmp(sp->m_definer_user.str, + (!strcmp(sp->m_definer.user.str, thd->security_ctx->priv_user) && - !strcmp(sp->m_definer_host.str, + !strcmp(sp->m_definer.host.str, thd->security_ctx->priv_host))); if (!*full_access) return check_some_routine_access(thd, sp->m_db.str, sp->m_name.str, diff --git a/sql/sp_head.h b/sql/sp_head.h index f9d14378b7b..9c6b69f0ab8 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -187,8 +187,7 @@ public: LEX_CSTRING m_body; LEX_CSTRING m_body_utf8; LEX_CSTRING m_defstr; - LEX_CSTRING m_definer_user; - LEX_CSTRING m_definer_host; + AUTHID m_definer; /** Is this routine being executed? @@ -676,7 +675,10 @@ public: const st_sp_chistics *chistics, sql_mode_t sql_mode); void set_definer(const char *definer, uint definerlen); - void set_definer(const LEX_CSTRING *user_name, const LEX_CSTRING *host_name); + void set_definer(const LEX_CSTRING *user_name, const LEX_CSTRING *host_name) + { + m_definer.copy(mem_root, user_name, host_name); + } void reset_thd_mem_root(THD *thd); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 433d48a3de4..79acb996740 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -10909,7 +10909,7 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, Dummy_error_handler error_handler; DBUG_ENTER("sp_grant_privileges"); - if (!(combo=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + if (!(combo=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))) DBUG_RETURN(TRUE); combo->user.str= sctx->user; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 32c8ef5dd49..1e7dede8455 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -939,8 +939,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) m_internal_handler= NULL; m_binlog_invoker= INVOKER_NONE; - memset(&invoker_user, 0, sizeof(invoker_user)); - memset(&invoker_host, 0, sizeof(invoker_host)); + invoker.init(); prepare_derived_at_open= FALSE; create_tmp_table_for_derived= FALSE; save_prep_leaf_list= FALSE; @@ -5375,8 +5374,8 @@ void THD::get_definer(LEX_USER *definer, bool role) if (slave_thread && has_invoker()) #endif { - definer->user= invoker_user; - definer->host= invoker_host; + definer->user= invoker.user; + definer->host= invoker.host; definer->reset_auth(); } else @@ -7446,4 +7445,16 @@ bool Discrete_intervals_list::append(Discrete_interval *new_interval) DBUG_RETURN(0); } + +void AUTHID::copy(MEM_ROOT *mem_root, const LEX_CSTRING *user_name, + const LEX_CSTRING *host_name) +{ + user.str= strmake_root(mem_root, user_name->str, user_name->length); + user.length= user_name->length; + + host.str= strmake_root(mem_root, host_name->str, host_name->length); + host.length= host_name->length; +} + + #endif /* !defined(MYSQL_CLIENT) */ diff --git a/sql/sql_class.h b/sql/sql_class.h index eab078fe62d..819342a8aa1 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4080,12 +4080,12 @@ public: void get_definer(LEX_USER *definer, bool role); void set_invoker(const LEX_CSTRING *user, const LEX_CSTRING *host) { - invoker_user= *user; - invoker_host= *host; + invoker.user= *user; + invoker.host= *host; } - LEX_CSTRING get_invoker_user() { return invoker_user; } - LEX_CSTRING get_invoker_host() { return invoker_host; } - bool has_invoker() { return invoker_user.length > 0; } + LEX_CSTRING get_invoker_user() { return invoker.user; } + LEX_CSTRING get_invoker_host() { return invoker.host; } + bool has_invoker() { return invoker.user.length > 0; } void print_aborted_warning(uint threshold, const char *reason) { @@ -4184,8 +4184,7 @@ private: TRIGGER or VIEW statements or current user in account management statements if it is not NULL. */ - LEX_CSTRING invoker_user; - LEX_CSTRING invoker_host; + AUTHID invoker; public: #ifndef EMBEDDED_LIBRARY diff --git a/sql/sql_connect.h b/sql/sql_connect.h index 9cd31814ad7..364be401944 100644 --- a/sql/sql_connect.h +++ b/sql/sql_connect.h @@ -57,7 +57,6 @@ public: class THD; -typedef struct st_lex_user LEX_USER; typedef struct user_conn USER_CONN; void init_max_user_conn(void); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 1d0d3341b37..e0980711afe 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1697,8 +1697,8 @@ void Trigger::get_trigger_info(LEX_CSTRING *trigger_stmt, } else { - definer->length= strxmov(definer->str, body->m_definer_user.str, "@", - body->m_definer_host.str, NullS) - definer->str; + definer->length= strxmov(definer->str, body->m_definer.user.str, "@", + body->m_definer.host.str, NullS) - definer->str; } DBUG_VOID_RETURN; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8b47568141d..b1510fb413e 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -14495,7 +14495,7 @@ ident_or_text: user_maybe_role: ident_or_text { - if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + if (!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))) MYSQL_YYABORT; $$->user = $1; $$->host= null_clex_str; // User or Role, see get_current_user() @@ -14508,7 +14508,7 @@ user_maybe_role: } | ident_or_text '@' ident_or_text { - if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + if (!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))) MYSQL_YYABORT; $$->user = $1; $$->host=$3; $$->reset_auth(); @@ -15735,7 +15735,7 @@ grant_role: ((char*) $1.str)[$1.length] = '\0'; if ($1.length == 0) my_yyabort_error((ER_INVALID_ROLE, MYF(0), "")); - if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + if (!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))) MYSQL_YYABORT; $$->user= $1; $$->host= empty_clex_str; diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index e7a995c727c..27b523a3fa8 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -14643,7 +14643,7 @@ ident_or_text: user_maybe_role: ident_or_text { - if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + if (!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))) MYSQL_YYABORT; $$->user = $1; $$->host= null_clex_str; // User or Role, see get_current_user() @@ -14656,7 +14656,7 @@ user_maybe_role: } | ident_or_text '@' ident_or_text { - if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + if (!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))) MYSQL_YYABORT; $$->user = $1; $$->host=$3; $$->reset_auth(); @@ -15980,7 +15980,7 @@ grant_role: ((char*) $1.str)[$1.length] = '\0'; if ($1.length == 0) my_yyabort_error((ER_INVALID_ROLE, MYF(0), "")); - if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + if (!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))) MYSQL_YYABORT; $$->user= $1; $$->host= empty_clex_str; diff --git a/sql/structs.h b/sql/structs.h index 80371b1b8b6..982eda99d30 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -204,9 +204,12 @@ extern const char *show_comp_option_name[]; typedef int *(*update_var)(THD *, struct st_mysql_show_var *); -typedef struct st_lex_user { - LEX_CSTRING user, host, plugin, auth; - LEX_CSTRING pwtext, pwhash; + +struct AUTHID +{ + LEX_CSTRING user, host; + void init() { memset(this, 0, sizeof(*this)); } + void copy(MEM_ROOT *root, const LEX_CSTRING *usr, const LEX_CSTRING *host); bool is_role() const { return user.str[0] && !host.str[0]; } void set_lex_string(LEX_CSTRING *l, char *buf) { @@ -218,13 +221,20 @@ typedef struct st_lex_user { l->length= strxmov(buf, user.str, "@", host.str, NullS) - buf; } } +}; + + +struct LEX_USER: public AUTHID +{ + LEX_CSTRING plugin, auth; + LEX_CSTRING pwtext, pwhash; void reset_auth() { pwtext.length= pwhash.length= plugin.length= auth.length= 0; pwtext.str= pwhash.str= 0; plugin.str= auth.str= ""; } -} LEX_USER; +}; /* This structure specifies the maximum amount of resources which diff --git a/sql/table.h b/sql/table.h index dcf5723b3b9..c502b6bddf8 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1993,7 +1993,7 @@ struct TABLE_LIST LEX_CSTRING view_db; /* saved view database */ LEX_CSTRING view_name; /* saved view name */ LEX_STRING timestamp; /* GMT time stamp of last operation */ - st_lex_user definer; /* definer of view */ + LEX_USER definer; /* definer of view */ ulonglong file_version; /* version of file's field set */ ulonglong mariadb_version; /* version of server on creation */ ulonglong updatable_view; /* VIEW can be updated */