Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
fd34712b
Commit
fd34712b
authored
Oct 15, 2008
by
Mikael Ronstrom
Browse files
Options
Browse Files
Download
Plain Diff
merged Google background IO threads
parents
186a5311
11157d3c
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
367 additions
and
248 deletions
+367
-248
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+29
-0
storage/innobase/include/os0file.h
storage/innobase/include/os0file.h
+10
-12
storage/innobase/include/srv0srv.h
storage/innobase/include/srv0srv.h
+6
-0
storage/innobase/os/os0file.c
storage/innobase/os/os0file.c
+294
-221
storage/innobase/srv/srv0srv.c
storage/innobase/srv/srv0srv.c
+4
-0
storage/innobase/srv/srv0start.c
storage/innobase/srv/srv0start.c
+24
-15
No files found.
storage/innobase/handler/ha_innodb.cc
View file @
fd34712b
...
...
@@ -140,6 +140,14 @@ static long innobase_io_capacity = 100;
/* Write dirty pages when pct dirty is less than max pct dirty */
static
my_bool
innobase_extra_dirty_writes
=
TRUE
;
/* Max number of IO requests merged to perform large IO in background
IO threads.
*/
long
innobase_max_merged_io
=
64
;
/* Number of background IO threads for read and write. */
long
innobase_read_io_threads
,
innobase_write_io_threads
;
/* The following counter is used to convey information to InnoDB
about server activity: in selects it is not sensible to call
srv_active_wake_master_thread after each fetch or search, we only do
...
...
@@ -1616,6 +1624,9 @@ innobase_init(
srv_mem_pool_size
=
(
ulint
)
innobase_additional_mem_pool_size
;
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_max_merged_io
=
(
ulint
)
innobase_max_merged_io
;
srv_lock_wait_timeout
=
(
ulint
)
innobase_lock_wait_timeout
;
srv_force_recovery
=
(
ulint
)
innobase_force_recovery
;
...
...
@@ -8138,6 +8149,21 @@ static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads,
"Number of file I/O threads in InnoDB."
,
NULL
,
NULL
,
4
,
4
,
64
,
0
);
static
MYSQL_SYSVAR_LONG
(
write_io_threads
,
innobase_write_io_threads
,
PLUGIN_VAR_RQCMDARG
|
PLUGIN_VAR_READONLY
,
"Number of write I/O threads in InnoDB."
,
NULL
,
NULL
,
1
,
1
,
64
,
0
);
static
MYSQL_SYSVAR_LONG
(
read_io_threads
,
innobase_read_io_threads
,
PLUGIN_VAR_RQCMDARG
|
PLUGIN_VAR_READONLY
,
"Number of read I/O threads in InnoDB."
,
NULL
,
NULL
,
1
,
1
,
64
,
0
);
static
MYSQL_SYSVAR_LONG
(
max_merged_io
,
innobase_max_merged_io
,
PLUGIN_VAR_RQCMDARG
|
PLUGIN_VAR_READONLY
,
"Max number of adjacent IO requests to merge in InnoDB."
,
NULL
,
NULL
,
64
,
1
,
64
,
0
);
static
MYSQL_SYSVAR_LONG
(
force_recovery
,
innobase_force_recovery
,
PLUGIN_VAR_RQCMDARG
|
PLUGIN_VAR_READONLY
,
"Helps to save your data in case the disk image of the database becomes corrupt."
,
...
...
@@ -8217,6 +8243,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR
(
doublewrite
),
MYSQL_SYSVAR
(
fast_shutdown
),
MYSQL_SYSVAR
(
file_io_threads
),
MYSQL_SYSVAR
(
read_io_threads
),
MYSQL_SYSVAR
(
write_io_threads
),
MYSQL_SYSVAR
(
max_merged_io
),
MYSQL_SYSVAR
(
file_per_table
),
MYSQL_SYSVAR
(
flush_log_at_trx_commit
),
MYSQL_SYSVAR
(
flush_method
),
...
...
storage/innobase/include/os0file.h
View file @
fd34712b
...
...
@@ -535,21 +535,19 @@ os_file_create_subdirs_if_needed(
FALSE otherwise */
const
char
*
path
);
/* in: path name */
/****************************************************************************
Initializes the asynchronous io system. Creates 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 n_read_threads segments for
read, n_write_threads segments for writes, one segment for the ibuf i/o, and
one segment for log IO. Returns the number of segments created. When async
IO is not used, and 4 threads should be created to process requests put
in the segments. */
void
ulint
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
ios_per_array
,
/* in: maximum number of pending aio operations
allowed per array
*/
ulint
n_
read_threads
,
/* in: number of read threads */
ulint
n_write_threads
,
/* in: number of write threads
*/
ulint
n_slots_sync
);
/* in: number of slots in the sync aio array */
/***********************************************************************
Requests an asynchronous i/o operation. */
...
...
storage/innobase/include/srv0srv.h
View file @
fd34712b
...
...
@@ -90,6 +90,12 @@ extern ulint srv_mem_pool_size;
extern
ulint
srv_lock_table_size
;
extern
ulint
srv_n_file_io_threads
;
/* Number of background IO threads for read and write. Replaces
* srv_n_file_io_threads. */
extern
ulint
srv_n_read_io_threads
;
extern
ulint
srv_n_write_io_threads
;
/* Max number of adjacent IO requests to merge into one large request. */
extern
ulint
srv_max_merged_io
;
/* Number of IO operations per second the server can do */
extern
ulint
srv_io_capacity
;
...
...
storage/innobase/os/os0file.c
View file @
fd34712b
This diff is collapsed.
Click to expand it.
storage/innobase/srv/srv0srv.c
View file @
fd34712b
...
...
@@ -179,6 +179,10 @@ ibool srv_extra_dirty_writes = TRUE; /* Write dirty pages to disk when pct
ulint
srv_n_file_io_threads
=
ULINT_MAX
;
ulint
srv_n_read_io_threads
=
ULINT_MAX
;
ulint
srv_n_write_io_threads
=
ULINT_MAX
;
ulint
srv_max_merged_io
=
64
;
#ifdef UNIV_LOG_ARCHIVE
ibool
srv_log_archive_on
=
FALSE
;
ibool
srv_archive_recovery
=
0
;
...
...
storage/innobase/srv/srv0start.c
View file @
fd34712b
...
...
@@ -985,6 +985,7 @@ innobase_start_or_create_for_mysql(void)
ulint
i
;
ibool
srv_file_per_table_original_value
=
srv_file_per_table
;
mtr_t
mtr
;
ulint
n_threads
;
#ifdef HAVE_DARWIN_THREADS
# ifdef F_FULLFSYNC
/* This executable has been compiled on Mac OS X 10.3 or later.
...
...
@@ -1238,24 +1239,32 @@ innobase_start_or_create_for_mysql(void)
}
/* Restrict the maximum number of file i/o threads */
if
(
srv_n_file_io_threads
>
SRV_MAX_N_IO_THREADS
)
{
srv_n_file_io_threads
=
SRV_MAX_N_IO_THREADS
;
if
((
srv_n_read_io_threads
+
srv_n_write_io_threads
)
>
SRV_MAX_N_IO_THREADS
)
{
fprintf
(
stderr
,
"InnoDB: requested too many read(%d) or write(%d) IO threads, max is %d
\n
"
,
srv_n_read_io_threads
,
srv_n_write_io_threads
,
SRV_MAX_N_IO_THREADS
);
return
(
DB_ERROR
);
}
if
(
!
os_aio_use_native_aio
)
{
/* In simulated aio we currently have use only for 4 threads */
srv_n_file_io_threads
=
4
;
os_aio_init
(
8
*
SRV_N_PENDING_IOS_PER_THREAD
*
srv_n_file_io_threads
,
srv_n_file_io_threads
,
SRV_MAX_N_PENDING_SYNC_IOS
);
/* More than 4 threads are now supported. */
n_threads
=
os_aio_init
(
8
*
SRV_N_PENDING_IOS_PER_THREAD
,
srv_n_read_io_threads
,
srv_n_write_io_threads
,
SRV_MAX_N_PENDING_SYNC_IOS
);
}
else
{
os_aio_init
(
SRV_N_PENDING_IOS_PER_THREAD
*
srv_n_file_io_threads
,
srv_n_file_io_threads
,
SRV_MAX_N_PENDING_SYNC_IOS
);
/* Might need more slots here. Alas, I don't do windows. */
n_threads
=
os_aio_init
(
SRV_N_PENDING_IOS_PER_THREAD
,
srv_n_read_io_threads
,
srv_n_write_io_threads
,
SRV_MAX_N_PENDING_SYNC_IOS
);
}
if
(
n_threads
>
SRV_MAX_N_IO_THREADS
)
{
fprintf
(
stderr
,
"InnoDB: requested too many IO threads(%d), max is %d
\n
"
,
n_threads
,
SRV_MAX_N_IO_THREADS
);
return
(
DB_ERROR
);
}
fil_init
(
srv_max_n_open_files
);
...
...
@@ -1295,7 +1304,7 @@ innobase_start_or_create_for_mysql(void)
/* Create i/o-handler threads: */
for
(
i
=
0
;
i
<
srv_n_file_io
_threads
;
i
++
)
{
for
(
i
=
0
;
i
<
n
_threads
;
i
++
)
{
n
[
i
]
=
i
;
os_thread_create
(
io_handler_thread
,
n
+
i
,
thread_ids
+
i
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment