Commit b89957b3 authored by Vadim Tkachenko's avatar Vadim Tkachenko

real sync with patches rev12

parent 82785bdb
...@@ -3595,13 +3595,15 @@ buf_print_io( ...@@ -3595,13 +3595,15 @@ buf_print_io(
buf_pool_mutex_enter(); buf_pool_mutex_enter();
fprintf(file, fprintf(file,
"Buffer pool size %lu\n" "Buffer pool size %lu\n"
"Free buffers %lu\n" "Buffer pool size, bytes %lu\n"
"Database pages %lu\n" "Free buffers %lu\n"
"Modified db pages %lu\n" "Database pages %lu\n"
"Modified db pages %lu\n"
"Pending reads %lu\n" "Pending reads %lu\n"
"Pending writes: LRU %lu, flush list %lu, single page %lu\n", "Pending writes: LRU %lu, flush list %lu, single page %lu\n",
(ulong) size, (ulong) size,
(ulong) size * UNIV_PAGE_SIZE,
(ulong) UT_LIST_GET_LEN(buf_pool->free), (ulong) UT_LIST_GET_LEN(buf_pool->free),
(ulong) UT_LIST_GET_LEN(buf_pool->LRU), (ulong) UT_LIST_GET_LEN(buf_pool->LRU),
(ulong) UT_LIST_GET_LEN(buf_pool->flush_list), (ulong) UT_LIST_GET_LEN(buf_pool->flush_list),
......
...@@ -187,6 +187,10 @@ buf_read_ahead_random( ...@@ -187,6 +187,10 @@ buf_read_ahead_random(
ulint i; ulint i;
ulint buf_read_ahead_random_area; ulint buf_read_ahead_random_area;
if (!(srv_read_ahead & 1)) {
return(0);
}
if (srv_startup_is_before_trx_rollback_phase) { if (srv_startup_is_before_trx_rollback_phase) {
/* No read-ahead to avoid thread deadlocks */ /* No read-ahead to avoid thread deadlocks */
return(0); return(0);
...@@ -412,6 +416,10 @@ buf_read_ahead_linear( ...@@ -412,6 +416,10 @@ buf_read_ahead_linear(
const ulint buf_read_ahead_linear_area const ulint buf_read_ahead_linear_area
= BUF_READ_AHEAD_LINEAR_AREA; = BUF_READ_AHEAD_LINEAR_AREA;
if (!(srv_read_ahead & 2)) {
return(0);
}
if (UNIV_UNLIKELY(srv_startup_is_before_trx_rollback_phase)) { if (UNIV_UNLIKELY(srv_startup_is_before_trx_rollback_phase)) {
/* No read-ahead to avoid thread deadlocks */ /* No read-ahead to avoid thread deadlocks */
return(0); return(0);
......
...@@ -4816,3 +4816,30 @@ fil_page_get_type( ...@@ -4816,3 +4816,30 @@ fil_page_get_type(
return(mach_read_from_2(page + FIL_PAGE_TYPE)); return(mach_read_from_2(page + FIL_PAGE_TYPE));
} }
/*************************************************************************
Return local hash table informations. */
ulint
fil_system_hash_cells(void)
/*=======================*/
{
if (fil_system) {
return (fil_system->spaces->n_cells
+ fil_system->name_hash->n_cells);
} else {
return 0;
}
}
ulint
fil_system_hash_nodes(void)
/*=======================*/
{
if (fil_system) {
return (UT_LIST_GET_LEN(fil_system->space_list)
* (sizeof(fil_space_t) + MEM_BLOCK_HEADER_SIZE));
} else {
return 0;
}
}
...@@ -137,6 +137,7 @@ static long innobase_mirrored_log_groups, innobase_log_files_in_group, ...@@ -137,6 +137,7 @@ static long innobase_mirrored_log_groups, innobase_log_files_in_group,
innobase_force_recovery, innobase_open_files, innobase_force_recovery, innobase_open_files,
innobase_autoinc_lock_mode; innobase_autoinc_lock_mode;
static unsigned long innobase_read_io_threads, innobase_write_io_threads;
static long long innobase_buffer_pool_size, innobase_log_file_size; static long long innobase_buffer_pool_size, innobase_log_file_size;
/* The default values for the following char* start-up parameters /* The default values for the following char* start-up parameters
...@@ -2066,6 +2067,8 @@ innobase_init( ...@@ -2066,6 +2067,8 @@ innobase_init(
srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size; srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
srv_n_file_io_threads = (ulint) innobase_file_io_threads; srv_n_file_io_threads = (ulint) innobase_file_io_threads;
srv_n_read_io_threads = (ulint) innobase_read_io_threads;
srv_n_write_io_threads = (ulint) innobase_write_io_threads;
srv_force_recovery = (ulint) innobase_force_recovery; srv_force_recovery = (ulint) innobase_force_recovery;
...@@ -9406,6 +9409,16 @@ static MYSQL_SYSVAR_BOOL(locks_unsafe_for_binlog, innobase_locks_unsafe_for_binl ...@@ -9406,6 +9409,16 @@ static MYSQL_SYSVAR_BOOL(locks_unsafe_for_binlog, innobase_locks_unsafe_for_binl
"Force InnoDB to not use next-key locking, to use only row-level locking.", "Force InnoDB to not use next-key locking, to use only row-level locking.",
NULL, NULL, FALSE); NULL, NULL, FALSE);
static MYSQL_SYSVAR_ULONG(show_verbose_locks, srv_show_verbose_locks,
PLUGIN_VAR_OPCMDARG,
"Whether to show records locked in SHOW INNODB STATUS.",
NULL, NULL, 0, 0, 1, 0);
static MYSQL_SYSVAR_ULONG(show_locks_held, srv_show_locks_held,
PLUGIN_VAR_RQCMDARG,
"Number of locks held to print for each InnoDB transaction in SHOW INNODB STATUS.",
NULL, NULL, 10, 0, 1000, 0);
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
static MYSQL_SYSVAR_STR(log_arch_dir, innobase_log_arch_dir, static MYSQL_SYSVAR_STR(log_arch_dir, innobase_log_arch_dir,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
...@@ -9556,7 +9569,32 @@ static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode, ...@@ -9556,7 +9569,32 @@ static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode,
static MYSQL_SYSVAR_STR(version, innodb_version_str, static MYSQL_SYSVAR_STR(version, innodb_version_str,
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY, PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
"InnoDB version", NULL, NULL, INNODB_VERSION_STR); "Percona-InnoDB-plugin version", NULL, NULL, INNODB_VERSION_STR);
static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
PLUGIN_VAR_RQCMDARG,
"Number of IO operations per second the server can do. Tunes background IO rate.",
NULL, NULL, 100, 100, 999999999, 0);
static MYSQL_SYSVAR_ULONG(read_ahead, srv_read_ahead,
PLUGIN_VAR_RQCMDARG,
"Enable/Diasable read aheads bit0:random bit1:linear",
NULL, NULL, 3, 0, 3, 0);
static MYSQL_SYSVAR_ULONG(adaptive_checkpoint, srv_adaptive_checkpoint,
PLUGIN_VAR_RQCMDARG,
"Enable/Disable flushing along modified age 0:disable 1:enable",
NULL, NULL, 0, 0, 1, 0);
static MYSQL_SYSVAR_ULONG(read_io_threads, innobase_read_io_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of background read I/O threads in InnoDB.",
NULL, NULL, 1, 1, 64, 0);
static MYSQL_SYSVAR_ULONG(write_io_threads, innobase_write_io_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of background write I/O threads in InnoDB.",
NULL, NULL, 1, 1, 64, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= { static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(additional_mem_pool_size),
...@@ -9603,7 +9641,14 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { ...@@ -9603,7 +9641,14 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(thread_concurrency), MYSQL_SYSVAR(thread_concurrency),
MYSQL_SYSVAR(thread_sleep_delay), MYSQL_SYSVAR(thread_sleep_delay),
MYSQL_SYSVAR(autoinc_lock_mode), MYSQL_SYSVAR(autoinc_lock_mode),
MYSQL_SYSVAR(show_verbose_locks),
MYSQL_SYSVAR(show_locks_held),
MYSQL_SYSVAR(version), MYSQL_SYSVAR(version),
MYSQL_SYSVAR(io_capacity),
MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_checkpoint),
MYSQL_SYSVAR(read_io_threads),
MYSQL_SYSVAR(write_io_threads),
NULL NULL
}; };
......
...@@ -24,5 +24,8 @@ struct innodb_enhancement { ...@@ -24,5 +24,8 @@ struct innodb_enhancement {
const char *link; const char *link;
}innodb_enhancements[] = { }innodb_enhancements[] = {
{"innodb_show_enhancements","I_S.PERCONA_INNODB_ENHANCEMENTS","","http://www.percona.com/docs/wiki/percona-innodb-plugin:innodb_show_enhancements"}, {"innodb_show_enhancements","I_S.PERCONA_INNODB_ENHANCEMENTS","","http://www.percona.com/docs/wiki/percona-innodb-plugin:innodb_show_enhancements"},
{NULL, NULL, NULL, NULL, NULL, NULL} {"innodb_show_status","Improvements to SHOW INNODB STATUS","Memory information and lock info fixes","http://www.percona.com/docs/wiki/percona-innodb-plugin:innodb_show_status"},
{"innodb_io","Improvements to InnoDB IO","","http://www.percona.com/docs/wiki/percona-innodb-plugin:innodb_io"},
{"innodb_rw_lock","InnoDB RW-lock fixes","Useful for 8+ cores SMP systems","http://www.percona.com/docs/wiki/percona-innodb-plugin:innodb_rw_lock"},
{NULL, NULL, NULL, NULL}
}; };
...@@ -696,6 +696,16 @@ fil_page_get_type( ...@@ -696,6 +696,16 @@ fil_page_get_type(
return value not defined */ return value not defined */
const byte* page); /* in: file page */ const byte* page); /* in: file page */
/*************************************************************************
Return local hash table informations. */
ulint
fil_system_hash_cells(void);
/*========================*/
ulint
fil_system_hash_nodes(void);
/*========================*/
typedef struct fil_space_struct fil_space_t; typedef struct fil_space_struct fil_space_t;
......
...@@ -561,8 +561,10 @@ os_aio_init( ...@@ -561,8 +561,10 @@ os_aio_init(
/*========*/ /*========*/
ulint n, /* in: maximum number of pending aio operations ulint n, /* in: maximum number of pending aio operations
allowed; n must be divisible by n_segments */ allowed; n must be divisible by n_segments */
ulint n_segments, /* in: combined number of segments in the four // ulint n_segments, /* in: combined number of segments in the four
first aio arrays; must be >= 4 */ // first aio arrays; must be >= 4 */
ulint n_read_threads, /* n_segments == 2 + n_read_threads + n_write_threads */
ulint n_write_threads, /**/
ulint n_slots_sync); /* in: number of slots in the sync aio array */ ulint n_slots_sync); /* in: number of slots in the sync aio array */
/*********************************************************************** /***********************************************************************
Requests an asynchronous i/o operation. */ Requests an asynchronous i/o operation. */
......
...@@ -90,6 +90,9 @@ extern ulint srv_log_file_size; ...@@ -90,6 +90,9 @@ extern ulint srv_log_file_size;
extern ulint srv_log_buffer_size; extern ulint srv_log_buffer_size;
extern ulong srv_flush_log_at_trx_commit; extern ulong srv_flush_log_at_trx_commit;
extern ulint srv_show_locks_held;
extern ulint srv_show_verbose_locks;
/* The sort order table of the MySQL latin1_swedish_ci character set /* The sort order table of the MySQL latin1_swedish_ci character set
collation */ collation */
extern const byte* srv_latin1_ordering; extern const byte* srv_latin1_ordering;
...@@ -100,6 +103,8 @@ extern ulint srv_mem_pool_size; ...@@ -100,6 +103,8 @@ extern ulint srv_mem_pool_size;
extern ulint srv_lock_table_size; extern ulint srv_lock_table_size;
extern ulint srv_n_file_io_threads; extern ulint srv_n_file_io_threads;
extern ulint srv_n_read_io_threads;
extern ulint srv_n_write_io_threads;
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
extern ibool srv_log_archive_on; extern ibool srv_log_archive_on;
...@@ -144,6 +149,11 @@ extern ulong srv_max_buf_pool_modified_pct; ...@@ -144,6 +149,11 @@ extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag; extern ulong srv_max_purge_lag;
extern ulong srv_replication_delay; extern ulong srv_replication_delay;
extern ulint srv_io_capacity;
extern ulint srv_read_ahead;
extern ulint srv_adaptive_checkpoint;
/*-------------------------------------------*/ /*-------------------------------------------*/
extern ulint srv_n_rows_inserted; extern ulint srv_n_rows_inserted;
......
...@@ -328,7 +328,17 @@ rw_lock_get_x_lock_count( ...@@ -328,7 +328,17 @@ rw_lock_get_x_lock_count(
Accessor functions for rw lock. */ Accessor functions for rw lock. */
UNIV_INLINE UNIV_INLINE
ulint ulint
rw_lock_get_waiters( rw_lock_get_s_waiters(
/*==================*/
rw_lock_t* lock);
UNIV_INLINE
ulint
rw_lock_get_x_waiters(
/*==================*/
rw_lock_t* lock);
UNIV_INLINE
ulint
rw_lock_get_wx_waiters(
/*================*/ /*================*/
rw_lock_t* lock); rw_lock_t* lock);
UNIV_INLINE UNIV_INLINE
...@@ -412,6 +422,11 @@ rw_lock_debug_print( ...@@ -412,6 +422,11 @@ rw_lock_debug_print(
rw_lock_debug_t* info); /* in: debug struct */ rw_lock_debug_t* info); /* in: debug struct */
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
#ifdef HAVE_GCC_ATOMIC_BUILTINS
/* This value means NOT_LOCKED */
#define RW_LOCK_BIAS 0x00100000
#endif
/* NOTE! The structure appears here only for the compiler to know its size. /* NOTE! The structure appears here only for the compiler to know its size.
Do not use its fields directly! The structure used in the spin lock Do not use its fields directly! The structure used in the spin lock
implementation of a read-write lock. Several threads may have a shared lock implementation of a read-write lock. Several threads may have a shared lock
...@@ -421,9 +436,9 @@ blocked by readers, a writer may queue for the lock by setting the writer ...@@ -421,9 +436,9 @@ blocked by readers, a writer may queue for the lock by setting the writer
field. Then no new readers are allowed in. */ field. Then no new readers are allowed in. */
struct rw_lock_struct { struct rw_lock_struct {
os_event_t event; /* Used by sync0arr.c for thread queueing */ /* Used by sync0arr.c for thread queueing */
os_event_t s_event; /* Used for s_lock */
#ifdef __WIN__ os_event_t x_event; /* Used for x_lock */
os_event_t wait_ex_event; /* This windows specific event is os_event_t wait_ex_event; /* This windows specific event is
used by the thread which has set the used by the thread which has set the
lock state to RW_LOCK_WAIT_EX. The lock state to RW_LOCK_WAIT_EX. The
...@@ -431,30 +446,34 @@ struct rw_lock_struct { ...@@ -431,30 +446,34 @@ struct rw_lock_struct {
thread will be the next one to proceed thread will be the next one to proceed
once the current the event gets once the current the event gets
signalled. See LEMMA 2 in sync0sync.c */ signalled. See LEMMA 2 in sync0sync.c */
#ifdef HAVE_GCC_ATOMIC_BUILTINS
volatile lint lock_word; /* Used by using atomic builtin */
#endif #endif
ulint reader_count; /* Number of readers who have locked this volatile ulint reader_count; /* Number of readers who have locked this
lock in the shared mode */ lock in the shared mode */
ulint writer; /* This field is set to RW_LOCK_EX if there volatile ulint writer; /* This field is set to RW_LOCK_EX if there
is a writer owning the lock (in exclusive is a writer owning the lock (in exclusive
mode), RW_LOCK_WAIT_EX if a writer is mode), RW_LOCK_WAIT_EX if a writer is
queueing for the lock, and queueing for the lock, and
RW_LOCK_NOT_LOCKED, otherwise. */ RW_LOCK_NOT_LOCKED, otherwise. */
os_thread_id_t writer_thread; volatile os_thread_id_t writer_thread;
/* Thread id of a possible writer thread */ /* Thread id of a possible writer thread */
ulint writer_count; /* Number of times the same thread has volatile ulint writer_count; /* Number of times the same thread has
recursively locked the lock in the exclusive recursively locked the lock in the exclusive
mode */ mode */
#ifndef HAVE_GCC_ATOMIC_BUILTINS
mutex_t mutex; /* The mutex protecting rw_lock_struct */ mutex_t mutex; /* The mutex protecting rw_lock_struct */
#endif
ulint pass; /* Default value 0. This is set to some ulint pass; /* Default value 0. This is set to some
value != 0 given by the caller of an x-lock value != 0 given by the caller of an x-lock
operation, if the x-lock is to be passed to operation, if the x-lock is to be passed to
another thread to unlock (which happens in another thread to unlock (which happens in
asynchronous i/o). */ asynchronous i/o). */
ulint waiters; /* This ulint is set to 1 if there are volatile ulint s_waiters; /* 1: there are waiters (s_lock) */
waiters (readers or writers) in the global volatile ulint x_waiters; /* 1: there are waiters (x_lock) */
wait array, waiting for this rw_lock. volatile ulint wait_ex_waiters; /* 1: there are waiters (wait_ex) */
Otherwise, == 0. */
UT_LIST_NODE_T(rw_lock_t) list; UT_LIST_NODE_T(rw_lock_t) list;
/* All allocated rw locks are put into a /* All allocated rw locks are put into a
list */ list */
...@@ -467,7 +486,7 @@ struct rw_lock_struct { ...@@ -467,7 +486,7 @@ struct rw_lock_struct {
const char* cfile_name;/* File name where lock created */ const char* cfile_name;/* File name where lock created */
const char* last_s_file_name;/* File name where last s-locked */ const char* last_s_file_name;/* File name where last s-locked */
const char* last_x_file_name;/* File name where last x-locked */ const char* last_x_file_name;/* File name where last x-locked */
ibool writer_is_wait_ex; volatile ibool writer_is_wait_ex;
/* This is TRUE if the writer field is /* This is TRUE if the writer field is
RW_LOCK_WAIT_EX; this field is located far RW_LOCK_WAIT_EX; this field is located far
from the memory update hotspot fields which from the memory update hotspot fields which
......
This diff is collapsed.
...@@ -60,6 +60,17 @@ thr_local_get_in_ibuf_field(void); ...@@ -60,6 +60,17 @@ thr_local_get_in_ibuf_field(void);
/*=============================*/ /*=============================*/
/* out: pointer to the in_ibuf field */ /* out: pointer to the in_ibuf field */
/*************************************************************************
Return local hash table informations. */
ulint
thr_local_hash_cells(void);
/*=======================*/
ulint
thr_local_hash_nodes(void);
/*=======================*/
#ifndef UNIV_NONINL #ifndef UNIV_NONINL
#include "thr0loc.ic" #include "thr0loc.ic"
#endif #endif
......
...@@ -12,6 +12,7 @@ Created 1/20/1994 Heikki Tuuri ...@@ -12,6 +12,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1 #define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 0 #define INNODB_VERSION_MINOR 0
#define INNODB_VERSION_BUGFIX 2 #define INNODB_VERSION_BUGFIX 2
#define PERCONA_INNODB_VERSION 1
/* The following is the InnoDB version as shown in /* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins; SELECT plugin_version FROM information_schema.plugins;
...@@ -23,13 +24,14 @@ component, i.e. we show M.N.P as M.N */ ...@@ -23,13 +24,14 @@ component, i.e. we show M.N.P as M.N */
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
/* auxiliary macros to help creating the version as string */ /* auxiliary macros to help creating the version as string */
#define __INNODB_VERSION(a, b, c) (#a "." #b "." #c) #define __INNODB_VERSION(a, b, c, d) (#a "." #b "." #c "-" #d)
#define _INNODB_VERSION(a, b, c) __INNODB_VERSION(a, b, c) #define _INNODB_VERSION(a, b, c, d) __INNODB_VERSION(a, b, c, d)
#define INNODB_VERSION_STR \ #define INNODB_VERSION_STR \
_INNODB_VERSION(INNODB_VERSION_MAJOR, \ _INNODB_VERSION(INNODB_VERSION_MAJOR, \
INNODB_VERSION_MINOR, \ INNODB_VERSION_MINOR, \
INNODB_VERSION_BUGFIX) INNODB_VERSION_BUGFIX, \
PERCONA_INNODB_VERSION)
#ifdef MYSQL_DYNAMIC_PLUGIN #ifdef MYSQL_DYNAMIC_PLUGIN
/* In the dynamic plugin, redefine some externally visible symbols /* In the dynamic plugin, redefine some externally visible symbols
......
...@@ -4294,32 +4294,32 @@ lock_rec_print( ...@@ -4294,32 +4294,32 @@ lock_rec_print(
putc('\n', file); putc('\n', file);
block = buf_page_try_get(space, page_no, &mtr); if ( srv_show_verbose_locks ) {
block = buf_page_try_get(space, page_no, &mtr);
if (block) { if (block) {
for (i = 0; i < lock_rec_get_n_bits(lock); i++) { for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
if (lock_rec_get_nth_bit(lock, i)) { if (lock_rec_get_nth_bit(lock, i)) {
const rec_t* rec const rec_t* rec
= page_find_rec_with_heap_no( = page_find_rec_with_heap_no(
buf_block_get_frame(block), i); buf_block_get_frame(block), i);
offsets = rec_get_offsets( offsets = rec_get_offsets(
rec, lock->index, offsets, rec, lock->index, offsets,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
fprintf(file, "Record lock, heap no %lu ", fprintf(file, "Record lock, heap no %lu ",
(ulong) i); (ulong) i);
rec_print_new(file, rec, offsets); rec_print_new(file, rec, offsets);
putc('\n', file); putc('\n', file);
}
}
} else {
for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
fprintf(file, "Record lock, heap no %lu\n", (ulong) i);
} }
}
} else {
for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
fprintf(file, "Record lock, heap no %lu\n", (ulong) i);
} }
} }
mtr_commit(&mtr); mtr_commit(&mtr);
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
...@@ -4498,7 +4498,7 @@ loop: ...@@ -4498,7 +4498,7 @@ loop:
} }
} }
if (!srv_print_innodb_lock_monitor) { if (!srv_print_innodb_lock_monitor && !srv_show_locks_held) {
nth_trx++; nth_trx++;
goto loop; goto loop;
} }
...@@ -4557,8 +4557,8 @@ loop: ...@@ -4557,8 +4557,8 @@ loop:
nth_lock++; nth_lock++;
if (nth_lock >= 10) { if (nth_lock >= srv_show_locks_held) {
fputs("10 LOCKS PRINTED FOR THIS TRX:" fputs("TOO LOCKS PRINTED FOR THIS TRX:"
" SUPPRESSING FURTHER PRINTS\n", " SUPPRESSING FURTHER PRINTS\n",
file); file);
......
...@@ -3258,6 +3258,15 @@ log_print( ...@@ -3258,6 +3258,15 @@ log_print(
log_sys->flushed_to_disk_lsn, log_sys->flushed_to_disk_lsn,
log_sys->last_checkpoint_lsn); log_sys->last_checkpoint_lsn);
fprintf(file,
"Max checkpoint age %lu\n"
"Modified age %lu\n"
"Checkpoint age %lu\n",
(ulong) log_sys->max_checkpoint_age,
(ulong) (log_sys->lsn -
log_buf_pool_get_oldest_modification()),
(ulong) (log_sys->lsn - log_sys->last_checkpoint_lsn));
current_time = time(NULL); current_time = time(NULL);
time_elapsed = 0.001 + difftime(current_time, time_elapsed = 0.001 + difftime(current_time,
......
...@@ -2920,8 +2920,10 @@ os_aio_init( ...@@ -2920,8 +2920,10 @@ os_aio_init(
/*========*/ /*========*/
ulint n, /* in: maximum number of pending aio operations ulint n, /* in: maximum number of pending aio operations
allowed; n must be divisible by n_segments */ allowed; n must be divisible by n_segments */
ulint n_segments, /* in: combined number of segments in the four // ulint n_segments, /* in: combined number of segments in the four
first aio arrays; must be >= 4 */ // first aio arrays; must be >= 4 */
ulint n_read_threads, /* n_segments == 2 + n_read_threads + n_write_threads*/
ulint n_write_threads, /**/
ulint n_slots_sync) /* in: number of slots in the sync aio array */ ulint n_slots_sync) /* in: number of slots in the sync aio array */
{ {
ulint n_read_segs; ulint n_read_segs;
...@@ -2929,6 +2931,8 @@ os_aio_init( ...@@ -2929,6 +2931,8 @@ os_aio_init(
ulint n_per_seg; ulint n_per_seg;
ulint i; ulint i;
ulint n_segments = 2 + n_read_threads + n_write_threads;
ut_ad(n % n_segments == 0); ut_ad(n % n_segments == 0);
ut_ad(n_segments >= 4); ut_ad(n_segments >= 4);
...@@ -2939,8 +2943,8 @@ os_aio_init( ...@@ -2939,8 +2943,8 @@ os_aio_init(
} }
n_per_seg = n / n_segments; n_per_seg = n / n_segments;
n_write_segs = (n_segments - 2) / 2; n_write_segs = n_write_threads;
n_read_segs = n_segments - 2 - n_write_segs; n_read_segs = n_read_threads;
/* fprintf(stderr, "Array n per seg %lu\n", n_per_seg); */ /* fprintf(stderr, "Array n per seg %lu\n", n_per_seg); */
...@@ -3140,6 +3144,13 @@ os_aio_array_reserve_slot( ...@@ -3140,6 +3144,13 @@ os_aio_array_reserve_slot(
OVERLAPPED* control; OVERLAPPED* control;
#endif #endif
ulint i; ulint i;
ulint prim_segment;
ulint n;
n = array->n_slots / array->n_segments;
/* 64 blocks' striping ( aligning max(BUF_READ_AHEAD_AREA) ) */
prim_segment = ( offset >> (UNIV_PAGE_SIZE_SHIFT + 6) ) % (array->n_segments);
loop: loop:
os_mutex_enter(array->mutex); os_mutex_enter(array->mutex);
...@@ -3158,6 +3169,16 @@ loop: ...@@ -3158,6 +3169,16 @@ loop:
goto loop; goto loop;
} }
for (i = prim_segment * n; i < array->n_slots; i++) {
slot = os_aio_array_get_nth_slot(array, i);
if (slot->reserved == FALSE) {
break;
}
}
if (slot->reserved == TRUE){
/* Not found after the intended segment. So we should search before. */
for (i = 0;; i++) { for (i = 0;; i++) {
slot = os_aio_array_get_nth_slot(array, i); slot = os_aio_array_get_nth_slot(array, i);
...@@ -3165,6 +3186,7 @@ loop: ...@@ -3165,6 +3186,7 @@ loop:
break; break;
} }
} }
}
array->n_reserved++; array->n_reserved++;
......
This diff is collapsed.
...@@ -1204,24 +1204,28 @@ innobase_start_or_create_for_mysql(void) ...@@ -1204,24 +1204,28 @@ innobase_start_or_create_for_mysql(void)
return(DB_ERROR); return(DB_ERROR);
} }
/* over write innodb_file_io_threads */
srv_n_file_io_threads = 2 + srv_n_read_io_threads + srv_n_write_io_threads;
/* Restrict the maximum number of file i/o threads */ /* Restrict the maximum number of file i/o threads */
if (srv_n_file_io_threads > SRV_MAX_N_IO_THREADS) { if (srv_n_file_io_threads > SRV_MAX_N_IO_THREADS) {
srv_n_file_io_threads = SRV_MAX_N_IO_THREADS; srv_n_file_io_threads = SRV_MAX_N_IO_THREADS;
srv_n_read_io_threads = srv_n_write_io_threads = (SRV_MAX_N_IO_THREADS - 2) / 2;
} }
if (!os_aio_use_native_aio) { if (!os_aio_use_native_aio) {
/* In simulated aio we currently have use only for 4 threads */ /* In simulated aio we currently have use only for 4 threads */
srv_n_file_io_threads = 4; /*srv_n_file_io_threads = 4;*/
os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD
* srv_n_file_io_threads, * srv_n_file_io_threads,
srv_n_file_io_threads, srv_n_read_io_threads, srv_n_write_io_threads,
SRV_MAX_N_PENDING_SYNC_IOS); SRV_MAX_N_PENDING_SYNC_IOS * 8);
} else { } else {
os_aio_init(SRV_N_PENDING_IOS_PER_THREAD os_aio_init(SRV_N_PENDING_IOS_PER_THREAD
* srv_n_file_io_threads, * srv_n_file_io_threads,
srv_n_file_io_threads, srv_n_read_io_threads, srv_n_write_io_threads,
SRV_MAX_N_PENDING_SYNC_IOS); SRV_MAX_N_PENDING_SYNC_IOS);
} }
......
...@@ -307,13 +307,13 @@ sync_cell_event_reset( ...@@ -307,13 +307,13 @@ sync_cell_event_reset(
{ {
if (type == SYNC_MUTEX) { if (type == SYNC_MUTEX) {
return(os_event_reset(((mutex_t *) object)->event)); return(os_event_reset(((mutex_t *) object)->event));
#ifdef __WIN__
} else if (type == RW_LOCK_WAIT_EX) { } else if (type == RW_LOCK_WAIT_EX) {
return(os_event_reset( return(os_event_reset(
((rw_lock_t *) object)->wait_ex_event)); ((rw_lock_t *) object)->wait_ex_event));
#endif } else if (type == RW_LOCK_SHARED) {
} else { return(os_event_reset(((rw_lock_t *) object)->s_event));
return(os_event_reset(((rw_lock_t *) object)->event)); } else { /* RW_LOCK_EX */
return(os_event_reset(((rw_lock_t *) object)->x_event));
} }
} }
...@@ -413,15 +413,12 @@ sync_array_wait_event( ...@@ -413,15 +413,12 @@ sync_array_wait_event(
if (cell->request_type == SYNC_MUTEX) { if (cell->request_type == SYNC_MUTEX) {
event = ((mutex_t*) cell->wait_object)->event; event = ((mutex_t*) cell->wait_object)->event;
#ifdef __WIN__
/* On windows if the thread about to wait is the one which
has set the state of the rw_lock to RW_LOCK_WAIT_EX, then
it waits on a special event i.e.: wait_ex_event. */
} else if (cell->request_type == RW_LOCK_WAIT_EX) { } else if (cell->request_type == RW_LOCK_WAIT_EX) {
event = ((rw_lock_t*) cell->wait_object)->wait_ex_event; event = ((rw_lock_t*) cell->wait_object)->wait_ex_event;
#endif } else if (cell->request_type == RW_LOCK_SHARED) {
event = ((rw_lock_t*) cell->wait_object)->s_event;
} else { } else {
event = ((rw_lock_t*) cell->wait_object)->event; event = ((rw_lock_t*) cell->wait_object)->x_event;
} }
cell->waiting = TRUE; cell->waiting = TRUE;
...@@ -462,6 +459,7 @@ sync_array_cell_print( ...@@ -462,6 +459,7 @@ sync_array_cell_print(
mutex_t* mutex; mutex_t* mutex;
rw_lock_t* rwlock; rw_lock_t* rwlock;
ulint type; ulint type;
ulint writer;
type = cell->request_type; type = cell->request_type;
...@@ -491,12 +489,10 @@ sync_array_cell_print( ...@@ -491,12 +489,10 @@ sync_array_cell_print(
(ulong) mutex->waiters); (ulong) mutex->waiters);
} else if (type == RW_LOCK_EX } else if (type == RW_LOCK_EX
#ifdef __WIN__
|| type == RW_LOCK_WAIT_EX || type == RW_LOCK_WAIT_EX
#endif
|| type == RW_LOCK_SHARED) { || type == RW_LOCK_SHARED) {
fputs(type == RW_LOCK_EX ? "X-lock on" : "S-lock on", file); fputs(type == RW_LOCK_SHARED ? "S-lock on" : "X-lock on", file);
rwlock = cell->old_wait_rw_lock; rwlock = cell->old_wait_rw_lock;
...@@ -504,22 +500,24 @@ sync_array_cell_print( ...@@ -504,22 +500,24 @@ sync_array_cell_print(
" RW-latch at %p created in file %s line %lu\n", " RW-latch at %p created in file %s line %lu\n",
(void*) rwlock, rwlock->cfile_name, (void*) rwlock, rwlock->cfile_name,
(ulong) rwlock->cline); (ulong) rwlock->cline);
if (rwlock->writer != RW_LOCK_NOT_LOCKED) { writer = rw_lock_get_writer(rwlock);
if (writer != RW_LOCK_NOT_LOCKED) {
fprintf(file, fprintf(file,
"a writer (thread id %lu) has" "a writer (thread id %lu) has"
" reserved it in mode %s", " reserved it in mode %s",
(ulong) os_thread_pf(rwlock->writer_thread), (ulong) os_thread_pf(rwlock->writer_thread),
rwlock->writer == RW_LOCK_EX writer == RW_LOCK_EX
? " exclusive\n" ? " exclusive\n"
: " wait exclusive\n"); : " wait exclusive\n");
} }
fprintf(file, fprintf(file,
"number of readers %lu, waiters flag %lu\n" "number of readers %lu, s_waiters flag %lu, x_waiters flag %lu\n"
"Last time read locked in file %s line %lu\n" "Last time read locked in file %s line %lu\n"
"Last time write locked in file %s line %lu\n", "Last time write locked in file %s line %lu\n",
(ulong) rwlock->reader_count, (ulong) rwlock->reader_count,
(ulong) rwlock->waiters, (ulong) rwlock->s_waiters,
(ulong) (rwlock->x_waiters || rwlock->wait_ex_waiters),
rwlock->last_s_file_name, rwlock->last_s_file_name,
(ulong) rwlock->last_s_line, (ulong) rwlock->last_s_line,
rwlock->last_x_file_name, rwlock->last_x_file_name,
...@@ -844,11 +842,15 @@ sync_array_object_signalled( ...@@ -844,11 +842,15 @@ sync_array_object_signalled(
/*========================*/ /*========================*/
sync_array_t* arr) /* in: wait array */ sync_array_t* arr) /* in: wait array */
{ {
#ifdef HAVE_GCC_ATOMIC_BUILTINS
__sync_fetch_and_add(&(arr->sg_count),1);
#else
sync_array_enter(arr); sync_array_enter(arr);
arr->sg_count++; arr->sg_count++;
sync_array_exit(arr); sync_array_exit(arr);
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -889,19 +891,23 @@ sync_arr_wake_threads_if_sema_free(void) ...@@ -889,19 +891,23 @@ sync_arr_wake_threads_if_sema_free(void)
mutex = cell->wait_object; mutex = cell->wait_object;
os_event_set(mutex->event); os_event_set(mutex->event);
#ifdef __WIN__
} else if (cell->request_type } else if (cell->request_type
== RW_LOCK_WAIT_EX) { == RW_LOCK_WAIT_EX) {
rw_lock_t* lock; rw_lock_t* lock;
lock = cell->wait_object; lock = cell->wait_object;
os_event_set(lock->wait_ex_event); os_event_set(lock->wait_ex_event);
#endif } else if (cell->request_type
} else { == RW_LOCK_SHARED) {
rw_lock_t* lock; rw_lock_t* lock;
lock = cell->wait_object; lock = cell->wait_object;
os_event_set(lock->event); os_event_set(lock->s_event);
} else {
rw_lock_t* lock;
lock = cell->wait_object;
os_event_set(lock->x_event);
} }
} }
} }
......
This diff is collapsed.
...@@ -32,6 +32,7 @@ static mutex_t thr_local_mutex; ...@@ -32,6 +32,7 @@ static mutex_t thr_local_mutex;
/* The hash table. The module is not yet initialized when it is NULL. */ /* The hash table. The module is not yet initialized when it is NULL. */
static hash_table_t* thr_local_hash = NULL; static hash_table_t* thr_local_hash = NULL;
ulint thr_local_hash_n_nodes = 0;
/* The private data for each thread should be put to /* The private data for each thread should be put to
the structure below and the accessor functions written the structure below and the accessor functions written
...@@ -177,6 +178,7 @@ thr_local_create(void) ...@@ -177,6 +178,7 @@ thr_local_create(void)
os_thread_pf(os_thread_get_curr_id()), os_thread_pf(os_thread_get_curr_id()),
local); local);
thr_local_hash_n_nodes++;
mutex_exit(&thr_local_mutex); mutex_exit(&thr_local_mutex);
} }
...@@ -204,6 +206,7 @@ thr_local_free( ...@@ -204,6 +206,7 @@ thr_local_free(
HASH_DELETE(thr_local_t, hash, thr_local_hash, HASH_DELETE(thr_local_t, hash, thr_local_hash,
os_thread_pf(id), local); os_thread_pf(id), local);
thr_local_hash_n_nodes--;
mutex_exit(&thr_local_mutex); mutex_exit(&thr_local_mutex);
...@@ -226,3 +229,29 @@ thr_local_init(void) ...@@ -226,3 +229,29 @@ thr_local_init(void)
mutex_create(&thr_local_mutex, SYNC_THR_LOCAL); mutex_create(&thr_local_mutex, SYNC_THR_LOCAL);
} }
/*************************************************************************
Return local hash table informations. */
ulint
thr_local_hash_cells(void)
/*======================*/
{
if (thr_local_hash) {
return (thr_local_hash->n_cells);
} else {
return 0;
}
}
ulint
thr_local_hash_nodes(void)
/*======================*/
{
if (thr_local_hash) {
return (thr_local_hash_n_nodes
* (sizeof(thr_local_t) + MEM_BLOCK_HEADER_SIZE));
} else {
return 0;
}
}
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