+--source include/rpl_end.inc
--- a/sql/log.cc
+++ b/sql/log.cc
-@@ -5076,6 +5076,12 @@
+@@ -5112,6 +5112,12 @@
user_var_event->type,
user_var_event->charset_number,
flags);
--- /dev/null
+--- /dev/null
++++ b/mysql-test/r/percona_innodb_version.result
+@@ -0,0 +1,3 @@
++SELECT @@innodb_version;
++@@innodb_version
++1.1.x-x.x
+--- /dev/null
++++ b/mysql-test/t/percona_innodb_version.test
+@@ -0,0 +1,8 @@
++--source include/have_innodb.inc
++
++########################################################################
++# Bug #917246: Unintentional change of innodb_version format in 5.1.60
++########################################################################
++
++--replace_regex /1\.1\.[0-9]+-[0-9]+\.[0-9]+/1.1.x-x.x/
++SELECT @@innodb_version;
for (idx_p= index_drop_buffer, idx_end_p= idx_p + index_drop_count;
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
-@@ -2192,6 +2192,13 @@
+@@ -2265,6 +2265,13 @@
GLOBAL_VAR(opt_optimizer_fix),
NO_CMD_LINE, DEFAULT(TRUE));
sync_period_ptr(sync_period),
is_relay_log(0), signal_cnt(0),
description_event_for_exec(0), description_event_for_queue(0)
-@@ -5325,19 +5327,15 @@
+@@ -5361,19 +5363,15 @@
SYNOPSIS
write_cache()
cache Cache to write to the binary log
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
return ER_ERROR_ON_WRITE;
uint length= my_b_bytes_in_cache(cache), group, carry, hdr_offs;
-@@ -5448,6 +5446,8 @@
+@@ -5484,6 +5482,8 @@
}
/* Write data to the binary log file */
if (my_b_write(&log_file, cache->read_pos, length))
return ER_ERROR_ON_WRITE;
thd->binlog_bytes_written+= length;
-@@ -5456,9 +5456,6 @@
+@@ -5492,9 +5492,6 @@
DBUG_ASSERT(carry == 0);
return 0; // All OK
}
-@@ -5499,8 +5496,6 @@
+@@ -5535,8 +5532,6 @@
if (!is_open())
DBUG_RETURN(error);
Incident incident= INCIDENT_LOST_EVENTS;
Incident_log_event ev(thd, incident, write_error_msg);
if (lock)
-@@ -5549,112 +5544,332 @@
+@@ -5585,112 +5580,332 @@
'cache' needs to be reinitialized after this functions returns.
*/
/**
Wait until we get a signal that the relay log has been updated.
-@@ -6059,6 +6274,68 @@
+@@ -6095,6 +6310,68 @@
}
/********* transaction coordinator log for 2pc - mmap() based solution *******/
/*
-@@ -6195,6 +6472,7 @@
+@@ -6231,6 +6508,7 @@
mysql_mutex_init(key_LOCK_pool, &LOCK_pool, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_active, &COND_active, 0);
mysql_cond_init(key_COND_pool, &COND_pool, 0);
inited=6;
-@@ -6202,6 +6480,8 @@
+@@ -6238,6 +6516,8 @@
active=pages;
pool=pages+1;
pool_last=pages+npages-1;
return 0;
-@@ -6307,7 +6587,7 @@
+@@ -6343,7 +6623,7 @@
to the position in memory where xid was logged to.
*/
{
int err;
PAGE *p;
-@@ -6446,7 +6726,9 @@
+@@ -6482,7 +6762,9 @@
mysql_mutex_destroy(&LOCK_sync);
mysql_mutex_destroy(&LOCK_active);
mysql_mutex_destroy(&LOCK_pool);
case 5:
data[0]='A'; // garble the first (signature) byte, in case mysql_file_delete fails
case 4:
-@@ -6656,42 +6938,87 @@
+@@ -6692,42 +6974,87 @@
mysql_cond_destroy(&COND_prep_xids);
}
}
int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle)
-@@ -6760,9 +7087,67 @@
+@@ -6796,9 +7123,67 @@
{
return (ulonglong) mysql_bin_log.get_log_file()->pos_in_file;
}
struct st_mysql_storage_engine binlog_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
-@@ -6777,7 +7162,7 @@
+@@ -6813,7 +7198,7 @@
binlog_init, /* Plugin Init */
NULL, /* Plugin Deinit */
0x0100 /* 1.0 */,
class Log_event_handler
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
-@@ -1490,6 +1490,7 @@
+@@ -1495,6 +1495,7 @@
ha_end();
if (tc_log)
tc_log->close();
delegates_destroy();
xid_cache_free();
table_def_free();
-@@ -4061,6 +4062,8 @@
+@@ -3911,6 +3912,8 @@
query_response_time_init();
#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
/* We have to initialize the storage engines before CSV logging */
init_global_table_stats();
init_global_index_stats();
-@@ -8004,6 +8007,7 @@
+@@ -7872,6 +7875,7 @@
key_LOCK_error_messages, key_LOG_INFO_lock, key_LOCK_thread_count,
key_PARTITION_LOCK_auto_inc;
PSI_mutex_key key_RELAYLOG_LOCK_index;
static PSI_mutex_info all_server_mutexes[]=
{
-@@ -8024,6 +8028,7 @@
+@@ -7892,6 +7896,7 @@
{ &key_delayed_insert_mutex, "Delayed_insert::mutex", 0},
{ &key_hash_filo_lock, "hash_filo::lock", 0},
{ &key_LOCK_active_mi, "LOCK_active_mi", PSI_FLAG_GLOBAL},
{ &key_LOCK_connection_count, "LOCK_connection_count", PSI_FLAG_GLOBAL},
{ &key_LOCK_crypt, "LOCK_crypt", PSI_FLAG_GLOBAL},
{ &key_LOCK_delayed_create, "LOCK_delayed_create", PSI_FLAG_GLOBAL},
-@@ -8039,6 +8044,7 @@
+@@ -7907,6 +7912,7 @@
"LOCK_global_index_stats", PSI_FLAG_GLOBAL},
{ &key_LOCK_gdl, "LOCK_gdl", PSI_FLAG_GLOBAL},
{ &key_LOCK_global_system_variables, "LOCK_global_system_variables", PSI_FLAG_GLOBAL},
{ &key_LOCK_manager, "LOCK_manager", PSI_FLAG_GLOBAL},
{ &key_LOCK_prepared_stmt_count, "LOCK_prepared_stmt_count", PSI_FLAG_GLOBAL},
{ &key_LOCK_rpl_status, "LOCK_rpl_status", PSI_FLAG_GLOBAL},
-@@ -8050,6 +8056,7 @@
+@@ -7918,6 +7924,7 @@
{ &key_LOCK_temporary_tables, "THD::LOCK_temporary_tables", 0},
{ &key_LOCK_user_conn, "LOCK_user_conn", PSI_FLAG_GLOBAL},
{ &key_LOCK_uuid_generator, "LOCK_uuid_generator", PSI_FLAG_GLOBAL},
{ &key_LOG_LOCK_log, "LOG::LOCK_log", 0},
{ &key_master_info_data_lock, "Master_info::data_lock", 0},
{ &key_master_info_run_lock, "Master_info::run_lock", 0},
-@@ -8097,6 +8104,7 @@
+@@ -7965,6 +7972,7 @@
key_TABLE_SHARE_cond, key_user_level_lock_cond,
key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache;
PSI_cond_key key_RELAYLOG_update_cond;
static PSI_cond_info all_server_conds[]=
{
-@@ -8113,8 +8121,10 @@
+@@ -7981,8 +7989,10 @@
{ &key_RELAYLOG_update_cond, "MYSQL_RELAY_LOG::update_cond", 0},
{ &key_COND_cache_status_changed, "Query_cache::COND_cache_status_changed", 0},
{ &key_COND_manager, "COND_manager", PSI_FLAG_GLOBAL},
{ &key_item_func_sleep_cond, "Item_func_sleep::cond", 0},
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
-@@ -273,6 +273,7 @@
+@@ -274,6 +274,7 @@
key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data,
key_LOCK_error_messages, key_LOCK_thread_count, key_PARTITION_LOCK_auto_inc;
extern PSI_mutex_key key_RELAYLOG_LOCK_index;
extern PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger,
key_rwlock_LOCK_sys_init_connect, key_rwlock_LOCK_sys_init_slave,
-@@ -293,6 +294,7 @@
+@@ -294,6 +295,7 @@
key_TABLE_SHARE_cond, key_user_level_lock_cond,
key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache;
extern PSI_cond_key key_RELAYLOG_update_cond;
mysql_mutex_destroy(&LOCK_thd_data);
mysql_mutex_destroy(&LOCK_temporary_tables);
#ifndef DBUG_OFF
-@@ -5292,6 +5296,24 @@
+@@ -5297,6 +5301,24 @@
DBUG_RETURN(0);
}
trx_deregister_from_2pc(trx);
-@@ -10982,6 +11149,7 @@
+@@ -10981,6 +11148,7 @@
srv_active_wake_master_thread();
if (thd_sql_command(thd) != SQLCOM_XA_PREPARE
&& (all
|| !thd_test_options(
-@@ -11008,6 +11176,7 @@
+@@ -11007,6 +11175,7 @@
mysql_mutex_lock(&prepare_commit_mutex);
trx_owns_prepare_commit_mutex_set(trx);
}
#ifdef UNIV_DEBUG
block->page.in_page_hash = FALSE;
-@@ -1427,7 +1428,11 @@
+@@ -1429,7 +1430,11 @@
ulint p;
#ifdef UNIV_SYNC_DEBUG
#endif /* UNIV_SYNC_DEBUG */
ut_ad(!btr_search_enabled);
-@@ -2142,6 +2147,7 @@
+@@ -2144,6 +2149,7 @@
{
block->check_index_page_at_flush = FALSE;
block->index = NULL;
block->n_fields = 1;
--- a/storage/innobase/buf/buf0lru.c
+++ b/storage/innobase/buf/buf0lru.c
-@@ -560,7 +560,7 @@
+@@ -576,7 +576,7 @@
mutex_exit(&buf_pool->LRU_list_mutex);
chunk = buf_pool->chunks;
for (j = buf_pool->n_chunks; j--; chunk++) {
buf_block_t* block = chunk->blocks;
-@@ -572,16 +572,16 @@
+@@ -588,16 +588,16 @@
continue;
}
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
-@@ -1846,7 +1846,7 @@
+@@ -1851,7 +1851,7 @@
zero. */
for (;;) {
}
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
-@@ -11833,6 +11833,11 @@
+@@ -11832,6 +11832,11 @@
"Disable with --skip-innodb-adaptive-hash-index.",
NULL, innodb_adaptive_hash_index_update, TRUE);
static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay,
PLUGIN_VAR_RQCMDARG,
"Replication thread delay (ms) on the slave server if "
-@@ -12253,6 +12258,7 @@
+@@ -12252,6 +12257,7 @@
MYSQL_SYSVAR(use_sys_stats_table),
MYSQL_SYSVAR(stats_sample_pages),
MYSQL_SYSVAR(adaptive_hash_index),
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
-@@ -1580,6 +1580,7 @@
+@@ -1600,6 +1600,7 @@
complete, though: there may
have been hash collisions,
record deletions, etc. */
# should be done or reviewed by the maintainer!
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
-@@ -11999,7 +11999,8 @@
+@@ -12041,7 +12041,8 @@
i_s_innodb_sys_foreign_cols,
i_s_innodb_sys_stats,
i_s_innodb_table_stats,
# should be done or reviewed by the maintainer!
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
-@@ -4161,6 +4161,36 @@
+@@ -4163,6 +4163,36 @@
mutex_exit(block_mutex);
}
@return TRUE */
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
-@@ -12296,6 +12296,9 @@
+@@ -12338,6 +12338,9 @@
i_s_innodb_sys_stats,
i_s_innodb_table_stats,
i_s_innodb_index_stats,
#endif /* i_s_h */
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
-@@ -1161,6 +1161,14 @@
+@@ -1181,6 +1181,14 @@
/*===========*/
const buf_pool_t* buf_pool) /*!< in: buffer pool */
__attribute__((nonnull, const));
srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
srv_n_file_io_threads = (ulint) innobase_file_io_threads;
-@@ -11864,6 +11872,16 @@
+@@ -11863,6 +11871,16 @@
"Number of buffer pool instances, set to higher value on high-end machines to increase scalability",
NULL, NULL, 1L, 1L, MAX_BUFFER_POOLS, 1L);
static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
PLUGIN_VAR_RQCMDARG,
"Helps in performance tuning in heavily concurrent environments.",
-@@ -12170,6 +12188,8 @@
+@@ -12209,6 +12227,8 @@
MYSQL_SYSVAR(autoextend_increment),
MYSQL_SYSVAR(buffer_pool_size),
MYSQL_SYSVAR(buffer_pool_instances),
Gets the size of a lock struct.
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
-@@ -767,6 +767,7 @@
+@@ -770,6 +770,7 @@
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
break;
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
-@@ -474,6 +474,7 @@
+@@ -477,6 +477,7 @@
static ulint srv_n_rows_deleted_old = 0;
static ulint srv_n_rows_read_old = 0;
UNIV_INTERN ulint srv_n_lock_wait_count = 0;
UNIV_INTERN ulint srv_n_lock_wait_current_count = 0;
UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0;
-@@ -2290,6 +2291,7 @@
+@@ -2293,6 +2294,7 @@
export_vars.innodb_buffer_pool_pages_data = LRU_len;
export_vars.innodb_buffer_pool_pages_dirty = flush_list_len;
export_vars.innodb_buffer_pool_pages_free = free_len;
mutex_exit(&(dict_sys->mutex));
if (table != NULL) {
-@@ -1259,6 +1263,64 @@
+@@ -1264,6 +1268,64 @@
dict_mem_table_free(table);
}
/****************************************************************//**
If the given column name is reserved for InnoDB system columns, return
TRUE.
-@@ -1763,6 +1825,11 @@
+@@ -1768,6 +1830,11 @@
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
ut_ad(mutex_own(&(dict_sys->mutex)));
{"have_atomic_builtins",
(char*) &export_vars.innodb_have_atomic_builtins, SHOW_BOOL},
{"log_waits",
-@@ -11774,6 +11776,11 @@
- "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
- NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
+@@ -11813,6 +11815,11 @@
+ NULL, NULL, 0, 0, 1, 0);
+ #endif
+static MYSQL_SYSVAR_ULONG(dict_size_limit, srv_dict_size_limit,
+ PLUGIN_VAR_RQCMDARG,
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -11843,6 +11850,7 @@
+@@ -11882,6 +11889,7 @@
MYSQL_SYSVAR(flush_neighbor_pages),
MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_flushing_method),
or freed in a file segment. */
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
-@@ -1575,6 +1575,15 @@
+@@ -1595,6 +1595,15 @@
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
/* @} */
/*-------------------------------------------*/
extern ulint srv_n_rows_inserted;
-@@ -714,6 +715,7 @@
+@@ -717,6 +718,7 @@
ulint innodb_data_writes; /*!< I/O write requests */
ulint innodb_data_written; /*!< Data bytes written */
ulint innodb_data_reads; /*!< I/O read requests */
/*-------------------------------------------*/
UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
-@@ -2222,6 +2224,7 @@
+@@ -2225,6 +2227,7 @@
export_vars.innodb_data_reads = os_n_file_reads;
export_vars.innodb_data_writes = os_n_file_writes;
export_vars.innodb_data_written = srv_data_written;
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
-@@ -1013,6 +1013,9 @@
+@@ -1014,6 +1014,9 @@
List<Alter_column> alter_list;
List<Key> key_list;
List<Create_field> create_list;
uint flags;
enum enum_enable_or_disable keys_onoff;
enum tablespace_op_type tablespace_op;
-@@ -1024,6 +1027,8 @@
+@@ -1025,6 +1028,8 @@
Alter_info() :
flags(0),
keys_onoff(LEAVE_AS_IS),
tablespace_op(NO_TABLESPACE_OP),
-@@ -1039,6 +1044,9 @@
+@@ -1040,6 +1045,9 @@
alter_list.empty();
key_list.empty();
create_list.empty();
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
-@@ -710,6 +710,14 @@
+@@ -783,6 +783,14 @@
ON_CHECK(event_scheduler_check), ON_UPDATE(event_scheduler_update));
#endif
--expire-logs-days=#
If non-zero, binary logs will be purged after
expire_logs_days days; possible purges happen at startup
-@@ -777,6 +781,7 @@
+@@ -781,6 +785,7 @@
div-precision-increment 4
engine-condition-pushdown TRUE
event-scheduler OFF
#ifndef UNIV_HOTBACKUP
# include "buf0lru.h"
# include "ibuf0ibuf.h"
-@@ -3033,6 +3041,84 @@
+@@ -3041,6 +3049,84 @@
}
/********************************************************************//**
Tries to open a single-table tablespace and optionally checks the space id is
right in it. If does not succeed, prints an error message to the .err log. This
function is used to open a tablespace when we start up mysqld, and also in
-@@ -3055,8 +3141,11 @@
+@@ -3063,8 +3149,11 @@
accessing the first page of the file */
ulint id, /*!< in: space id */
ulint flags, /*!< in: tablespace flags */
{
os_file_t file;
char* filepath;
-@@ -3079,7 +3168,7 @@
+@@ -3087,7 +3176,7 @@
file = os_file_create_simple_no_error_handling(
innodb_file_data_key, filepath, OS_FILE_OPEN,
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
-@@ -3126,6 +3215,453 @@
+@@ -3134,6 +3223,453 @@
space_id = fsp_header_get_space_id(page);
space_flags = fsp_header_get_flags(page);
ut_free(buf2);
if (UNIV_UNLIKELY(space_id != id
-@@ -3167,6 +3703,269 @@
+@@ -3175,6 +3711,269 @@
os_file_close(file);
mem_free(filepath);
#endif /* !UNIV_HOTBACKUP */
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
-@@ -7422,6 +7422,14 @@
+@@ -7421,6 +7421,14 @@
err = row_discard_tablespace_for_mysql(dict_table->name, trx);
} else {
err = row_import_tablespace_for_mysql(dict_table->name, trx);
}
err = convert_error_code_to_mysql(err, dict_table->flags, NULL);
-@@ -11781,6 +11789,11 @@
- "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
- NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
+@@ -11820,6 +11828,11 @@
+ NULL, NULL, 0, 0, 1, 0);
+ #endif
+static MYSQL_SYSVAR_ULONG(import_table_from_xtrabackup, srv_expand_import,
+ PLUGIN_VAR_RQCMDARG,
static MYSQL_SYSVAR_ULONG(dict_size_limit, srv_dict_size_limit,
PLUGIN_VAR_RQCMDARG,
"Limit the allocated memory for dictionary cache. (0: unlimited)",
-@@ -11855,6 +11868,7 @@
+@@ -11894,6 +11907,7 @@
MYSQL_SYSVAR(flush_neighbor_pages),
MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_flushing_method),
/** When mysqld is run, the default directory "." is the mysqld datadir,
but in the MySQL Embedded Server Library and ibbackup it is not the default
-@@ -473,8 +474,11 @@
+@@ -478,8 +479,11 @@
accessing the first page of the file */
ulint id, /*!< in: space id */
ulint flags, /*!< in: tablespace flags */
/*
IMPLEMENTATION OF THE BUFFER POOL
-@@ -1869,8 +1903,16 @@
+@@ -1871,8 +1905,16 @@
mutex_t* block_mutex;
ibool must_read;
unsigned access_time;
buf_pool->stat.n_page_gets++;
for (;;) {
-@@ -1888,7 +1930,7 @@
+@@ -1890,7 +1932,7 @@
//buf_pool_mutex_exit(buf_pool);
rw_lock_s_unlock(&buf_pool->page_hash_latch);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 37 || buf_validate());
-@@ -1984,6 +2026,13 @@
+@@ -1986,6 +2028,13 @@
/* Let us wait until the read operation
completes */
for (;;) {
enum buf_io_fix io_fix;
-@@ -1998,6 +2047,12 @@
+@@ -2000,6 +2049,12 @@
break;
}
}
}
#ifdef UNIV_IBUF_COUNT_DEBUG
-@@ -2312,6 +2367,11 @@
+@@ -2314,6 +2369,11 @@
ibool must_read;
ulint retries = 0;
mutex_t* block_mutex = NULL;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mtr);
-@@ -2341,6 +2401,9 @@
+@@ -2343,6 +2403,9 @@
|| ibuf_page_low(space, zip_size, offset,
FALSE, file, line, NULL));
#endif
buf_pool->stat.n_page_gets++;
fold = buf_page_address_fold(space, offset);
loop:
-@@ -2411,9 +2474,9 @@
+@@ -2413,9 +2476,9 @@
return(NULL);
}
retries = 0;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
-@@ -2723,6 +2786,13 @@
+@@ -2725,6 +2788,13 @@
/* Let us wait until the read operation
completes */
for (;;) {
enum buf_io_fix io_fix;
-@@ -2737,6 +2807,12 @@
+@@ -2739,6 +2809,12 @@
break;
}
}
}
fix_type = MTR_MEMO_BUF_FIX;
-@@ -2763,13 +2839,17 @@
+@@ -2765,13 +2841,17 @@
read-ahead */
buf_read_ahead_linear(space, zip_size, offset,
return(block);
}
-@@ -2793,6 +2873,7 @@
+@@ -2795,6 +2875,7 @@
unsigned access_time;
ibool success;
ulint fix_type;
ut_ad(block);
ut_ad(mtr);
-@@ -2870,6 +2951,10 @@
+@@ -2872,6 +2953,10 @@
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ut_a(block->page.file_page_was_freed == FALSE);
#endif
if (UNIV_UNLIKELY(!access_time)) {
/* In the case of a first access, try to apply linear
read-ahead */
-@@ -2877,7 +2962,7 @@
+@@ -2879,7 +2964,7 @@
buf_read_ahead_linear(buf_block_get_space(block),
buf_block_get_zip_size(block),
buf_block_get_page_no(block),
}
#ifdef UNIV_IBUF_COUNT_DEBUG
-@@ -2887,6 +2972,9 @@
+@@ -2889,6 +2974,9 @@
buf_pool = buf_pool_from_block(block);
buf_pool->stat.n_page_gets++;
return(TRUE);
}
-@@ -2909,6 +2997,7 @@
+@@ -2911,6 +2999,7 @@
buf_pool_t* buf_pool;
ibool success;
ulint fix_type;
ut_ad(mtr);
ut_ad(mtr->state == MTR_ACTIVE);
-@@ -2995,6 +3084,11 @@
+@@ -2997,6 +3086,11 @@
#endif
buf_pool->stat.n_page_gets++;
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
-@@ -4757,7 +4757,7 @@
+@@ -4765,7 +4765,7 @@
node->name, node->handle, buf,
offset_low, offset_high,
page_size * n_pages,
#endif
if (success) {
node->size += n_pages;
-@@ -5084,7 +5084,7 @@
+@@ -5092,7 +5092,7 @@
i/o on a tablespace which does not exist */
UNIV_INTERN
ulint
/*===*/
ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE,
ORed to OS_FILE_LOG, if a log i/o
-@@ -5109,8 +5109,9 @@
+@@ -5117,8 +5117,9 @@
void* buf, /*!< in/out: buffer where to store read data
or from where to write; in aio this must be
appropriately aligned */
{
ulint mode;
fil_space_t* space;
-@@ -5278,7 +5279,7 @@
+@@ -5286,7 +5287,7 @@
#else
/* Queue the aio request */
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
/*********************************************************************//**
Note that a transaction has been registered with MySQL.
@return true if transaction is registered with MySQL 2PC coordinator */
-@@ -9418,6 +9454,25 @@
+@@ -9417,6 +9453,25 @@
statement has ended */
if (trx->n_mysql_tables_in_use == 0) {
order to contract the insert buffer tree. Technically, this function is like
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
-@@ -615,9 +615,12 @@
+@@ -620,9 +620,12 @@
Reads or writes data. This operation is asynchronous (aio).
@return DB_SUCCESS, or DB_TABLESPACE_DELETED if we are trying to do
i/o on a tablespace which does not exist */
/*===*/
ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE,
ORed to OS_FILE_LOG, if a log i/o
-@@ -642,8 +645,9 @@
+@@ -647,8 +650,9 @@
void* buf, /*!< in/out: buffer where to store read data
or from where to write; in aio this must be
appropriately aligned */
/* The following counter is incremented whenever there is some user activity
in the server */
UNIV_INTERN ulint srv_activity_count = 0;
-@@ -1234,6 +1237,10 @@
+@@ -1237,6 +1240,10 @@
ibool has_slept = FALSE;
srv_conc_slot_t* slot = NULL;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
-@@ -1314,6 +1321,7 @@
+@@ -1317,6 +1324,7 @@
switches. */
if (SRV_THREAD_SLEEP_DELAY > 0) {
os_thread_sleep(SRV_THREAD_SLEEP_DELAY);
}
trx->op_info = "";
-@@ -1373,6 +1381,14 @@
+@@ -1376,6 +1384,14 @@
#ifdef UNIV_SYNC_DEBUG
ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
#endif /* UNIV_SYNC_DEBUG */
trx->op_info = "waiting in InnoDB queue";
thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK);
-@@ -1381,6 +1397,12 @@
+@@ -1384,6 +1400,12 @@
trx->op_info = "";
# should be done or reviewed by the maintainer!
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
-@@ -11664,6 +11664,7 @@
+@@ -11706,6 +11706,7 @@
NULL, /* reserved */
0, /* flags */
},
/* Transaction is deregistered only in a commit or a rollback. If
it is deregistered we know there cannot be resources to be freed
and we could return immediately. For the time being, we play safe
-@@ -7544,6 +7557,12 @@
+@@ -7543,6 +7556,12 @@
trx = innobase_trx_allocate(thd);
/* Latch the InnoDB data dictionary exclusively so that no deadlocks
or lock waits can happen in it during a table create operation.
Drop table etc. do this latching in row0mysql.c. */
-@@ -7764,6 +7783,10 @@
+@@ -7763,6 +7782,10 @@
DBUG_RETURN(HA_ERR_CRASHED);
}
/* Truncate the table in InnoDB */
error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx);
-@@ -7820,6 +7843,12 @@
+@@ -7819,6 +7842,12 @@
trx = innobase_trx_allocate(thd);
name_len = strlen(name);
ut_a(name_len < 1000);
-@@ -7906,6 +7935,12 @@
+@@ -7905,6 +7934,12 @@
trx->mysql_thd = NULL;
#else
trx = innobase_trx_allocate(thd);
#endif
row_drop_database_for_mysql(namebuf, trx);
my_free(namebuf);
-@@ -8011,6 +8046,11 @@
+@@ -8010,6 +8045,11 @@
trx_search_latch_release_if_reserved(parent_trx);
trx = innobase_trx_allocate(thd);
error = innobase_rename_table(trx, from, to, TRUE);
-@@ -10881,6 +10921,10 @@
+@@ -10880,6 +10920,10 @@
return(0);
}
thd_get_xid(thd, (MYSQL_XID*) &trx->xid);
/* Release a possible FIFO ticket and search latch. Since we will
-@@ -12438,6 +12482,7 @@
- MYSQL_SYSVAR(rollback_segments),
+@@ -12480,6 +12524,7 @@
+ #endif
MYSQL_SYSVAR(corrupt_table_action),
MYSQL_SYSVAR(lazy_drop_table),
+ MYSQL_SYSVAR(fake_changes),
/* We overwrite the first 4 bytes of the end lsn field to store
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
-@@ -3095,13 +3095,24 @@
+@@ -3103,13 +3103,24 @@
return(TRUE);
}
return(FALSE);
}
-@@ -3117,7 +3128,9 @@
+@@ -3125,7 +3136,9 @@
if (!zip_size) {
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums
srv_blocking_lru_restore = (ibool) innobase_blocking_lru_restore;
-@@ -11542,6 +11544,15 @@
+@@ -11541,6 +11543,15 @@
"Disable with --skip-innodb-checksums.",
NULL, NULL, TRUE);
static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
PLUGIN_VAR_READONLY,
"The common part for InnoDB table spaces.",
-@@ -12073,6 +12084,7 @@
+@@ -12112,6 +12123,7 @@
MYSQL_SYSVAR(buffer_pool_size),
MYSQL_SYSVAR(buffer_pool_instances),
MYSQL_SYSVAR(checksums),
fprintf(stderr,
"InnoDB: Error: the size of single-table"
" tablespace file %s\n"
-@@ -4161,7 +4161,7 @@
+@@ -4169,7 +4169,7 @@
size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;
#ifndef UNIV_HOTBACKUP
fprintf(stderr,
"InnoDB: Error: the size of single-table tablespace"
" file %s\n"
-@@ -4181,7 +4181,7 @@
+@@ -4189,7 +4189,7 @@
/* Align the memory for file i/o if we might have O_DIRECT set */
page = ut_align(buf2, UNIV_PAGE_SIZE);
success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
/* We have to read the tablespace id from the file */
-@@ -5159,9 +5159,9 @@
+@@ -5167,9 +5167,9 @@
ut_ad(ut_is_2pow(zip_size));
ut_ad(buf);
ut_ad(len > 0);
# ifndef UNIV_LOG_DEBUG
--- a/storage/innobase/fsp/fsp0fsp.c
+++ b/storage/innobase/fsp/fsp0fsp.c
-@@ -656,16 +656,18 @@
+@@ -595,16 +595,18 @@
0 for uncompressed pages */
ulint offset) /*!< in: page offset */
{
ut_ad(ut_is_2pow(zip_size));
if (!zip_size) {
-@@ -1464,12 +1466,12 @@
+@@ -1403,12 +1405,12 @@
mtr);
xdes_init(descr, mtr);
#ifndef MYSQL_SERVER
innodb_overwrite_relay_log_info = FALSE;
#endif
-@@ -7290,9 +7352,9 @@
+@@ -7289,9 +7351,9 @@
| DICT_TF_COMPACT
| DICT_TF_FORMAT_ZIP
<< DICT_TF_FORMAT_SHIFT;
}
}
-@@ -11553,6 +11615,16 @@
+@@ -11552,6 +11614,16 @@
"#### Attention: The checksum is not compatible for normal or disabled version! ####",
NULL, NULL, FALSE);
static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
PLUGIN_VAR_READONLY,
"The common part for InnoDB table spaces.",
-@@ -12079,6 +12151,8 @@
+@@ -12118,6 +12190,8 @@
NULL, NULL, 0, &corrupt_table_action_typelib);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(buffer_pool_size),
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
-@@ -1705,7 +1705,7 @@
+@@ -1725,7 +1725,7 @@
time_t last_printout_time;
/*!< when buf_print_io was last time
called */
/*!< Statistics of buddy system,
indexed by block size */
buf_pool_stat_t stat; /*!< current statistics */
-@@ -1803,7 +1803,7 @@
+@@ -1823,7 +1823,7 @@
UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;
/*!< unmodified compressed pages */
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
/*!< buddy free lists */
buf_page_t watch[BUF_POOL_WATCH_SIZE];
-@@ -1811,9 +1811,9 @@
+@@ -1831,9 +1831,9 @@
pool watches. Protected by
buf_pool->mutex. */
#endif
--- a/storage/innobase/include/buf0types.h
+++ b/storage/innobase/include/buf0types.h
-@@ -67,12 +67,13 @@
+@@ -70,12 +70,13 @@
#define BUF_BUDDY_LOW (1 << BUF_BUDDY_LOW_SHIFT)
#define BUF_BUDDY_SIZES (UNIV_PAGE_SIZE_SHIFT - BUF_BUDDY_LOW_SHIFT)
dest_offset = nth_file * group->file_size;
#ifdef UNIV_DEBUG
-@@ -1794,9 +1799,7 @@
+@@ -1797,9 +1802,7 @@
ulint i;
ut_ad(mutex_own(&(log_sys->mutex)));
buf = group->checkpoint_buf;
-@@ -1810,6 +1813,7 @@
+@@ -1813,6 +1816,7 @@
mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, log_sys->buf_size);
#ifdef UNIV_LOG_ARCHIVE
if (log_sys->archiving_state == LOG_ARCH_OFF) {
archived_lsn = IB_ULONGLONG_MAX;
} else {
-@@ -1823,7 +1827,9 @@
+@@ -1826,7 +1830,9 @@
mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN, archived_lsn);
#else /* UNIV_LOG_ARCHIVE */
readahead request. */
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
-@@ -1562,11 +1562,13 @@
+@@ -1582,11 +1582,13 @@
}
#endif /* UNIV_LOG_ARCHIVE */
return(DB_ERROR);
}
-@@ -1575,7 +1577,7 @@
+@@ -1595,7 +1597,7 @@
for (i = 0; i < srv_n_data_files; i++) {
#ifndef __WIN__
# should be done or reviewed by the maintainer!
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
-@@ -1979,6 +1979,27 @@
+@@ -1981,6 +1981,27 @@
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
}
if (UNIV_UNLIKELY(!bpage->zip.data)) {
/* There is no compressed page. */
err_exit:
-@@ -2487,6 +2508,27 @@
+@@ -2489,6 +2510,27 @@
block = (buf_block_t*) buf_page_hash_get_low(
buf_pool, space, offset, fold);
if (block) {
block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
ut_a(block_mutex);
}
-@@ -3409,11 +3451,28 @@
+@@ -3411,11 +3453,28 @@
fold = buf_page_address_fold(space, offset);
if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) {
/* The page is already in the buffer pool. */
watch_page = NULL;
-@@ -3544,6 +3603,7 @@
+@@ -3546,6 +3605,7 @@
bpage->state = BUF_BLOCK_ZIP_PAGE;
bpage->space = space;
bpage->offset = offset;
#ifdef UNIV_DEBUG
bpage->in_page_hash = FALSE;
-@@ -3628,6 +3688,7 @@
+@@ -3630,6 +3690,7 @@
fold = buf_page_address_fold(space, offset);
//buf_pool_mutex_enter(buf_pool);
mutex_enter(&buf_pool->LRU_list_mutex);
rw_lock_x_lock(&buf_pool->page_hash_latch);
-@@ -3635,6 +3696,21 @@
+@@ -3637,6 +3698,21 @@
block = (buf_block_t*) buf_page_hash_get_low(
buf_pool, space, offset, fold);
if (block
&& buf_page_in_file(&block->page)
&& !buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
-@@ -3988,8 +4064,11 @@
+@@ -3990,8 +4066,11 @@
}
if (io_type == BUF_IO_WRITE
return(TRUE);
--- a/storage/innobase/buf/buf0lru.c
+++ b/storage/innobase/buf/buf0lru.c
-@@ -529,6 +529,62 @@
+@@ -545,6 +545,62 @@
}
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
-@@ -1483,6 +1539,10 @@
+@@ -1499,6 +1555,10 @@
return(FALSE);
}
fil_system->spaces = hash_create(hash_size);
fil_system->name_hash = hash_create(hash_size);
-@@ -2344,7 +2347,11 @@
+@@ -2352,7 +2355,11 @@
completely and permanently. The flag is_being_deleted also prevents
fil_flush() from being applied to this tablespace. */
#endif
/* printf("Deleting tablespace %s id %lu\n", space->name, id); */
-@@ -4731,6 +4738,10 @@
+@@ -4739,6 +4746,10 @@
ulint page_size;
ibool success = TRUE;
fil_mutex_enter_and_prepare_for_io(space_id);
space = fil_space_get_by_id(space_id);
-@@ -4742,6 +4753,7 @@
+@@ -4750,6 +4761,7 @@
*actual_size = space->size;
mutex_exit(&fil_system->mutex);
return(TRUE);
}
-@@ -4774,6 +4786,8 @@
+@@ -4782,6 +4794,8 @@
offset_low = ((start_page_no - file_start_page_no)
% (4096 * ((1024 * 1024) / page_size)))
* page_size;
#ifdef UNIV_HOTBACKUP
success = os_file_write(node->name, node->handle, buf,
offset_low, offset_high,
-@@ -4783,8 +4797,10 @@
+@@ -4791,8 +4805,10 @@
node->name, node->handle, buf,
offset_low, offset_high,
page_size * n_pages,
if (success) {
node->size += n_pages;
space->size += n_pages;
-@@ -4830,6 +4846,7 @@
+@@ -4838,6 +4854,7 @@
printf("Extended %s to %lu, actual size %lu pages\n", space->name,
size_after_extend, *actual_size); */
mutex_exit(&fil_system->mutex);
fil_flush(space_id, TRUE);
-@@ -5192,6 +5209,22 @@
+@@ -5200,6 +5217,22 @@
srv_data_written+= len;
}
/* Reserve the fil_system mutex and make sure that we can open at
least one file while holding it, if the file is not already open */
-@@ -5333,10 +5366,24 @@
+@@ -5341,10 +5374,24 @@
#else
/* Queue the aio request */
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
ut_a(ret);
if (mode == OS_AIO_SYNC) {
-@@ -5436,6 +5483,7 @@
+@@ -5444,6 +5491,7 @@
fil_node_t* fil_node;
void* message;
ulint type;
ut_ad(fil_validate_skip());
-@@ -5443,10 +5491,10 @@
+@@ -5451,10 +5499,10 @@
srv_set_io_thread_op_info(segment, "native aio handle");
#ifdef WIN_ASYNC_IO
ret = os_aio_windows_handle(segment, 0, &fil_node,
#else
ut_error;
ret = 0; /* Eliminate compiler warning */
-@@ -5455,7 +5503,22 @@
+@@ -5463,7 +5511,22 @@
srv_set_io_thread_op_info(segment, "simulated aio handle");
ret = os_aio_simulated_handle(segment, &fil_node,
ut_a(ret);
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
-@@ -12150,6 +12150,12 @@
+@@ -12189,6 +12189,12 @@
"except for the deletion.",
NULL, NULL, 0, &corrupt_table_action_typelib);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(page_size),
MYSQL_SYSVAR(log_block_size),
-@@ -12244,6 +12250,7 @@
- MYSQL_SYSVAR(purge_batch_size),
- MYSQL_SYSVAR(rollback_segments),
+@@ -12286,6 +12292,7 @@
+ MYSQL_SYSVAR(flush_checkpoint_debug),
+ #endif
MYSQL_SYSVAR(corrupt_table_action),
+ MYSQL_SYSVAR(lazy_drop_table),
NULL
};
-@@ -12253,7 +12260,7 @@
+@@ -12295,7 +12302,7 @@
&innobase_storage_engine,
innobase_hton_name,
plugin_author,
NULL, /* Plugin Deinit */
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
-@@ -1455,6 +1455,7 @@
+@@ -1475,6 +1475,7 @@
0 if the block was never accessed
in the buffer pool */
/* @} */
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
-@@ -2167,7 +2167,7 @@
+@@ -2187,7 +2187,7 @@
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
fprintf(stderr,
return(0);
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
-@@ -2601,7 +2601,7 @@
+@@ -2609,7 +2609,7 @@
os_thread_sleep(20000);
goto retry;
-@@ -2815,7 +2815,7 @@
+@@ -2823,7 +2823,7 @@
goto error_exit;
}
if (!ret) {
fputs("InnoDB: Error: file flush of tablespace ", stderr);
-@@ -3001,7 +3001,7 @@
+@@ -3009,7 +3009,7 @@
}
}
if (!success) {
goto func_exit;
-@@ -3023,7 +3023,7 @@
+@@ -3031,7 +3031,7 @@
goto func_exit;
}
func_exit:
os_file_close(file);
ut_free(buf2);
-@@ -4006,7 +4006,7 @@
+@@ -4014,7 +4014,7 @@
size_after_extend, *actual_size); */
mutex_exit(&fil_system->mutex);
return(success);
}
-@@ -4577,8 +4577,9 @@
+@@ -4585,8 +4585,9 @@
void
fil_flush(
/*======*/
{
fil_space_t* space;
fil_node_t* node;
-@@ -4649,7 +4650,7 @@
+@@ -4657,7 +4658,7 @@
/* fprintf(stderr, "Flushing to file %s\n",
node->name); */
mutex_enter(&fil_system->mutex);
-@@ -4732,7 +4733,7 @@
+@@ -4740,7 +4741,7 @@
a non-existing space id. */
for (i = 0; i < n_space_ids; i++) {
srv_force_recovery = (ulint) innobase_force_recovery;
srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
-@@ -11142,7 +11162,7 @@
+@@ -11141,7 +11161,7 @@
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"Purge threads can be either 0 or 1.",
NULL, NULL,
0, /* Minimum value */
1, 0); /* Maximum value */
-@@ -11184,12 +11204,18 @@
+@@ -11183,12 +11203,18 @@
innodb_file_format_max_validate,
innodb_file_format_max_update, "Antelope");
static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11294,7 +11320,7 @@
+@@ -11293,7 +11319,7 @@
static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11451,6 +11477,135 @@
+@@ -11450,6 +11476,135 @@
"trigger a readahead.",
NULL, NULL, 56, 0, 64, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -11471,6 +11626,7 @@
+@@ -11470,6 +11625,7 @@
MYSQL_SYSVAR(file_format_check),
MYSQL_SYSVAR(file_format_max),
MYSQL_SYSVAR(flush_log_at_trx_commit),
MYSQL_SYSVAR(flush_method),
MYSQL_SYSVAR(force_recovery),
MYSQL_SYSVAR(large_prefix),
-@@ -11510,6 +11666,13 @@
+@@ -11509,6 +11665,13 @@
MYSQL_SYSVAR(show_verbose_locks),
MYSQL_SYSVAR(show_locks_held),
MYSQL_SYSVAR(version),
MYSQL_SYSVAR(use_sys_malloc),
MYSQL_SYSVAR(use_native_aio),
MYSQL_SYSVAR(change_buffering),
-@@ -11522,6 +11685,9 @@
+@@ -11521,6 +11684,9 @@
MYSQL_SYSVAR(purge_threads),
MYSQL_SYSVAR(purge_batch_size),
MYSQL_SYSVAR(rollback_segments),
/** read only pages belonging to the insert buffer tree */
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
-@@ -658,8 +658,9 @@
+@@ -663,8 +663,9 @@
void
fil_flush(
/*======*/
mutex_enter(&kernel_mutex);
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
-@@ -1217,6 +1217,9 @@
+@@ -1237,6 +1237,9 @@
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
# Performance schema variables are too long for files named
# 'mysql-test/suite/sys_vars/t/' ...
+--- a/mysql-test/suite/innodb/t/innodb_cmp_drop_table-master.opt
++++ b/mysql-test/suite/innodb/t/innodb_cmp_drop_table-master.opt
+@@ -1 +1 @@
+---innodb-buffer-pool-size=8M
++--innodb-buffer-pool-size=32M
+--- a/mysql-test/suite/innodb/t/innodb_cmp_drop_table.test
++++ b/mysql-test/suite/innodb/t/innodb_cmp_drop_table.test
+@@ -36,13 +36,14 @@
+
+ -- disable_query_log
+
+--- let $i = 400
++-- let $i = 4000
++begin;
+ while ($i)
+ {
+ insert into t2 values(repeat('abcdefghijklmnopqrstuvwxyz',1000));
+ dec $i;
+ }
+-
++commit;
+ -- enable_query_log
+
+ # now there should be no 8K pages in the buffer pool
#ifdef HAVE_PSI_INTERFACE
/* Register keys with MySQL performance schema */
if (PSI_server) {
-@@ -11695,6 +11699,57 @@
+@@ -11694,6 +11698,57 @@
return(false);
}
static SHOW_VAR innodb_status_variables_export[]= {
{"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG}
-@@ -11986,6 +12041,15 @@
+@@ -11985,6 +12040,15 @@
"Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
NULL, NULL, 500L, 1L, ~0L, 0);
static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR,
"Number of file I/O threads in InnoDB.",
-@@ -12288,6 +12352,7 @@
+@@ -12327,6 +12391,7 @@
MYSQL_SYSVAR(fast_checksum),
MYSQL_SYSVAR(commit_concurrency),
MYSQL_SYSVAR(concurrency_tickets),
MYSQL_SYSVAR(data_home_dir),
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
-@@ -296,6 +296,7 @@
+@@ -299,6 +299,7 @@
extern ulint srv_activity_count;
extern ulint srv_fatal_semaphore_wait_threshold;
extern ulint srv_dml_needed_delay;
/* How much data manipulation language (DML) statements need to be delayed,
in microseconds, in order to reduce the lagging of the purge thread. */
UNIV_INTERN ulint srv_dml_needed_delay = 0;
-@@ -2834,6 +2843,36 @@
+@@ -2837,6 +2846,36 @@
old_sema = sema;
}
# should be done or reviewed by the maintainer!
--- a/storage/innobase/buf/buf0lru.c
+++ b/storage/innobase/buf/buf0lru.c
-@@ -2183,6 +2183,289 @@
+@@ -2197,6 +2197,289 @@
memset(&buf_LRU_stat_cur, 0, sizeof buf_LRU_stat_cur);
}
/*==============*/
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
-@@ -5299,6 +5299,70 @@
+@@ -5307,6 +5307,70 @@
return(DB_SUCCESS);
}
#ifdef HAVE_LARGE_PAGES
if ((os_use_large_pages = (ibool) my_use_large_pages))
os_large_page_size = (ulint) opt_large_page_size;
-@@ -11925,6 +11929,19 @@
+@@ -11964,6 +11968,19 @@
"Limit the allocated memory for dictionary cache. (0: unlimited)",
NULL, NULL, 0, 0, LONG_MAX, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -12009,6 +12026,8 @@
+@@ -12048,6 +12065,8 @@
MYSQL_SYSVAR(random_read_ahead),
MYSQL_SYSVAR(read_ahead_threshold),
MYSQL_SYSVAR(io_capacity),
an exclusive lock on the buffer frame. The flag is cleared and the x-lock
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
-@@ -648,6 +648,14 @@
+@@ -653,6 +653,14 @@
void* message, /*!< in: message for aio handler if non-sync
aio used, else ignored */
trx_t* trx);
handler for completed requests. The aio array of pending requests is divided
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
-@@ -361,6 +361,12 @@
+@@ -364,6 +364,12 @@
reading of a disk page */
extern ulint srv_buf_pool_reads;
/** Status variables to be passed to MySQL */
typedef struct export_var_struct export_struc;
-@@ -666,6 +672,16 @@
+@@ -669,6 +675,16 @@
/*=====================*/
void* arg); /*!< in: a dummy parameter required by
os_thread_create */
/* structure to pass status variables to MySQL */
UNIV_INTERN export_struc export_vars;
-@@ -2710,6 +2716,58 @@
- OS_THREAD_DUMMY_RETURN;
- }
+@@ -2708,6 +2714,58 @@
+ /* We count the number of threads in os_thread_exit(). A created
+ thread should always use that to exit and not use return() to exit. */
++ os_thread_exit(NULL);
++
++ OS_THREAD_DUMMY_RETURN;
++}
++
+/*********************************************************************//**
+A thread which restores the buffer pool from a dump file on startup and does
+periodic buffer pool dumps.
+ /* We count the number of threads in os_thread_exit(). A created
+ thread should always use that to exit and not use return() to exit. */
+
-+ os_thread_exit(NULL);
-+
-+ OS_THREAD_DUMMY_RETURN;
-+}
-+
- /**********************************************************************//**
- Check whether any background thread is active.
- @return FALSE if all are are suspended or have exited. */
+ os_thread_exit(NULL);
+
+ OS_THREAD_DUMMY_RETURN;
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
@@ -87,6 +87,7 @@
/** We use this mutex to test the return value of pthread_mutex_trylock
on successful locking. HP-UX does NOT return 0, though Linux et al do. */
-@@ -1821,6 +1822,15 @@
+@@ -1841,6 +1842,15 @@
os_thread_create(&srv_monitor_thread, NULL,
thread_ids + 4 + SRV_MAX_N_IO_THREADS);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
block->n_pointers = 0;
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-@@ -1401,7 +1401,7 @@
+@@ -1403,7 +1403,7 @@
memcpy(dpage, bpage, sizeof *dpage);
ut_d(bpage->in_page_hash = FALSE);
/* relocate buf_pool->LRU */
-@@ -3223,8 +3223,8 @@
+@@ -3225,8 +3225,8 @@
bpage->in_zip_hash = FALSE;
bpage->in_flush_list = FALSE;
bpage->in_free_list = FALSE;
ut_d(bpage->in_page_hash = TRUE);
-@@ -3389,7 +3389,7 @@
+@@ -3391,7 +3391,7 @@
ibuf_merge_or_delete_for_page(NULL, space, offset, zip_size, TRUE);
/* Flush pages from the end of the LRU list if necessary */
return(FALSE);
}
-@@ -1985,8 +1988,14 @@
+@@ -2049,8 +2052,14 @@
buf_page_t* bpage;
ulint n_replaceable;
ulint distance = 0;
n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
-@@ -1997,7 +2006,13 @@
+@@ -2061,7 +2070,13 @@
+ BUF_FLUSH_EXTRA_MARGIN(buf_pool))
&& (distance < BUF_LRU_FREE_SEARCH_LEN(buf_pool))) {
mutex_enter(block_mutex);
-@@ -2012,11 +2027,18 @@
+@@ -2076,11 +2091,18 @@
bpage = UT_LIST_GET_PREV(LRU, bpage);
}
}
return(BUF_FLUSH_FREE_BLOCK_MARGIN(buf_pool)
-@@ -2034,7 +2056,8 @@
+@@ -2098,7 +2120,8 @@
void
buf_flush_free_margin(
/*==================*/
{
ulint n_to_flush;
-@@ -2045,7 +2068,7 @@
+@@ -2109,7 +2132,7 @@
n_flushed = buf_flush_LRU(buf_pool, n_to_flush);
/* There was an LRU type flush batch already running;
let us wait for it to end */
-@@ -2058,8 +2081,9 @@
+@@ -2122,8 +2145,9 @@
Flushes pages from the end of all the LRU lists. */
UNIV_INTERN
void
{
ulint i;
-@@ -2068,7 +2092,7 @@
+@@ -2132,7 +2156,7 @@
buf_pool = buf_pool_from_array(i);
--- a/storage/innobase/buf/buf0lru.c
+++ b/storage/innobase/buf/buf0lru.c
-@@ -923,7 +923,7 @@
+@@ -934,7 +934,7 @@
/* No free block was found: try to flush the LRU list */
++srv_buf_pool_wait_free;
os_aio_simulated_wake_handler_threads();
-@@ -1120,7 +1120,7 @@
+@@ -1131,7 +1131,7 @@
/* Remove the block from the LRU list */
UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage);
buf_unzip_LRU_remove_block_if_needed(bpage);
-@@ -1199,7 +1199,7 @@
+@@ -1210,7 +1210,7 @@
ut_ad(!bpage->in_LRU_list);
UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage);
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
-@@ -1269,7 +1269,7 @@
+@@ -1280,7 +1280,7 @@
buf_pool->LRU_old_len++;
}
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
-@@ -1513,7 +1513,7 @@
+@@ -1524,7 +1524,7 @@
buf_page_set_old(b, buf_page_is_old(b));
#endif /* UNIV_LRU_DEBUG */
} else {
if (buf_debug_prints) {
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
-@@ -1404,11 +1404,11 @@
+@@ -1424,11 +1424,11 @@
UT_LIST_NODE_T(buf_page_t) LRU;
/*!< node of the LRU list */
trx_commit_for_mysql(trx);
}
-@@ -11131,6 +11323,12 @@
+@@ -11130,6 +11322,12 @@
"The common part for InnoDB table spaces.",
NULL, NULL, NULL);
static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Enable InnoDB doublewrite buffer (enabled by default). "
-@@ -11608,6 +11806,7 @@
+@@ -11647,6 +11845,7 @@
MYSQL_SYSVAR(old_blocks_pct),
MYSQL_SYSVAR(old_blocks_time),
MYSQL_SYSVAR(open_files),
if (!ready) {
return(block);
-@@ -1945,6 +1951,13 @@
+@@ -1947,6 +1953,13 @@
return(NULL);
}
block_mutex = buf_page_get_mutex_enter(bpage);
rw_lock_s_unlock(&buf_pool->page_hash_latch);
-@@ -2524,6 +2537,13 @@
+@@ -2526,6 +2539,13 @@
return(NULL);
}
switch (buf_block_get_state(block)) {
buf_page_t* bpage;
ibool success;
-@@ -3198,6 +3218,7 @@
+@@ -3200,6 +3220,7 @@
bpage->newest_modification = 0;
bpage->oldest_modification = 0;
HASH_INVALIDATE(bpage, hash);
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
bpage->file_page_was_freed = FALSE;
#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
-@@ -3836,6 +3857,7 @@
+@@ -3838,6 +3859,7 @@
(ulong) bpage->offset);
}
/* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */
-@@ -3877,6 +3899,23 @@
+@@ -3879,6 +3901,23 @@
REFMAN "forcing-innodb-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
/* If page space id is larger than TRX_SYS_SPACE
(0), we will attempt to mark the corresponding
-@@ -3893,6 +3932,7 @@
+@@ -3895,6 +3934,7 @@
}
}
}
if (recv_recovery_is_on()) {
/* Pages must be uncompressed for crash recovery. */
-@@ -3902,8 +3942,11 @@
+@@ -3904,8 +3944,11 @@
if (uncompressed && !recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page(
/* If table->ibd_file_missing == TRUE, this will
print an error message and return without doing
anything. */
-@@ -1293,7 +1294,7 @@
+@@ -1298,7 +1299,7 @@
+ dict_sys->size) > srv_dict_size_limit ) {
prev_table = UT_LIST_GET_PREV(table_LRU, table);
goto next_loop;
cached_foreign_tables = 0;
-@@ -4367,6 +4368,12 @@
+@@ -4377,6 +4378,12 @@
heap = mem_heap_create(1000);
while (index) {
size = btr_get_size(index, BTR_TOTAL_SIZE);
index->stat_index_size = size;
-@@ -4514,6 +4521,12 @@
+@@ -4524,6 +4531,12 @@
heap = mem_heap_create(1000);
while (index) {
/*===========================================*/
{
dict_table_t* sys_stats;
-@@ -4706,6 +4719,13 @@
+@@ -4716,6 +4729,13 @@
|| (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
&& dict_index_is_clust(index)))) {
ulint size;
size = btr_get_size(index, BTR_TOTAL_SIZE);
index->stat_index_size = size;
-@@ -5685,4 +5705,42 @@
+@@ -5695,4 +5715,42 @@
index->type |= DICT_CORRUPT;
}
UT_LIST_ADD_LAST(space_list, fil_system->space_list, space);
mutex_exit(&fil_system->mutex);
-@@ -5277,6 +5280,34 @@
+@@ -5285,6 +5288,34 @@
ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
#ifdef UNIV_HOTBACKUP
/* In ibbackup do normal i/o, not aio */
if (type == OS_FILE_READ) {
-@@ -5291,6 +5322,8 @@
+@@ -5299,6 +5330,8 @@
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
offset_low, offset_high, len, node, message, trx);
#endif
ut_a(ret);
if (mode == OS_AIO_SYNC) {
-@@ -5791,3 +5824,46 @@
+@@ -5799,3 +5832,46 @@
return 0;
}
}
+
--- a/storage/innobase/fsp/fsp0fsp.c
+++ b/storage/innobase/fsp/fsp0fsp.c
-@@ -369,6 +369,12 @@
+@@ -308,6 +308,12 @@
ut_ad(id || !zip_size);
block = buf_page_get(id, zip_size, 0, RW_X_LATCH, mtr);
header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
-@@ -787,6 +793,12 @@
+@@ -726,6 +732,12 @@
fsp_header_t* sp_header;
block = buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
sp_header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
-@@ -1866,6 +1878,11 @@
+@@ -1805,6 +1817,11 @@
{
fseg_inode_t* inode;
for (; i < FSP_SEG_INODES_PER_PAGE(zip_size); i++) {
inode = fsp_seg_inode_page_get_nth_inode(
-@@ -1979,6 +1996,11 @@
+@@ -1918,6 +1935,11 @@
page = buf_block_get_frame(block);
n = fsp_seg_inode_page_find_free(page, 0, zip_size, mtr);
ut_a(n != ULINT_UNDEFINED);
-@@ -2072,6 +2094,11 @@
+@@ -2011,6 +2033,11 @@
inode = fut_get_ptr(space, zip_size, inode_addr, RW_X_LATCH, mtr);
if (UNIV_UNLIKELY(!mach_read_from_8(inode + FSEG_ID))) {
inode = NULL;
-@@ -2098,7 +2125,7 @@
+@@ -2037,7 +2064,7 @@
{
fseg_inode_t* inode
= fseg_inode_try_get(header, space, zip_size, mtr);
return(inode);
}
-@@ -3304,6 +3331,11 @@
+@@ -3243,6 +3270,11 @@
descr = xdes_get_descriptor(space, zip_size, page, mtr);
ut_a(descr);
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) {
fputs("InnoDB: Dump of the tablespace extent descriptor: ",
-@@ -3551,6 +3583,11 @@
+@@ -3490,6 +3522,11 @@
descr = xdes_get_descriptor(space, zip_size, header_page, mtr);
/* Check that the header resides on a page which has not been
freed yet */
-@@ -3635,6 +3672,12 @@
+@@ -3574,6 +3611,12 @@
inode = fseg_inode_get(header, space, zip_size, mtr);
switch (ret) {
case DB_SUCCESS:
error = 0;
-@@ -6137,6 +6188,10 @@
+@@ -6136,6 +6187,10 @@
{
DBUG_ENTER("change_active_index");
ut_ad(user_thd == ha_thd());
ut_a(prebuilt->trx == thd_to_trx(user_thd));
-@@ -6250,6 +6305,10 @@
+@@ -6249,6 +6304,10 @@
DBUG_ENTER("general_fetch");
ut_a(prebuilt->trx == thd_to_trx(user_thd));
innodb_srv_conc_enter_innodb(prebuilt->trx);
-@@ -6259,6 +6318,10 @@
+@@ -6258,6 +6317,10 @@
innodb_srv_conc_exit_innodb(prebuilt->trx);
switch (ret) {
case DB_SUCCESS:
error = 0;
-@@ -7525,10 +7588,18 @@
+@@ -7524,10 +7587,18 @@
update_thd(ha_thd());
error = convert_error_code_to_mysql(error, prebuilt->table->flags,
NULL);
-@@ -8040,6 +8111,16 @@
+@@ -8039,6 +8110,16 @@
return(ranges + (double) rows / (double) total_rows * time_for_scan);
}
/*********************************************************************//**
Calculates the key number used inside MySQL for an Innobase index. We will
first check the "index translation table" for a match of the index to get
-@@ -8217,7 +8298,7 @@
+@@ -8216,7 +8297,7 @@
ib_table = prebuilt->table;
if (flag & HA_STATUS_TIME) {
/* In sql_show we call with this flag: update
then statistics so that they are up-to-date */
-@@ -8517,10 +8598,18 @@
+@@ -8516,10 +8597,18 @@
THD* thd, /*!< in: connection thread handle */
HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
{
return(0);
}
-@@ -8756,6 +8845,10 @@
+@@ -8755,6 +8844,10 @@
my_error(ER_QUERY_INTERRUPTED, MYF(0));
}
DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
}
-@@ -9526,6 +9619,10 @@
+@@ -9525,6 +9618,10 @@
update_thd(thd);
if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
ut_print_timestamp(stderr);
fprintf(stderr,
-@@ -11990,6 +12087,26 @@
+@@ -11989,6 +12086,26 @@
"dump file (if present). Disabled by default.",
NULL, NULL, FALSE);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -12083,6 +12200,7 @@
+@@ -12082,6 +12199,7 @@
#ifdef UNIV_DEBUG
MYSQL_SYSVAR(flush_checkpoint_debug),
#endif
block, index != NULL && dict_index_is_ibuf(index)
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
-@@ -1003,7 +1003,7 @@
+@@ -1023,7 +1023,7 @@
const buf_block_t* block) /*!< in: pointer to the control block */
__attribute__((pure));
#else /* UNIV_DEBUG */
#endif /* UNIV_DEBUG */
/*********************************************************************//**
Gets the space id of a block.
-@@ -1450,6 +1450,7 @@
+@@ -1470,6 +1470,7 @@
0 if the block was never accessed
in the buffer pool */
/* @} */
/*********************************************************************//**
Gets the current size of buffer buf_pool in bytes.
@return size in bytes */
-@@ -637,6 +637,12 @@
+@@ -681,6 +681,12 @@
/*================*/
const buf_block_t* block) /*!< in: pointer to the control block */
{
#ifdef UNIV_DEBUG
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
-@@ -754,6 +754,19 @@
+@@ -759,6 +759,19 @@
fil_system_hash_nodes(void);
/*========================*/
/*-------------------------------------------*/
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
-@@ -2155,6 +2155,13 @@
+@@ -2175,6 +2175,13 @@
os_fast_mutex_free(&srv_os_test_mutex);
srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
srv_use_checksums = (ibool) innobase_use_checksums;
-@@ -11391,6 +11394,11 @@
+@@ -11390,6 +11393,11 @@
"The common part for InnoDB table spaces.",
NULL, NULL, NULL);
static MYSQL_SYSVAR_BOOL(recovery_update_relay_log, innobase_overwrite_relay_log_info,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"During InnoDB crash recovery on slave overwrite relay-log.info "
-@@ -11879,6 +11887,7 @@
+@@ -11918,6 +11926,7 @@
MYSQL_SYSVAR(data_file_path),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
# should be done or reviewed by the maintainer!
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
-@@ -3805,7 +3805,8 @@
+@@ -3807,7 +3807,8 @@
read_space_id = mach_read_from_4(
frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
if (err != DB_SUCCESS) {
return(err);
-@@ -4168,7 +4178,7 @@
+@@ -4176,7 +4186,7 @@
}
#ifndef UNIV_HOTBACKUP
fprintf(stderr,
"InnoDB: Error: tablespace id %lu in file %s"
" is not sensible\n",
-@@ -4177,7 +4187,7 @@
+@@ -4185,7 +4195,7 @@
goto func_exit;
}
#else
char* new_path;
fprintf(stderr,
-@@ -4998,7 +5008,7 @@
+@@ -5006,7 +5016,7 @@
}
if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
/* The node is in the LRU list, remove it */
ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
-@@ -5044,7 +5054,7 @@
+@@ -5052,7 +5062,7 @@
}
if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE
/* The node must be put back to the LRU list */
UT_LIST_ADD_FIRST(LRU, system->LRU, node);
}
-@@ -5655,7 +5665,7 @@
+@@ -5663,7 +5673,7 @@
ut_a(fil_node->n_pending == 0);
ut_a(fil_node->open);
ut_a(fil_node->space->purpose == FIL_TABLESPACE);
-
+#include "trx0sys.h"
- #define FSP_HEADER_OFFSET FIL_PAGE_DATA /* Offset of the space header
- within a file page */
-@@ -999,10 +999,10 @@
+ /* FILE SEGMENT INODE
+ ==================
+@@ -938,10 +938,10 @@
flst_init(header + FSP_SEG_INODES_FREE, mtr);
mlog_write_ull(header + FSP_SEG_ID, 1, mtr);
srv_use_sys_stats_table = (ibool) innobase_use_sys_stats_table;
/* -------------- Log files ---------------------------*/
-@@ -11772,6 +11775,11 @@
+@@ -11771,6 +11774,11 @@
"Path to individual files and their sizes.",
NULL, NULL, NULL);
static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"The AUTOINC lock modes supported by InnoDB: "
-@@ -11951,6 +11959,7 @@
+@@ -11990,6 +11998,7 @@
MYSQL_SYSVAR(commit_concurrency),
MYSQL_SYSVAR(concurrency_tickets),
MYSQL_SYSVAR(data_file_path),
#ifdef UNIV_LOG_ARCHIVE
ulint* min_arch_log_no,/*!< out: min of archived log
numbers in data files */
-@@ -747,6 +748,7 @@
+@@ -748,6 +749,7 @@
*sum_of_new_sizes = 0;
*create_new_db = FALSE;
srv_normalize_path_for_win(srv_data_home);
-@@ -984,6 +986,142 @@
+@@ -1004,6 +1006,142 @@
srv_data_file_is_raw_partition[i] != 0);
}
+ (ulong) TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9);
+ }
+
-+ fil_read_flushed_lsn_and_arch_log_no(
-+ files[i], one_opened,
++ fil_read_first_page(
++ files[i], one_opened, &flags,
+#ifdef UNIV_LOG_ARCHIVE
+ min_arch_log_no, max_arch_log_no,
+#endif /* UNIV_LOG_ARCHIVE */
return(DB_SUCCESS);
}
-@@ -997,6 +1135,7 @@
+@@ -1017,6 +1155,7 @@
/*====================================*/
{
ibool create_new_db;
ibool log_file_created;
ibool log_created = FALSE;
ibool log_opened = FALSE;
-@@ -1462,6 +1601,7 @@
+@@ -1482,6 +1621,7 @@
}
err = open_or_create_data_files(&create_new_db,
#ifdef UNIV_LOG_ARCHIVE
&min_arch_log_no, &max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
-@@ -1629,6 +1769,14 @@
+@@ -1649,6 +1789,14 @@
after the double write buffer has been created. */
trx_sys_create();
dict_create();
srv_startup_is_before_trx_rollback_phase = FALSE;
-@@ -1662,6 +1810,13 @@
+@@ -1682,6 +1830,13 @@
recv_recovery_from_archive_finish();
#endif /* UNIV_LOG_ARCHIVE */
} else {
/* Check if we support the max format that is stamped
on the system tablespace.
-@@ -1748,6 +1903,17 @@
+@@ -1768,6 +1923,17 @@
we have finished the recovery process so that the
image of TRX_SYS_PAGE_NO is not stale. */
trx_sys_file_format_tag_init();
# should be done or reviewed by the maintainer!
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
-@@ -9710,9 +9710,8 @@
+@@ -9709,9 +9709,8 @@
rw_lock_wait_time += mutex->lspent_time;
}
#else /* UNIV_DEBUG */
buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu",
(ulong) mutex->count_os_wait);
-@@ -9727,10 +9726,8 @@
+@@ -9726,10 +9725,8 @@
if (block_mutex) {
buf1len = (uint) my_snprintf(buf1, sizeof buf1,
buf2len = (uint) my_snprintf(buf2, sizeof buf2,
"os_waits=%lu",
(ulong) block_mutex_oswait_count);
-@@ -9759,9 +9756,8 @@
+@@ -9758,9 +9755,8 @@
continue;
}
buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu",
(ulong) lock->count_os_wait);
-@@ -9775,10 +9771,8 @@
+@@ -9774,10 +9770,8 @@
if (block_lock) {
buf1len = (uint) my_snprintf(buf1, sizeof buf1,
# should be done or reviewed by the maintainer!
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
-@@ -4365,6 +4365,7 @@
+@@ -4372,6 +4372,7 @@
}
total_info->pool_size += pool_info->pool_size;
total_info->lru_len += pool_info->lru_len;
total_info->old_lru_len += pool_info->old_lru_len;
total_info->free_list_len += pool_info->free_list_len;
-@@ -4430,6 +4431,8 @@
+@@ -4437,6 +4438,8 @@
pool_info->pool_size = buf_pool->curr_size;
pool_info->lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
pool_info->old_lru_len = buf_pool->LRU_old_len;
-@@ -4551,14 +4554,16 @@
+@@ -4558,14 +4561,16 @@
ut_ad(pool_info);
fprintf(file,
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
-@@ -4889,3 +4889,30 @@
+@@ -4897,3 +4897,30 @@
fil_system = NULL;
}
{"buffer_pool_pages_free",
(char*) &export_vars.innodb_buffer_pool_pages_free, SHOW_LONG},
#ifdef UNIV_DEBUG
-@@ -11208,6 +11210,16 @@
+@@ -11207,6 +11209,16 @@
"Force InnoDB to not use next-key locking, to use only row-level locking.",
NULL, NULL, FALSE);
#ifdef UNIV_LOG_ARCHIVE
static MYSQL_SYSVAR_STR(log_arch_dir, innobase_log_arch_dir,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11395,7 +11407,7 @@
+@@ -11394,7 +11406,7 @@
static MYSQL_SYSVAR_STR(version, innodb_version_str,
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
static MYSQL_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
-@@ -11495,6 +11507,8 @@
+@@ -11494,6 +11506,8 @@
MYSQL_SYSVAR(thread_concurrency),
MYSQL_SYSVAR(thread_sleep_delay),
MYSQL_SYSVAR(autoinc_lock_mode),
ulint free_list_len; /*!< Length of buf_pool->free list */
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
-@@ -726,6 +726,17 @@
+@@ -731,6 +731,17 @@
/*============================*/
ulint id); /*!< in: space id */
/** The lock system */
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
-@@ -739,6 +739,11 @@
+@@ -742,6 +742,11 @@
/** Status variables to be passed to MySQL */
struct export_var_struct{
ulint innodb_data_pending_reads; /*!< Pending reads */
ulint innodb_data_pending_writes; /*!< Pending writes */
ulint innodb_data_pending_fsyncs; /*!< Pending fsyncs */
-@@ -756,6 +761,9 @@
+@@ -759,6 +764,9 @@
#ifdef UNIV_DEBUG
ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
#endif /* UNIV_DEBUG */
ulint innodb_buffer_pool_read_requests; /*!< buf_pool->stat.n_page_gets */
ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */
ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */
-@@ -765,13 +773,43 @@
+@@ -768,13 +776,43 @@
ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
ulint innodb_os_log_written; /*!< srv_os_log_written */
ulint innodb_os_log_fsyncs; /*!< fil_n_log_flushes */
ulint innodb_os_log_pending_writes; /*!< srv_os_log_pending_writes */
-@@ -780,6 +818,8 @@
+@@ -783,6 +821,8 @@
ulint innodb_pages_created; /*!< buf_pool->stat.n_pages_created */
ulint innodb_pages_read; /*!< buf_pool->stat.n_pages_read */
ulint innodb_pages_written; /*!< buf_pool->stat.n_pages_written */
ulint innodb_row_lock_waits; /*!< srv_n_lock_wait_count */
ulint innodb_row_lock_current_waits; /*!< srv_n_lock_wait_current_count */
ib_int64_t innodb_row_lock_time; /*!< srv_n_lock_wait_time
-@@ -789,11 +829,18 @@
+@@ -792,11 +832,18 @@
/ srv_n_lock_wait_count */
ulint innodb_row_lock_time_max; /*!< srv_n_lock_max_wait_time
/ 1000 */
}
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
-@@ -2259,12 +2259,49 @@
+@@ -2262,12 +2262,49 @@
ulint LRU_len;
ulint free_len;
ulint flush_list_len;
export_vars.innodb_data_pending_reads
= os_n_pending_reads;
export_vars.innodb_data_pending_writes
-@@ -2303,6 +2340,92 @@
+@@ -2306,6 +2343,92 @@
export_vars.innodb_buffer_pool_pages_misc
= buf_pool_get_n_pages() - LRU_len - free_len;
Determine the flags of a table described in SYS_TABLES.
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
-@@ -11908,7 +11908,14 @@
+@@ -11950,7 +11950,14 @@
i_s_innodb_cmp,
i_s_innodb_cmp_reset,
i_s_innodb_cmpmem,
buf_pool_mutex_exit(buf_pool);
return(DB_SUCCESS);
-@@ -1374,7 +1402,11 @@
+@@ -1376,7 +1404,11 @@
ulint fold;
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
ut_a(bpage->buf_fix_count == 0);
-@@ -1485,21 +1517,32 @@
+@@ -1487,21 +1519,32 @@
buf_page_t* bpage;
ulint i;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
for (i = 0; i < BUF_POOL_WATCH_SIZE; i++) {
bpage = &buf_pool->watch[i];
-@@ -1523,10 +1566,12 @@
+@@ -1525,10 +1568,12 @@
bpage->space = space;
bpage->offset = offset;
bpage->buf_fix_count = 1;
return(NULL);
case BUF_BLOCK_ZIP_PAGE:
ut_ad(bpage->in_page_hash);
-@@ -1544,6 +1589,8 @@
+@@ -1546,6 +1591,8 @@
ut_error;
/* Fix compiler warning */
return(NULL);
}
-@@ -1561,7 +1608,11 @@
+@@ -1563,7 +1610,11 @@
space, offset) */
buf_page_t* watch) /*!< in/out: sentinel for watch */
{
HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, watch);
ut_d(watch->in_page_hash = FALSE);
-@@ -1583,28 +1634,31 @@
+@@ -1585,28 +1636,31 @@
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ulint fold = buf_page_address_fold(space, offset);
}
/****************************************************************//**
-@@ -1624,14 +1678,16 @@
+@@ -1626,14 +1680,16 @@
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ulint fold = buf_page_address_fold(space, offset);
return(ret);
}
-@@ -1648,13 +1704,15 @@
+@@ -1650,13 +1706,15 @@
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
}
/********************************************************************//**
-@@ -1678,14 +1736,20 @@
+@@ -1680,14 +1738,20 @@
ut_a(buf_page_in_file(bpage));
if (buf_page_peek_if_too_old(bpage)) {
}
}
-@@ -1702,7 +1766,8 @@
+@@ -1704,7 +1768,8 @@
buf_block_t* block;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
block = (buf_block_t*) buf_page_hash_get(buf_pool, space, offset);
-@@ -1711,7 +1776,8 @@
+@@ -1713,7 +1778,8 @@
block->check_index_page_at_flush = FALSE;
}
}
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
-@@ -1731,7 +1797,8 @@
+@@ -1733,7 +1799,8 @@
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
bpage = buf_page_hash_get(buf_pool, space, offset);
-@@ -1742,7 +1809,8 @@
+@@ -1744,7 +1811,8 @@
bpage->file_page_was_freed = TRUE;
}
return(bpage);
}
-@@ -1763,7 +1831,8 @@
+@@ -1765,7 +1833,8 @@
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
bpage = buf_page_hash_get(buf_pool, space, offset);
-@@ -1772,7 +1841,8 @@
+@@ -1774,7 +1843,8 @@
bpage->file_page_was_freed = FALSE;
}
return(bpage);
}
-@@ -1804,8 +1874,9 @@
+@@ -1806,8 +1876,9 @@
buf_pool->stat.n_page_gets++;
for (;;) {
bpage = buf_page_hash_get(buf_pool, space, offset);
if (bpage) {
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
-@@ -1814,7 +1885,8 @@
+@@ -1816,7 +1887,8 @@
/* Page not in buf_pool: needs to be read from file */
buf_read_page(space, zip_size, offset);
-@@ -1826,10 +1898,15 @@
+@@ -1828,10 +1900,15 @@
if (UNIV_UNLIKELY(!bpage->zip.data)) {
/* There is no compressed page. */
err_exit:
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
switch (buf_page_get_state(bpage)) {
-@@ -1838,24 +1915,43 @@
+@@ -1840,24 +1917,43 @@
case BUF_BLOCK_MEMORY:
case BUF_BLOCK_REMOVE_HASH:
case BUF_BLOCK_ZIP_FREE:
buf_block_buf_fix_inc((buf_block_t*) bpage,
__FILE__, __LINE__);
goto got_block;
-@@ -1868,7 +1964,7 @@
+@@ -1870,7 +1966,7 @@
must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ;
access_time = buf_page_is_accessed(bpage);
mutex_exit(block_mutex);
-@@ -2179,7 +2275,7 @@
+@@ -2181,7 +2277,7 @@
const buf_block_t* block) /*!< in: pointer to block,
not dereferenced */
{
if (UNIV_UNLIKELY((((ulint) block) % sizeof *block) != 0)) {
/* The pointer should be aligned. */
-@@ -2215,6 +2311,7 @@
+@@ -2217,6 +2313,7 @@
ulint fix_type;
ibool must_read;
ulint retries = 0;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mtr);
-@@ -2248,18 +2345,24 @@
+@@ -2250,18 +2347,24 @@
fold = buf_page_address_fold(space, offset);
loop:
block = guess;
block = guess = NULL;
} else {
ut_ad(!block->page.in_zip_hash);
-@@ -2268,12 +2371,19 @@
+@@ -2270,12 +2373,19 @@
}
if (block == NULL) {
block = NULL;
}
-@@ -2285,12 +2395,14 @@
+@@ -2287,12 +2397,14 @@
space, offset, fold);
if (UNIV_LIKELY_NULL(block)) {
if (mode == BUF_GET_IF_IN_POOL
|| mode == BUF_PEEK_IF_IN_POOL
-@@ -2343,7 +2455,8 @@
+@@ -2345,7 +2457,8 @@
/* The page is being read to buffer pool,
but we cannot wait around for the read to
complete. */
return(NULL);
}
-@@ -2353,38 +2466,49 @@
+@@ -2355,38 +2468,49 @@
ibool success;
case BUF_BLOCK_FILE_PAGE:
{
buf_page_t* hash_bpage;
-@@ -2397,35 +2521,47 @@
+@@ -2399,35 +2523,47 @@
while buf_pool->mutex was released.
Free the block that was allocated. */
buf_block_init_low(block);
block->lock_hash_val = lock_rec_hash(space, offset);
-@@ -2435,7 +2571,7 @@
+@@ -2437,7 +2573,7 @@
if (buf_page_get_state(&block->page)
== BUF_BLOCK_ZIP_PAGE) {
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
&block->page);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
ut_ad(!block->page.in_flush_list);
-@@ -2453,18 +2589,23 @@
+@@ -2455,18 +2591,23 @@
/* Insert at the front of unzip_LRU list */
buf_unzip_LRU_add_block(block, FALSE);
buf_page_free_descriptor(bpage);
/* Decompress the page and apply buffered operations
-@@ -2478,12 +2619,15 @@
+@@ -2480,12 +2621,15 @@
}
/* Unfix and unlatch the block. */
rw_lock_x_unlock(&block->lock);
break;
-@@ -2499,7 +2643,7 @@
+@@ -2501,7 +2645,7 @@
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
#if UNIV_WORD_SIZE == 4
/* On 32-bit systems, there is no padding in buf_page_t. On
other systems, Valgrind could complain about uninitialized pad
-@@ -2512,8 +2656,8 @@
+@@ -2514,8 +2658,8 @@
/* Try to evict the block from the buffer pool, to use the
insert buffer (change buffer) as much as possible. */
if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
/* Set the watch, as it would have
been set if the page were not in the
-@@ -2522,6 +2666,9 @@
+@@ -2524,6 +2668,9 @@
space, offset, fold);
if (UNIV_LIKELY_NULL(block)) {
/* The page entered the buffer
pool for some reason. Try to
-@@ -2529,7 +2676,7 @@
+@@ -2531,7 +2678,7 @@
goto got_block;
}
}
fprintf(stderr,
"innodb_change_buffering_debug evict %u %u\n",
(unsigned) space, (unsigned) offset);
-@@ -2551,13 +2698,14 @@
+@@ -2553,13 +2700,14 @@
ut_a(mode == BUF_GET_POSSIBLY_FREED
|| !block->page.file_page_was_freed);
#endif
if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL)) {
buf_page_set_accessed_make_young(&block->page, access_time);
-@@ -2790,9 +2938,11 @@
+@@ -2792,9 +2940,11 @@
buf_pool = buf_pool_from_block(block);
if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) {
} else if (!buf_page_is_accessed(&block->page)) {
/* Above, we do a dirty read on purpose, to avoid
mutex contention. The field buf_page_t::access_time
-@@ -2800,9 +2950,11 @@
+@@ -2802,9 +2952,11 @@
field must be protected by mutex, however. */
ulint time_ms = ut_time_ms();
}
ut_ad(!ibuf_inside(mtr) || mode == BUF_KEEP_OLD);
-@@ -2869,18 +3021,21 @@
+@@ -2871,18 +3023,21 @@
ut_ad(mtr);
ut_ad(mtr->state == MTR_ACTIVE);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
-@@ -2970,7 +3125,10 @@
+@@ -2972,7 +3127,10 @@
buf_page_t* hash_page;
ut_ad(buf_pool == buf_pool_get(space, offset));
ut_ad(mutex_own(&(block->mutex)));
ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE);
-@@ -2999,11 +3157,14 @@
+@@ -3001,11 +3159,14 @@
if (UNIV_LIKELY(!hash_page)) {
} else if (buf_pool_watch_is_sentinel(buf_pool, hash_page)) {
/* Preserve the reference count. */
} else {
fprintf(stderr,
"InnoDB: Error: page %lu %lu already found"
-@@ -3013,7 +3174,8 @@
+@@ -3015,7 +3176,8 @@
(const void*) hash_page, (const void*) block);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
mutex_exit(&block->mutex);
buf_print();
buf_LRU_print();
buf_validate();
-@@ -3096,7 +3258,9 @@
+@@ -3098,7 +3260,9 @@
fold = buf_page_address_fold(space, offset);
watch_page = buf_page_hash_get_low(buf_pool, space, offset, fold);
if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) {
-@@ -3105,9 +3269,15 @@
+@@ -3107,9 +3271,15 @@
err_exit:
if (block) {
mutex_enter(&block->mutex);
bpage = NULL;
goto func_exit;
-@@ -3130,6 +3300,8 @@
+@@ -3132,6 +3302,8 @@
buf_page_init(buf_pool, space, offset, fold, block);
/* The block must be put to the LRU list, to the old blocks */
buf_LRU_add_block(bpage, TRUE/* to old blocks */);
-@@ -3157,7 +3329,7 @@
+@@ -3159,7 +3331,7 @@
been added to buf_pool->LRU and
buf_pool->page_hash. */
mutex_exit(&block->mutex);
mutex_enter(&block->mutex);
block->page.zip.data = data;
-@@ -3170,13 +3342,14 @@
+@@ -3172,13 +3344,14 @@
buf_unzip_LRU_add_block(block, TRUE);
}
/* If buf_buddy_alloc() allocated storage from the LRU list,
it released and reacquired buf_pool->mutex. Thus, we must
-@@ -3192,7 +3365,10 @@
+@@ -3194,7 +3367,10 @@
/* The block was added by some other thread. */
watch_page = NULL;
bpage = NULL;
goto func_exit;
-@@ -3240,20 +3416,26 @@
+@@ -3242,20 +3418,26 @@
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold,
bpage);
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
-@@ -3295,7 +3477,9 @@
+@@ -3297,7 +3479,9 @@
fold = buf_page_address_fold(space, offset);
block = (buf_block_t*) buf_page_hash_get_low(
buf_pool, space, offset, fold);
-@@ -3311,7 +3495,9 @@
+@@ -3313,7 +3497,9 @@
#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
/* Page can be found in buf_pool */
buf_block_free(free_block);
-@@ -3333,6 +3519,7 @@
+@@ -3335,6 +3521,7 @@
mutex_enter(&block->mutex);
buf_page_init(buf_pool, space, offset, fold, block);
/* The block must be put to the LRU list */
buf_LRU_add_block(&block->page, FALSE);
-@@ -3359,7 +3546,7 @@
+@@ -3361,7 +3548,7 @@
the reacquisition of buf_pool->mutex. We also must
defer this operation until after the block descriptor
has been added to buf_pool->LRU and buf_pool->page_hash. */
mutex_enter(&block->mutex);
block->page.zip.data = data;
-@@ -3377,7 +3564,8 @@
+@@ -3379,7 +3566,8 @@
buf_page_set_accessed(&block->page, time_ms);
mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
-@@ -3432,7 +3620,9 @@
+@@ -3434,7 +3622,9 @@
ibool ret = TRUE;
/* First unfix and release lock on the bpage */
mutex_enter(buf_page_get_mutex(bpage));
ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ);
ut_ad(bpage->buf_fix_count == 0);
-@@ -3453,11 +3643,15 @@
+@@ -3455,11 +3645,15 @@
ret = FALSE;
}
return(ret);
}
-@@ -3475,6 +3669,8 @@
+@@ -3477,6 +3671,8 @@
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
const ibool uncompressed = (buf_page_get_state(bpage)
== BUF_BLOCK_FILE_PAGE);
ut_a(buf_page_in_file(bpage));
-@@ -3617,8 +3813,26 @@
+@@ -3619,8 +3815,26 @@
}
}
#ifdef UNIV_IBUF_COUNT_DEBUG
if (io_type == BUF_IO_WRITE || uncompressed) {
-@@ -3641,6 +3855,7 @@
+@@ -3643,6 +3857,7 @@
the x-latch to this OS thread: do not let this confuse you in
debugging! */
ut_ad(buf_pool->n_pend_reads > 0);
buf_pool->n_pend_reads--;
buf_pool->stat.n_pages_read++;
-@@ -3658,6 +3873,9 @@
+@@ -3660,6 +3875,9 @@
buf_flush_write_complete(bpage);
if (uncompressed) {
rw_lock_s_unlock_gen(&((buf_block_t*) bpage)->lock,
BUF_IO_WRITE);
-@@ -3680,8 +3898,8 @@
+@@ -3682,8 +3900,8 @@
}
#endif /* UNIV_DEBUG */
}
/*********************************************************************//**
-@@ -3698,7 +3916,9 @@
+@@ -3700,7 +3918,9 @@
ut_ad(buf_pool);
chunk = buf_pool->chunks;
-@@ -3715,7 +3935,9 @@
+@@ -3717,7 +3937,9 @@
}
}
return(TRUE);
}
-@@ -3763,7 +3985,8 @@
+@@ -3765,7 +3987,8 @@
freed = buf_LRU_search_and_free_block(buf_pool, 100);
}
ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == 0);
ut_ad(UT_LIST_GET_LEN(buf_pool->unzip_LRU) == 0);
-@@ -3776,7 +3999,8 @@
+@@ -3778,7 +4001,8 @@
memset(&buf_pool->stat, 0x00, sizeof(buf_pool->stat));
buf_refresh_io_stats(buf_pool);
}
/*********************************************************************//**
-@@ -3818,7 +4042,10 @@
+@@ -3820,7 +4044,10 @@
ut_ad(buf_pool);
chunk = buf_pool->chunks;
-@@ -3913,7 +4140,7 @@
+@@ -3918,7 +4145,7 @@
/* Check clean compressed-only blocks. */
for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
switch (buf_page_get_io_fix(b)) {
case BUF_IO_NONE:
-@@ -3944,7 +4171,7 @@
+@@ -3950,7 +4177,7 @@
buf_flush_list_mutex_enter(buf_pool);
for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
ut_ad(b->in_flush_list);
ut_a(b->oldest_modification);
n_flush++;
-@@ -4003,6 +4230,8 @@
+@@ -4010,6 +4237,8 @@
}
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
fprintf(stderr, "Free list len %lu, free blocks %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->free),
-@@ -4013,8 +4242,11 @@
+@@ -4020,8 +4249,11 @@
ut_a(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE] == n_single_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_LIST] == n_list_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_LRU] == n_lru_flush);
ut_a(buf_LRU_validate());
ut_a(buf_flush_validate(buf_pool));
-@@ -4070,7 +4302,9 @@
+@@ -4077,7 +4309,9 @@
index_ids = mem_alloc(size * sizeof *index_ids);
counts = mem_alloc(sizeof(ulint) * size);
buf_flush_list_mutex_enter(buf_pool);
fprintf(stderr,
-@@ -4139,7 +4373,9 @@
+@@ -4146,7 +4380,9 @@
}
}
for (i = 0; i < n_found; i++) {
index = dict_index_get_if_in_cache(index_ids[i]);
-@@ -4196,7 +4432,7 @@
+@@ -4203,7 +4439,7 @@
buf_chunk_t* chunk;
ulint fixed_pages_number = 0;
chunk = buf_pool->chunks;
-@@ -4230,7 +4466,7 @@
+@@ -4237,7 +4473,7 @@
/* Traverse the lists of clean and dirty compressed-only blocks. */
for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
ut_a(buf_page_get_io_fix(b) != BUF_IO_WRITE);
-@@ -4242,7 +4478,7 @@
+@@ -4249,7 +4485,7 @@
buf_flush_list_mutex_enter(buf_pool);
for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
ut_ad(b->in_flush_list);
switch (buf_page_get_state(b)) {
-@@ -4268,7 +4504,7 @@
+@@ -4275,7 +4511,7 @@
buf_flush_list_mutex_exit(buf_pool);
mutex_exit(&buf_pool->zip_mutex);
return(fixed_pages_number);
}
-@@ -4426,6 +4662,8 @@
+@@ -4433,6 +4669,8 @@
/* Find appropriate pool_info to store stats for this buffer pool */
pool_info = &all_pool_info[pool_id];
buf_pool_mutex_enter(buf_pool);
buf_flush_list_mutex_enter(buf_pool);
-@@ -4541,6 +4779,8 @@
+@@ -4548,6 +4786,8 @@
pool_info->unzip_cur = buf_LRU_stat_cur.unzip;
buf_refresh_io_stats(buf_pool);
buf_pool_mutex_exit(buf_pool);
}
-@@ -4785,11 +5025,13 @@
+@@ -4792,11 +5032,13 @@
{
ulint len;
}
--- a/storage/innobase/buf/buf0lru.c
+++ b/storage/innobase/buf/buf0lru.c
-@@ -143,8 +143,9 @@
+@@ -147,8 +147,9 @@
void
buf_LRU_block_free_hashed_page(
/*===========================*/
/******************************************************************//**
Determines if the unzip_LRU list should be used for evicting a victim
-@@ -154,15 +155,20 @@
+@@ -158,15 +159,20 @@
ibool
buf_LRU_evict_from_unzip_LRU(
/*=========================*/
return(FALSE);
}
-@@ -171,14 +177,20 @@
+@@ -175,14 +181,20 @@
decompressed pages in the buffer pool. */
if (UT_LIST_GET_LEN(buf_pool->unzip_LRU)
<= UT_LIST_GET_LEN(buf_pool->LRU) / 10) {
/* Calculate the average over past intervals, and add the values
of the current interval. */
-@@ -246,18 +258,25 @@
+@@ -250,18 +262,25 @@
page_arr = ut_malloc(
- sizeof(ulint) * BUF_LRU_DROP_SEARCH_HASH_SIZE);
+ sizeof(ulint) * BUF_LRU_DROP_SEARCH_SIZE);
- buf_pool_mutex_enter(buf_pool);
+ //buf_pool_mutex_enter(buf_pool);
ut_a(buf_page_in_file(bpage));
if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE
-@@ -266,23 +285,27 @@
+@@ -270,24 +289,30 @@
/* Compressed pages are never hashed.
Skip blocks of other tablespaces.
Skip I/O-fixed blocks (to be dealt with later). */
/* Store the page number so that we can drop the hash
index in a batch later. */
page_arr[num_entries] = bpage->offset;
++
+ mutex_exit(block_mutex);
+
- ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE);
+ ut_a(num_entries < BUF_LRU_DROP_SEARCH_SIZE);
++
++num_entries;
-@@ -292,14 +315,16 @@
+ if (num_entries < BUF_LRU_DROP_SEARCH_SIZE) {
+@@ -296,14 +321,16 @@
/* Array full. We release the buf_pool->mutex to obey
the latching order. */
/* Note that we released the buf_pool mutex above
after reading the prev_bpage during processing of a
-@@ -317,13 +342,23 @@
+@@ -321,13 +348,23 @@
/* If, however, bpage has been removed from LRU list
to the free list then we should restart the scan.
bpage->state is protected by buf_pool mutex. */
/* Drop any remaining batch of search hashed pages. */
buf_LRU_drop_page_hash_batch(id, zip_size, page_arr, num_entries);
-@@ -345,7 +380,9 @@
- ibool all_freed;
+@@ -351,7 +388,9 @@
+ ulint i;
scan_again:
- buf_pool_mutex_enter(buf_pool);
+ //buf_pool_mutex_enter(buf_pool);
+ mutex_enter(&buf_pool->LRU_list_mutex);
+ rw_lock_x_lock(&buf_pool->page_hash_latch);
+ buf_flush_list_mutex_enter(buf_pool);
all_freed = TRUE;
+@@ -364,7 +403,7 @@
-@@ -375,8 +412,15 @@
- all_freed = FALSE;
- goto next_page;
- } else {
-- block_mutex = buf_page_get_mutex(bpage);
-- mutex_enter(block_mutex);
-+ block_mutex = buf_page_get_mutex_enter(bpage);
-+
-+ if (!block_mutex) {
-+ /* It may be impossible case...
-+ Something wrong, so will be scan_again */
-+
-+ all_freed = FALSE;
-+ goto next_page;
-+ }
+ ut_a(buf_page_in_file(bpage));
- if (bpage->buf_fix_count > 0) {
+- prev_bpage = UT_LIST_GET_PREV(list, bpage);
++ prev_bpage = UT_LIST_GET_PREV(flush_list, bpage);
-@@ -409,7 +453,9 @@
- ulint page_no;
- ulint zip_size;
+ /* bpage->space and bpage->io_fix are protected by
+ buf_pool->mutex and block_mutex. It is safe to check
+@@ -388,8 +427,14 @@
+ will stay in the flush_list because buf_flush_remove()
+ needs buf_pool->mutex as well. */
+ buf_flush_list_mutex_exit(buf_pool);
+- block_mutex = buf_page_get_mutex(bpage);
+- mutex_enter(block_mutex);
++ block_mutex = buf_page_get_mutex_enter(bpage);
++
++ if (!block_mutex) {
++ /* It may be impossible case...
++ Something wrong, so will be scan_again */
++ all_freed = FALSE;
++ goto next_page;
++ }
-- buf_pool_mutex_exit(buf_pool);
-+ //buf_pool_mutex_exit(buf_pool);
-+ mutex_exit(&buf_pool->LRU_list_mutex);
-+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ if (bpage->buf_fix_count > 0) {
+ mutex_exit(block_mutex);
+@@ -440,9 +485,15 @@
+ mutex_exit(block_mutex);
- zip_size = buf_page_get_zip_size(bpage);
- page_no = buf_page_get_page_no(bpage);
-@@ -433,7 +479,7 @@
+ /* Now it is safe to release the buf_pool->mutex. */
+- buf_pool_mutex_exit(buf_pool);
++ //buf_pool_mutex_exit(buf_pool);
++ mutex_exit(&buf_pool->LRU_list_mutex);
++ rw_lock_x_unlock(&buf_pool->page_hash_latch);
++
+ os_thread_yield();
+- buf_pool_mutex_enter(buf_pool);
++ //buf_pool_mutex_enter(buf_pool);
++ mutex_enter(&buf_pool->LRU_list_mutex);
++ rw_lock_x_lock(&buf_pool->page_hash_latch);
++
- if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
- != BUF_BLOCK_ZIP_FREE) {
-- buf_LRU_block_free_hashed_page((buf_block_t*) bpage);
-+ buf_LRU_block_free_hashed_page((buf_block_t*) bpage, TRUE);
- mutex_exit(block_mutex);
- } else {
- /* The block_mutex should have been released
-@@ -446,7 +492,9 @@
- bpage = prev_bpage;
+ mutex_enter(block_mutex);
+ buf_page_unset_sticky(bpage);
+@@ -454,7 +505,9 @@
+ i = 0;
}
- buf_pool_mutex_exit(buf_pool);
-+ //buf_pool_mutex_exit(buf_pool);
++// buf_pool_mutex_exit(buf_pool);
+ mutex_exit(&buf_pool->LRU_list_mutex);
+ rw_lock_x_unlock(&buf_pool->page_hash_latch);
+ buf_flush_list_mutex_exit(buf_pool);
- if (!all_freed) {
- os_thread_sleep(20000);
-@@ -493,7 +541,9 @@
+ ut_ad(buf_flush_validate(buf_pool));
+@@ -504,7 +557,9 @@
buf_page_t* b;
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_PAGE);
/* Find the first successor of bpage in the LRU list
-@@ -501,17 +551,17 @@
+@@ -512,17 +567,17 @@
b = bpage;
do {
b = UT_LIST_GET_NEXT(LRU, b);
}
}
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
-@@ -525,18 +575,19 @@
+@@ -536,18 +591,19 @@
buf_LRU_free_from_unzip_LRU_list(
/*=============================*/
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
/* Theoratically it should be much easier to find a victim
from unzip_LRU as we can choose even a dirty block (as we'll
-@@ -546,7 +597,7 @@
+@@ -557,7 +613,7 @@
if we have done five iterations so far. */
if (UNIV_UNLIKELY(n_iterations >= 5)
return(FALSE);
}
-@@ -554,18 +605,25 @@
+@@ -565,18 +621,25 @@
distance = 100 + (n_iterations
* UT_LIST_GET_LEN(buf_pool->unzip_LRU)) / 5;
mutex_exit(&block->mutex);
if (freed) {
-@@ -584,35 +642,46 @@
+@@ -595,35 +658,46 @@
buf_LRU_free_from_common_LRU_list(
/*==============================*/
buf_pool_t* buf_pool,
mutex_exit(block_mutex);
if (freed) {
-@@ -649,16 +718,23 @@
+@@ -660,16 +734,23 @@
n_iterations / 5 of the unzip_LRU list. */
{
ibool freed = FALSE;
- buf_pool_mutex_enter(buf_pool);
+ if (UT_LIST_GET_LEN(buf_pool->unzip_LRU))
+ have_LRU_mutex = TRUE;
-
-- freed = buf_LRU_free_from_unzip_LRU_list(buf_pool, n_iterations);
++
+ //buf_pool_mutex_enter(buf_pool);
+ if (have_LRU_mutex)
+ mutex_enter(&buf_pool->LRU_list_mutex);
-+
+
+- freed = buf_LRU_free_from_unzip_LRU_list(buf_pool, n_iterations);
+ freed = buf_LRU_free_from_unzip_LRU_list(buf_pool, n_iterations, have_LRU_mutex);
if (!freed) {
if (!freed) {
buf_pool->LRU_flush_ended = 0;
} else if (buf_pool->LRU_flush_ended > 0) {
-@@ -666,6 +742,8 @@
+@@ -677,6 +758,8 @@
}
buf_pool_mutex_exit(buf_pool);
return(freed);
}
-@@ -726,7 +804,9 @@
+@@ -737,7 +820,9 @@
buf_pool = buf_pool_from_array(i);
if (!recv_recovery_on
&& UT_LIST_GET_LEN(buf_pool->free)
-@@ -736,7 +816,9 @@
+@@ -747,7 +832,9 @@
ret = TRUE;
}
}
return(ret);
-@@ -754,9 +836,10 @@
+@@ -765,9 +852,10 @@
{
buf_block_t* block;
if (block) {
-@@ -765,7 +848,9 @@
+@@ -776,7 +864,9 @@
ut_ad(!block->page.in_flush_list);
ut_ad(!block->page.in_LRU_list);
ut_a(!buf_page_in_file(&block->page));
mutex_enter(&block->mutex);
-@@ -775,6 +860,8 @@
+@@ -786,6 +876,8 @@
ut_ad(buf_pool_from_block(block) == buf_pool);
mutex_exit(&block->mutex);
}
return(block);
-@@ -797,7 +884,7 @@
+@@ -808,7 +900,7 @@
ibool mon_value_was = FALSE;
ibool started_monitor = FALSE;
loop:
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->curr_size / 20) {
-@@ -865,7 +952,7 @@
+@@ -876,7 +968,7 @@
/* If there is a block in the free list, take it */
block = buf_LRU_get_free_only(buf_pool);
if (block) {
ut_ad(buf_pool_from_block(block) == buf_pool);
-@@ -965,7 +1052,8 @@
+@@ -976,7 +1068,8 @@
ulint new_len;
ut_a(buf_pool->LRU_old);
ut_ad(buf_pool->LRU_old_ratio >= BUF_LRU_OLD_RATIO_MIN);
ut_ad(buf_pool->LRU_old_ratio <= BUF_LRU_OLD_RATIO_MAX);
#if BUF_LRU_OLD_RATIO_MIN * BUF_LRU_OLD_MIN_LEN <= BUF_LRU_OLD_RATIO_DIV * (BUF_LRU_OLD_TOLERANCE + 5)
-@@ -1031,7 +1119,8 @@
+@@ -1042,7 +1135,8 @@
{
buf_page_t* bpage;
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN);
/* We first initialize all blocks in the LRU list as old and then use
-@@ -1066,13 +1155,14 @@
+@@ -1077,13 +1171,14 @@
ut_ad(buf_pool);
ut_ad(bpage);
ut_ad(buf_page_in_file(bpage));
UT_LIST_REMOVE(unzip_LRU, buf_pool->unzip_LRU, block);
}
-@@ -1090,7 +1180,8 @@
+@@ -1101,7 +1196,8 @@
ut_ad(buf_pool);
ut_ad(bpage);
ut_a(buf_page_in_file(bpage));
-@@ -1167,12 +1258,13 @@
+@@ -1178,12 +1274,13 @@
ut_ad(buf_pool);
ut_ad(block);
if (old) {
UT_LIST_ADD_LAST(unzip_LRU, buf_pool->unzip_LRU, block);
-@@ -1193,7 +1285,8 @@
+@@ -1204,7 +1301,8 @@
ut_ad(buf_pool);
ut_ad(bpage);
ut_a(buf_page_in_file(bpage));
-@@ -1244,7 +1337,8 @@
+@@ -1255,7 +1353,8 @@
ut_ad(buf_pool);
ut_ad(bpage);
ut_a(buf_page_in_file(bpage));
ut_ad(!bpage->in_LRU_list);
-@@ -1323,7 +1417,8 @@
+@@ -1334,7 +1433,8 @@
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
if (bpage->old) {
buf_pool->stat.n_pages_made_young++;
-@@ -1362,17 +1457,18 @@
+@@ -1373,17 +1473,18 @@
buf_LRU_free_block(
/*===============*/
buf_page_t* bpage, /*!< in: block to be freed */
ut_ad(!bpage->in_flush_list == !bpage->oldest_modification);
#if UNIV_WORD_SIZE == 4
/* On 32-bit systems, there is no padding in buf_page_t. On
-@@ -1381,7 +1477,7 @@
+@@ -1392,7 +1493,7 @@
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
#endif
/* Do not free buffer-fixed or I/O-fixed blocks. */
return(FALSE);
-@@ -1415,7 +1511,7 @@
+@@ -1426,7 +1527,7 @@
alloc:
b = buf_page_alloc_descriptor();
ut_a(b);
}
#ifdef UNIV_DEBUG
-@@ -1426,6 +1522,39 @@
+@@ -1437,6 +1538,39 @@
}
#endif /* UNIV_DEBUG */
if (buf_LRU_block_remove_hashed_page(bpage, zip)
!= BUF_BLOCK_ZIP_FREE) {
ut_a(bpage->buf_fix_count == 0);
-@@ -1442,6 +1571,10 @@
+@@ -1453,6 +1587,10 @@
ut_a(!hash_b);
b->state = b->oldest_modification
? BUF_BLOCK_ZIP_DIRTY
: BUF_BLOCK_ZIP_PAGE;
-@@ -1517,6 +1650,7 @@
+@@ -1528,6 +1666,7 @@
buf_LRU_add_block_low(b, buf_page_is_old(b));
}
if (b->state == BUF_BLOCK_ZIP_PAGE) {
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
buf_LRU_insert_zip_clean(b);
-@@ -1534,9 +1668,12 @@
+@@ -1543,12 +1682,13 @@
+ /* Prevent buf_page_get_gen() from
+ decompressing the block while we release
buf_pool->mutex and block_mutex. */
- b->buf_fix_count++;
- b->io_fix = BUF_IO_READ;
-+ mutex_exit(&buf_pool->zip_mutex);
+- mutex_enter(&buf_pool->zip_mutex);
+ buf_page_set_sticky(b);
+ mutex_exit(&buf_pool->zip_mutex);
}
- buf_pool_mutex_exit(buf_pool);
mutex_exit(block_mutex);
/* Remove possible adaptive hash index on the page.
-@@ -1568,7 +1705,9 @@
+@@ -1580,7 +1720,9 @@
: BUF_NO_CHECKSUM_MAGIC);
}
mutex_enter(block_mutex);
if (b) {
-@@ -1578,13 +1717,17 @@
+@@ -1589,13 +1731,17 @@
mutex_exit(&buf_pool->zip_mutex);
}
}
return(TRUE);
-@@ -1596,13 +1739,14 @@
+@@ -1607,13 +1753,14 @@
void
buf_LRU_block_free_non_file_page(
/*=============================*/
ut_ad(mutex_own(&block->mutex));
switch (buf_block_get_state(block)) {
-@@ -1636,18 +1780,21 @@
+@@ -1647,18 +1794,21 @@
if (data) {
block->page.zip.data = NULL;
mutex_exit(&block->mutex);
UNIV_MEM_ASSERT_AND_FREE(block->frame, UNIV_PAGE_SIZE);
}
-@@ -1677,7 +1824,11 @@
+@@ -1688,7 +1838,11 @@
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(bpage);
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
-@@ -1785,7 +1936,9 @@
+@@ -1796,7 +1950,9 @@
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
mutex_exit(buf_page_get_mutex(bpage));
buf_print();
buf_LRU_print();
buf_validate();
-@@ -1807,17 +1960,17 @@
+@@ -1818,17 +1974,17 @@
ut_a(buf_page_get_zip_size(bpage));
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
buf_page_free_descriptor(bpage);
return(BUF_BLOCK_ZIP_FREE);
-@@ -1839,13 +1992,13 @@
+@@ -1850,13 +2006,13 @@
ut_ad(!bpage->in_flush_list);
ut_ad(!bpage->in_LRU_list);
mutex_exit(&((buf_block_t*) bpage)->mutex);
mutex_enter(&((buf_block_t*) bpage)->mutex);
page_zip_set_size(&bpage->zip, 0);
}
-@@ -1871,18 +2024,19 @@
+@@ -1882,18 +2038,19 @@
void
buf_LRU_block_free_hashed_page(
/*===========================*/
}
/******************************************************************//**
-@@ -1897,7 +2051,7 @@
+@@ -1908,7 +2065,7 @@
{
if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
!= BUF_BLOCK_ZIP_FREE) {
}
}
-@@ -1925,7 +2079,8 @@
+@@ -1936,7 +2093,8 @@
}
if (adjust) {
if (ratio != buf_pool->LRU_old_ratio) {
buf_pool->LRU_old_ratio = ratio;
-@@ -1937,7 +2092,8 @@
+@@ -1948,7 +2106,8 @@
}
}
} else {
buf_pool->LRU_old_ratio = ratio;
}
-@@ -2042,7 +2198,8 @@
+@@ -2053,7 +2212,8 @@
ulint new_len;
ut_ad(buf_pool);
if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
-@@ -2103,16 +2260,22 @@
+@@ -2114,16 +2274,22 @@
ut_a(buf_pool->LRU_old_len == old_len);
UT_LIST_VALIDATE(unzip_LRU, buf_block_t, buf_pool->unzip_LRU,
ut_ad(ut_list_node_313->in_unzip_LRU_list
&& ut_list_node_313->page.in_LRU_list));
-@@ -2126,7 +2289,8 @@
+@@ -2137,7 +2303,8 @@
ut_a(buf_page_belongs_to_unzip_LRU(&block->page));
}
}
/**********************************************************************//**
-@@ -2162,7 +2326,8 @@
+@@ -2173,7 +2340,8 @@
const buf_page_t* bpage;
ut_ad(buf_pool);
bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
-@@ -2219,7 +2384,8 @@
+@@ -2230,7 +2398,8 @@
bpage = UT_LIST_GET_NEXT(LRU, bpage);
}
/*********************************************************************//**
Get the flush type of a page.
@return flush type */
-@@ -1332,7 +1355,7 @@
+@@ -1352,7 +1375,7 @@
All these are protected by buf_pool->mutex. */
/* @{ */
/*!< based on state, this is a
list node, protected either by
buf_pool->mutex or by
-@@ -1360,6 +1383,10 @@
+@@ -1380,6 +1403,10 @@
BUF_BLOCK_REMOVE_HASH or
BUF_BLOCK_READY_IN_USE. */
#ifdef UNIV_DEBUG
ibool in_flush_list; /*!< TRUE if in buf_pool->flush_list;
when buf_pool->flush_list_mutex is
-@@ -1452,11 +1479,11 @@
+@@ -1472,11 +1499,11 @@
a block is in the unzip_LRU list
if page.state == BUF_BLOCK_FILE_PAGE
and page.zip.data != NULL */
mutex_t mutex; /*!< mutex protecting this block:
state (also protected by the buffer
pool mutex), io_fix, buf_fix_count,
-@@ -1636,6 +1663,11 @@
+@@ -1656,6 +1683,11 @@
pool instance, protects compressed
only pages (of type buf_page_t, not
buf_block_t */
ulint instance_no; /*!< Array index of this buffer
pool instance */
ulint old_pool_size; /*!< Old pool size in bytes */
-@@ -1789,8 +1821,8 @@
+@@ -1809,8 +1841,8 @@
/** Test if a buffer pool mutex is owned. */
#define buf_pool_mutex_own(b) mutex_own(&b->mutex)
/** Acquire a buffer pool mutex. */
/*********************************************************************//**
Get the flush type of a page.
@return flush type */
-@@ -443,8 +472,8 @@
+@@ -444,8 +473,8 @@
enum buf_io_fix io_fix) /*!< in: io_fix state */
{
#ifdef UNIV_DEBUG
#endif
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
-@@ -474,14 +503,14 @@
+@@ -482,7 +511,7 @@
+ {
+ #ifdef UNIV_DEBUG
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+- ut_ad(buf_pool_mutex_own(buf_pool));
++ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
+ #endif
+ ut_ad(mutex_own(buf_page_get_mutex(bpage)));
+ ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
+@@ -500,7 +529,7 @@
+ {
+ #ifdef UNIV_DEBUG
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+- ut_ad(buf_pool_mutex_own(buf_pool));
++ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
+ #endif
+ ut_ad(mutex_own(buf_page_get_mutex(bpage)));
+ ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_PIN);
+@@ -518,14 +547,14 @@
const buf_page_t* bpage) /*!< control block being relocated */
{
#ifdef UNIV_DEBUG
&& bpage->buf_fix_count == 0);
}
-@@ -495,8 +524,8 @@
+@@ -539,8 +568,8 @@
const buf_page_t* bpage) /*!< in: control block */
{
#ifdef UNIV_DEBUG
#endif
ut_ad(buf_page_in_file(bpage));
-@@ -516,7 +545,8 @@
+@@ -560,7 +589,8 @@
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
#endif /* UNIV_DEBUG */
ut_a(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
#ifdef UNIV_LRU_DEBUG
-@@ -563,9 +593,10 @@
+@@ -607,9 +637,10 @@
ulint time_ms) /*!< in: ut_time_ms() */
{
#ifdef UNIV_DEBUG
ut_a(buf_page_in_file(bpage));
if (!bpage->access_time) {
-@@ -808,19 +839,19 @@
+@@ -852,19 +883,19 @@
/*===========*/
buf_block_t* block) /*!< in, own: block to be freed */
{
}
#endif /* !UNIV_HOTBACKUP */
-@@ -868,17 +899,17 @@
+@@ -912,17 +943,17 @@
page frame */
{
ib_uint64_t lsn;
return(lsn);
}
-@@ -896,7 +927,7 @@
+@@ -940,7 +971,7 @@
#ifdef UNIV_SYNC_DEBUG
buf_pool_t* buf_pool = buf_pool_from_bpage((buf_page_t*)block);
&& (block->page.buf_fix_count == 0))
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /* UNIV_SYNC_DEBUG */
-@@ -1026,7 +1057,11 @@
+@@ -1070,7 +1101,11 @@
buf_page_t* bpage;
ut_ad(buf_pool);
ut_ad(fold == buf_page_address_fold(space, offset));
/* Look for the page in the hash table */
-@@ -1111,11 +1146,13 @@
+@@ -1155,11 +1190,13 @@
const buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
return(bpage != NULL);
}
-@@ -1243,4 +1280,38 @@
+@@ -1287,4 +1324,38 @@
buf_pool_mutex_exit(buf_pool);
}
}
}
if (node->state == INDEX_CREATE_INDEX_TREE) {
-@@ -1183,6 +1322,66 @@
- }
+@@ -1177,6 +1316,66 @@
+ return(NULL);
+ }
- /****************************************************************//**
++ thr->run_node = que_node_get_parent(node);
++
++ return(thr);
++}
++
++/****************************************************************//**
+*/
+UNIV_INTERN
+que_thr_t*
+ return(NULL);
+ }
+
-+ thr->run_node = que_node_get_parent(node);
-+
-+ return(thr);
-+}
-+
-+/****************************************************************//**
- Creates the foreign key constraints system tables inside InnoDB
- at database creation or database start if they are not found or are
- not of the right form.
+ thr->run_node = que_node_get_parent(node);
+
+ return(thr);
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -755,7 +755,7 @@
}
return(table);
-@@ -4344,6 +4344,295 @@
+@@ -4354,6 +4354,295 @@
}
/*********************************************************************//**
Calculates new estimates for table and index statistics. The statistics
are used in query optimization. */
UNIV_INTERN
-@@ -4351,10 +4640,11 @@
+@@ -4361,10 +4650,11 @@
dict_update_statistics(
/*===================*/
dict_table_t* table, /*!< in/out: table */
{
dict_index_t* index;
ulint sum_of_index_sizes = 0;
-@@ -4371,6 +4661,27 @@
+@@ -4381,6 +4671,27 @@
return;
}
/* Find out the sizes of the indexes and how many different values
for the key they approximately have */
-@@ -4435,6 +4746,11 @@
+@@ -4445,6 +4756,11 @@
index = dict_table_get_next_index(index);
} while (index);
index = dict_table_get_first_index(table);
table->stat_n_rows = index->stat_n_diff_key_vals[
-@@ -4452,6 +4768,78 @@
+@@ -4462,6 +4778,78 @@
dict_table_stats_unlock(table, RW_X_LATCH);
}
/**********************************************************************//**
Prints info of a foreign key constraint. */
static
-@@ -4529,7 +4917,8 @@
+@@ -4539,7 +4927,8 @@
ut_ad(mutex_own(&(dict_sys->mutex)));
break;
case DB_RECORD_NOT_FOUND:
error = HA_ERR_KEY_NOT_FOUND;
-@@ -6197,6 +6217,11 @@
+@@ -6196,6 +6216,11 @@
case DB_SUCCESS:
error = 0;
table->status = 0;
break;
case DB_RECORD_NOT_FOUND:
error = HA_ERR_END_OF_FILE;
-@@ -8150,11 +8175,35 @@
+@@ -8149,11 +8174,35 @@
/* In sql_show we call with this flag: update
then statistics so that they are up-to-date */
prebuilt->trx->op_info = "returning various info to MySQL";
}
-@@ -8239,7 +8288,7 @@
+@@ -8238,7 +8287,7 @@
are asked by MySQL to avoid locking. Another reason to
avoid the call is that it uses quite a lot of CPU.
See Bug#38185. */
|| !(flag & HA_STATUS_VARIABLE_EXTRA)) {
/* We do not update delete_length if no
locking is requested so the "old" value can
-@@ -11512,6 +11561,26 @@
+@@ -11511,6 +11560,26 @@
"The number of index pages to sample when calculating statistics (default 8)",
NULL, NULL, 8, 1, ~0ULL, 0);
static MYSQL_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
PLUGIN_VAR_OPCMDARG,
"Enable InnoDB adaptive hash index (enabled by default). "
-@@ -11844,6 +11913,9 @@
+@@ -11883,6 +11952,9 @@
MYSQL_SYSVAR(recovery_update_relay_log),
MYSQL_SYSVAR(rollback_on_timeout),
MYSQL_SYSVAR(stats_on_metadata),
MYSQL_SYSVAR(stats_sample_pages),
MYSQL_SYSVAR(adaptive_hash_index),
MYSQL_SYSVAR(stats_method),
-@@ -11915,7 +11987,10 @@
+@@ -11957,7 +12029,10 @@
i_s_innodb_sys_columns,
i_s_innodb_sys_fields,
i_s_innodb_sys_foreign,
#ifdef UNIV_LOG_ARCHIVE
srv_log_archive_on = (ulint) innobase_log_archive;
#endif /* UNIV_LOG_ARCHIVE */
-@@ -11602,6 +11606,12 @@
+@@ -11601,6 +11605,12 @@
"Maximum delay between polling for a spin lock (6 by default)",
NULL, NULL, 6L, 0L, ~0L, 0);
static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
PLUGIN_VAR_RQCMDARG,
"Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.",
-@@ -11820,6 +11830,7 @@
+@@ -11859,6 +11869,7 @@
MYSQL_SYSVAR(spin_wait_delay),
MYSQL_SYSVAR(table_locks),
MYSQL_SYSVAR(thread_concurrency),
UNIV_INTERN ulong srv_thread_concurrency = 0;
/* this mutex protects srv_conc data structures */
-@@ -1145,6 +1146,75 @@
+@@ -1148,6 +1149,75 @@
/*********************************************************************//**
Puts an OS thread to wait if there are too many concurrent threads
(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */
UNIV_INTERN
void
srv_conc_enter_innodb(
-@@ -1179,6 +1249,13 @@
+@@ -1182,6 +1252,13 @@
return;
}
os_fast_mutex_lock(&srv_conc_mutex);
retry:
if (trx->declared_to_be_inside_innodb) {
-@@ -1332,6 +1409,14 @@
+@@ -1335,6 +1412,14 @@
}
ut_ad(srv_conc_n_threads >= 0);
os_fast_mutex_lock(&srv_conc_mutex);
-@@ -1365,6 +1450,13 @@
+@@ -1368,6 +1453,13 @@
return;
}
+Comment=
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
-@@ -5098,6 +5098,10 @@
+@@ -4959,6 +4959,10 @@
DBUG_PRINT("error",("Too many connections"));
close_connection(thd, ER_CON_COUNT_ERROR);
delete thd;
DBUG_VOID_RETURN;
}
-@@ -5481,6 +5485,10 @@
+@@ -5342,6 +5346,10 @@
if (!(thd->net.vio= vio_new_win32pipe(hConnectedPipe)) ||
my_net_init(&thd->net, thd->net.vio))
{
close_connection(thd, ER_OUT_OF_RESOURCES);
delete thd;
continue;
-@@ -5676,6 +5684,10 @@
+@@ -5537,6 +5545,10 @@
event_conn_closed)) ||
my_net_init(&thd->net, thd->net.vio))
{
+2011-02-21 rename patch log_warning_silence.patch to log_warnings_suppress.patch. Also rename variable "log_warning_silence" to "log_warning_suppress".
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
-@@ -628,6 +628,8 @@
+@@ -632,6 +632,8 @@
SHOW_COMP_OPTION have_crypt, have_compress;
SHOW_COMP_OPTION have_profiling;
pthread_key(MEM_ROOT**,THR_MALLOC);
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
-@@ -228,6 +228,8 @@
+@@ -229,6 +229,8 @@
extern TYPELIB thread_handling_typelib;
extern my_decimal decimal_zero;
using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
-@@ -5024,7 +5024,7 @@
+@@ -5029,7 +5029,7 @@
ER_BINLOG_UNSAFE_STATEMENT,
ER(ER_BINLOG_UNSAFE_STATEMENT),
ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
SLAVE_EXEC_MODE_LAST_BIT};
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
-@@ -1499,6 +1499,15 @@
+@@ -1572,6 +1572,15 @@
READ_ONLY GLOBAL_VAR(mysqld_port), CMD_LINE(REQUIRED_ARG, 'P'),
VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1));
Summary(uk.UTF-8): MySQL - швидкий SQL-сервер
Summary(zh_CN.UTF-8): MySQL数据库服务器
Name: mysql
-Version: 5.5.19
-Release: 3
+Version: 5.5.20
+Release: 1
License: GPL + MySQL FLOSS Exception
Group: Applications/Databases
# Source0Download: http://dev.mysql.com/downloads/mysql/5.5.html#downloads
Source0: http://vesta.informatik.rwth-aachen.de/mysql/Downloads/MySQL-5.5/%{name}-%{version}.tar.gz
-# Source0-md5: a78cf450974e9202bd43674860349b5a
-Source100: http://www.sphinxsearch.com/files/sphinx-2.0.1-beta.tar.gz
-# Source100-md5: 95c217d81d0b7a4ff73d5297318c3481
+# Source0-md5: 375794ebf84b4c7b63f1676bc7416cd0
+Source100: http://sphinxsearch.com/files/sphinx-2.0.3-release.tar.gz
+# Source100-md5: a1293aecd5034aa797811610beb7ba89
Source1: %{name}.init
Source2: %{name}.sysconfig
Source3: %{name}.logrotate
Patch19: %{name}-chain-certs.patch
# from fedora
Patch20: %{name}-dubious-exports.patch
-# http://sphinxsearch.com/bugs/view.php?id=676
-Patch21: sphinx-mysql.patch
# <percona patches, updated with percona.sh>
Patch100: microsec_process.patch
Patch101: optimizer_fix.patch
Patch160: bug45702.patch
Patch161: group_commit.patch
Patch162: warning_fixes.patch
+Patch163: bug917246.patch
# </percona>
URL: http://www.mysql.com/products/community/
BuildRequires: bison
%patch14 -p0
%patch19 -p1
%patch20 -p1
-cd storage/sphinx
-%patch21 -p1
-cd ../..
# <percona %patches>
%patch100 -p1
%patch101 -p1
%patch160 -p1
%patch161 -p1
%patch162 -p1
+%patch163 -p1
# </percona>
# to get these files rebuild
+Ported to 5.1.42
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
-@@ -430,6 +430,7 @@
+@@ -434,6 +434,7 @@
MYSQL_PLUGIN_IMPORT uint opt_debug_sync_timeout= 0;
#endif /* defined(ENABLED_DEBUG_SYNC) */
my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
DBUG_RETURN(HA_POS_ERROR); /* This shouldn't happend */
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
-@@ -2186,6 +2186,12 @@
+@@ -2259,6 +2259,12 @@
VALID_RANGE(1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
# should be done or reviewed by the maintainer!
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
-@@ -2419,6 +2419,7 @@
+@@ -2424,6 +2424,7 @@
thd->sent_row_count++;
thd->sent_row_count_2++;
+2010-11 - Ported to 5.5
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
-@@ -904,6 +904,7 @@
+@@ -909,6 +909,7 @@
#endif
#ifdef HAVE_QUERY_CACHE
ulong query_cache_min_res_unit= QUERY_CACHE_MIN_RESULT_DATA_SIZE;
NET net; // client connection descriptor
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
-@@ -1815,6 +1815,11 @@
+@@ -1888,6 +1888,11 @@
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_query_cache_size));
+2010-09-15 add column 'total'
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
-@@ -51,7 +51,7 @@
+@@ -52,7 +52,7 @@
message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c
mysqld.cc net_serv.cc keycaches.cc
../sql-common/client_plugin.c
../sql-common/pack.c parse_file.cc password.c procedure.cc
protocol.cc records.cc repl_failsafe.cc rpl_filter.cc set_var.cc
slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc
-@@ -59,7 +59,7 @@
+@@ -60,7 +60,7 @@
sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h
sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc
sql_error.cc sql_handler.cc sql_help.cc sql_insert.cc sql_lex.cc
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#include "../storage/perfschema/pfs_server.h"
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
-@@ -611,7 +613,7 @@
+@@ -615,7 +617,7 @@
MY_LOCALE *my_default_lc_messages;
MY_LOCALE *my_default_lc_time_names;
SHOW_COMP_OPTION have_geometry, have_rtree_keys;
SHOW_COMP_OPTION have_crypt, have_compress;
SHOW_COMP_OPTION have_profiling;
-@@ -912,6 +914,10 @@
+@@ -917,6 +919,10 @@
my_bool opt_enable_shared_memory;
HANDLE smem_event_connect_request= 0;
#endif
my_bool opt_use_ssl = 0;
char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL,
-@@ -1483,6 +1489,9 @@
+@@ -1488,6 +1494,9 @@
my_free(opt_bin_logname);
bitmap_free(&temp_pool);
free_max_user_conn();
#ifdef HAVE_REPLICATION
end_slave_list();
#endif
-@@ -4010,6 +4019,9 @@
+@@ -3860,6 +3869,9 @@
if (!DEFAULT_ERRMSGS[0][0])
unireg_abort(1);
/* We have to initialize the storage engines before CSV logging */
if (ha_init())
{
-@@ -6905,6 +6917,11 @@
+@@ -6773,6 +6785,11 @@
#else
have_query_cache=SHOW_OPTION_NO;
#endif
+#endif // QUERY_RESPONSE_TIME_H
--- a/sql/set_var.h
+++ b/sql/set_var.h
-@@ -293,6 +293,7 @@
+@@ -294,6 +294,7 @@
extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen;
extern SHOW_COMP_OPTION have_query_cache;
%token QUICK
%token RANGE_SYM /* SQL-2003-R */
%token READS_SYM /* SQL-2003-R */
-@@ -11100,6 +11101,15 @@
+@@ -11105,6 +11106,15 @@
{
Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
}
| CREATE PROCEDURE_SYM sp_name
{
LEX *lex= Lex;
-@@ -11339,6 +11349,12 @@
+@@ -11344,6 +11354,12 @@
Lex->type|= REFRESH_SLAVE;
Lex->reset_slave_info.all= false;
}
| MASTER_SYM
{ Lex->type|= REFRESH_MASTER; }
| DES_KEY_FILE
-@@ -12646,6 +12662,7 @@
+@@ -12651,6 +12667,7 @@
| PROXY_SYM {}
| QUARTER_SYM {}
| QUERY_SYM {}
| REBUILD_SYM {}
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
-@@ -49,6 +49,7 @@
- #include "../storage/perfschema/pfs_server.h"
- #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
+@@ -51,6 +51,7 @@
+
+ TYPELIB bool_typelib={ array_elements(bool_values)-1, "", bool_values, 0 };
+#include "query_response_time.h"
/*
This forward declaration is needed because including sql_base.h
causes further includes. [TODO] Eliminate this forward declaration
-@@ -1866,6 +1867,26 @@
+@@ -1939,6 +1940,26 @@
DEFAULT(FALSE));
#endif /* HAVE_QUERY_CACHE */
{ "NVARCHAR", SYM(NVARCHAR_SYM)},
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
-@@ -3121,6 +3121,7 @@
+@@ -2971,6 +2971,7 @@
{"show_relaylog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_RELAYLOG_EVENTS]), SHOW_LONG_STATUS},
{"show_slave_hosts", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS},
{"show_slave_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS},
%token STDDEV_SAMP_SYM /* SQL-2003-N */
%token STD_SYM
%token STOP_SYM
-@@ -11106,6 +11107,11 @@
+@@ -11111,6 +11112,11 @@
{
Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
}
SCH_VARIABLES,
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
-@@ -3101,6 +3101,7 @@
+@@ -2951,6 +2951,7 @@
{"show_storage_engines", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STORAGE_ENGINES]), SHOW_LONG_STATUS},
{"show_table_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLE_STATUS]), SHOW_LONG_STATUS},
{"show_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLES]), SHOW_LONG_STATUS},
{"show_triggers", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TRIGGERS]), SHOW_LONG_STATUS},
{"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
{"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
-@@ -7802,6 +7803,7 @@
+@@ -7670,6 +7671,7 @@
PSI_mutex_key key_LOCK_des_key_file;
#endif /* HAVE_OPENSSL */
PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
-@@ -7855,6 +7857,7 @@
+@@ -7723,6 +7725,7 @@
{ &key_LOCK_system_variables_hash, "LOCK_system_variables_hash", PSI_FLAG_GLOBAL},
{ &key_LOCK_table_share, "LOCK_table_share", PSI_FLAG_GLOBAL},
{ &key_LOCK_thd_data, "THD::LOCK_thd_data", 0},
OPEN_TRIGGER_ONLY|OPTIMIZE_I_S_TABLE},
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
-@@ -10893,6 +10893,15 @@
+@@ -10898,6 +10898,15 @@
if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES))
MYSQL_YYABORT;
}
LEX *lex= Lex;
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
-@@ -233,6 +233,7 @@
+@@ -234,6 +234,7 @@
extern PSI_mutex_key key_LOCK_des_key_file;
#endif
ulonglong lock_utime, bool is_command,
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
-@@ -421,6 +421,10 @@
+@@ -425,6 +425,10 @@
char* opt_secure_file_priv;
my_bool opt_log_slow_admin_statements= 0;
my_bool opt_log_slow_slave_statements= 0;
my_bool lower_case_file_system= 0;
my_bool opt_large_pages= 0;
my_bool opt_super_large_pages= 0;
-@@ -5892,14 +5896,10 @@
+@@ -5753,14 +5757,10 @@
"Don't log extra information to update and slow-query logs.",
&opt_short_log_format, &opt_short_log_format,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slow-queries", OPT_SLOW_QUERY_LOG,
"Log slow queries to a table or log file. Defaults logging to table "
"mysql.slow_log or hostname-slow.log if --log-output=file is used. "
-@@ -7288,6 +7288,10 @@
+@@ -7156,6 +7156,10 @@
C_MODE_END
/**
Get server options from the command line,
and perform related server initializations.
-@@ -7437,6 +7441,8 @@
+@@ -7305,6 +7309,8 @@
global_system_variables.long_query_time= (ulonglong)
(global_system_variables.long_query_time_double * 1e6);
}
-@@ -3682,8 +3717,6 @@
+@@ -3687,8 +3722,6 @@
backup->in_sub_stmt= in_sub_stmt;
backup->enable_slow_log= enable_slow_log;
backup->limit_found_rows= limit_found_rows;
backup->cuted_fields= cuted_fields;
backup->client_capabilities= client_capabilities;
backup->savepoints= transaction.savepoints;
-@@ -3691,6 +3724,7 @@
+@@ -3696,6 +3729,7 @@
first_successful_insert_id_in_prev_stmt;
backup->first_successful_insert_id_in_cur_stmt=
first_successful_insert_id_in_cur_stmt;
if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&
!is_current_stmt_binlog_format_row())
-@@ -3706,13 +3740,74 @@
+@@ -3711,13 +3745,74 @@
/* Disable result sets */
client_capabilities &= ~CLIENT_MULTI_RESULTS;
in_sub_stmt|= new_state;
void THD::restore_sub_statement_state(Sub_statement_state *backup)
{
-@@ -3753,7 +3848,6 @@
+@@ -3758,7 +3853,6 @@
first_successful_insert_id_in_cur_stmt=
backup->first_successful_insert_id_in_cur_stmt;
limit_found_rows= backup->limit_found_rows;
client_capabilities= backup->client_capabilities;
/*
If we've left sub-statement mode, reset the fatal error flag.
-@@ -3771,8 +3865,8 @@
+@@ -3776,8 +3870,8 @@
The following is added to the old values as we are interested in the
total complexity of the query
*/
{
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
-@@ -972,6 +972,29 @@
+@@ -1045,6 +1045,29 @@
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(update_cached_long_query_time));
static bool fix_low_prio_updates(sys_var *self, THD *thd, enum_var_type type)
{
if (type == OPT_SESSION)
-@@ -2904,6 +2927,123 @@
+@@ -2977,6 +3000,123 @@
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_log_state));
+++ /dev/null
-Index: mysqlse/ha_sphinx.cc
-===================================================================
---- mysqlse/ha_sphinx.cc (wersja 2920)
-+++ mysqlse/ha_sphinx.cc (wersja 2921)
-@@ -24,7 +24,10 @@
-
- #include <mysql_version.h>
-
--#if MYSQL_VERSION_ID>50100
-+#if MYSQL_VERSION_ID>=50515
-+#include "sql_class.h"
-+#include "sql_array.h"
-+#elif MYSQL_VERSION_ID>50100
- #include "mysql_priv.h"
- #include <mysql/plugin.h>
- #else
-@@ -119,6 +122,22 @@
-
- #endif
-
-+#if MYSQL_VERSION_ID>=50515
-+
-+#define sphinx_hash_init my_hash_init
-+#define sphinx_hash_free my_hash_free
-+#define sphinx_hash_search my_hash_search
-+#define sphinx_hash_delete my_hash_delete
-+
-+#else
-+
-+#define sphinx_hash_init hash_init
-+#define sphinx_hash_free hash_free
-+#define sphinx_hash_search hash_search
-+#define sphinx_hash_delete hash_delete
-+
-+#endif
-+
- /////////////////////////////////////////////////////////////////////////////
-
- // FIXME! make this all dynamic
-@@ -675,8 +694,8 @@
- if ( !sphinx_init )
- {
- sphinx_init = 1;
-- VOID ( pthread_mutex_init ( &sphinx_mutex, MY_MUTEX_INIT_FAST ) );
-- hash_init ( &sphinx_open_tables, system_charset_info, 32, 0, 0,
-+ void ( pthread_mutex_init ( &sphinx_mutex, MY_MUTEX_INIT_FAST ) );
-+ sphinx_hash_init ( &sphinx_open_tables, system_charset_info, 32, 0, 0,
- sphinx_get_key, 0, 0 );
-
- #if MYSQL_VERSION_ID > 50100
-@@ -726,7 +745,7 @@
- sphinx_init = 0;
- if ( sphinx_open_tables.records )
- error = 1;
-- hash_free ( &sphinx_open_tables );
-+ sphinx_hash_free ( &sphinx_open_tables );
- pthread_mutex_destroy ( &sphinx_mutex );
- }
-
-@@ -1131,12 +1150,12 @@
- {
- // check if we already have this share
- #if MYSQL_VERSION_ID>=50120
-- pShare = (CSphSEShare*) hash_search ( &sphinx_open_tables, (const uchar *) table_name, strlen(table_name) );
-+ pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, (const uchar *) table_name, strlen(table_name) );
- #else
- #ifdef __WIN__
-- pShare = (CSphSEShare*) hash_search ( &sphinx_open_tables, (const byte *) table_name, strlen(table_name) );
-+ pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, (const byte *) table_name, strlen(table_name) );
- #else
-- pShare = (CSphSEShare*) hash_search ( &sphinx_open_tables, table_name, strlen(table_name) );
-+ pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, table_name, strlen(table_name) );
- #endif // win
- #endif // pre-5.1.20
-
-@@ -1188,7 +1207,7 @@
-
- if ( !--pShare->m_iUseCount )
- {
-- hash_delete ( &sphinx_open_tables, (byte *)pShare );
-+ sphinx_hash_delete ( &sphinx_open_tables, (byte *)pShare );
- SafeDelete ( pShare );
- }
-
-@@ -2073,15 +2092,29 @@
- } else
- {
- int tmp_errno;
-+ bool bError = false;
-+
-+#if MYSQL_VERSION_ID>=50515
-+ struct addrinfo tmp_hostent, *hp;
-+ tmp_errno = getaddrinfo ( sHost, NULL, &tmp_hostent, &hp );
-+ if ( !tmp_errno )
-+ {
-+ freeaddrinfo ( hp );
-+ bError = true;
-+ }
-+#else
- struct hostent tmp_hostent, *hp;
- char buff2 [ GETHOSTBYNAME_BUFF_SIZE ];
--
-- hp = my_gethostbyname_r ( sHost, &tmp_hostent,
-- buff2, sizeof(buff2), &tmp_errno );
-+ hp = my_gethostbyname_r ( sHost, &tmp_hostent, buff2, sizeof(buff2), &tmp_errno );
- if ( !hp )
- {
- my_gethostbyname_r_free();
-+ bError = true;
-+ }
-+#endif
-
-+ if ( bError )
-+ {
- char sError[256];
- my_snprintf ( sError, sizeof(sError), "failed to resolve searchd host (name=%s)", sHost );
-
-@@ -2089,9 +2122,13 @@
- SPH_RET(-1);
- }
-
-- memcpy ( &sin.sin_addr, hp->h_addr,
-- Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
-+#if MYSQL_VERSION_ID>=50515
-+ memcpy ( &sin.sin_addr, hp->ai_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->ai_addrlen ) );
-+ freeaddrinfo ( hp );
-+#else
-+ memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
- my_gethostbyname_r_free();
-+#endif
- }
- } else
- {
-@@ -2932,7 +2969,7 @@
-
- for ( uint32 i=0; i<m_iAttrs; i++ )
- {
-- longlong iValue64;
-+ longlong iValue64 = 0;
- uint32 uValue = UnpackDword ();
- if ( m_dAttrs[i].m_uType==SPH_ATTR_BIGINT )
- iValue64 = ( (longlong)uValue<<32 ) | UnpackDword();
-Index: mysqlse/ha_sphinx.h
-===================================================================
---- mysqlse/ha_sphinx.h (wersja 2920)
-+++ mysqlse/ha_sphinx.h (wersja 2921)
-@@ -7,7 +7,9 @@
- #endif
-
-
--#if MYSQL_VERSION_ID>50100
-+#if MYSQL_VERSION_ID>=50515
-+#define TABLE_ARG TABLE_SHARE
-+#elif MYSQL_VERSION_ID>50100
- #define TABLE_ARG st_table_share
- #else
- #define TABLE_ARG st_table
-@@ -47,7 +49,7 @@
-
- public:
- #if MYSQL_VERSION_ID<50100
-- ha_sphinx ( TABLE_ARG * table_arg );
-+ ha_sphinx ( TABLE_ARG * table_arg ); // NOLINT
- #else
- ha_sphinx ( handlerton * hton, TABLE_ARG * table_arg );
- #endif
-@@ -90,7 +92,7 @@
- int index_init ( uint keynr, bool sorted ); // 5.1.x
- int index_init ( uint keynr ) { return index_init ( keynr, false ); } // 5.0.x
-
-- int index_end ();
-+ int index_end ();
- int index_read ( byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag );
- int index_read_idx ( byte * buf, uint idx, const byte * key, uint key_len, enum ha_rkey_function find_flag );
- int index_next ( byte * buf );
-Index: mysqlse/CMakeLists.txt
-===================================================================
---- mysqlse/CMakeLists.txt (wersja 2920)
-+++ mysqlse/CMakeLists.txt (wersja 2921)
-@@ -8,4 +8,9 @@
- ${CMAKE_SOURCE_DIR}/regex)
-
- SET(SPHINX_SOURCES ha_sphinx.cc)
-+IF(MYSQL_VERSION_ID LESS 50515)
- ADD_LIBRARY(sphinx ha_sphinx.cc)
-+ELSE()
-+SET(SPHINX_PLUGIN_DYNAMIC "ha_sphinx")
-+MYSQL_ADD_PLUGIN(sphinx ${SPHINX_SOURCES} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES mysys)
-+ENDIF()
{ "SQL_TSI_SECOND", SYM(SECOND_SYM)},
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
-@@ -194,6 +194,8 @@
+@@ -195,6 +195,8 @@
extern char language[FN_REFLEN];
extern "C" MYSQL_PLUGIN_IMPORT ulong server_id;
extern ulong concurrency;
#include <thr_alarm.h>
#include <ft_global.h>
-@@ -487,6 +492,11 @@
+@@ -491,6 +496,11 @@
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
ulong max_connections, max_connect_errors;
/*
Maximum length of parameter value which can be set through
mysql_send_long_data() call.
-@@ -4252,6 +4262,97 @@
+@@ -4102,6 +4112,97 @@
#define decrement_handler_count()
#endif /* defined(_WIN32) || defined(HAVE_SMEM) */
#ifndef EMBEDDED_LIBRARY
#ifndef DBUG_OFF
-@@ -4510,6 +4611,10 @@
+@@ -4363,6 +4464,10 @@
test_lc_time_sz();
#endif
/*
We have enough space for fiddling with the argv, continue
*/
-@@ -4713,6 +4818,10 @@
+@@ -4574,6 +4679,10 @@
}
#endif
clean_up(1);
mysqld_exit(0);
}
-@@ -6553,6 +6662,7 @@
+@@ -6421,6 +6530,7 @@
{"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG},
{"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG_NOFLUSH},
{"Delayed_writes", (char*) &delayed_insert_writes, SHOW_LONG},
lex->leaf_tables_insert= 0;
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
-@@ -2345,6 +2345,7 @@
+@@ -2346,6 +2346,7 @@
enum enum_yes_no_unknown tx_chain, tx_release;
bool safe_to_cache_query;
%token SQL_SMALL_RESULT
%token SQL_SYM /* SQL-2003-R */
%token SQL_THREAD
-@@ -7357,6 +7358,10 @@
+@@ -7362,6 +7363,10 @@
Lex->select_lex.sql_cache= SELECT_LEX::SQL_NO_CACHE;
}
}
require "lib/mtr_process.pl";
require "lib/mtr_io.pl";
-@@ -291,6 +292,7 @@
+@@ -292,6 +293,7 @@
my $opt_valgrind_path;
my $valgrind_reports= 0;
my $opt_callgrind;
my %mysqld_logs;
my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions.
-@@ -630,6 +632,7 @@
+@@ -631,6 +633,7 @@
# Report test status
mtr_report_test($result);
if ( $result->is_failed() ) {
-@@ -1142,6 +1145,7 @@
+@@ -1144,6 +1147,7 @@
'valgrind-option=s' => \@valgrind_args,
'valgrind-path=s' => \$opt_valgrind_path,
'callgrind' => \$opt_callgrind,
'debug-sync-timeout=i' => \$opt_debug_sync_timeout,
# Directories
-@@ -1703,11 +1707,18 @@
+@@ -1705,11 +1709,18 @@
unless @valgrind_args;
}
# Don't add --quiet; you will loose the summary reports.
-@@ -5796,6 +5807,10 @@
+@@ -5831,6 +5842,10 @@
mtr_add_arg($args, "--tool=callgrind");
mtr_add_arg($args, "--base=$opt_vardir/log");
}
/*
Log error with all enabled log event handlers
-@@ -5026,6 +5033,8 @@
+@@ -5062,6 +5069,8 @@
thd->first_successful_insert_id_in_prev_stmt_for_binlog);
if (e.write(file))
goto err;
}
if (thd->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0)
{
-@@ -5037,12 +5046,16 @@
+@@ -5073,12 +5082,16 @@
minimum());
if (e.write(file))
goto err;
}
if (thd->user_var_events.elements)
{
-@@ -5065,6 +5078,8 @@
+@@ -5101,6 +5114,8 @@
flags);
if (e.write(file))
goto err;
}
}
}
-@@ -5076,6 +5091,8 @@
+@@ -5112,6 +5127,8 @@
if (event_info->write(file) ||
DBUG_EVALUATE_IF("injecting_fault_writing", 1, 0))
goto err;
error= 0;
err:
-@@ -5310,7 +5327,8 @@
+@@ -5346,7 +5363,8 @@
be reset as a READ_CACHE to be able to read the contents from it.
*/
{
Mutex_sentry sentry(lock_log ? &LOCK_log : NULL);
-@@ -5357,6 +5375,7 @@
+@@ -5393,6 +5411,7 @@
/* write the first half of the split header */
if (my_b_write(&log_file, header, carry))
return ER_ERROR_ON_WRITE;
/*
copy fixed second half of header to cache so the correct
-@@ -5425,6 +5444,7 @@
+@@ -5461,6 +5480,7 @@
/* Write data to the binary log file */
if (my_b_write(&log_file, cache->read_pos, length))
return ER_ERROR_ON_WRITE;
cache->read_pos=cache->read_end; // Mark buffer used up
} while ((length= my_b_fill(cache)));
-@@ -5548,20 +5568,23 @@
+@@ -5584,20 +5604,23 @@
Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE, TRUE, 0);
if (qinfo.write(&log_file))
goto err;
MYSQL_QUERY_LOG *get_mysql_log() { return &mysql_log; }
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
-@@ -441,6 +441,7 @@
+@@ -445,6 +445,7 @@
MYSQL_PLUGIN_IMPORT uint opt_debug_sync_timeout= 0;
#endif /* defined(ENABLED_DEBUG_SYNC) */
my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
my_bool opt_optimizer_fix= 0;
/*
True if there is at least one per-hour limit for some user, so we should
-@@ -492,6 +493,7 @@
+@@ -496,6 +497,7 @@
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
ulong max_connections, max_connect_errors;
/* flashcache */
int cachedev_fd;
-@@ -641,7 +643,9 @@
+@@ -645,7 +647,9 @@
LOCK_crypt,
LOCK_global_system_variables,
LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
/**
The below lock protects access to two global server variables:
max_prepared_stmt_count and prepared_stmt_count. These variables
-@@ -1504,6 +1508,11 @@
+@@ -1509,6 +1513,11 @@
#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
query_response_time_free();
#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
#ifdef HAVE_REPLICATION
end_slave_list();
#endif
-@@ -1607,6 +1616,10 @@
+@@ -1612,6 +1621,10 @@
mysql_cond_destroy(&COND_thread_cache);
mysql_cond_destroy(&COND_flush_thread_cache);
mysql_cond_destroy(&COND_manager);
}
#endif /*EMBEDDED_LIBRARY*/
-@@ -3088,6 +3101,7 @@
+@@ -2938,6 +2951,7 @@
{"show_binlog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS},
{"show_binlogs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
{"show_charsets", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS},
{"show_collations", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS},
{"show_contributors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CONTRIBUTORS]), SHOW_LONG_STATUS},
{"show_create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS},
-@@ -3108,6 +3122,7 @@
+@@ -2958,6 +2972,7 @@
#endif
{"show_function_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS_FUNC]), SHOW_LONG_STATUS},
{"show_grants", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_GRANTS]), SHOW_LONG_STATUS},
{"show_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
{"show_master_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
{"show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
-@@ -3126,10 +3141,13 @@
+@@ -2976,10 +2991,13 @@
{"show_slave_status_nolock", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_NOLOCK_STAT]), SHOW_LONG_STATUS},
{"show_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
{"show_storage_engines", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STORAGE_ENGINES]), SHOW_LONG_STATUS},
{"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
{"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
{"slave_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
-@@ -3667,6 +3685,13 @@
+@@ -3517,6 +3535,13 @@
mysql_mutex_init(key_LOCK_server_started,
&LOCK_server_started, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_server_started, &COND_server_started, NULL);
sp_cache_init();
#ifdef HAVE_EVENT_SCHEDULER
Events::init_mutexes();
-@@ -4036,6 +4061,9 @@
+@@ -3886,6 +3911,9 @@
query_response_time_init();
#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
/* We have to initialize the storage engines before CSV logging */
if (ha_init())
{
sql_print_error("Can't init databases");
-@@ -4172,6 +4200,9 @@
+@@ -4022,6 +4050,9 @@
init_max_user_conn();
init_update_queries();
DBUG_RETURN(0);
}
-@@ -5226,6 +5257,7 @@
+@@ -5087,6 +5118,7 @@
{
sql_print_warning("%s", ER_DEFAULT(ER_CON_COUNT_ERROR));
}
delete thd;
DBUG_VOID_RETURN;
}
-@@ -7957,6 +7989,8 @@
+@@ -7825,6 +7857,8 @@
key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_system_variables,
key_LOCK_manager,
key_LOCK_prepared_stmt_count,
-@@ -7996,6 +8030,13 @@
+@@ -7864,6 +7898,13 @@
{ &key_LOCK_delayed_insert, "LOCK_delayed_insert", PSI_FLAG_GLOBAL},
{ &key_LOCK_delayed_status, "LOCK_delayed_status", PSI_FLAG_GLOBAL},
{ &key_LOCK_error_log, "LOCK_error_log", PSI_FLAG_GLOBAL},
extern my_bool opt_optimizer_fix;
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
extern my_bool opt_secure_auth;
-@@ -182,6 +184,7 @@
+@@ -183,6 +185,7 @@
extern ulong slave_trans_retries;
extern uint slave_net_timeout;
extern uint max_user_connections;
extern ulong what_to_log,flush_time;
extern ulong max_prepared_stmt_count, prepared_stmt_count;
extern ulong open_files_limit;
-@@ -209,6 +212,11 @@
+@@ -210,6 +213,11 @@
extern struct system_variables max_system_variables;
extern struct system_status_var global_status_var;
extern struct rand_struct sql_rand;
extern const char *opt_date_time_formats[];
extern handlerton *partition_hton;
extern handlerton *myisam_hton;
-@@ -251,6 +259,8 @@
+@@ -252,6 +260,8 @@
key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_system_variables,
key_LOCK_logger, key_LOCK_manager,
key_LOCK_prepared_stmt_count,
-@@ -350,7 +360,9 @@
+@@ -351,7 +361,9 @@
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager,
LOCK_global_system_variables, LOCK_user_conn,
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
#ifdef HAVE_OPENSSL
extern mysql_mutex_t LOCK_des_key_file;
-@@ -462,6 +474,16 @@
+@@ -463,6 +475,16 @@
return id;
}
/*
Init THD for query processing.
-@@ -2120,6 +2216,32 @@
+@@ -2125,6 +2221,32 @@
}
#endif
struct Item_change_record: public ilink
{
-@@ -2296,6 +2418,7 @@
+@@ -2301,6 +2423,7 @@
}
thd->sent_row_count++;
if (thd->vio_ok())
DBUG_RETURN(protocol->write());
-@@ -2388,6 +2511,7 @@
+@@ -2393,6 +2516,7 @@
select_export::~select_export()
{
thd->sent_row_count=row_count;
}
-@@ -3411,6 +3535,7 @@
+@@ -3416,6 +3540,7 @@
if (likely(thd != 0))
{ /* current_thd==0 when close_connection() calls net_send_error() */
thd->status_var.bytes_sent+= length;
}
}
-@@ -3418,6 +3543,7 @@
+@@ -3423,6 +3548,7 @@
void thd_increment_bytes_received(ulong length)
{
current_thd->status_var.bytes_received+= length;
%token USE_FRM
%token USE_SYM
%token USING /* SQL-2003-R */
-@@ -11121,6 +11126,41 @@
+@@ -11126,6 +11131,41 @@
MYSQL_YYABORT;
#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
}
| CREATE PROCEDURE_SYM sp_name
{
LEX *lex= Lex;
-@@ -11366,6 +11406,16 @@
+@@ -11371,6 +11411,16 @@
Lex->type|= REFRESH_QUERY_RESPONSE_TIME;
#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
}
| MASTER_SYM
{ Lex->type|= REFRESH_MASTER; }
| DES_KEY_FILE
-@@ -12510,6 +12560,7 @@
+@@ -12515,6 +12565,7 @@
| CHAIN_SYM {}
| CHANGED {}
| CIPHER_SYM {}
| CLIENT_SYM {}
| CLASS_ORIGIN_SYM {}
| COALESCE {}
-@@ -12578,6 +12629,7 @@
+@@ -12583,6 +12634,7 @@
| HOSTS_SYM {}
| HOUR_SYM {}
| IDENTIFIED_SYM {}
| IGNORE_SERVER_IDS_SYM {}
| INVOKER_SYM {}
| IMPORT {}
-@@ -12729,6 +12781,7 @@
+@@ -12734,6 +12786,7 @@
| SUSPEND_SYM {}
| SWAPS_SYM {}
| SWITCHES_SYM {}
| TABLE_NAME_SYM {}
| TABLES {}
| TABLE_CHECKSUM_SYM {}
-@@ -12754,6 +12807,7 @@
+@@ -12759,6 +12812,7 @@
| UNKNOWN_SYM {}
| UNTIL_SYM {}
| USER {}
#define REG_NEW_RECORD 2 /* Write a new record if not found */
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
-@@ -1638,6 +1638,17 @@
+@@ -1711,6 +1711,17 @@
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_read_only), ON_UPDATE(fix_read_only));