mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
Update to innoplug-1.0.4.
This commit is contained in:
parent
058cd62565
commit
bae6276d45
104 changed files with 5341 additions and 1173 deletions
|
|
@ -15,6 +15,32 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*****************************************************************************/
|
||||
/***********************************************************************
|
||||
|
||||
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted
|
||||
by Percona Inc.. Those modifications are
|
||||
gratefully acknowledged and are described briefly in the InnoDB
|
||||
documentation. The contributions by Percona Inc. are incorporated with
|
||||
their permission, and subject to the conditions contained in the file
|
||||
COPYING.Percona.
|
||||
|
||||
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 os/os0file.c
|
||||
|
|
@ -1618,6 +1644,7 @@ os_file_close(
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef UNIV_HOTBACKUP
|
||||
/***********************************************************************//**
|
||||
Closes a file handle.
|
||||
@return TRUE if success */
|
||||
|
|
@ -1652,6 +1679,7 @@ os_file_close_no_error_handling(
|
|||
return(TRUE);
|
||||
#endif
|
||||
}
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
|
||||
/***********************************************************************//**
|
||||
Gets a file size.
|
||||
|
|
@ -2923,31 +2951,27 @@ os_aio_array_create(
|
|||
return(array);
|
||||
}
|
||||
|
||||
/************************************************************************//**
|
||||
Initializes the asynchronous io system. Calls also os_io_init_simple.
|
||||
Creates a separate aio array for
|
||||
non-ibuf read and write, a third aio array for the ibuf i/o, with just one
|
||||
segment, two aio arrays for log reads and writes with one segment, and a
|
||||
synchronous aio array of the specified size. The combined number of segments
|
||||
in the three first aio arrays is the parameter n_segments given to the
|
||||
function. The caller must create an i/o handler thread for each segment in
|
||||
the four first arrays, but not for the sync aio array. */
|
||||
/***********************************************************************
|
||||
Initializes the asynchronous io system. Creates one array each for ibuf
|
||||
and log i/o. Also creates one array each for read and write where each
|
||||
array is divided logically into n_read_segs and n_write_segs
|
||||
respectively. The caller must create an i/o handler thread for each
|
||||
segment in these arrays. This function also creates the sync array.
|
||||
No i/o handler thread needs to be created for that */
|
||||
UNIV_INTERN
|
||||
void
|
||||
os_aio_init(
|
||||
/*========*/
|
||||
ulint n, /*!< in: maximum number of pending aio operations
|
||||
allowed; n must be divisible by n_segments */
|
||||
ulint n_segments, /*!< in: combined number of segments in the four
|
||||
first aio arrays; must be >= 4 */
|
||||
ulint n_slots_sync) /*!< in: number of slots in the sync aio array */
|
||||
ulint n_per_seg, /*<! in: maximum number of pending aio
|
||||
operations allowed per segment */
|
||||
ulint n_read_segs, /*<! in: number of reader threads */
|
||||
ulint n_write_segs, /*<! in: number of writer threads */
|
||||
ulint n_slots_sync) /*<! in: number of slots in the sync aio
|
||||
array */
|
||||
{
|
||||
ulint n_read_segs;
|
||||
ulint n_write_segs;
|
||||
ulint n_per_seg;
|
||||
ulint i;
|
||||
ulint n_segments = 2 + n_read_segs + n_write_segs;
|
||||
|
||||
ut_ad(n % n_segments == 0);
|
||||
ut_ad(n_segments >= 4);
|
||||
|
||||
os_io_init_simple();
|
||||
|
|
@ -2956,9 +2980,6 @@ os_aio_init(
|
|||
srv_set_io_thread_op_info(i, "not started yet");
|
||||
}
|
||||
|
||||
n_per_seg = n / n_segments;
|
||||
n_write_segs = (n_segments - 2) / 2;
|
||||
n_read_segs = n_segments - 2 - n_write_segs;
|
||||
|
||||
/* fprintf(stderr, "Array n per seg %lu\n", n_per_seg); */
|
||||
|
||||
|
|
@ -3157,6 +3178,18 @@ os_aio_array_reserve_slot(
|
|||
OVERLAPPED* control;
|
||||
#endif
|
||||
ulint i;
|
||||
ulint slots_per_seg;
|
||||
ulint local_seg;
|
||||
|
||||
/* No need of a mutex. Only reading constant fields */
|
||||
slots_per_seg = array->n_slots / array->n_segments;
|
||||
|
||||
/* We attempt to keep adjacent blocks in the same local
|
||||
segment. This can help in merging IO requests when we are
|
||||
doing simulated AIO */
|
||||
local_seg = (offset >> (UNIV_PAGE_SIZE_SHIFT + 6))
|
||||
% array->n_segments;
|
||||
|
||||
loop:
|
||||
os_mutex_enter(array->mutex);
|
||||
|
||||
|
|
@ -3175,14 +3208,26 @@ loop:
|
|||
goto loop;
|
||||
}
|
||||
|
||||
/* First try to find a slot in the preferred local segment */
|
||||
for (i = local_seg * slots_per_seg; i < array->n_slots; i++) {
|
||||
slot = os_aio_array_get_nth_slot(array, i);
|
||||
|
||||
if (slot->reserved == FALSE) {
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fall back to a full scan. We are guaranteed to find a slot */
|
||||
for (i = 0;; i++) {
|
||||
slot = os_aio_array_get_nth_slot(array, i);
|
||||
|
||||
if (slot->reserved == FALSE) {
|
||||
break;
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
found:
|
||||
ut_a(slot->reserved == FALSE);
|
||||
array->n_reserved++;
|
||||
|
||||
if (array->n_reserved == 1) {
|
||||
|
|
|
|||
|
|
@ -228,37 +228,3 @@ os_mem_free_large(
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************//**
|
||||
Sets the priority boost for threads released from waiting within the current
|
||||
process. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
os_process_set_priority_boost(
|
||||
/*==========================*/
|
||||
ibool do_boost) /*!< in: TRUE if priority boost should be done,
|
||||
FALSE if not */
|
||||
{
|
||||
#ifdef __WIN__
|
||||
ibool no_boost;
|
||||
|
||||
if (do_boost) {
|
||||
no_boost = FALSE;
|
||||
} else {
|
||||
no_boost = TRUE;
|
||||
}
|
||||
|
||||
#if TRUE != 1
|
||||
# error "TRUE != 1"
|
||||
#endif
|
||||
|
||||
/* Does not do anything currently!
|
||||
SetProcessPriorityBoost(GetCurrentProcess(), no_boost);
|
||||
*/
|
||||
fputs("Warning: process priority boost setting"
|
||||
" currently not functional!\n",
|
||||
stderr);
|
||||
#else
|
||||
UT_NOT_USED(do_boost);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,47 +196,6 @@ os_event_create(
|
|||
return(event);
|
||||
}
|
||||
|
||||
#ifdef __WIN__
|
||||
/*********************************************************//**
|
||||
Creates an auto-reset event semaphore, i.e., an event which is automatically
|
||||
reset when a single thread is released. Works only in Windows.
|
||||
@return the event handle */
|
||||
UNIV_INTERN
|
||||
os_event_t
|
||||
os_event_create_auto(
|
||||
/*=================*/
|
||||
const char* name) /*!< in: the name of the event, if NULL
|
||||
the event is created without a name */
|
||||
{
|
||||
os_event_t event;
|
||||
|
||||
event = ut_malloc(sizeof(struct os_event_struct));
|
||||
|
||||
event->handle = CreateEvent(NULL, /* No security attributes */
|
||||
FALSE, /* Auto-reset */
|
||||
FALSE, /* Initial state nonsignaled */
|
||||
(LPCTSTR) name);
|
||||
|
||||
if (!event->handle) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Could not create a Windows auto"
|
||||
" event semaphore; Windows error %lu\n",
|
||||
(ulong) GetLastError());
|
||||
}
|
||||
|
||||
/* Put to the list of events */
|
||||
os_mutex_enter(os_sync_mutex);
|
||||
|
||||
UT_LIST_ADD_FIRST(os_event_list, os_event_list, event);
|
||||
|
||||
os_event_count++;
|
||||
|
||||
os_mutex_exit(os_sync_mutex);
|
||||
|
||||
return(event);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**********************************************************//**
|
||||
Sets an event semaphore to the signaled state: lets waiting threads
|
||||
proceed. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue