#At file:///home/narayanan/Work/mysql/W-M/mysql-5.1-bugteam-37282/ based on revid:svoj@stripped
2804 V Narayanan 2009-02-12
Bug#37282 LOAD DATA CONCURRENT blocks selects when set to 2 and hole in table
A running LOAD DATA CONCURRENT locks the table,
so new SELECT statements must wait for the load to finish.
Occurs when concurrent_inserts=2 and there is a hole in
the data.
Currently in MyISAM concurrent_inserts = 2 disallows concurrent inserts
on the table when there are concurrent readers on the table. This causes
the selects to wait when a load concurrent operation is in progress.
The current patch fixes the behaviour by introducing a new mode
concurrent_inserts = 3
In this mode concurrent inserts are disable only when there are concurrent
writers and not when there are concurrent readers.
modified:
sql/mysqld.cc
storage/myisam/mi_locking.c
per-file messages:
sql/mysqld.cc
Increase the maximum value for concurrent_insert to 3.
storage/myisam/mi_locking.c
Modified the function mi_check_status to allow concurrent inserts when
a) myisam_concurrent_insert=3 and
b) there are no concurrent writers. (This variable
is set by setting the global variable concurrent_insert=3).
(info->s->w_locks)
NOTE: Earlier this function allowed cocurrent inserts only in the following
condition
a) myisam_concurrent_insert=2
b) there are no concurrent writers (info->s->w_locks)
c) there are no concurrent readers (info->s->r_locks)
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-02-12 04:44:32 +0000
+++ b/sql/mysqld.cc 2009-02-12 11:59:09 +0000
@@ -5705,7 +5705,7 @@ struct my_option my_long_options[] =
{"concurrent-insert", OPT_CONCURRENT_INSERT,
"Use concurrent insert with MyISAM. Disable with --concurrent-insert=0",
(uchar**) &myisam_concurrent_insert, (uchar**) &myisam_concurrent_insert,
- 0, GET_ULONG, OPT_ARG, 1, 0, 2, 0, 0, 0},
+ 0, GET_ULONG, OPT_ARG, 1, 0, 3, 0, 0, 0},
{"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows.",
(uchar**) &opt_console, (uchar**) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
=== modified file 'storage/myisam/mi_locking.c'
--- a/storage/myisam/mi_locking.c 2007-08-13 13:11:25 +0000
+++ b/storage/myisam/mi_locking.c 2009-02-12 11:59:09 +0000
@@ -385,6 +385,32 @@ my_bool mi_check_status(void *param)
DBUG_PRINT("info",("dellink: %ld r_locks: %u w_locks: %u",
(long) info->s->state.dellink, (uint) info->s->r_locks,
(uint) info->s->w_locks));
+ /*
+ myisam_concurrent_insert == 2 => Allow concurrent insert if
+ a) There are no holes in the datafile
+ b) There are no concurrent writers on the
+ datafile
+ c) There are no concurrent readers on the
+ datafile
+
+ myisam_concurrent_insert == 3 => Allow concurrent insert if
+ a) There are no holes in the data file
+ b) There are no concurrent writers on the
+ datafile
+
+ For E.g.
+
+ If t1 is a table that HAS HOLES in it and a we are LOADING DATA CONCURRENTLY
+ into it from a datafile, a SELECT on this table would
+
+ a) WAIT until LOAD completes when myisam_concurrent_insert == 2
+ b) WILL NOT WAIT for LOAD when myisam_concurrent_insert == 3.
+ */
+ if (myisam_concurrent_insert == 3)
+ {
+ return (my_bool) !(info->s->state.dellink == HA_OFFSET_ERROR ||
+ (myisam_concurrent_insert == 3 && info->s->w_locks == 1));
+ }
return (my_bool) !(info->s->state.dellink == HA_OFFSET_ERROR ||
(myisam_concurrent_insert == 2 && info->s->r_locks &&
info->s->w_locks == 1));
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (v.narayanan:2804) Bug#37282 | V Narayanan | 12 Feb |