Commit d455680f authored by Vadim Tkachenko's avatar Vadim Tkachenko

sync with ext rev82

parent 40a7e02b
......@@ -20,14 +20,14 @@ ADD_DEFINITIONS(-D_WIN32 -D_LIB)
# Bug 19424 - InnoDB: Possibly a memory overrun of the buffer being freed (64-bit Visual C)
# Removing Win64 compiler optimizations for all innodb/mem/* files.
IF(CMAKE_GENERATOR MATCHES "Visual Studio" AND CMAKE_SIZEOF_VOID_P MATCHES 8)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/storage/innobase/mem/mem0mem.c
${CMAKE_SOURCE_DIR}/storage/innobase/mem/mem0pool.c
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/storage/xtradb/mem/mem0mem.c
${CMAKE_SOURCE_DIR}/storage/xtradb/mem/mem0pool.c
PROPERTIES COMPILE_FLAGS -Od)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio" AND CMAKE_SIZEOF_VOID_P MATCHES 8)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/storage/innobase/include
${CMAKE_SOURCE_DIR}/storage/innobase/handler
${CMAKE_SOURCE_DIR}/storage/xtradb/include
${CMAKE_SOURCE_DIR}/storage/xtradb/handler
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/extra/yassl/include)
......
......@@ -22,7 +22,7 @@ MYSQLLIBdir= $(pkglibdir)
pkgplugindir= $(pkglibdir)/plugin
INCLUDES= -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/storage/innobase/include \
-I$(top_srcdir)/storage/xtradb/include \
-I$(top_srcdir)/sql \
-I$(srcdir)
......
......@@ -134,6 +134,46 @@ buf_read_page_low(
bpage = buf_page_init_for_read(err, mode, space, zip_size, unzip,
tablespace_version, offset);
if (bpage == NULL) {
/* bugfix: http://bugs.mysql.com/bug.php?id=43948 */
if (recv_recovery_is_on() && *err == DB_TABLESPACE_DELETED) {
/* hashed log recs must be treated here */
recv_addr_t* recv_addr;
mutex_enter(&(recv_sys->mutex));
if (recv_sys->apply_log_recs == FALSE) {
mutex_exit(&(recv_sys->mutex));
goto not_to_recover;
}
/* recv_get_fil_addr_struct() */
recv_addr = HASH_GET_FIRST(recv_sys->addr_hash,
hash_calc_hash(ut_fold_ulint_pair(space, offset),
recv_sys->addr_hash));
while (recv_addr) {
if ((recv_addr->space == space)
&& (recv_addr->page_no == offset)) {
break;
}
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
}
if ((recv_addr == NULL)
|| (recv_addr->state == RECV_BEING_PROCESSED)
|| (recv_addr->state == RECV_PROCESSED)) {
mutex_exit(&(recv_sys->mutex));
goto not_to_recover;
}
fprintf(stderr, " (cannot find space: %lu)", space);
recv_addr->state = RECV_PROCESSED;
ut_a(recv_sys->n_addrs);
recv_sys->n_addrs--;
mutex_exit(&(recv_sys->mutex));
}
not_to_recover:
return(0);
}
......@@ -784,11 +824,11 @@ buf_read_recv_pages(
while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) {
os_aio_simulated_wake_handler_threads();
os_thread_sleep(500000);
os_thread_sleep(10000);
count++;
if (count > 100) {
if (count > 5000) {
fprintf(stderr,
"InnoDB: Error: InnoDB has waited for"
" 50 seconds for pending\n"
......
......@@ -53,35 +53,35 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
/* Include necessary InnoDB headers */
extern "C" {
#include "../storage/innobase/include/univ.i"
#include "../storage/innobase/include/btr0sea.h"
#include "../storage/innobase/include/os0file.h"
#include "../storage/innobase/include/os0thread.h"
#include "../storage/innobase/include/srv0start.h"
#include "../storage/innobase/include/srv0srv.h"
#include "../storage/innobase/include/trx0roll.h"
#include "../storage/innobase/include/trx0trx.h"
#include "../storage/innobase/include/trx0sys.h"
#include "../storage/innobase/include/mtr0mtr.h"
#include "../storage/innobase/include/row0ins.h"
#include "../storage/innobase/include/row0mysql.h"
#include "../storage/innobase/include/row0sel.h"
#include "../storage/innobase/include/row0upd.h"
#include "../storage/innobase/include/log0log.h"
#include "../storage/innobase/include/lock0lock.h"
#include "../storage/innobase/include/dict0crea.h"
#include "../storage/innobase/include/btr0cur.h"
#include "../storage/innobase/include/btr0btr.h"
#include "../storage/innobase/include/fsp0fsp.h"
#include "../storage/innobase/include/sync0sync.h"
#include "../storage/innobase/include/fil0fil.h"
#include "../storage/innobase/include/trx0xa.h"
#include "../storage/innobase/include/row0merge.h"
#include "../storage/innobase/include/thr0loc.h"
#include "../storage/innobase/include/dict0boot.h"
#include "../storage/innobase/include/ha_prototypes.h"
#include "../storage/innobase/include/ut0mem.h"
#include "../storage/innobase/include/ibuf0ibuf.h"
#include "../storage/xtradb/include/univ.i"
#include "../storage/xtradb/include/btr0sea.h"
#include "../storage/xtradb/include/os0file.h"
#include "../storage/xtradb/include/os0thread.h"
#include "../storage/xtradb/include/srv0start.h"
#include "../storage/xtradb/include/srv0srv.h"
#include "../storage/xtradb/include/trx0roll.h"
#include "../storage/xtradb/include/trx0trx.h"
#include "../storage/xtradb/include/trx0sys.h"
#include "../storage/xtradb/include/mtr0mtr.h"
#include "../storage/xtradb/include/row0ins.h"
#include "../storage/xtradb/include/row0mysql.h"
#include "../storage/xtradb/include/row0sel.h"
#include "../storage/xtradb/include/row0upd.h"
#include "../storage/xtradb/include/log0log.h"
#include "../storage/xtradb/include/lock0lock.h"
#include "../storage/xtradb/include/dict0crea.h"
#include "../storage/xtradb/include/btr0cur.h"
#include "../storage/xtradb/include/btr0btr.h"
#include "../storage/xtradb/include/fsp0fsp.h"
#include "../storage/xtradb/include/sync0sync.h"
#include "../storage/xtradb/include/fil0fil.h"
#include "../storage/xtradb/include/trx0xa.h"
#include "../storage/xtradb/include/row0merge.h"
#include "../storage/xtradb/include/thr0loc.h"
#include "../storage/xtradb/include/dict0boot.h"
#include "../storage/xtradb/include/ha_prototypes.h"
#include "../storage/xtradb/include/ut0mem.h"
#include "../storage/xtradb/include/ibuf0ibuf.h"
}
#include "ha_innodb.h"
......@@ -2220,6 +2220,7 @@ mem_free_and_error:
srv_n_write_io_threads = (ulint) innobase_write_io_threads;
srv_read_ahead &= 3;
srv_adaptive_checkpoint %= 3;
srv_force_recovery = (ulint) innobase_force_recovery;
......@@ -10030,10 +10031,36 @@ static MYSQL_SYSVAR_ENUM(read_ahead, srv_read_ahead,
"Control read ahead activity. (none, random, linear, [both])",
NULL, innodb_read_ahead_update, 3, &read_ahead_typelib);
static MYSQL_SYSVAR_ULONG(adaptive_checkpoint, srv_adaptive_checkpoint,
static
void
innodb_adaptive_checkpoint_update(
THD* thd,
struct st_mysql_sys_var* var,
void* var_ptr,
const void* save)
{
*(long *)var_ptr= (*(long *)save) % 3;
}
const char *adaptive_checkpoint_names[]=
{
"none", /* 0 */
"reflex", /* 1 */
"estimate", /* 2 */
/* For compatibility of the older patch */
"0", /* 3 ("none" + 3) */
"1", /* 4 ("reflex" + 3) */
"2", /* 5 ("estimate" + 3) */
NullS
};
TYPELIB adaptive_checkpoint_typelib=
{
array_elements(adaptive_checkpoint_names) - 1, "adaptive_checkpoint_typelib",
adaptive_checkpoint_names, NULL
};
static MYSQL_SYSVAR_ENUM(adaptive_checkpoint, srv_adaptive_checkpoint,
PLUGIN_VAR_RQCMDARG,
"Enable/Disable flushing along modified age. 0:disable 1:enable",
NULL, NULL, 0, 0, 1, 0);
"Enable/Disable flushing along modified age. ([none], reflex, estimate)",
NULL, innodb_adaptive_checkpoint_update, 0, &adaptive_checkpoint_typelib);
static MYSQL_SYSVAR_ULONG(enable_unsafe_group_commit, srv_enable_unsafe_group_commit,
PLUGIN_VAR_RQCMDARG,
......
......@@ -37,5 +37,6 @@ struct innodb_enhancement {
{"innodb_dict_size_limit","Limit dictionary cache size","Variable innodb_dict_size_limit in bytes","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_split_buf_pool_mutex","More fix of buffer_pool mutex","Spliting buf_pool_mutex and optimizing based on innodb_opt_lru_count","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_stats","Additional features about InnoDB statistics/optimizer","","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_recovery_patches","Bugfixes and adjustments about recovery process","","http://www.percona.com/docs/wiki/percona-xtradb"},
{NULL, NULL, NULL, NULL}
};
......@@ -110,7 +110,7 @@ the log and store the scanned log records in the buffer pool: we will
use these free frames to read in pages when we start applying the
log records to the database. */
UNIV_INTERN ulint recv_n_pool_free_frames = 256;
UNIV_INTERN ulint recv_n_pool_free_frames = 1024;
/* The maximum lsn we see for a page during the recovery process. If this
is bigger than the lsn we are able to scan up to, that is an indication that
......@@ -1225,6 +1225,8 @@ recv_recover_page(
buf_block_get_page_no(block));
if ((recv_addr == NULL)
/* bugfix: http://bugs.mysql.com/bug.php?id=44140 */
|| (recv_addr->state == RECV_BEING_READ && !just_read_in)
|| (recv_addr->state == RECV_BEING_PROCESSED)
|| (recv_addr->state == RECV_PROCESSED)) {
......
--- mysql-test/t/events_stress.test.orig 2009-04-16 19:39:47.000000000 +0000
+++ mysql-test/t/events_stress.test 2009-04-16 19:41:16.000000000 +0000
--- mysql-test/t/events_stress.test.orig 2009-07-05 10:29:14.000000000 +0000
+++ mysql-test/t/events_stress.test 2009-07-05 10:30:49.000000000 +0000
@@ -61,6 +61,7 @@
}
--enable_query_log
......@@ -8,13 +8,15 @@
SET GLOBAL event_scheduler=on;
--sleep 2.5
DROP DATABASE events_conn1_test2;
@@ -135,3 +136,4 @@
#
@@ -137,5 +138,5 @@
DROP DATABASE events_test;
# Cleanup
-SET GLOBAL event_scheduler=off;
+SET GLOBAL event_scheduler=@old_event_scheduler;
--- mysql-test/r/events_stress.result.orig 2009-04-16 19:41:48.000000000 +0000
+++ mysql-test/r/events_stress.result 2009-04-16 19:42:07.000000000 +0000
--source include/check_events_off.inc
--- mysql-test/r/events_stress.result.orig 2009-07-05 10:54:30.000000000 +0000
+++ mysql-test/r/events_stress.result 2009-07-05 10:54:48.000000000 +0000
@@ -32,6 +32,7 @@
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
COUNT(*)
......@@ -23,8 +25,9 @@
SET GLOBAL event_scheduler=on;
DROP DATABASE events_conn1_test2;
SET GLOBAL event_scheduler=off;
@@ -63,3 +64,4 @@
@@ -63,4 +64,4 @@
DROP TABLE fill_it2;
DROP TABLE fill_it3;
DROP DATABASE events_test;
-SET GLOBAL event_scheduler=off;
+SET GLOBAL event_scheduler=@old_event_scheduler;
--- mysql-test/r/information_schema.result.orig 2009-04-16 19:59:13.000000000 +0000
+++ mysql-test/r/information_schema.result 2009-04-16 20:00:16.000000000 +0000
@@ -71,6 +71,18 @@
--- mysql-test/r/information_schema.result.orig 2009-06-25 21:33:28.000000000 +0000
+++ mysql-test/r/information_schema.result 2009-06-25 21:33:49.000000000 +0000
@@ -71,6 +71,20 @@
TRIGGERS
USER_PRIVILEGES
VIEWS
......@@ -10,16 +10,18 @@
+INNODB_BUFFER_POOL_PAGES
+XTRADB_ENHANCEMENTS
+INNODB_TRX
+INNODB_BUFFER_POOL_PAGES_BLOB
+INNODB_INDEX_STATS
+INNODB_LOCK_WAITS
+INNODB_CMP_RESET
+INNODB_CMP
+INNODB_CMPMEM_RESET
+INNODB_BUFFER_POOL_PAGES_BLOB
+INNODB_CMPMEM
+INNODB_TABLE_STATS
columns_priv
db
event
@@ -799,6 +811,8 @@
@@ -799,6 +813,8 @@
TABLES UPDATE_TIME datetime
TABLES CHECK_TIME datetime
TRIGGERS CREATED datetime
......@@ -28,22 +30,24 @@
event execute_at datetime
event last_executed datetime
event starts datetime
@@ -847,12 +861,13 @@
@@ -847,12 +863,15 @@
TABLE_CONSTRAINTS TABLE_NAME select
TABLE_PRIVILEGES TABLE_NAME select
VIEWS TABLE_NAME select
+INNODB_BUFFER_POOL_PAGES_INDEX table_name select
+INNODB_INDEX_STATS table_name select
+INNODB_TABLE_STATS table_name select
delete from mysql.user where user='mysqltest_4';
delete from mysql.db where user='mysqltest_4';
flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*)
-information_schema 28
+information_schema 40
+information_schema 42
mysql 22
create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row
@@ -1267,6 +1282,18 @@
@@ -1267,6 +1286,20 @@
TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE
VIEWS TABLE_SCHEMA
......@@ -53,16 +57,18 @@
+INNODB_BUFFER_POOL_PAGES page_type
+XTRADB_ENHANCEMENTS name
+INNODB_TRX trx_id
+INNODB_BUFFER_POOL_PAGES_BLOB space_id
+INNODB_INDEX_STATS table_name
+INNODB_LOCK_WAITS requesting_trx_id
+INNODB_CMP_RESET page_size
+INNODB_CMP page_size
+INNODB_CMPMEM_RESET page_size
+INNODB_BUFFER_POOL_PAGES_BLOB space_id
+INNODB_CMPMEM page_size
+INNODB_TABLE_STATS table_name
SELECT t.table_name, c1.column_name
FROM information_schema.tables t
INNER JOIN
@@ -1310,14 +1337,26 @@
@@ -1310,14 +1343,28 @@
TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE
VIEWS TABLE_SCHEMA
......@@ -72,12 +78,14 @@
+INNODB_BUFFER_POOL_PAGES page_type
+XTRADB_ENHANCEMENTS name
+INNODB_TRX trx_id
+INNODB_BUFFER_POOL_PAGES_BLOB space_id
+INNODB_INDEX_STATS table_name
+INNODB_LOCK_WAITS requesting_trx_id
+INNODB_CMP_RESET page_size
+INNODB_CMP page_size
+INNODB_CMPMEM_RESET page_size
+INNODB_BUFFER_POOL_PAGES_BLOB space_id
+INNODB_CMPMEM page_size
+INNODB_TABLE_STATS table_name
SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
MAX(table_name)
-VIEWS
......@@ -91,7 +99,7 @@
DROP TABLE IF EXISTS bug23037;
DROP FUNCTION IF EXISTS get_value;
SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037';
@@ -1386,6 +1425,17 @@
@@ -1386,6 +1433,19 @@
FILES information_schema.FILES 1
GLOBAL_STATUS information_schema.GLOBAL_STATUS 1
GLOBAL_VARIABLES information_schema.GLOBAL_VARIABLES 1
......@@ -102,14 +110,16 @@
+INNODB_CMPMEM information_schema.INNODB_CMPMEM 1
+INNODB_CMPMEM_RESET information_schema.INNODB_CMPMEM_RESET 1
+INNODB_CMP_RESET information_schema.INNODB_CMP_RESET 1
+INNODB_INDEX_STATS information_schema.INNODB_INDEX_STATS 1
+INNODB_LOCKS information_schema.INNODB_LOCKS 1
+INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
+INNODB_RSEG information_schema.INNODB_RSEG 1
+INNODB_TABLE_STATS information_schema.INNODB_TABLE_STATS 1
+INNODB_TRX information_schema.INNODB_TRX 1
KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
PARTITIONS information_schema.PARTITIONS 1
PLUGINS information_schema.PLUGINS 1
@@ -1404,6 +1454,7 @@
@@ -1404,6 +1464,7 @@
TRIGGERS information_schema.TRIGGERS 1
USER_PRIVILEGES information_schema.USER_PRIVILEGES 1
VIEWS information_schema.VIEWS 1
......
--- mysql-test/r/information_schema_db.result.orig 2009-04-16 20:05:49.000000000 +0000
+++ mysql-test/r/information_schema_db.result 2009-04-16 20:06:07.000000000 +0000
@@ -33,6 +33,18 @@
--- mysql-test/r/information_schema_db.result.orig 2009-06-25 21:41:38.000000000 +0000
+++ mysql-test/r/information_schema_db.result 2009-06-25 21:42:01.000000000 +0000
@@ -33,6 +33,20 @@
TRIGGERS
USER_PRIVILEGES
VIEWS
......@@ -10,12 +10,14 @@
+INNODB_BUFFER_POOL_PAGES
+XTRADB_ENHANCEMENTS
+INNODB_TRX
+INNODB_BUFFER_POOL_PAGES_BLOB
+INNODB_INDEX_STATS
+INNODB_LOCK_WAITS
+INNODB_CMP_RESET
+INNODB_CMP
+INNODB_CMPMEM_RESET
+INNODB_BUFFER_POOL_PAGES_BLOB
+INNODB_CMPMEM
+INNODB_TABLE_STATS
show tables from INFORMATION_SCHEMA like 'T%';
Tables_in_information_schema (T%)
TABLES
--- mysql-test/r/mysqlshow.result.orig 2009-04-16 20:13:30.000000000 +0000
+++ mysql-test/r/mysqlshow.result 2009-04-16 20:13:45.000000000 +0000
@@ -107,6 +107,18 @@
--- mysql-test/r/mysqlshow.result.orig 2009-06-25 21:56:22.000000000 +0000
+++ mysql-test/r/mysqlshow.result 2009-06-25 21:56:28.000000000 +0000
@@ -107,6 +107,20 @@
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
......@@ -10,16 +10,18 @@
+| INNODB_BUFFER_POOL_PAGES |
+| XTRADB_ENHANCEMENTS |
+| INNODB_TRX |
+| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_INDEX_STATS |
+| INNODB_LOCK_WAITS |
+| INNODB_CMP_RESET |
+| INNODB_CMP |
+| INNODB_CMPMEM_RESET |
+| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_CMPMEM |
+| INNODB_TABLE_STATS |
+---------------------------------------+
Database: INFORMATION_SCHEMA
+---------------------------------------+
@@ -140,6 +152,18 @@
@@ -140,6 +154,20 @@
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
......@@ -29,12 +31,14 @@
+| INNODB_BUFFER_POOL_PAGES |
+| XTRADB_ENHANCEMENTS |
+| INNODB_TRX |
+| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_INDEX_STATS |
+| INNODB_LOCK_WAITS |
+| INNODB_CMP_RESET |
+| INNODB_CMP |
+| INNODB_CMPMEM_RESET |
+| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_CMPMEM |
+| INNODB_TABLE_STATS |
+---------------------------------------+
Wildcard: inf_rmation_schema
+--------------------+
......@@ -16,7 +16,7 @@
MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine],
[Transactional Tables using InnoDB], [max,max-no-ndb])
MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase])
MYSQL_PLUGIN_DIRECTORY(innobase, [storage/xtradb])
MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a])
MYSQL_PLUGIN_DYNAMIC(innobase, [ha_innodb.la])
MYSQL_PLUGIN_ACTIONS(innobase, [
......
......@@ -21,7 +21,7 @@
set -eu
TARGETDIR=../storage/innobase
TARGETDIR=../storage/xtradb
# link the build scripts
BUILDSCRIPTS="compile-innodb compile-innodb-debug"
......@@ -40,8 +40,8 @@ ln -sf ../$TARGETDIR/mysql-test/*.inc .
# These patches are usually needed because of deviations of behavior between
# the stock InnoDB and the InnoDB Plugin.
cd ../..
for patch in storage/innobase/mysql-test/patches/*.diff ; do
if [ "${patch}" != "storage/innobase/mysql-test/patches/*.diff" ] ; then
for patch in storage/xtradb/mysql-test/patches/*.diff ; do
if [ "${patch}" != "storage/xtradb/mysql-test/patches/*.diff" ] ; then
patch -p0 < ${patch}
fi
done
......@@ -364,7 +364,7 @@ UNIV_INTERN ulint srv_flush_neighbor_pages = 1; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_enable_unsafe_group_commit = 0; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */
UNIV_INTERN ulint srv_adaptive_checkpoint = 0; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_adaptive_checkpoint = 0; /* 0: none 1: reflex 2: estimate */
UNIV_INTERN ulint srv_expand_import = 0; /* 0:disable 1:enable */
......@@ -2509,6 +2509,9 @@ srv_master_thread(
mutex_exit(&kernel_mutex);
mutex_enter(&(log_sys->mutex));
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
loop:
/*****************************************************************/
/* ---- When there is database activity by users, we cycle in this
......@@ -2538,14 +2541,24 @@ loop:
for (i = 0; i < 10; i++) {
n_ios_old = log_sys->n_log_ios + buf_pool->n_pages_read
+ buf_pool->n_pages_written;
mutex_enter(&(log_sys->mutex));
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
srv_main_thread_op_info = "sleeping";
if (!skip_sleep) {
os_thread_sleep(1000000);
/*
mutex_enter(&(log_sys->mutex));
oldest_lsn = buf_pool_get_oldest_modification();
ib_uint64_t lsn = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
if(oldest_lsn)
fprintf(stderr,
"InnoDB flush: age pct: %lu, lsn progress: %lu\n",
(lsn - oldest_lsn) * 100 / log_sys->max_checkpoint_age,
lsn - lsn_old);
*/
}
skip_sleep = FALSE;
......@@ -2610,13 +2623,16 @@ loop:
iteration of this loop. */
skip_sleep = TRUE;
} else if (srv_adaptive_checkpoint) {
mutex_enter(&(log_sys->mutex));
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
} else if (srv_adaptive_checkpoint == 1) {
/* Try to keep modified age not to exceed
max_checkpoint_age * 7/8 line */
mutex_enter(&(log_sys->mutex));
lsn_old = log_sys->lsn;
oldest_lsn = buf_pool_get_oldest_modification();
if (oldest_lsn == 0) {
......@@ -2628,6 +2644,49 @@ loop:
/* LOG_POOL_PREFLUSH_RATIO_ASYNC is exceeded. */
/* We should not flush from here. */
mutex_exit(&(log_sys->mutex));
} else if ((log_sys->lsn - oldest_lsn)
> (log_sys->max_checkpoint_age) - ((log_sys->max_checkpoint_age) / 4)) {
/* 2nd defence line (max_checkpoint_age * 3/4) */
mutex_exit(&(log_sys->mutex));
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(100),
IB_ULONGLONG_MAX);
skip_sleep = TRUE;
} else if ((log_sys->lsn - oldest_lsn)
> (log_sys->max_checkpoint_age)/2 ) {
/* 1st defence line (max_checkpoint_age * 1/2) */
mutex_exit(&(log_sys->mutex));
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, PCT_IO(10),
IB_ULONGLONG_MAX);
skip_sleep = TRUE;
} else {
mutex_exit(&(log_sys->mutex));
}
}
} else if (srv_adaptive_checkpoint == 2) {
/* Try to keep modified age not to exceed
max_checkpoint_age * 7/8 line */
mutex_enter(&(log_sys->mutex));
oldest_lsn = buf_pool_get_oldest_modification();
if (oldest_lsn == 0) {
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
} else {
if ((log_sys->lsn - oldest_lsn)
> (log_sys->max_checkpoint_age) - ((log_sys->max_checkpoint_age) / 8)) {
/* LOG_POOL_PREFLUSH_RATIO_ASYNC is exceeded. */
/* We should not flush from here. */
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
} else if ((log_sys->lsn - oldest_lsn)
> (log_sys->max_checkpoint_age)/2 ) {
......@@ -2663,11 +2722,23 @@ loop:
mutex_exit(&flush_list_mutex);
if(bpl)
if (!srv_use_doublewrite_buf) {
/* flush is faster than when doublewrite */
bpl = (bpl * 3) / 4;
}
if (bpl) {
retry_flush_batch:
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST,
bpl,
oldest_lsn + (lsn - lsn_old));
if (n_pages_flushed == ULINT_UNDEFINED) {
os_thread_sleep(5000);
goto retry_flush_batch;
}
}
lsn_old = lsn;
/*
fprintf(stderr,
"InnoDB flush: age pct: %lu, lsn progress: %lu, blocks to flush:%llu\n",
......@@ -2675,10 +2746,15 @@ loop:
lsn - lsn_old, bpl);
*/
} else {
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
}
}
} else {
mutex_enter(&(log_sys->mutex));
lsn_old = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
}
if (srv_activity_count == old_activity_count) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment