1019
1019
diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
1020
1020
--- a/storage/innobase/buf/buf0lru.c 2010-12-04 15:35:29.137347521 +0900
1021
1021
+++ b/storage/innobase/buf/buf0lru.c 2010-12-04 16:12:48.658550840 +0900
1022
@@ -1796,7 +1796,7 @@
1022
@@ -1798,7 +1798,7 @@
1024
1024
UNIV_MEM_VALID(((buf_block_t*) bpage)->frame,
1025
1025
UNIV_PAGE_SIZE);
1056
1056
diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
1057
1057
--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:12:20.185850734 +0900
1058
1058
+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:12:48.674552412 +0900
1059
@@ -11695,6 +11695,11 @@
1059
@@ -11702,6 +11702,11 @@
1060
1060
"Disable with --skip-innodb-adaptive-hash-index.",
1061
1061
NULL, innodb_adaptive_hash_index_update, TRUE);
1063
1063
+static MYSQL_SYSVAR_ULONG(adaptive_hash_index_partitions, btr_search_index_num,
1064
1064
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
1065
1065
+ "Number of InnoDB adaptive hash index partitions (default 1: disable partitioning)",
1066
+ NULL, NULL, 1, 1, 32, 0);
1066
+ NULL, NULL, 1, 1, sizeof(ulint) * 8, 0);
1068
1068
static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay,
1069
1069
PLUGIN_VAR_RQCMDARG,
1070
1070
"Replication thread delay (ms) on the slave server if "
1071
@@ -12060,6 +12065,7 @@
1071
@@ -12068,6 +12073,7 @@
1072
1072
MYSQL_SYSVAR(use_sys_stats_table),
1073
1073
MYSQL_SYSVAR(stats_sample_pages),
1074
1074
MYSQL_SYSVAR(adaptive_hash_index),
1264
1264
diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
1265
1265
--- a/storage/innobase/include/buf0buf.h 2010-12-15 19:00:07.713604580 +0900
1266
1266
+++ b/storage/innobase/include/buf0buf.h 2010-12-15 20:58:03.546839883 +0900
1267
@@ -1547,7 +1547,7 @@
1267
@@ -1546,7 +1546,7 @@
1268
1268
pointers in the adaptive hash index
1269
1269
pointing to this frame */
1270
1270
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
1273
1273
already been built on this
1274
1274
page; note that it does not
1275
1275
guarantee that the index is
1276
@@ -1561,6 +1561,7 @@
1276
@@ -1560,6 +1560,7 @@
1277
1277
unsigned curr_left_side:1;/*!< TRUE or FALSE in hash indexing */
1278
1278
dict_index_t* index; /*!< Index for which the adaptive
1279
1279
hash index has been created. */
1397
1397
- && trx->has_search_latch) {
1398
1398
+ should_release = 0;
1399
1399
+ for (i = 0; i < btr_search_index_num; i++) {
1400
+ if ((trx->has_search_latch & ((ulint)1 << i))
1401
+ && rw_lock_get_writer(btr_search_latch_part[i])
1402
+ != RW_LOCK_NOT_LOCKED) {
1400
+ /* we should check all latches (fix Bug#791030) */
1401
+ if (rw_lock_get_writer(btr_search_latch_part[i])
1402
+ != RW_LOCK_NOT_LOCKED) {
1403
1403
+ should_release |= ((ulint)1 << i);
1414
1414
- rw_lock_s_unlock(&btr_search_latch);
1415
1415
- trx->has_search_latch = FALSE;
1416
1416
+ for (i = 0; i < btr_search_index_num; i++) {
1417
+ if (should_release & ((ulint)1 << i)) {
1417
+ /* we should release all s-latches (fix Bug#791030) */
1418
+ if (trx->has_search_latch & ((ulint)1 << i)) {
1418
1419
+ rw_lock_s_unlock(btr_search_latch_part[i]);
1419
+ trx->has_search_latch &= ~((ulint)1 << i);
1420
+ trx->has_search_latch &= (~((ulint)1 << i));
1435
1436
- trx->has_search_latch = TRUE;
1436
1437
+ if (!(trx->has_search_latch
1437
1438
+ & ((ulint)1 << (index->id % btr_search_index_num)))) {
1438
+ rw_lock_s_lock(btr_search_get_latch(index->id));
1439
+ trx->has_search_latch |=
1440
+ (ulint)1 << (index->id % btr_search_index_num);
1439
+ if (trx->has_search_latch
1440
+ < ((ulint)1 << (index->id % btr_search_index_num))) {
1441
+ rw_lock_s_lock(btr_search_get_latch(index->id));
1442
+ trx->has_search_latch |=
1443
+ ((ulint)1 << (index->id % btr_search_index_num));
1445
+ /* should re-lock to obay latch-order */
1446
+ for (i = 0; i < btr_search_index_num; i++) {
1447
+ if (trx->has_search_latch & ((ulint)1 << i)) {
1448
+ rw_lock_s_unlock(btr_search_latch_part[i]);
1451
+ trx->has_search_latch |=
1452
+ ((ulint)1 << (index->id % btr_search_index_num));
1453
+ for (i = 0; i < btr_search_index_num; i++) {
1454
+ if (trx->has_search_latch & ((ulint)1 << i)) {
1455
+ rw_lock_s_lock(btr_search_latch_part[i]);
1443
1461
switch (row_sel_try_search_shortcut_for_mysql(
1444
@@ -3666,7 +3684,11 @@
1462
@@ -3671,7 +3707,11 @@
1446
1464
trx->search_latch_timeout--;
1471
1489
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
1472
1490
--- a/storage/innobase/srv/srv0srv.c 2010-12-04 16:12:20.231484679 +0900
1473
1491
+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 16:12:48.726551018 +0900
1474
@@ -2035,7 +2035,9 @@
1492
@@ -2045,7 +2045,9 @@
1475
1493
"-------------------------------------\n", file);
1476
1494
ibuf_print(file);
1484
1502
"%.2f hash searches/s, %.2f non-hash searches/s\n",
1485
@@ -2060,14 +2062,15 @@
1503
@@ -2070,14 +2072,15 @@
1486
1504
ut_total_allocated_memory,
1487
1505
mem_pool_get_reserved(mem_comm_pool));
1488
1506
/* Calcurate reserved memories */
1518
1536
diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
1519
1537
--- a/storage/innobase/sync/sync0sync.c 2010-12-03 17:36:44.300986571 +0900
1520
1538
+++ b/storage/innobase/sync/sync0sync.c 2010-12-04 16:12:48.729513564 +0900
1521
@@ -1178,7 +1178,6 @@
1539
@@ -1223,7 +1223,6 @@
1522
1540
case SYNC_OUTER_ANY_LATCH:
1523
1541
case SYNC_FILE_FORMAT_TAG:
1524
1542
case SYNC_DOUBLEWRITE:
1537
1555
diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
1538
1556
--- a/storage/innobase/trx/trx0trx.c 2010-12-03 17:49:11.623953784 +0900
1539
1557
+++ b/storage/innobase/trx/trx0trx.c 2010-12-04 16:12:48.731513275 +0900
1540
@@ -266,8 +266,14 @@
1558
@@ -265,8 +265,14 @@
1541
1559
/*=================================*/
1542
1560
trx_t* trx) /*!< in: transaction */