Commit f875041f authored by Vasil Dimov's avatar Vasil Dimov

Merge from innodb-branches-innodb+

parents 7b653d64 4b0bd332
......@@ -232,7 +232,7 @@ SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
rem/rem0cmp.c rem/rem0rec.c
row/row0ext.c row/row0ins.c row/row0merge.c row/row0mysql.c row/row0purge.c row/row0row.c
row/row0sel.c row/row0uins.c row/row0umod.c row/row0undo.c row/row0upd.c row/row0vers.c
srv/srv0que.c srv/srv0srv.c srv/srv0start.c
srv/srv0srv.c srv/srv0start.c
sync/sync0arr.c sync/sync0rw.c sync/sync0sync.c
thr/thr0loc.c
trx/trx0i_s.c trx/trx0purge.c trx/trx0rec.c trx/trx0roll.c trx/trx0rseg.c
......
......@@ -174,7 +174,6 @@ noinst_HEADERS= \
include/row0upd.ic \
include/row0vers.h \
include/row0vers.ic \
include/srv0que.h \
include/srv0srv.h \
include/srv0srv.ic \
include/srv0start.h \
......@@ -299,7 +298,6 @@ libinnobase_a_SOURCES= \
row/row0undo.c \
row/row0upd.c \
row/row0vers.c \
srv/srv0que.c \
srv/srv0srv.c \
srv/srv0start.c \
sync/sync0arr.c \
......
......@@ -381,6 +381,9 @@ struct que_thr_struct{
thus far */
ulint lock_state; /*!< lock state of thread (table or
row) */
struct srv_slot_struct*
slot; /* The thread slot in the wait
array in srv_sys_t */
};
#define QUE_THR_MAGIC_N 8476583
......
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/**************************************************//**
@file include/srv0que.h
Server query execution
Created 6/5/1996 Heikki Tuuri
*******************************************************/
#ifndef srv0que_h
#define srv0que_h
#include "univ.i"
#include "que0types.h"
/**********************************************************************//**
Enqueues a task to server task queue and releases a worker thread, if there
is a suspended one. */
UNIV_INTERN
void
srv_que_task_enqueue_low(
/*=====================*/
que_thr_t* thr); /*!< in: query thread */
#endif
......@@ -239,7 +239,6 @@ extern ibool srv_print_latch_waits;
# define srv_print_latch_waits FALSE
#endif /* UNIV_DEBUG */
extern ulint srv_activity_count;
extern ulint srv_fatal_semaphore_wait_threshold;
extern ulint srv_dml_needed_delay;
......@@ -314,12 +313,6 @@ typedef struct export_var_struct export_struc;
/** Status variables to be passed to MySQL */
extern export_struc export_vars;
/** The server system */
typedef struct srv_sys_struct srv_sys_t;
/** The server system */
extern srv_sys_t* srv_sys;
# ifdef UNIV_PFS_THREAD
/* Keys to register InnoDB threads with performance schema */
extern mysql_pfs_key_t trx_rollback_clean_thread_key;
......@@ -420,6 +413,8 @@ enum srv_thread_type {
be biggest) */
};
struct srv_slot_struct;
/*********************************************************************//**
Boots Innobase server.
@return DB_SUCCESS or error code */
......@@ -470,17 +465,6 @@ srv_set_io_thread_op_info(
const char* str); /*!< in: constant char string describing the
state */
/*********************************************************************//**
Releases threads of the type given from suspension in the thread table.
NOTE! The server mutex has to be reserved by the caller!
@return number of threads released: this may be less than n if not
enough threads were suspended at the moment */
UNIV_INTERN
ulint
srv_release_threads(
/*================*/
enum srv_thread_type type, /*!< in: thread type */
ulint n); /*!< in: number of threads to release */
/*********************************************************************//**
The master thread controlling the server.
@return a dummy parameter */
UNIV_INTERN
......@@ -627,6 +611,13 @@ void
srv_export_innodb_status(void);
/*==========================*/
/******************************************************************//**
Increment the server activity counter. */
UNIV_INTERN
void
srv_inc_activity_count(void);
/*=========================*/
/*********************************************************************//**
Asynchronous purge thread.
@return a dummy parameter */
......@@ -636,11 +627,23 @@ srv_purge_thread(
/*=============*/
void* arg __attribute__((unused))); /*!< in: a dummy parameter
required by os_thread_create */
/** Thread slot in the thread table */
typedef struct srv_slot_struct srv_slot_t;
/** Thread table is an array of slots */
typedef srv_slot_t srv_table_t;
/**********************************************************************//**
Enqueues a task to server task queue and releases a worker thread, if there
is a suspended one. */
UNIV_INTERN
void
srv_que_task_enqueue_low(
/*=====================*/
que_thr_t* thr); /*!< in: query thread */
/**********************************************************************//**
Check whether the master thread is active.
@return FALSE is it is not active. */
UNIV_INTERN
ibool
srv_is_master_thread_active(void);
/*==============================*/
/** Status variables to be passed to MySQL */
struct export_var_struct{
......@@ -696,14 +699,6 @@ struct export_var_struct{
ulint innodb_rows_deleted; /*!< srv_n_rows_deleted */
};
/** The server system struct */
struct srv_sys_struct{
srv_table_t* threads; /*!< server thread table */
UT_LIST_BASE_NODE_T(que_thr_t)
tasks; /*!< task queue */
};
extern ulint srv_n_threads_active[];
#else /* !UNIV_HOTBACKUP */
# define srv_use_adaptive_hash_indexes FALSE
# define srv_use_checksums TRUE
......
......@@ -105,6 +105,7 @@ extern mysql_pfs_key_t rw_lock_mutex_key;
extern mysql_pfs_key_t srv_dict_tmpfile_mutex_key;
extern mysql_pfs_key_t srv_innodb_monitor_mutex_key;
extern mysql_pfs_key_t srv_misc_tmpfile_mutex_key;
extern mysql_pfs_key_t srv_threads_mutex_key;
extern mysql_pfs_key_t srv_monitor_file_mutex_key;
extern mysql_pfs_key_t syn_arr_mutex_key;
# ifdef UNIV_SYNC_DEBUG
......@@ -587,6 +588,9 @@ Kernel mutex If a kernel operation needs a file
| fsp x-latch before acquiring the kernel
| mutex.
V
Threads mutex Thread scheduling mutex
|
V
Search system mutex
|
V
......@@ -657,8 +661,9 @@ or row lock! */
/*------------------------------------- MySQL binlog mutex */
/*-------------------------------*/
#define SYNC_KERNEL 300
#define SYNC_REC_LOCK 299
#define SYNC_TRX_LOCK_HEAP 298
#define SYNC_THREADS 299
#define SYNC_REC_LOCK 298
#define SYNC_TRX_LOCK_HEAP 297
#define SYNC_TRX_SYS_HEADER 290
#define SYNC_LOG 170
#define SYNC_LOG_FLUSH_ORDER 147
......
......@@ -3131,17 +3131,14 @@ logs_empty_and_mark_files_at_shutdown(void)
return; /* We SKIP ALL THE REST !! */
}
/* Check that the master thread is suspended */
if (srv_n_threads_active[SRV_MASTER] != 0) {
mutex_exit(&kernel_mutex);
mutex_exit(&kernel_mutex);
/* Check that the master thread is suspended */
if (srv_is_master_thread_active()) {
goto loop;
}
mutex_exit(&kernel_mutex);
mutex_enter(&(log_sys->mutex));
if (log_sys->n_pending_checkpoint_writes
......@@ -3199,18 +3196,14 @@ logs_empty_and_mark_files_at_shutdown(void)
mutex_exit(&(log_sys->mutex));
mutex_enter(&kernel_mutex);
/* Check that the master thread has stayed suspended */
if (srv_n_threads_active[SRV_MASTER] != 0) {
if (srv_is_master_thread_active()) {
fprintf(stderr,
"InnoDB: Warning: the master thread woke up"
" during shutdown\n");
mutex_exit(&kernel_mutex);
goto loop;
}
mutex_exit(&kernel_mutex);
fil_flush_file_spaces(FIL_TABLESPACE);
fil_flush_file_spaces(FIL_LOG);
......@@ -3228,7 +3221,8 @@ logs_empty_and_mark_files_at_shutdown(void)
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
/* Make some checks that the server really is quiet */
ut_a(srv_n_threads_active[SRV_MASTER] == 0);
ut_a(!srv_is_master_thread_active());
ut_a(buf_all_freed());
ut_a(lsn == log_sys->lsn);
......@@ -3249,7 +3243,8 @@ logs_empty_and_mark_files_at_shutdown(void)
fil_close_all_files();
/* Make some checks that the server really is quiet */
ut_a(srv_n_threads_active[SRV_MASTER] == 0);
ut_a(!srv_is_master_thread_active());
ut_a(buf_all_freed());
ut_a(lsn == log_sys->lsn);
}
......
......@@ -29,7 +29,6 @@ Created 5/27/1996 Heikki Tuuri
#include "que0que.ic"
#endif
#include "srv0que.h"
#include "usr0sess.h"
#include "trx0trx.h"
#include "trx0roll.h"
......@@ -311,7 +310,9 @@ que_thr_end_wait_no_next_thr(
/* In MySQL we let the OS thread (not just the query thread) to wait
for the lock to be released: */
srv_release_mysql_thread_if_suspended(thr);
if (thr != NULL) {
srv_release_mysql_thread_if_suspended(thr);
}
/* srv_que_task_enqueue_low(thr); */
}
......
......@@ -341,7 +341,7 @@ row_undo_step(
ut_ad(thr);
srv_activity_count++;
srv_inc_activity_count();
trx = thr_get_trx(thr);
......
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/**************************************************//**
@file srv/srv0que.c
Server query execution
Created 6/5/1996 Heikki Tuuri
*******************************************************/
#include "srv0que.h"
#include "srv0srv.h"
#include "sync0sync.h"
#include "os0thread.h"
#include "usr0sess.h"
#include "que0que.h"
/**********************************************************************//**
Enqueues a task to server task queue and releases a worker thread, if there
is a suspended one. */
UNIV_INTERN
void
srv_que_task_enqueue_low(
/*=====================*/
que_thr_t* thr) /*!< in: query thread */
{
ut_ad(thr);
ut_ad(mutex_own(&kernel_mutex));
UT_LIST_ADD_LAST(queue, srv_sys->tasks, thr);
srv_release_threads(SRV_WORKER, 1);
}
This diff is collapsed.
......@@ -1167,6 +1167,7 @@ sync_thread_add_level(
case SYNC_SEARCH_SYS_CONF:
case SYNC_TRX_LOCK_HEAP:
case SYNC_KERNEL:
case SYNC_THREADS:
case SYNC_IBUF_BITMAP_MUTEX:
case SYNC_RSEG:
case SYNC_TRX_UNDO:
......
......@@ -37,7 +37,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0rec.h"
#include "que0que.h"
#include "usr0sess.h"
#include "srv0que.h"
#include "srv0start.h"
#include "row0undo.h"
#include "row0mysql.h"
......
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