Merge lp:~stewart/percona-server/5.5.13-merge into lp:percona-server/5.5

Proposed by Stewart Smith on 2011-06-20
Status: Merged
Approved by: Stewart Smith on 2011-06-20
Approved revision: 122
Merged at revision: 122
Proposed branch: lp:~stewart/percona-server/5.5.13-merge
Merge into: lp:percona-server/5.5
Diff against target: 11671 lines (+7079/-693)
63 files modified
Makefile (+2/-2)
control_online_alter_index.patch (+1/-1)
innodb_adaptive_hash_index_partitions.patch (+45/-27)
innodb_admin_command_base.patch (+1/-1)
innodb_buffer_pool_pages_i_s.patch (+3/-3)
innodb_buffer_pool_shm.patch (+7/-7)
innodb_deadlock_count.patch (+3/-3)
innodb_dict_size_limit.patch (+10/-10)
innodb_expand_import.patch (+597/-87)
innodb_extend_slow.patch (+35/-34)
innodb_extra_rseg.patch (+1/-1)
innodb_fake_changes.patch (+614/-0)
innodb_fast_checksum.patch (+33/-46)
innodb_files_extend.patch (+15/-24)
innodb_fix_misc.patch (+39/-39)
innodb_io_patches.patch (+39/-38)
innodb_lru_dump_restore.patch (+8/-8)
innodb_overwrite_relay_log_info.patch (+17/-18)
innodb_pass_corrupt_table.patch (+106/-100)
innodb_recovery_patches.patch (+10/-10)
innodb_separate_doublewrite.patch (+34/-34)
innodb_show_lock_name.patch (+6/-6)
innodb_show_status.patch (+15/-15)
innodb_show_status_extend.patch (+8/-8)
innodb_show_sys_tables.patch (+1/-1)
innodb_split_buf_pool_mutex.patch (+37/-26)
innodb_stats.patch (+31/-25)
innodb_thread_concurrency_timer_based.patch (+7/-7)
install_tests.sh.THIS (+35/-0)
log_connection_error.patch (+3/-3)
log_warnings_suppress.patch (+3/-3)
memory_dynamic_rows.patch (+2865/-0)
microsec_process.patch (+1/-1)
mysql-test/memory_dynamic_rows.patch/percona_heap_blob.result (+952/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_blob.test.disabled (+642/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug783366.result (+14/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug783366.test.disabled (+19/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug783451.result (+132/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug783451.test.disabled (+16/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug784464.result (+70/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug784464.test.disabled (+67/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug784468.result (+15/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug784468.test.disabled (+16/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug788544.result (+9/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug788544.test.disabled (+15/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug788576.result (+19/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug788576.test.disabled (+19/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug788722.result (+18/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug788722.test.disabled (+20/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug789131.result (+7/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_bug789131.test.disabled (+14/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_var.result (+194/-0)
mysql-test/memory_dynamic_rows.patch/percona_heap_var.test.disabled (+84/-0)
normalize_patches.sh (+1/-1)
optimizer_fix.patch (+2/-2)
processlist_row_stats.patch (+2/-2)
query_cache_enhance.patch (+2/-2)
response_time_distribution.patch (+8/-8)
show_slave_status_nolock.patch (+1/-1)
show_temp.patch (+6/-6)
slow_extended.patch (+17/-17)
sql_no_fcache.patch (+8/-8)
userstat.patch (+58/-58)
To merge this branch: bzr merge lp:~stewart/percona-server/5.5.13-merge
Reviewer Review Type Date Requested Status
Oleg Tsarev (community) dev Needs Fixing on 2011-06-20
Percona developers 2011-06-20 Pending
Review via email: mp+65167@code.launchpad.net

Description of the change

Merge of Yasufumi and Oleg merging patches to MySQL 5.5.13 base. Only patches that already in 5.5.12

http://jenkins.percona.com/job/percona-server-5.5-param/4/

passes as well as lp:percona-server does (better really)

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
<
=== modified file 'Makefile'
--- Makefile 2011-05-18 00:03:53 +0000
+++ Makefile 2011-06-20 09:04:39 +0000
@@ -1,7 +1,7 @@
1FETCH_CMD=wget1FETCH_CMD=wget
2MASTER_SITE=http://www.percona.com/downloads/community2MASTER_SITE=http://www.percona.com/downloads/community
3MYSQL_VERSION=5.5.123MYSQL_VERSION=5.5.13
4PERCONA_SERVER_VERSION=rel20.34PERCONA_SERVER_VERSION=rel20.4
5PERCONA_SERVER ?=Percona-Server-$(MYSQL_VERSION)-$(PERCONA_SERVER_VERSION)5PERCONA_SERVER ?=Percona-Server-$(MYSQL_VERSION)-$(PERCONA_SERVER_VERSION)
6DEBUG_DIR ?= $(PERCONA_SERVER)-debug6DEBUG_DIR ?= $(PERCONA_SERVER)-debug
7RELEASE_DIR ?= $(PERCONA_SERVER)-release7RELEASE_DIR ?= $(PERCONA_SERVER)-release
88
=== modified file 'control_online_alter_index.patch'
--- control_online_alter_index.patch 2011-05-10 11:57:42 +0000
+++ control_online_alter_index.patch 2011-06-20 09:04:39 +0000
@@ -8,7 +8,7 @@
8diff -ruN a/sql/handler.h b/sql/handler.h8diff -ruN a/sql/handler.h b/sql/handler.h
9--- a/sql/handler.h 2010-11-03 07:01:14.000000000 +09009--- a/sql/handler.h 2010-11-03 07:01:14.000000000 +0900
10+++ b/sql/handler.h 2010-12-03 13:51:04.727293058 +090010+++ b/sql/handler.h 2010-12-03 13:51:04.727293058 +0900
11@@ -203,6 +203,8 @@11@@ -205,6 +205,8 @@
12 #define HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE (1L << 9)12 #define HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE (1L << 9)
13 #define HA_INPLACE_ADD_PK_INDEX_NO_WRITE (1L << 10)13 #define HA_INPLACE_ADD_PK_INDEX_NO_WRITE (1L << 10)
14 #define HA_INPLACE_DROP_PK_INDEX_NO_WRITE (1L << 11)14 #define HA_INPLACE_DROP_PK_INDEX_NO_WRITE (1L << 11)
1515
=== modified file 'innodb_adaptive_hash_index_partitions.patch'
--- innodb_adaptive_hash_index_partitions.patch 2011-06-03 13:00:05 +0000
+++ innodb_adaptive_hash_index_partitions.patch 2011-06-20 09:04:39 +0000
@@ -516,7 +516,7 @@
516+ }516+ }
517+ if (UNIV_LIKELY(!block->is_hashed)) {517+ if (UNIV_LIKELY(!block->is_hashed)) {
518+ rw_lock_s_unlock(btr_search_latch);518+ rw_lock_s_unlock(btr_search_latch);
519+ return;519+ goto retry;
520+ }520+ }
521+ index = block->index;521+ index = block->index;
522+ ut_a(btr_search_latch == btr_search_get_latch(index->id));522+ ut_a(btr_search_latch == btr_search_get_latch(index->id));
@@ -1008,7 +1008,7 @@
1008 #endif /* UNIV_SYNC_DEBUG */1008 #endif /* UNIV_SYNC_DEBUG */
1009 ut_ad(!btr_search_enabled);1009 ut_ad(!btr_search_enabled);
1010 1010
1011@@ -2633,6 +2638,7 @@1011@@ -2632,6 +2637,7 @@
1012 {1012 {
1013 block->check_index_page_at_flush = FALSE;1013 block->check_index_page_at_flush = FALSE;
1014 block->index = NULL;1014 block->index = NULL;
@@ -1019,7 +1019,7 @@
1019diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c1019diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
1020--- a/storage/innobase/buf/buf0lru.c 2010-12-04 15:35:29.137347521 +09001020--- a/storage/innobase/buf/buf0lru.c 2010-12-04 15:35:29.137347521 +0900
1021+++ b/storage/innobase/buf/buf0lru.c 2010-12-04 16:12:48.658550840 +09001021+++ b/storage/innobase/buf/buf0lru.c 2010-12-04 16:12:48.658550840 +0900
1022@@ -1796,7 +1796,7 @@1022@@ -1798,7 +1798,7 @@
1023 1023
1024 UNIV_MEM_VALID(((buf_block_t*) bpage)->frame,1024 UNIV_MEM_VALID(((buf_block_t*) bpage)->frame,
1025 UNIV_PAGE_SIZE);1025 UNIV_PAGE_SIZE);
@@ -1031,7 +1031,7 @@
1031diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c1031diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
1032--- a/storage/innobase/dict/dict0dict.c 2010-12-04 15:52:23.398513916 +09001032--- a/storage/innobase/dict/dict0dict.c 2010-12-04 15:52:23.398513916 +0900
1033+++ b/storage/innobase/dict/dict0dict.c 2010-12-04 16:12:48.662550715 +09001033+++ b/storage/innobase/dict/dict0dict.c 2010-12-04 16:12:48.662550715 +0900
1034@@ -1812,7 +1812,7 @@1034@@ -1811,7 +1811,7 @@
1035 zero. */1035 zero. */
1036 1036
1037 for (;;) {1037 for (;;) {
@@ -1056,19 +1056,19 @@
1056diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc1056diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
1057--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:12:20.185850734 +09001057--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:12:20.185850734 +0900
1058+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:12:48.674552412 +09001058+++ 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 "Disable with --skip-innodb-adaptive-hash-index.",1060 "Disable with --skip-innodb-adaptive-hash-index.",
1061 NULL, innodb_adaptive_hash_index_update, TRUE);1061 NULL, innodb_adaptive_hash_index_update, TRUE);
1062 1062
1063+static MYSQL_SYSVAR_ULONG(adaptive_hash_index_partitions, btr_search_index_num,1063+static MYSQL_SYSVAR_ULONG(adaptive_hash_index_partitions, btr_search_index_num,
1064+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,1064+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
1065+ "Number of InnoDB adaptive hash index partitions (default 1: disable partitioning)",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);
1067+1067+
1068 static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay,1068 static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay,
1069 PLUGIN_VAR_RQCMDARG,1069 PLUGIN_VAR_RQCMDARG,
1070 "Replication thread delay (ms) on the slave server if "1070 "Replication thread delay (ms) on the slave server if "
1071@@ -12060,6 +12065,7 @@1071@@ -12068,6 +12073,7 @@
1072 MYSQL_SYSVAR(use_sys_stats_table),1072 MYSQL_SYSVAR(use_sys_stats_table),
1073 MYSQL_SYSVAR(stats_sample_pages),1073 MYSQL_SYSVAR(stats_sample_pages),
1074 MYSQL_SYSVAR(adaptive_hash_index),1074 MYSQL_SYSVAR(adaptive_hash_index),
@@ -1264,7 +1264,7 @@
1264diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h1264diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
1265--- a/storage/innobase/include/buf0buf.h 2010-12-15 19:00:07.713604580 +09001265--- a/storage/innobase/include/buf0buf.h 2010-12-15 19:00:07.713604580 +0900
1266+++ b/storage/innobase/include/buf0buf.h 2010-12-15 20:58:03.546839883 +09001266+++ 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 pointers in the adaptive hash index1268 pointers in the adaptive hash index
1269 pointing to this frame */1269 pointing to this frame */
1270 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */1270 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -1273,7 +1273,7 @@
1273 already been built on this1273 already been built on this
1274 page; note that it does not1274 page; note that it does not
1275 guarantee that the index is1275 guarantee that the index is
1276@@ -1561,6 +1561,7 @@1276@@ -1560,6 +1560,7 @@
1277 unsigned curr_left_side:1;/*!< TRUE or FALSE in hash indexing */1277 unsigned curr_left_side:1;/*!< TRUE or FALSE in hash indexing */
1278 dict_index_t* index; /*!< Index for which the adaptive1278 dict_index_t* index; /*!< Index for which the adaptive
1279 hash index has been created. */1279 hash index has been created. */
@@ -1389,7 +1389,7 @@
1389 #ifdef UNIV_SEARCH_DEBUG1389 #ifdef UNIV_SEARCH_DEBUG
1390 ulint cnt = 0;1390 ulint cnt = 0;
1391 #endif /* UNIV_SEARCH_DEBUG */1391 #endif /* UNIV_SEARCH_DEBUG */
1392@@ -3441,18 +3443,32 @@1392@@ -3446,18 +3448,33 @@
1393 /* PHASE 0: Release a possible s-latch we are holding on the1393 /* PHASE 0: Release a possible s-latch we are holding on the
1394 adaptive hash index latch if there is someone waiting behind */1394 adaptive hash index latch if there is someone waiting behind */
1395 1395
@@ -1397,9 +1397,9 @@
1397- && trx->has_search_latch) {1397- && trx->has_search_latch) {
1398+ should_release = 0;1398+ should_release = 0;
1399+ for (i = 0; i < btr_search_index_num; i++) {1399+ for (i = 0; i < btr_search_index_num; i++) {
1400+ if ((trx->has_search_latch & ((ulint)1 << i))1400+ /* we should check all latches (fix Bug#791030) */
1401+ && rw_lock_get_writer(btr_search_latch_part[i])1401+ if (rw_lock_get_writer(btr_search_latch_part[i])
1402+ != RW_LOCK_NOT_LOCKED) {1402+ != RW_LOCK_NOT_LOCKED) {
1403+ should_release |= ((ulint)1 << i);1403+ should_release |= ((ulint)1 << i);
1404+ }1404+ }
1405+ }1405+ }
@@ -1414,9 +1414,10 @@
1414- rw_lock_s_unlock(&btr_search_latch);1414- rw_lock_s_unlock(&btr_search_latch);
1415- trx->has_search_latch = FALSE;1415- trx->has_search_latch = FALSE;
1416+ for (i = 0; i < btr_search_index_num; i++) {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+ rw_lock_s_unlock(btr_search_latch_part[i]);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));
1420+ }1421+ }
1421+ }1422+ }
1422 1423
@@ -1426,7 +1427,7 @@
1426 }1427 }
1427 1428
1428 /* Reset the new record lock info if srv_locks_unsafe_for_binlog1429 /* Reset the new record lock info if srv_locks_unsafe_for_binlog
1429@@ -3603,9 +3619,11 @@1430@@ -3608,9 +3625,28 @@
1430 hash index semaphore! */1431 hash index semaphore! */
1431 1432
1432 #ifndef UNIV_SEARCH_DEBUG1433 #ifndef UNIV_SEARCH_DEBUG
@@ -1435,13 +1436,30 @@
1435- trx->has_search_latch = TRUE;1436- trx->has_search_latch = TRUE;
1436+ if (!(trx->has_search_latch1437+ if (!(trx->has_search_latch
1437+ & ((ulint)1 << (index->id % btr_search_index_num)))) {1438+ & ((ulint)1 << (index->id % btr_search_index_num)))) {
1438+ rw_lock_s_lock(btr_search_get_latch(index->id));1439+ if (trx->has_search_latch
1439+ trx->has_search_latch |=1440+ < ((ulint)1 << (index->id % btr_search_index_num))) {
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));
1444+ } else {
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]);
1449+ }
1450+ }
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]);
1456+ }
1457+ }
1458+ }
1441 }1459 }
1442 #endif1460 #endif
1443 switch (row_sel_try_search_shortcut_for_mysql(1461 switch (row_sel_try_search_shortcut_for_mysql(
1444@@ -3666,7 +3684,11 @@1462@@ -3671,7 +3707,11 @@
1445 1463
1446 trx->search_latch_timeout--;1464 trx->search_latch_timeout--;
1447 1465
@@ -1454,7 +1472,7 @@
1454 trx->has_search_latch = FALSE;1472 trx->has_search_latch = FALSE;
1455 }1473 }
1456 1474
1457@@ -3690,7 +3712,12 @@1475@@ -3695,7 +3735,12 @@
1458 /* PHASE 3: Open or restore index cursor position */1476 /* PHASE 3: Open or restore index cursor position */
1459 1477
1460 if (trx->has_search_latch) {1478 if (trx->has_search_latch) {
@@ -1471,7 +1489,7 @@
1471diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c1489diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
1472--- a/storage/innobase/srv/srv0srv.c 2010-12-04 16:12:20.231484679 +09001490--- a/storage/innobase/srv/srv0srv.c 2010-12-04 16:12:20.231484679 +0900
1473+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 16:12:48.726551018 +09001491+++ 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 "-------------------------------------\n", file);1493 "-------------------------------------\n", file);
1476 ibuf_print(file);1494 ibuf_print(file);
1477 1495
@@ -1482,7 +1500,7 @@
1482 1500
1483 fprintf(file,1501 fprintf(file,
1484 "%.2f hash searches/s, %.2f non-hash searches/s\n",1502 "%.2f hash searches/s, %.2f non-hash searches/s\n",
1485@@ -2060,14 +2062,15 @@1503@@ -2070,14 +2072,15 @@
1486 ut_total_allocated_memory,1504 ut_total_allocated_memory,
1487 mem_pool_get_reserved(mem_comm_pool));1505 mem_pool_get_reserved(mem_comm_pool));
1488 /* Calcurate reserved memories */1506 /* Calcurate reserved memories */
@@ -1502,7 +1520,7 @@
1502 1520
1503 lock_sys_subtotal = 0;1521 lock_sys_subtotal = 0;
1504 if (trx_sys) {1522 if (trx_sys) {
1505@@ -2093,10 +2096,10 @@1523@@ -2103,10 +2106,10 @@
1506 " Recovery system %lu \t(%lu + %lu)\n",1524 " Recovery system %lu \t(%lu + %lu)\n",
1507 1525
1508 (ulong) (btr_search_sys1526 (ulong) (btr_search_sys
@@ -1518,7 +1536,7 @@
1518diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c1536diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
1519--- a/storage/innobase/sync/sync0sync.c 2010-12-03 17:36:44.300986571 +09001537--- a/storage/innobase/sync/sync0sync.c 2010-12-03 17:36:44.300986571 +0900
1520+++ b/storage/innobase/sync/sync0sync.c 2010-12-04 16:12:48.729513564 +09001538+++ 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 case SYNC_OUTER_ANY_LATCH:1540 case SYNC_OUTER_ANY_LATCH:
1523 case SYNC_FILE_FORMAT_TAG:1541 case SYNC_FILE_FORMAT_TAG:
1524 case SYNC_DOUBLEWRITE:1542 case SYNC_DOUBLEWRITE:
@@ -1526,7 +1544,7 @@
1526 case SYNC_SEARCH_SYS_CONF:1544 case SYNC_SEARCH_SYS_CONF:
1527 case SYNC_TRX_LOCK_HEAP:1545 case SYNC_TRX_LOCK_HEAP:
1528 case SYNC_KERNEL:1546 case SYNC_KERNEL:
1529@@ -1199,6 +1198,7 @@1547@@ -1244,6 +1243,7 @@
1530 ut_error;1548 ut_error;
1531 }1549 }
1532 break;1550 break;
@@ -1537,7 +1555,7 @@
1537diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c1555diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
1538--- a/storage/innobase/trx/trx0trx.c 2010-12-03 17:49:11.623953784 +09001556--- a/storage/innobase/trx/trx0trx.c 2010-12-03 17:49:11.623953784 +0900
1539+++ b/storage/innobase/trx/trx0trx.c 2010-12-04 16:12:48.731513275 +09001557+++ 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 trx_t* trx) /*!< in: transaction */1560 trx_t* trx) /*!< in: transaction */
1543 {1561 {
15441562
=== modified file 'innodb_admin_command_base.patch'
--- innodb_admin_command_base.patch 2011-05-23 03:13:18 +0000
+++ innodb_admin_command_base.patch 2011-06-20 09:04:39 +0000
@@ -8,7 +8,7 @@
8diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc8diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
9--- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:32:15.624039043 +09009--- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:32:15.624039043 +0900
10+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:32:35.424957827 +090010+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:32:35.424957827 +0900
11@@ -11856,7 +11856,8 @@11@@ -11863,7 +11863,8 @@
12 i_s_innodb_sys_foreign_cols,12 i_s_innodb_sys_foreign_cols,
13 i_s_innodb_sys_stats,13 i_s_innodb_sys_stats,
14 i_s_innodb_table_stats,14 i_s_innodb_table_stats,
1515
=== modified file 'innodb_buffer_pool_pages_i_s.patch'
--- innodb_buffer_pool_pages_i_s.patch 2011-05-23 03:13:18 +0000
+++ innodb_buffer_pool_pages_i_s.patch 2011-06-20 09:04:39 +0000
@@ -8,7 +8,7 @@
8diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c8diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
9--- a/storage/innobase/buf/buf0buf.c 2010-12-04 20:20:44.595483291 +09009--- a/storage/innobase/buf/buf0buf.c 2010-12-04 20:20:44.595483291 +0900
10+++ b/storage/innobase/buf/buf0buf.c 2010-12-06 19:28:04.055227506 +090010+++ b/storage/innobase/buf/buf0buf.c 2010-12-06 19:28:04.055227506 +0900
11@@ -4536,6 +4536,36 @@11@@ -4537,6 +4537,36 @@
12 mutex_exit(block_mutex);12 mutex_exit(block_mutex);
13 }13 }
14 14
@@ -48,7 +48,7 @@
48diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc48diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
49--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 20:20:44.614551139 +090049--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 20:20:44.614551139 +0900
50+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-06 19:23:47.622195800 +090050+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-06 19:23:47.622195800 +0900
51@@ -12140,6 +12140,9 @@51@@ -12148,6 +12148,9 @@
52 i_s_innodb_sys_stats,52 i_s_innodb_sys_stats,
53 i_s_innodb_table_stats,53 i_s_innodb_table_stats,
54 i_s_innodb_index_stats,54 i_s_innodb_index_stats,
@@ -786,7 +786,7 @@
786diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h786diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
787--- a/storage/innobase/include/buf0buf.h 2010-12-04 19:46:40.197471531 +0900787--- a/storage/innobase/include/buf0buf.h 2010-12-04 19:46:40.197471531 +0900
788+++ b/storage/innobase/include/buf0buf.h 2010-12-06 19:23:47.638195824 +0900788+++ b/storage/innobase/include/buf0buf.h 2010-12-06 19:23:47.638195824 +0900
789@@ -1145,6 +1145,14 @@789@@ -1144,6 +1144,14 @@
790 /*===========*/790 /*===========*/
791 const buf_pool_t* buf_pool) /*!< in: buffer pool */791 const buf_pool_t* buf_pool) /*!< in: buffer pool */
792 __attribute__((nonnull, const));792 __attribute__((nonnull, const));
793793
=== modified file 'innodb_buffer_pool_shm.patch'
--- innodb_buffer_pool_shm.patch 2011-05-10 11:57:42 +0000
+++ innodb_buffer_pool_shm.patch 2011-06-20 09:04:39 +0000
@@ -742,7 +742,7 @@
742 742
743 743
744 static char* internal_innobase_data_file_path = NULL;744 static char* internal_innobase_data_file_path = NULL;
745@@ -2656,6 +2657,14 @@745@@ -2670,6 +2671,14 @@
746 srv_buf_pool_size = (ulint) innobase_buffer_pool_size;746 srv_buf_pool_size = (ulint) innobase_buffer_pool_size;
747 srv_buf_pool_instances = (ulint) innobase_buffer_pool_instances;747 srv_buf_pool_instances = (ulint) innobase_buffer_pool_instances;
748 748
@@ -757,7 +757,7 @@
757 srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;757 srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
758 758
759 srv_n_file_io_threads = (ulint) innobase_file_io_threads;759 srv_n_file_io_threads = (ulint) innobase_file_io_threads;
760@@ -2672,6 +2681,7 @@760@@ -2686,6 +2695,7 @@
761 srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;761 srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
762 srv_use_checksums = (ibool) innobase_use_checksums;762 srv_use_checksums = (ibool) innobase_use_checksums;
763 srv_fast_checksum = (ibool) innobase_fast_checksum;763 srv_fast_checksum = (ibool) innobase_fast_checksum;
@@ -765,7 +765,7 @@
765 765
766 #ifdef HAVE_LARGE_PAGES766 #ifdef HAVE_LARGE_PAGES
767 if ((os_use_large_pages = (ibool) my_use_large_pages))767 if ((os_use_large_pages = (ibool) my_use_large_pages))
768@@ -11726,6 +11736,16 @@768@@ -11733,6 +11743,16 @@
769 "Number of buffer pool instances, set to higher value on high-end machines to increase scalability",769 "Number of buffer pool instances, set to higher value on high-end machines to increase scalability",
770 NULL, NULL, 1L, 1L, MAX_BUFFER_POOLS, 1L);770 NULL, NULL, 1L, 1L, MAX_BUFFER_POOLS, 1L);
771 771
@@ -782,7 +782,7 @@
782 static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,782 static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
783 PLUGIN_VAR_RQCMDARG,783 PLUGIN_VAR_RQCMDARG,
784 "Helps in performance tuning in heavily concurrent environments.",784 "Helps in performance tuning in heavily concurrent environments.",
785@@ -12019,6 +12039,8 @@785@@ -12027,6 +12047,8 @@
786 MYSQL_SYSVAR(autoextend_increment),786 MYSQL_SYSVAR(autoextend_increment),
787 MYSQL_SYSVAR(buffer_pool_size),787 MYSQL_SYSVAR(buffer_pool_size),
788 MYSQL_SYSVAR(buffer_pool_instances),788 MYSQL_SYSVAR(buffer_pool_instances),
@@ -802,7 +802,7 @@
802 802
803 /** @name Modes for buf_page_get_gen */803 /** @name Modes for buf_page_get_gen */
804 /* @{ */804 /* @{ */
805@@ -1594,9 +1595,12 @@805@@ -1593,9 +1594,12 @@
806 /**********************************************************************//**806 /**********************************************************************//**
807 Compute the hash fold value for blocks in buf_pool->zip_hash. */807 Compute the hash fold value for blocks in buf_pool->zip_hash. */
808 /* @{ */808 /* @{ */
@@ -950,7 +950,7 @@
950diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h950diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
951--- a/storage/innobase/include/srv0srv.h 2011-04-09 18:48:45.000000000 +0400951--- a/storage/innobase/include/srv0srv.h 2011-04-09 18:48:45.000000000 +0400
952+++ b/storage/innobase/include/srv0srv.h 2011-04-09 18:48:48.000000000 +0400952+++ b/storage/innobase/include/srv0srv.h 2011-04-09 18:48:48.000000000 +0400
953@@ -171,6 +171,10 @@953@@ -168,6 +168,10 @@
954 extern ulint srv_mem_pool_size;954 extern ulint srv_mem_pool_size;
955 extern ulint srv_lock_table_size;955 extern ulint srv_lock_table_size;
956 956
@@ -1204,7 +1204,7 @@
1204diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c1204diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
1205--- a/storage/innobase/srv/srv0srv.c 2011-04-09 18:48:46.000000000 +04001205--- a/storage/innobase/srv/srv0srv.c 2011-04-09 18:48:46.000000000 +0400
1206+++ b/storage/innobase/srv/srv0srv.c 2011-04-09 18:48:48.000000000 +04001206+++ b/storage/innobase/srv/srv0srv.c 2011-04-09 18:48:48.000000000 +0400
1207@@ -234,6 +234,11 @@1207@@ -228,6 +228,11 @@
1208 UNIV_INTERN ulint srv_mem_pool_size = ULINT_MAX;1208 UNIV_INTERN ulint srv_mem_pool_size = ULINT_MAX;
1209 UNIV_INTERN ulint srv_lock_table_size = ULINT_MAX;1209 UNIV_INTERN ulint srv_lock_table_size = ULINT_MAX;
1210 1210
12111211
=== modified file 'innodb_deadlock_count.patch'
--- innodb_deadlock_count.patch 2011-05-10 11:57:42 +0000
+++ innodb_deadlock_count.patch 2011-06-20 09:04:39 +0000
@@ -31,7 +31,7 @@
31diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h31diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
32--- a/storage/innobase/include/srv0srv.h 2010-12-04 15:55:21.378480843 +090032--- a/storage/innobase/include/srv0srv.h 2010-12-04 15:55:21.378480843 +0900
33+++ b/storage/innobase/include/srv0srv.h 2010-12-04 16:10:24.606550983 +090033+++ b/storage/innobase/include/srv0srv.h 2010-12-04 16:10:24.606550983 +0900
34@@ -761,6 +761,7 @@34@@ -758,6 +758,7 @@
35 ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/35 ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
36 ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */36 ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
37 ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */37 ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
@@ -53,7 +53,7 @@
53diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c53diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
54--- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:57:13.069513371 +090054--- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:57:13.069513371 +0900
55+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 16:10:24.610593039 +090055+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 16:10:24.610593039 +0900
56@@ -474,6 +474,7 @@56@@ -468,6 +468,7 @@
57 static ulint srv_n_rows_deleted_old = 0;57 static ulint srv_n_rows_deleted_old = 0;
58 static ulint srv_n_rows_read_old = 0;58 static ulint srv_n_rows_read_old = 0;
59 59
@@ -61,7 +61,7 @@
61 UNIV_INTERN ulint srv_n_lock_wait_count = 0;61 UNIV_INTERN ulint srv_n_lock_wait_count = 0;
62 UNIV_INTERN ulint srv_n_lock_wait_current_count = 0;62 UNIV_INTERN ulint srv_n_lock_wait_current_count = 0;
63 UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0;63 UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0;
64@@ -2272,6 +2273,7 @@64@@ -2282,6 +2283,7 @@
65 export_vars.innodb_buffer_pool_pages_data = LRU_len;65 export_vars.innodb_buffer_pool_pages_data = LRU_len;
66 export_vars.innodb_buffer_pool_pages_dirty = flush_list_len;66 export_vars.innodb_buffer_pool_pages_dirty = flush_list_len;
67 export_vars.innodb_buffer_pool_pages_free = free_len;67 export_vars.innodb_buffer_pool_pages_free = free_len;
6868
=== modified file 'innodb_dict_size_limit.patch'
--- innodb_dict_size_limit.patch 2011-05-10 11:57:42 +0000
+++ innodb_dict_size_limit.patch 2011-06-20 09:04:39 +0000
@@ -277,7 +277,7 @@
277diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c277diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
278--- a/storage/innobase/dict/dict0dict.c 2010-11-03 07:01:13.000000000 +0900278--- a/storage/innobase/dict/dict0dict.c 2010-11-03 07:01:13.000000000 +0900
279+++ b/storage/innobase/dict/dict0dict.c 2010-12-03 15:45:47.525953769 +0900279+++ b/storage/innobase/dict/dict0dict.c 2010-12-03 15:45:47.525953769 +0900
280@@ -627,6 +627,8 @@280@@ -626,6 +626,8 @@
281 281
282 table = dict_table_get_on_id_low(table_id);282 table = dict_table_get_on_id_low(table_id);
283 283
@@ -286,7 +286,7 @@
286 mutex_exit(&(dict_sys->mutex));286 mutex_exit(&(dict_sys->mutex));
287 287
288 return(table);288 return(table);
289@@ -745,6 +747,8 @@289@@ -744,6 +746,8 @@
290 table->n_mysql_handles_opened++;290 table->n_mysql_handles_opened++;
291 }291 }
292 292
@@ -295,7 +295,7 @@
295 mutex_exit(&(dict_sys->mutex));295 mutex_exit(&(dict_sys->mutex));
296 296
297 if (table != NULL) {297 if (table != NULL) {
298@@ -1260,6 +1264,64 @@298@@ -1259,6 +1263,64 @@
299 dict_mem_table_free(table);299 dict_mem_table_free(table);
300 }300 }
301 301
@@ -360,7 +360,7 @@
360 /****************************************************************//**360 /****************************************************************//**
361 If the given column name is reserved for InnoDB system columns, return361 If the given column name is reserved for InnoDB system columns, return
362 TRUE.362 TRUE.
363@@ -1729,6 +1791,11 @@363@@ -1728,6 +1790,11 @@
364 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);364 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
365 ut_ad(mutex_own(&(dict_sys->mutex)));365 ut_ad(mutex_own(&(dict_sys->mutex)));
366 366
@@ -384,7 +384,7 @@
384 {"have_atomic_builtins",384 {"have_atomic_builtins",
385 (char*) &export_vars.innodb_have_atomic_builtins, SHOW_BOOL},385 (char*) &export_vars.innodb_have_atomic_builtins, SHOW_BOOL},
386 {"log_waits",386 {"log_waits",
387@@ -11635,6 +11637,11 @@387@@ -11642,6 +11644,11 @@
388 "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",388 "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
389 NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);389 NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
390 390
@@ -396,7 +396,7 @@
396 static struct st_mysql_sys_var* innobase_system_variables[]= {396 static struct st_mysql_sys_var* innobase_system_variables[]= {
397 MYSQL_SYSVAR(additional_mem_pool_size),397 MYSQL_SYSVAR(additional_mem_pool_size),
398 MYSQL_SYSVAR(autoextend_increment),398 MYSQL_SYSVAR(autoextend_increment),
399@@ -11702,6 +11709,7 @@399@@ -11709,6 +11716,7 @@
400 MYSQL_SYSVAR(flush_neighbor_pages),400 MYSQL_SYSVAR(flush_neighbor_pages),
401 MYSQL_SYSVAR(read_ahead),401 MYSQL_SYSVAR(read_ahead),
402 MYSQL_SYSVAR(adaptive_flushing_method),402 MYSQL_SYSVAR(adaptive_flushing_method),
@@ -500,7 +500,7 @@
500diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h500diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
501--- a/storage/innobase/include/srv0srv.h 2010-12-03 15:43:57.297067100 +0900501--- a/storage/innobase/include/srv0srv.h 2010-12-03 15:43:57.297067100 +0900
502+++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:45:47.562024404 +0900502+++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:45:47.562024404 +0900
503@@ -232,6 +232,7 @@503@@ -229,6 +229,7 @@
504 extern ulint srv_read_ahead;504 extern ulint srv_read_ahead;
505 extern ulint srv_adaptive_flushing_method;505 extern ulint srv_adaptive_flushing_method;
506 506
@@ -508,7 +508,7 @@
508 /*-------------------------------------------*/508 /*-------------------------------------------*/
509 509
510 extern ulint srv_n_rows_inserted;510 extern ulint srv_n_rows_inserted;
511@@ -712,6 +713,7 @@511@@ -709,6 +710,7 @@
512 ulint innodb_data_writes; /*!< I/O write requests */512 ulint innodb_data_writes; /*!< I/O write requests */
513 ulint innodb_data_written; /*!< Data bytes written */513 ulint innodb_data_written; /*!< Data bytes written */
514 ulint innodb_data_reads; /*!< I/O read requests */514 ulint innodb_data_reads; /*!< I/O read requests */
@@ -519,7 +519,7 @@
519diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c519diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
520--- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:43:57.301024390 +0900520--- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:43:57.301024390 +0900
521+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:45:47.565023830 +0900521+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:45:47.565023830 +0900
522@@ -421,6 +421,8 @@522@@ -415,6 +415,8 @@
523 UNIV_INTERN ulint srv_enable_unsafe_group_commit = 0; /* 0:disable 1:enable */523 UNIV_INTERN ulint srv_enable_unsafe_group_commit = 0; /* 0:disable 1:enable */
524 UNIV_INTERN ulint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */524 UNIV_INTERN ulint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */
525 UNIV_INTERN ulint srv_adaptive_flushing_method = 0; /* 0: native 1: estimate 2: keep_average */525 UNIV_INTERN ulint srv_adaptive_flushing_method = 0; /* 0: native 1: estimate 2: keep_average */
@@ -528,7 +528,7 @@
528 /*-------------------------------------------*/528 /*-------------------------------------------*/
529 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;529 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
530 UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;530 UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
531@@ -2211,6 +2213,7 @@531@@ -2220,6 +2222,7 @@
532 export_vars.innodb_data_reads = os_n_file_reads;532 export_vars.innodb_data_reads = os_n_file_reads;
533 export_vars.innodb_data_writes = os_n_file_writes;533 export_vars.innodb_data_writes = os_n_file_writes;
534 export_vars.innodb_data_written = srv_data_written;534 export_vars.innodb_data_written = srv_data_written;
535535
=== modified file 'innodb_expand_import.patch'
--- innodb_expand_import.patch 2011-05-10 11:57:42 +0000
+++ innodb_expand_import.patch 2011-06-20 09:04:39 +0000
@@ -5,10 +5,40 @@
5#!!! notice !!!5#!!! notice !!!
6# Any small change to this file in the main branch6# Any small change to this file in the main branch
7# should be done or reviewed by the maintainer!7# should be done or reviewed by the maintainer!
8diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
9--- a/storage/innobase/btr/btr0btr.c 2011-04-11 19:44:03.000000000 +0900
10+++ b/storage/innobase/btr/btr0btr.c 2011-05-24 20:30:12.455852287 +0900
11@@ -837,7 +837,7 @@
12 /**************************************************************//**
13 Creates a new index page (not the root, and also not
14 used in page reorganization). @see btr_page_empty(). */
15-static
16+UNIV_INTERN
17 void
18 btr_page_create(
19 /*============*/
20@@ -1707,7 +1707,7 @@
21 #ifndef UNIV_HOTBACKUP
22 /*************************************************************//**
23 Empties an index page. @see btr_page_create(). */
24-static
25+UNIV_INTERN
26 void
27 btr_page_empty(
28 /*===========*/
29@@ -2269,7 +2269,7 @@
30 /**************************************************************//**
31 Attaches the halves of an index page on the appropriate level in an
32 index tree. */
33-static
34+UNIV_INTERN
35 void
36 btr_attach_half_pages(
37 /*==================*/
8diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c38diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
9--- a/storage/innobase/fil/fil0fil.c 2010-12-03 15:09:51.274957577 +090039--- a/storage/innobase/fil/fil0fil.c 2010-12-03 15:09:51.274957577 +0900
10+++ b/storage/innobase/fil/fil0fil.c 2010-12-03 15:52:23.553986552 +090040+++ b/storage/innobase/fil/fil0fil.c 2010-12-03 15:52:23.553986552 +0900
11@@ -40,6 +40,12 @@41@@ -40,6 +40,14 @@
12 #include "dict0dict.h"42 #include "dict0dict.h"
13 #include "page0page.h"43 #include "page0page.h"
14 #include "page0zip.h"44 #include "page0zip.h"
@@ -18,10 +48,97 @@
18+#include "row0mysql.h"48+#include "row0mysql.h"
19+#include "row0row.h"49+#include "row0row.h"
20+#include "que0que.h"50+#include "que0que.h"
51+#include "btr0btr.h"
52+#include "btr0sea.h"
21 #ifndef UNIV_HOTBACKUP53 #ifndef UNIV_HOTBACKUP
22 # include "buf0lru.h"54 # include "buf0lru.h"
23 # include "ibuf0ibuf.h"55 # include "ibuf0ibuf.h"
24@@ -3078,7 +3084,7 @@56@@ -3032,6 +3040,84 @@
57 }
58
59 /********************************************************************//**
60+Checks if a page is corrupt. (for offline page)
61+*/
62+static
63+ibool
64+fil_page_buf_page_is_corrupted_offline(
65+/*===================================*/
66+ const byte* page, /*!< in: a database page */
67+ ulint zip_size) /*!< in: size of compressed page;
68+ 0 for uncompressed pages */
69+{
70+ ulint checksum_field;
71+ ulint old_checksum_field;
72+
73+ if (!zip_size
74+ && memcmp(page + FIL_PAGE_LSN + 4,
75+ page + UNIV_PAGE_SIZE
76+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)) {
77+ return(TRUE);
78+ }
79+
80+ checksum_field = mach_read_from_4(page
81+ + FIL_PAGE_SPACE_OR_CHKSUM);
82+
83+ if (zip_size) {
84+ return(checksum_field != BUF_NO_CHECKSUM_MAGIC
85+ && checksum_field
86+ != page_zip_calc_checksum(page, zip_size));
87+ }
88+
89+ old_checksum_field = mach_read_from_4(
90+ page + UNIV_PAGE_SIZE
91+ - FIL_PAGE_END_LSN_OLD_CHKSUM);
92+
93+ if (old_checksum_field != mach_read_from_4(page
94+ + FIL_PAGE_LSN)
95+ && old_checksum_field != BUF_NO_CHECKSUM_MAGIC
96+ && old_checksum_field
97+ != buf_calc_page_old_checksum(page)) {
98+ return(TRUE);
99+ }
100+
101+ if (checksum_field != 0
102+ && checksum_field != BUF_NO_CHECKSUM_MAGIC
103+ && checksum_field
104+ != buf_calc_page_new_checksum(page)) {
105+ return(TRUE);
106+ }
107+
108+ return(FALSE);
109+}
110+
111+/********************************************************************//**
112+*/
113+static
114+void
115+fil_page_buf_page_store_checksum(
116+/*=============================*/
117+ byte* page,
118+ ulint zip_size)
119+{
120+ if (!zip_size) {
121+ mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
122+ srv_use_checksums
123+ ? buf_calc_page_new_checksum(page)
124+ : BUF_NO_CHECKSUM_MAGIC);
125+ mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
126+ srv_use_checksums
127+ ? buf_calc_page_old_checksum(page)
128+ : BUF_NO_CHECKSUM_MAGIC);
129+ } else {
130+ mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
131+ srv_use_checksums
132+ ? page_zip_calc_checksum(page, zip_size)
133+ : BUF_NO_CHECKSUM_MAGIC);
134+ }
135+}
136+
137+/********************************************************************//**
138 Tries to open a single-table tablespace and optionally checks the space id is
139 right in it. If does not succeed, prints an error message to the .err log. This
140 function is used to open a tablespace when we start up mysqld, and also in
141@@ -3078,7 +3164,7 @@
25 142
26 file = os_file_create_simple_no_error_handling(143 file = os_file_create_simple_no_error_handling(
27 innodb_file_data_key, filepath, OS_FILE_OPEN,144 innodb_file_data_key, filepath, OS_FILE_OPEN,
@@ -30,7 +147,7 @@
30 if (!success) {147 if (!success) {
31 /* The following call prints an error message */148 /* The following call prints an error message */
32 os_file_get_last_error(TRUE);149 os_file_get_last_error(TRUE);
33@@ -3125,6 +3131,466 @@150@@ -3125,6 +3211,445 @@
34 space_id = fsp_header_get_space_id(page);151 space_id = fsp_header_get_space_id(page);
35 space_flags = fsp_header_get_flags(page);152 space_flags = fsp_header_get_flags(page);
36 153
@@ -56,6 +173,7 @@
56+ fil_system_t* system;173+ fil_system_t* system;
57+ fil_node_t* node = NULL;174+ fil_node_t* node = NULL;
58+ fil_space_t* space;175+ fil_space_t* space;
176+ ulint zip_size;
59+177+
60+ buf3 = ut_malloc(2 * UNIV_PAGE_SIZE);178+ buf3 = ut_malloc(2 * UNIV_PAGE_SIZE);
61+ descr_page = ut_align(buf3, UNIV_PAGE_SIZE);179+ descr_page = ut_align(buf3, UNIV_PAGE_SIZE);
@@ -73,12 +191,15 @@
73+ /* store as first descr page */191+ /* store as first descr page */
74+ memcpy(descr_page, page, UNIV_PAGE_SIZE);192+ memcpy(descr_page, page, UNIV_PAGE_SIZE);
75+193+
194+ zip_size = dict_table_flags_to_zip_size(flags);
195+ ut_a(zip_size == dict_table_flags_to_zip_size(space_flags));
196+
76+ /* get free limit (page number) of the table space */197+ /* get free limit (page number) of the table space */
77+/* these should be same to the definition in fsp0fsp.c */198+/* these should be same to the definition in fsp0fsp.c */
78+#define FSP_HEADER_OFFSET FIL_PAGE_DATA199+#define FSP_HEADER_OFFSET FIL_PAGE_DATA
79+#define FSP_FREE_LIMIT 12200+#define FSP_FREE_LIMIT 12
80+ free_limit = mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT + page);201+ free_limit = mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT + page);
81+ free_limit_bytes = (ib_int64_t)free_limit * (ib_int64_t)UNIV_PAGE_SIZE;202+ free_limit_bytes = (ib_int64_t)free_limit * (ib_int64_t)(zip_size ? zip_size : UNIV_PAGE_SIZE);
82+203+
83+ /* overwrite fsp header */204+ /* overwrite fsp header */
84+ fsp_header_init_fields(page, id, flags);205+ fsp_header_init_fields(page, id, flags);
@@ -87,14 +208,9 @@
87+ space_flags = flags;208+ space_flags = flags;
88+ if (mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN) > current_lsn)209+ if (mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN) > current_lsn)
89+ mach_write_to_8(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);210+ mach_write_to_8(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
90+ mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,211+
91+ srv_use_checksums212+ fil_page_buf_page_store_checksum(page, zip_size);
92+ ? buf_calc_page_new_checksum(page)213+
93+ : BUF_NO_CHECKSUM_MAGIC);
94+ mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
95+ srv_use_checksums
96+ ? buf_calc_page_old_checksum(page)
97+ : BUF_NO_CHECKSUM_MAGIC);
98+ success = os_file_write(filepath, file, page, 0, 0, UNIV_PAGE_SIZE);214+ success = os_file_write(filepath, file, page, 0, 0, UNIV_PAGE_SIZE);
99+215+
100+ /* get file size */216+ /* get file size */
@@ -104,7 +220,7 @@
104+220+
105+ if (size_bytes < free_limit_bytes) {221+ if (size_bytes < free_limit_bytes) {
106+ free_limit_bytes = size_bytes;222+ free_limit_bytes = size_bytes;
107+ if (size_bytes >= FSP_EXTENT_SIZE * UNIV_PAGE_SIZE) {223+ if (size_bytes >= (lint)FSP_EXTENT_SIZE * (lint)(zip_size ? zip_size : UNIV_PAGE_SIZE)) {
108+ fprintf(stderr, "InnoDB: free limit of %s is larger than its real size.\n", filepath);224+ fprintf(stderr, "InnoDB: free limit of %s is larger than its real size.\n", filepath);
109+ file_is_corrupt = TRUE;225+ file_is_corrupt = TRUE;
110+ }226+ }
@@ -168,63 +284,41 @@
168+ size_bytes = ut_2pow_round(size_bytes, 1024 * 1024);284+ size_bytes = ut_2pow_round(size_bytes, 1024 * 1024);
169+ }285+ }
170+ */286+ */
171+ if (!(flags & DICT_TF_ZSSIZE_MASK)) {287+
288+ if (zip_size) {
289+ fprintf(stderr, "InnoDB: Warning: importing compressed table is still EXPERIMENTAL, currently.\n");
290+ }
291+
292+ {
172+ mem_heap_t* heap = NULL;293+ mem_heap_t* heap = NULL;
173+ ulint offsets_[REC_OFFS_NORMAL_SIZE];294+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
174+ ulint* offsets = offsets_;295+ ulint* offsets = offsets_;
175+ ib_int64_t offset;296+ ib_int64_t offset;
176+297+
177+ size = (ulint) (size_bytes / UNIV_PAGE_SIZE);298+ size = (ulint) (size_bytes / (zip_size ? zip_size : UNIV_PAGE_SIZE));
178+ /* over write space id of all pages */299+ /* over write space id of all pages */
179+ rec_offs_init(offsets_);300+ rec_offs_init(offsets_);
180+301+
181+ fprintf(stderr, "InnoDB: Progress in %%:");302+ fprintf(stderr, "InnoDB: Progress in %%:");
182+303+
183+ for (offset = 0; offset < free_limit_bytes; offset += UNIV_PAGE_SIZE) {304+ for (offset = 0; offset < free_limit_bytes;
184+ ulint checksum_field;305+ offset += zip_size ? zip_size : UNIV_PAGE_SIZE) {
185+ ulint old_checksum_field;
186+ ibool page_is_corrupt;306+ ibool page_is_corrupt;
187+307+
188+ success = os_file_read(file, page,308+ success = os_file_read(file, page,
189+ (ulint)(offset & 0xFFFFFFFFUL),309+ (ulint)(offset & 0xFFFFFFFFUL),
190+ (ulint)(offset >> 32), UNIV_PAGE_SIZE);310+ (ulint)(offset >> 32),
311+ zip_size ? zip_size : UNIV_PAGE_SIZE);
191+312+
192+ page_is_corrupt = FALSE;313+ page_is_corrupt = FALSE;
193+314+
194+ /* check consistency */315+ /* check consistency */
195+ if (memcmp(page + FIL_PAGE_LSN + 4,316+ if (fil_page_buf_page_is_corrupted_offline(page, zip_size)) {
196+ page + UNIV_PAGE_SIZE
197+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4, 4)) {
198+
199+ page_is_corrupt = TRUE;317+ page_is_corrupt = TRUE;
200+ }318+ }
201+319+
202+ if (mach_read_from_4(page + FIL_PAGE_OFFSET)320+ if (mach_read_from_4(page + FIL_PAGE_OFFSET)
203+ != offset / UNIV_PAGE_SIZE) {321+ != offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)) {
204+
205+ page_is_corrupt = TRUE;
206+ }
207+
208+ checksum_field = mach_read_from_4(page
209+ + FIL_PAGE_SPACE_OR_CHKSUM);
210+
211+ old_checksum_field = mach_read_from_4(
212+ page + UNIV_PAGE_SIZE
213+ - FIL_PAGE_END_LSN_OLD_CHKSUM);
214+
215+ if (old_checksum_field != mach_read_from_4(page
216+ + FIL_PAGE_LSN)
217+ && old_checksum_field != BUF_NO_CHECKSUM_MAGIC
218+ && old_checksum_field
219+ != buf_calc_page_old_checksum(page)) {
220+
221+ page_is_corrupt = TRUE;
222+ }
223+
224+ if (checksum_field != 0
225+ && checksum_field != BUF_NO_CHECKSUM_MAGIC
226+ && checksum_field
227+ != buf_calc_page_new_checksum(page)) {
228+322+
229+ page_is_corrupt = TRUE;323+ page_is_corrupt = TRUE;
230+ }324+ }
@@ -235,7 +329,8 @@
235+ /* it should be overwritten already */329+ /* it should be overwritten already */
236+ ut_a(!page_is_corrupt);330+ ut_a(!page_is_corrupt);
237+331+
238+ } else if (!((offset / UNIV_PAGE_SIZE) % UNIV_PAGE_SIZE)) {332+ } else if (!((offset / (zip_size ? zip_size : UNIV_PAGE_SIZE))
333+ % (zip_size ? zip_size : UNIV_PAGE_SIZE))) {
239+ /* descr page (not header) */334+ /* descr page (not header) */
240+ if (page_is_corrupt) {335+ if (page_is_corrupt) {
241+ file_is_corrupt = TRUE;336+ file_is_corrupt = TRUE;
@@ -246,7 +341,7 @@
246+ }341+ }
247+342+
248+ /* store as descr page */343+ /* store as descr page */
249+ memcpy(descr_page, page, UNIV_PAGE_SIZE);344+ memcpy(descr_page, page, (zip_size ? zip_size : UNIV_PAGE_SIZE));
250+345+
251+ } else if (descr_is_corrupt) {346+ } else if (descr_is_corrupt) {
252+ /* unknown state of the page */347+ /* unknown state of the page */
@@ -274,9 +369,12 @@
274+ ulint bit_index;369+ ulint bit_index;
275+370+
276+ descr = descr_page + XDES_ARR_OFFSET371+ descr = descr_page + XDES_ARR_OFFSET
277+ + XDES_SIZE * (ut_2pow_remainder((offset / UNIV_PAGE_SIZE), UNIV_PAGE_SIZE) / FSP_EXTENT_SIZE);372+ + XDES_SIZE * (ut_2pow_remainder(
373+ (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)),
374+ (zip_size ? zip_size : UNIV_PAGE_SIZE)) / FSP_EXTENT_SIZE);
278+375+
279+ index = XDES_FREE_BIT + XDES_BITS_PER_PAGE * ((offset / UNIV_PAGE_SIZE) % FSP_EXTENT_SIZE);376+ index = XDES_FREE_BIT
377+ + XDES_BITS_PER_PAGE * ((offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)) % FSP_EXTENT_SIZE);
280+ byte_index = index / 8;378+ byte_index = index / 8;
281+ bit_index = index % 8;379+ bit_index = index % 8;
282+380+
@@ -294,7 +392,7 @@
294+ }392+ }
295+393+
296+ if (page_is_corrupt) {394+ if (page_is_corrupt) {
297+ fprintf(stderr, " [errp:%lld]", offset / UNIV_PAGE_SIZE);395+ fprintf(stderr, " [errp:%lld]", offset / (zip_size ? zip_size : UNIV_PAGE_SIZE));
298+396+
299+ /* cannot treat corrupt page */397+ /* cannot treat corrupt page */
300+ goto skip_write;398+ goto skip_write;
@@ -304,7 +402,13 @@
304+ mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);402+ mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
305+403+
306+ for (i = 0; i < n_index; i++) {404+ for (i = 0; i < n_index; i++) {
307+ if (offset / UNIV_PAGE_SIZE == root_page[i]) {405+ if (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE) == root_page[i]) {
406+ if (fil_page_get_type(page) != FIL_PAGE_INDEX) {
407+ file_is_corrupt = TRUE;
408+ fprintf(stderr, " [etyp:%lld]",
409+ offset / (zip_size ? zip_size : UNIV_PAGE_SIZE));
410+ goto skip_write;
411+ }
308+ /* this is index root page */412+ /* this is index root page */
309+ mach_write_to_4(page + FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF413+ mach_write_to_4(page + FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
310+ + FSEG_HDR_SPACE, id);414+ + FSEG_HDR_SPACE, id);
@@ -317,7 +421,14 @@
317+ if (fil_page_get_type(page) == FIL_PAGE_INDEX) {421+ if (fil_page_get_type(page) == FIL_PAGE_INDEX) {
318+ index_id_t tmp = mach_read_from_8(page + (PAGE_HEADER + PAGE_INDEX_ID));422+ index_id_t tmp = mach_read_from_8(page + (PAGE_HEADER + PAGE_INDEX_ID));
319+423+
320+ if (mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL) == 0424+ for (i = 0; i < n_index; i++) {
425+ if (old_id[i] == tmp) {
426+ mach_write_to_8(page + (PAGE_HEADER + PAGE_INDEX_ID), new_id[i]);
427+ break;
428+ }
429+ }
430+
431+ if (!zip_size && mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL) == 0
321+ && old_id[0] == tmp) {432+ && old_id[0] == tmp) {
322+ /* leaf page of cluster index, reset trx_id of records */433+ /* leaf page of cluster index, reset trx_id of records */
323+ rec_t* rec;434+ rec_t* rec;
@@ -356,42 +467,34 @@
356+ rec = page_rec_get_next(rec);467+ rec = page_rec_get_next(rec);
357+ n_recs--;468+ n_recs--;
358+ }469+ }
359+ }470+ } else if (mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL) == 0
360+471+ && old_id[0] != tmp) {
361+ for (i = 0; i < n_index; i++) {472+ mach_write_to_8(page + (PAGE_HEADER + PAGE_MAX_TRX_ID), 1);
362+ if (old_id[i] == tmp) {
363+ mach_write_to_8(page + (PAGE_HEADER + PAGE_INDEX_ID), new_id[i]);
364+ break;
365+ }
366+ }473+ }
367+ }474+ }
368+475+
369+ if (mach_read_from_8(page + FIL_PAGE_LSN) > current_lsn) {476+ if (mach_read_from_8(page + FIL_PAGE_LSN) > current_lsn) {
370+ mach_write_to_8(page + FIL_PAGE_LSN, current_lsn);477+ mach_write_to_8(page + FIL_PAGE_LSN, current_lsn);
371+ mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,478+ if (!zip_size) {
372+ current_lsn);479+ mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
480+ current_lsn);
481+ }
373+ }482+ }
374+483+
375+ mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,484+ fil_page_buf_page_store_checksum(page, zip_size);
376+ srv_use_checksums
377+ ? buf_calc_page_new_checksum(page)
378+ : BUF_NO_CHECKSUM_MAGIC);
379+ mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
380+ srv_use_checksums
381+ ? buf_calc_page_old_checksum(page)
382+ : BUF_NO_CHECKSUM_MAGIC);
383+485+
384+ success = os_file_write(filepath, file, page,486+ success = os_file_write(filepath, file, page,
385+ (ulint)(offset & 0xFFFFFFFFUL),487+ (ulint)(offset & 0xFFFFFFFFUL),
386+ (ulint)(offset >> 32), UNIV_PAGE_SIZE);488+ (ulint)(offset >> 32),
489+ zip_size ? zip_size : UNIV_PAGE_SIZE);
387+ }490+ }
388+491+
389+skip_write:492+skip_write:
390+ if (free_limit_bytes493+ if (free_limit_bytes
391+ && ((ib_int64_t)((offset + UNIV_PAGE_SIZE) * 100) / free_limit_bytes)494+ && ((ib_int64_t)((offset + (zip_size ? zip_size : UNIV_PAGE_SIZE)) * 100) / free_limit_bytes)
392+ != ((offset * 100) / free_limit_bytes)) {495+ != ((offset * 100) / free_limit_bytes)) {
393+ fprintf(stderr, " %lu",496+ fprintf(stderr, " %lu",
394+ (ulong)((ib_int64_t)((offset + UNIV_PAGE_SIZE) * 100) / free_limit_bytes));497+ (ulong)((ib_int64_t)((offset + (zip_size ? zip_size : UNIV_PAGE_SIZE)) * 100) / free_limit_bytes));
395+ }498+ }
396+ }499+ }
397+500+
@@ -447,13 +550,6 @@
447+ if (UNIV_LIKELY_NULL(heap)) {550+ if (UNIV_LIKELY_NULL(heap)) {
448+ mem_heap_free(heap);551+ mem_heap_free(heap);
449+ }552+ }
450+ } else {
451+ /* zip page? */
452+ size = (ulint)
453+ (size_bytes
454+ / dict_table_flags_to_zip_size(flags));
455+ fprintf(stderr, "InnoDB: Import: The table %s seems to be in a newer format."
456+ " It may not be possible to process it.\n", name);
457+ }553+ }
458+ /* .exp file should be removed */554+ /* .exp file should be removed */
459+ success = os_file_delete(info_file_path);555+ success = os_file_delete(info_file_path);
@@ -497,10 +593,282 @@
497 ut_free(buf2);593 ut_free(buf2);
498 594
499 if (UNIV_UNLIKELY(space_id != id595 if (UNIV_UNLIKELY(space_id != id
596@@ -3166,6 +3691,271 @@
597 os_file_close(file);
598 mem_free(filepath);
599
600+ if (srv_expand_import && dict_table_flags_to_zip_size(flags)) {
601+ ulint page_no;
602+ ulint zip_size;
603+ ulint height;
604+ ulint root_height = 0;
605+ rec_t* node_ptr;
606+ dict_table_t* table;
607+ dict_index_t* index;
608+ buf_block_t* block;
609+ page_t* page;
610+ page_zip_des_t* page_zip;
611+ mtr_t mtr;
612+
613+ mem_heap_t* heap = NULL;
614+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
615+ ulint* offsets = offsets_;
616+
617+ rec_offs_init(offsets_);
618+
619+ zip_size = dict_table_flags_to_zip_size(flags);
620+
621+ table = dict_table_get_low(name);
622+ index = dict_table_get_first_index(table);
623+ page_no = dict_index_get_page(index);
624+ ut_a(page_no == 3);
625+
626+ fprintf(stderr, "InnoDB: It is compressed .ibd file. need to convert additionaly on buffer pool.\n");
627+
628+ /* down to leaf */
629+ mtr_start(&mtr);
630+ mtr_set_log_mode(&mtr, MTR_LOG_NONE);
631+
632+ height = ULINT_UNDEFINED;
633+
634+ for (;;) {
635+ block = buf_page_get(space_id, zip_size, page_no,
636+ RW_NO_LATCH, &mtr);
637+ page = buf_block_get_frame(block);
638+
639+ block->check_index_page_at_flush = TRUE;
640+
641+ if (height == ULINT_UNDEFINED) {
642+ height = btr_page_get_level(page, &mtr);
643+ root_height = height;
644+ }
645+
646+ if (height == 0) {
647+ break;
648+ }
649+
650+ node_ptr = page_rec_get_next(page_get_infimum_rec(page));
651+
652+ height--;
653+
654+ offsets = rec_get_offsets(node_ptr, index, offsets, ULINT_UNDEFINED, &heap);
655+ page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
656+ }
657+
658+ mtr_commit(&mtr);
659+
660+ fprintf(stderr, "InnoDB: pages needs split are ...");
661+
662+ /* scan reaf pages */
663+ while (page_no != FIL_NULL) {
664+ rec_t* rec;
665+ rec_t* supremum;
666+ ulint n_recs;
667+
668+ mtr_start(&mtr);
669+
670+ block = buf_page_get(space_id, zip_size, page_no,
671+ RW_X_LATCH, &mtr);
672+ page = buf_block_get_frame(block);
673+ page_zip = buf_block_get_page_zip(block);
674+
675+ if (!page_zip) {
676+ /*something wrong*/
677+ fprintf(stderr, "InnoDB: Something wrong with reading page %lu.\n", page_no);
678+convert_err_exit:
679+ mtr_commit(&mtr);
680+ mutex_enter(&fil_system->mutex);
681+ fil_space_free(space_id, FALSE);
682+ mutex_exit(&fil_system->mutex);
683+ success = FALSE;
684+ goto convert_exit;
685+ }
686+
687+ supremum = page_get_supremum_rec(page);
688+ rec = page_rec_get_next(page_get_infimum_rec(page));
689+ n_recs = page_get_n_recs(page);
690+
691+ /* illegal operation as InnoDB online system. so not logged */
692+ while (rec && rec != supremum && n_recs > 0) {
693+ ulint n_fields;
694+ ulint i;
695+ ulint offset = index->trx_id_offset;
696+
697+ offsets = rec_get_offsets(rec, index, offsets,
698+ ULINT_UNDEFINED, &heap);
699+ n_fields = rec_offs_n_fields(offsets);
700+ if (!offset) {
701+ offset = row_get_trx_id_offset(rec, index, offsets);
702+ }
703+ trx_write_trx_id(rec + offset, 1);
704+
705+ for (i = 0; i < n_fields; i++) {
706+ if (rec_offs_nth_extern(offsets, i)) {
707+ ulint local_len;
708+ byte* data;
709+
710+ data = rec_get_nth_field(rec, offsets, i, &local_len);
711+
712+ local_len -= BTR_EXTERN_FIELD_REF_SIZE;
713+
714+ mach_write_to_4(data + local_len + BTR_EXTERN_SPACE_ID, id);
715+ }
716+ }
717+
718+ rec = page_rec_get_next(rec);
719+ n_recs--;
720+ }
721+
722+ /* dummy logged update for along with modified page path */
723+ if (index->id != btr_page_get_index_id(page)) {
724+ /* this should be adjusted already */
725+ fprintf(stderr, "InnoDB: The page %lu seems to be converted wrong.\n", page_no);
726+ goto convert_err_exit;
727+ }
728+ btr_page_set_index_id(page, page_zip, index->id, &mtr);
729+
730+ /* confirm whether fits to the page size or not */
731+ if (!page_zip_compress(page_zip, page, index, &mtr)
732+ && !btr_page_reorganize(block, index, &mtr)) {
733+ buf_block_t* new_block;
734+ page_t* new_page;
735+ page_zip_des_t* new_page_zip;
736+ rec_t* split_rec;
737+ ulint n_uniq;
738+
739+ /* split page is needed */
740+ fprintf(stderr, " %lu", page_no);
741+
742+ mtr_x_lock(dict_index_get_lock(index), &mtr);
743+
744+ n_uniq = dict_index_get_n_unique_in_tree(index);
745+
746+ if(page_get_n_recs(page) < 2) {
747+ /* no way to make smaller */
748+ fprintf(stderr, "InnoDB: The page %lu cannot be store to the page size.\n", page_no);
749+ goto convert_err_exit;
750+ }
751+
752+ if (UNIV_UNLIKELY(page_no == dict_index_get_page(index))) {
753+ ulint new_page_no;
754+ dtuple_t* node_ptr;
755+ ulint level;
756+ rec_t* node_ptr_rec;
757+ page_cur_t page_cursor;
758+
759+ /* it is root page, need to raise before split */
760+
761+ level = btr_page_get_level(page, &mtr);
762+
763+ new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, &mtr);
764+ new_page = buf_block_get_frame(new_block);
765+ new_page_zip = buf_block_get_page_zip(new_block);
766+ btr_page_create(new_block, new_page_zip, index, level, &mtr);
767+
768+ btr_page_set_next(new_page, new_page_zip, FIL_NULL, &mtr);
769+ btr_page_set_prev(new_page, new_page_zip, FIL_NULL, &mtr);
770+
771+ page_zip_copy_recs(new_page_zip, new_page,
772+ page_zip, page, index, &mtr);
773+ btr_search_move_or_delete_hash_entries(new_block, block, index);
774+
775+ rec = page_rec_get_next(page_get_infimum_rec(new_page));
776+ new_page_no = buf_block_get_page_no(new_block);
777+
778+ node_ptr = dict_index_build_node_ptr(index, rec, new_page_no, heap,
779+ level);
780+ dtuple_set_info_bits(node_ptr,
781+ dtuple_get_info_bits(node_ptr)
782+ | REC_INFO_MIN_REC_FLAG);
783+ btr_page_empty(block, page_zip, index, level + 1, &mtr);
784+
785+ btr_page_set_next(page, page_zip, FIL_NULL, &mtr);
786+ btr_page_set_prev(page, page_zip, FIL_NULL, &mtr);
787+
788+ page_cur_set_before_first(block, &page_cursor);
789+
790+ node_ptr_rec = page_cur_tuple_insert(&page_cursor, node_ptr,
791+ index, 0, &mtr);
792+ ut_a(node_ptr_rec);
793+
794+ if (!btr_page_reorganize(block, index, &mtr)) {
795+ fprintf(stderr, "InnoDB: failed to store the page %lu.\n", page_no);
796+ goto convert_err_exit;
797+ }
798+
799+ /* move to the raised page */
800+ page_no = new_page_no;
801+ block = new_block;
802+ page = new_page;
803+ page_zip = new_page_zip;
804+
805+ fprintf(stderr, "(raise_to:%lu)", page_no);
806+ }
807+
808+ split_rec = page_get_middle_rec(page);
809+
810+ new_block = btr_page_alloc(index, page_no + 1, FSP_UP,
811+ btr_page_get_level(page, &mtr), &mtr);
812+ new_page = buf_block_get_frame(new_block);
813+ new_page_zip = buf_block_get_page_zip(new_block);
814+ btr_page_create(new_block, new_page_zip, index,
815+ btr_page_get_level(page, &mtr), &mtr);
816+
817+ offsets = rec_get_offsets(split_rec, index, offsets, n_uniq, &heap);
818+
819+ btr_attach_half_pages(index, block,
820+ split_rec, new_block, FSP_UP, &mtr);
821+
822+ page_zip_copy_recs(new_page_zip, new_page,
823+ page_zip, page, index, &mtr);
824+ page_delete_rec_list_start(split_rec - page + new_page,
825+ new_block, index, &mtr);
826+ btr_search_move_or_delete_hash_entries(new_block, block, index);
827+ page_delete_rec_list_end(split_rec, block, index,
828+ ULINT_UNDEFINED, ULINT_UNDEFINED, &mtr);
829+
830+ fprintf(stderr, "(new:%lu)", buf_block_get_page_no(new_block));
831+
832+ /* Are they needed? */
833+ if (!btr_page_reorganize(block, index, &mtr)) {
834+ fprintf(stderr, "InnoDB: failed to store the page %lu.\n", page_no);
835+ goto convert_err_exit;
836+ }
837+ if (!btr_page_reorganize(new_block, index, &mtr)) {
838+ fprintf(stderr, "InnoDB: failed to store the page %lu.\n", buf_block_get_page_no(new_block));
839+ goto convert_err_exit;
840+ }
841+ }
842+
843+ page_no = btr_page_get_next(page, &mtr);
844+
845+ mtr_commit(&mtr);
846+
847+ if (heap) {
848+ mem_heap_empty(heap);
849+ }
850+ }
851+
852+ fprintf(stderr, "...done.\nInnoDB: waiting the flush batch of the additional conversion.\n");
853+
854+ /* should wait for the not-logged changes are all flushed */
855+ buf_flush_list(ULINT_MAX, mtr.end_lsn + 1);
856+ buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
857+
858+ fprintf(stderr, "InnoDB: done.\n");
859+convert_exit:
860+ if (UNIV_LIKELY_NULL(heap)) {
861+ mem_heap_free(heap);
862+ }
863+ }
864+
865 return(success);
866 }
867 #endif /* !UNIV_HOTBACKUP */
500diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc868diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
501--- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:49:59.195023983 +0900869--- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:49:59.195023983 +0900
502+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:52:23.555957062 +0900870+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:52:23.555957062 +0900
503@@ -7368,6 +7368,14 @@871@@ -7377,6 +7377,14 @@
504 err = row_discard_tablespace_for_mysql(dict_table->name, trx);872 err = row_discard_tablespace_for_mysql(dict_table->name, trx);
505 } else {873 } else {
506 err = row_import_tablespace_for_mysql(dict_table->name, trx);874 err = row_import_tablespace_for_mysql(dict_table->name, trx);
@@ -515,7 +883,7 @@
515 }883 }
516 884
517 err = convert_error_code_to_mysql(err, dict_table->flags, NULL);885 err = convert_error_code_to_mysql(err, dict_table->flags, NULL);
518@@ -11642,6 +11650,11 @@886@@ -11649,6 +11657,11 @@
519 "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",887 "Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)",
520 NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);888 NULL, innodb_adaptive_flushing_method_update, 1, &adaptive_flushing_method_typelib);
521 889
@@ -527,7 +895,7 @@
527 static MYSQL_SYSVAR_ULONG(dict_size_limit, srv_dict_size_limit,895 static MYSQL_SYSVAR_ULONG(dict_size_limit, srv_dict_size_limit,
528 PLUGIN_VAR_RQCMDARG,896 PLUGIN_VAR_RQCMDARG,
529 "Limit the allocated memory for dictionary cache. (0: unlimited)",897 "Limit the allocated memory for dictionary cache. (0: unlimited)",
530@@ -11714,6 +11727,7 @@898@@ -11721,6 +11734,7 @@
531 MYSQL_SYSVAR(flush_neighbor_pages),899 MYSQL_SYSVAR(flush_neighbor_pages),
532 MYSQL_SYSVAR(read_ahead),900 MYSQL_SYSVAR(read_ahead),
533 MYSQL_SYSVAR(adaptive_flushing_method),901 MYSQL_SYSVAR(adaptive_flushing_method),
@@ -535,10 +903,125 @@
535 MYSQL_SYSVAR(dict_size_limit),903 MYSQL_SYSVAR(dict_size_limit),
536 MYSQL_SYSVAR(use_sys_malloc),904 MYSQL_SYSVAR(use_sys_malloc),
537 MYSQL_SYSVAR(use_native_aio),905 MYSQL_SYSVAR(use_native_aio),
906diff -ruN a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
907--- a/storage/innobase/include/btr0btr.h 2011-04-11 19:44:03.000000000 +0900
908+++ b/storage/innobase/include/btr0btr.h 2011-05-24 20:30:12.459853343 +0900
909@@ -219,6 +219,17 @@
910 @return the uncompressed page frame */
911 # define btr_page_get(space,zip_size,page_no,mode,mtr) \
912 buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr))
913+/**************************************************************//**
914+Sets the index id field of a page. */
915+UNIV_INLINE
916+void
917+btr_page_set_index_id(
918+/*==================*/
919+ page_t* page, /*!< in: page to be created */
920+ page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
921+ part will be updated, or NULL */
922+ index_id_t id, /*!< in: index id */
923+ mtr_t* mtr); /*!< in: mtr */
924 #endif /* !UNIV_HOTBACKUP */
925 /**************************************************************//**
926 Gets the index id field of a page.
927@@ -256,6 +267,17 @@
928 const page_t* page, /*!< in: index page */
929 mtr_t* mtr); /*!< in: mini-transaction handle */
930 /********************************************************//**
931+Sets the next index page field. */
932+UNIV_INLINE
933+void
934+btr_page_set_next(
935+/*==============*/
936+ page_t* page, /*!< in: index page */
937+ page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
938+ part will be updated, or NULL */
939+ ulint next, /*!< in: next page number */
940+ mtr_t* mtr); /*!< in: mini-transaction handle */
941+/********************************************************//**
942 Gets the previous index page number.
943 @return prev page number */
944 UNIV_INLINE
945@@ -264,6 +286,17 @@
946 /*==============*/
947 const page_t* page, /*!< in: index page */
948 mtr_t* mtr); /*!< in: mini-transaction handle */
949+/********************************************************//**
950+Sets the previous index page field. */
951+UNIV_INLINE
952+void
953+btr_page_set_prev(
954+/*==============*/
955+ page_t* page, /*!< in: index page */
956+ page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
957+ part will be updated, or NULL */
958+ ulint prev, /*!< in: previous page number */
959+ mtr_t* mtr); /*!< in: mini-transaction handle */
960 /*************************************************************//**
961 Gets pointer to the previous user record in the tree. It is assumed
962 that the caller has appropriate latches on the page and its neighbor.
963@@ -309,6 +342,18 @@
964 /*===========================*/
965 const rec_t* rec, /*!< in: node pointer record */
966 const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
967+/**************************************************************//**
968+Creates a new index page (not the root, and also not
969+used in page reorganization). @see btr_page_empty(). */
970+UNIV_INTERN
971+void
972+btr_page_create(
973+/*============*/
974+ buf_block_t* block, /*!< in/out: page to be created */
975+ page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
976+ dict_index_t* index, /*!< in: index */
977+ ulint level, /*!< in: the B-tree level of the page */
978+ mtr_t* mtr); /*!< in: mtr */
979 /************************************************************//**
980 Creates the root node for a new index tree.
981 @return page number of the created root, FIL_NULL if did not succeed */
982@@ -379,6 +424,17 @@
983 dict_index_t* index, /*!< in: record descriptor */
984 mtr_t* mtr); /*!< in: mtr */
985 /*************************************************************//**
986+Empties an index page. @see btr_page_create(). */
987+UNIV_INTERN
988+void
989+btr_page_empty(
990+/*===========*/
991+ buf_block_t* block, /*!< in: page to be emptied */
992+ page_zip_des_t* page_zip,/*!< out: compressed page, or NULL */
993+ dict_index_t* index, /*!< in: index of the page */
994+ ulint level, /*!< in: the B-tree level of the page */
995+ mtr_t* mtr); /*!< in: mtr */
996+/*************************************************************//**
997 Decides if the page should be split at the convergence point of
998 inserts converging to left.
999 @return TRUE if split recommended */
1000@@ -437,6 +493,20 @@
1001 # define btr_insert_on_non_leaf_level(i,l,t,m) \
1002 btr_insert_on_non_leaf_level_func(i,l,t,__FILE__,__LINE__,m)
1003 #endif /* !UNIV_HOTBACKUP */
1004+/**************************************************************//**
1005+Attaches the halves of an index page on the appropriate level in an
1006+index tree. */
1007+UNIV_INTERN
1008+void
1009+btr_attach_half_pages(
1010+/*==================*/
1011+ dict_index_t* index, /*!< in: the index tree */
1012+ buf_block_t* block, /*!< in/out: page to be split */
1013+ rec_t* split_rec, /*!< in: first record on upper
1014+ half page */
1015+ buf_block_t* new_block, /*!< in/out: the new half page */
1016+ ulint direction, /*!< in: FSP_UP or FSP_DOWN */
1017+ mtr_t* mtr); /*!< in: mtr */
1018 /****************************************************************//**
1019 Sets a record as the predefined minimum record. */
1020 UNIV_INTERN
538diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h1021diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
539--- a/storage/innobase/include/srv0srv.h 2010-12-03 15:48:03.077954270 +09001022--- a/storage/innobase/include/srv0srv.h 2010-12-03 15:48:03.077954270 +0900
540+++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:52:23.561986996 +09001023+++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:52:23.561986996 +0900
541@@ -232,6 +232,8 @@1024@@ -229,6 +229,8 @@
542 extern ulint srv_read_ahead;1025 extern ulint srv_read_ahead;
543 extern ulint srv_adaptive_flushing_method;1026 extern ulint srv_adaptive_flushing_method;
544 1027
@@ -547,10 +1030,37 @@
547 extern ulint srv_dict_size_limit;1030 extern ulint srv_dict_size_limit;
548 /*-------------------------------------------*/1031 /*-------------------------------------------*/
549 1032
1033diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
1034--- a/storage/innobase/row/row0mysql.c 2011-04-11 19:44:03.000000000 +0900
1035+++ b/storage/innobase/row/row0mysql.c 2011-06-06 11:53:18.395764565 +0900
1036@@ -2568,6 +2568,11 @@
1037
1038 current_lsn = log_get_lsn();
1039
1040+ /* Enlarge the fatal lock wait timeout during import. */
1041+ mutex_enter(&kernel_mutex);
1042+ srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
1043+ mutex_exit(&kernel_mutex);
1044+
1045 /* It is possible, though very improbable, that the lsn's in the
1046 tablespace to be imported have risen above the current system lsn, if
1047 a lengthy purge, ibuf merge, or rollback was performed on a backup
1048@@ -2679,6 +2684,11 @@
1049
1050 trx->op_info = "";
1051
1052+ /* Restore the fatal semaphore wait timeout */
1053+ mutex_enter(&kernel_mutex);
1054+ srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
1055+ mutex_exit(&kernel_mutex);
1056+
1057 return((int) err);
1058 }
1059
550diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c1060diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
551--- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:49:59.230956118 +09001061--- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:49:59.230956118 +0900
552+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:52:23.562954411 +09001062+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:52:23.562954411 +0900
553@@ -422,6 +422,8 @@1063@@ -416,6 +416,8 @@
554 UNIV_INTERN ulint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */1064 UNIV_INTERN ulint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */
555 UNIV_INTERN ulint srv_adaptive_flushing_method = 0; /* 0: native 1: estimate 2: keep_average */1065 UNIV_INTERN ulint srv_adaptive_flushing_method = 0; /* 0: native 1: estimate 2: keep_average */
556 1066
5571067
=== modified file 'innodb_extend_slow.patch'
--- innodb_extend_slow.patch 2011-05-10 11:57:42 +0000
+++ innodb_extend_slow.patch 2011-06-20 09:04:39 +0000
@@ -335,7 +335,7 @@
335diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c335diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
336--- a/storage/innobase/fil/fil0fil.c 2010-12-03 15:53:54.610037199 +0900336--- a/storage/innobase/fil/fil0fil.c 2010-12-03 15:53:54.610037199 +0900
337+++ b/storage/innobase/fil/fil0fil.c 2010-12-03 17:42:42.079064198 +0900337+++ b/storage/innobase/fil/fil0fil.c 2010-12-03 17:42:42.079064198 +0900
338@@ -4423,7 +4423,7 @@338@@ -4747,7 +4747,7 @@
339 node->name, node->handle, buf,339 node->name, node->handle, buf,
340 offset_low, offset_high,340 offset_low, offset_high,
341 page_size * n_pages,341 page_size * n_pages,
@@ -344,7 +344,7 @@
344 #endif344 #endif
345 if (success) {345 if (success) {
346 node->size += n_pages;346 node->size += n_pages;
347@@ -4750,7 +4750,7 @@347@@ -5074,7 +5074,7 @@
348 i/o on a tablespace which does not exist */348 i/o on a tablespace which does not exist */
349 UNIV_INTERN349 UNIV_INTERN
350 ulint350 ulint
@@ -353,7 +353,7 @@
353 /*===*/353 /*===*/
354 ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE,354 ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE,
355 ORed to OS_FILE_LOG, if a log i/o355 ORed to OS_FILE_LOG, if a log i/o
356@@ -4775,8 +4775,9 @@356@@ -5099,8 +5099,9 @@
357 void* buf, /*!< in/out: buffer where to store read data357 void* buf, /*!< in/out: buffer where to store read data
358 or from where to write; in aio this must be358 or from where to write; in aio this must be
359 appropriately aligned */359 appropriately aligned */
@@ -364,7 +364,7 @@
364 {364 {
365 ulint mode;365 ulint mode;
366 fil_space_t* space;366 fil_space_t* space;
367@@ -4944,7 +4945,7 @@367@@ -5268,7 +5269,7 @@
368 #else368 #else
369 /* Queue the aio request */369 /* Queue the aio request */
370 ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,370 ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
@@ -376,7 +376,7 @@
376diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc376diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
377--- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:36:44.293955189 +0900377--- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:36:44.293955189 +0900
378+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:42:42.090024586 +0900378+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:42:42.090024586 +0900
379@@ -1559,6 +1559,16 @@379@@ -1573,6 +1573,16 @@
380 trx->check_unique_secondary = !thd_test_options(380 trx->check_unique_secondary = !thd_test_options(
381 thd, OPTION_RELAXED_UNIQUE_CHECKS);381 thd, OPTION_RELAXED_UNIQUE_CHECKS);
382 382
@@ -393,7 +393,7 @@
393 DBUG_VOID_RETURN;393 DBUG_VOID_RETURN;
394 }394 }
395 395
396@@ -1613,6 +1623,32 @@396@@ -1627,6 +1637,32 @@
397 return(trx);397 return(trx);
398 }398 }
399 399
@@ -426,7 +426,7 @@
426 /*********************************************************************//**426 /*********************************************************************//**
427 Note that a transaction has been registered with MySQL.427 Note that a transaction has been registered with MySQL.
428 @return true if transaction is registered with MySQL 2PC coordinator */428 @return true if transaction is registered with MySQL 2PC coordinator */
429@@ -9296,6 +9332,25 @@429@@ -9301,6 +9337,25 @@
430 statement has ended */430 statement has ended */
431 431
432 if (trx->n_mysql_tables_in_use == 0) {432 if (trx->n_mysql_tables_in_use == 0) {
@@ -648,13 +648,13 @@
648+/* prototypes for new functions added to ha_innodb.cc */648+/* prototypes for new functions added to ha_innodb.cc */
649+ibool innobase_get_slow_log();649+ibool innobase_get_slow_log();
650+650+
651 /* This is set to the MySQL server value for this variable. */651 /* Mutex for locking srv_monitor_file */
652 extern uint srv_lower_case_table_names;652 extern mutex_t srv_monitor_file_mutex;
653 653 /* Temporary file for innodb monitor output */
654diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h654diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
655--- a/storage/innobase/include/trx0trx.h 2010-12-03 15:41:52.049372966 +0900655--- a/storage/innobase/include/trx0trx.h 2010-12-03 15:41:52.049372966 +0900
656+++ b/storage/innobase/include/trx0trx.h 2010-12-03 17:42:42.107024532 +0900656+++ b/storage/innobase/include/trx0trx.h 2010-12-03 17:42:42.107024532 +0900
657@@ -738,6 +738,17 @@657@@ -743,6 +743,17 @@
658 /*------------------------------*/658 /*------------------------------*/
659 char detailed_error[256]; /*!< detailed error message for last659 char detailed_error[256]; /*!< detailed error message for last
660 error, or empty. */660 error, or empty. */
@@ -843,8 +843,8 @@
843 }843 }
844 844
845 ut_a(type == OS_FILE_WRITE);845 ut_a(type == OS_FILE_WRITE);
846@@ -4099,6 +4131,11 @@846@@ -4101,6 +4133,11 @@
847 ut_error;847 array = NULL; /* Eliminate compiler warning */
848 }848 }
849 849
850+ if (trx && type == OS_FILE_READ)850+ if (trx && type == OS_FILE_READ)
@@ -865,10 +865,10 @@
865+/* prototypes for new functions added to ha_innodb.cc */865+/* prototypes for new functions added to ha_innodb.cc */
866+ibool innobase_get_slow_log();866+ibool innobase_get_slow_log();
867+867+
868 /* This is set to the MySQL server value for this variable. It is only868 /* The following counter is incremented whenever there is some user activity
869 needed for FOREIGN KEY definition parsing since FOREIGN KEY names are not869 in the server */
870 stored in the server metadata. The server stores and enforces it for870 UNIV_INTERN ulint srv_activity_count = 0;
871@@ -1244,6 +1247,10 @@871@@ -1232,6 +1235,10 @@
872 ibool has_slept = FALSE;872 ibool has_slept = FALSE;
873 srv_conc_slot_t* slot = NULL;873 srv_conc_slot_t* slot = NULL;
874 ulint i;874 ulint i;
@@ -877,9 +877,9 @@
877+ ulint sec;877+ ulint sec;
878+ ulint ms;878+ ulint ms;
879 879
880 if (trx->mysql_thd != NULL880 #ifdef UNIV_SYNC_DEBUG
881 && thd_is_replication_slave_thread(trx->mysql_thd)) {881 ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
882@@ -1320,6 +1327,7 @@882@@ -1312,6 +1319,7 @@
883 switches. */883 switches. */
884 if (SRV_THREAD_SLEEP_DELAY > 0) {884 if (SRV_THREAD_SLEEP_DELAY > 0) {
885 os_thread_sleep(SRV_THREAD_SLEEP_DELAY);885 os_thread_sleep(SRV_THREAD_SLEEP_DELAY);
@@ -887,10 +887,11 @@
887 }887 }
888 888
889 trx->op_info = "";889 trx->op_info = "";
890@@ -1375,6 +1383,13 @@890@@ -1371,6 +1379,14 @@
891 /* Go to wait for the event; when a thread leaves InnoDB it will891 #ifdef UNIV_SYNC_DEBUG
892 release this thread */892 ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
893 893 #endif /* UNIV_SYNC_DEBUG */
894+
894+ if (innobase_get_slow_log() && trx->take_stats) {895+ if (innobase_get_slow_log() && trx->take_stats) {
895+ ut_usectime(&sec, &ms);896+ ut_usectime(&sec, &ms);
896+ start_time = (ib_uint64_t)sec * 1000000 + ms;897+ start_time = (ib_uint64_t)sec * 1000000 + ms;
@@ -901,7 +902,7 @@
901 trx->op_info = "waiting in InnoDB queue";902 trx->op_info = "waiting in InnoDB queue";
902 903
903 thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK);904 thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK);
904@@ -1383,6 +1398,12 @@905@@ -1379,6 +1395,12 @@
905 906
906 trx->op_info = "";907 trx->op_info = "";
907 908
@@ -917,7 +918,7 @@
917diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c918diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
918--- a/storage/innobase/trx/trx0trx.c 2010-12-03 15:41:52.053955669 +0900919--- a/storage/innobase/trx/trx0trx.c 2010-12-03 15:41:52.053955669 +0900
919+++ b/storage/innobase/trx/trx0trx.c 2010-12-03 17:42:42.127023410 +0900920+++ b/storage/innobase/trx/trx0trx.c 2010-12-03 17:42:42.127023410 +0900
920@@ -185,6 +185,15 @@921@@ -188,6 +188,15 @@
921 trx->global_read_view = NULL;922 trx->global_read_view = NULL;
922 trx->read_view = NULL;923 trx->read_view = NULL;
923 924
@@ -933,9 +934,9 @@
933 /* Set X/Open XA transaction identification to NULL */934 /* Set X/Open XA transaction identification to NULL */
934 memset(&trx->xid, 0, sizeof(trx->xid));935 memset(&trx->xid, 0, sizeof(trx->xid));
935 trx->xid.formatID = -1;936 trx->xid.formatID = -1;
936@@ -222,6 +231,11 @@937@@ -221,6 +230,11 @@
937 938
938 trx->mysql_process_no = os_proc_get_number();939 mutex_exit(&kernel_mutex);
939 940
940+ if (innobase_get_slow_log() && trx->take_stats) {941+ if (innobase_get_slow_log() && trx->take_stats) {
941+ trx->distinct_page_access_hash = mem_alloc(DPAH_SIZE);942+ trx->distinct_page_access_hash = mem_alloc(DPAH_SIZE);
@@ -945,7 +946,7 @@
945 return(trx);946 return(trx);
946 }947 }
947 948
948@@ -353,6 +367,12 @@949@@ -406,6 +420,12 @@
949 /*===============*/950 /*===============*/
950 trx_t* trx) /*!< in, own: trx object */951 trx_t* trx) /*!< in, own: trx object */
951 {952 {
@@ -958,7 +959,7 @@
958 mutex_enter(&kernel_mutex);959 mutex_enter(&kernel_mutex);
959 960
960 UT_LIST_REMOVE(mysql_trx_list, trx_sys->mysql_trx_list, trx);961 UT_LIST_REMOVE(mysql_trx_list, trx_sys->mysql_trx_list, trx);
961@@ -374,6 +394,12 @@962@@ -427,6 +447,12 @@
962 /*====================*/963 /*====================*/
963 trx_t* trx) /*!< in, own: trx object */964 trx_t* trx) /*!< in, own: trx object */
964 {965 {
@@ -971,7 +972,7 @@
971 mutex_enter(&kernel_mutex);972 mutex_enter(&kernel_mutex);
972 973
973 trx_free(trx);974 trx_free(trx);
974@@ -1152,6 +1178,9 @@975@@ -1212,6 +1238,9 @@
975 trx_t* trx) /*!< in: transaction */976 trx_t* trx) /*!< in: transaction */
976 {977 {
977 que_thr_t* thr;978 que_thr_t* thr;
@@ -981,7 +982,7 @@
981 982
982 ut_ad(mutex_own(&kernel_mutex));983 ut_ad(mutex_own(&kernel_mutex));
983 ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);984 ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
984@@ -1166,6 +1195,11 @@985@@ -1226,6 +1255,11 @@
985 thr = UT_LIST_GET_FIRST(trx->wait_thrs);986 thr = UT_LIST_GET_FIRST(trx->wait_thrs);
986 }987 }
987 988
@@ -993,7 +994,7 @@
993 trx->que_state = TRX_QUE_RUNNING;994 trx->que_state = TRX_QUE_RUNNING;
994 }995 }
995 996
996@@ -1179,6 +1213,9 @@997@@ -1239,6 +1273,9 @@
997 trx_t* trx) /*!< in: transaction in the TRX_QUE_LOCK_WAIT state */998 trx_t* trx) /*!< in: transaction in the TRX_QUE_LOCK_WAIT state */
998 {999 {
999 que_thr_t* thr;1000 que_thr_t* thr;
@@ -1003,7 +1004,7 @@
1003 1004
1004 ut_ad(mutex_own(&kernel_mutex));1005 ut_ad(mutex_own(&kernel_mutex));
1005 ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);1006 ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
1006@@ -1193,6 +1230,11 @@1007@@ -1253,6 +1290,11 @@
1007 thr = UT_LIST_GET_FIRST(trx->wait_thrs);1008 thr = UT_LIST_GET_FIRST(trx->wait_thrs);
1008 }1009 }
1009 1010
10101011
=== modified file 'innodb_extra_rseg.patch'
--- innodb_extra_rseg.patch 2011-05-23 03:13:18 +0000
+++ innodb_extra_rseg.patch 2011-06-20 09:04:39 +0000
@@ -8,7 +8,7 @@
8diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc8diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
9--- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:18:48.879955903 +09009--- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:18:48.879955903 +0900
10+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:22:53.779955671 +090010+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:22:53.779955671 +0900
11@@ -11521,6 +11521,7 @@11@@ -11528,6 +11528,7 @@
12 innobase_system_variables, /* system variables */12 innobase_system_variables, /* system variables */
13 NULL /* reserved */13 NULL /* reserved */
14 },14 },
1515
=== added file 'innodb_fake_changes.patch'
--- innodb_fake_changes.patch 1970-01-01 00:00:00 +0000
+++ innodb_fake_changes.patch 2011-06-20 09:04:39 +0000
@@ -0,0 +1,614 @@
1# name : innodb_fake_changes.patch
2# introduced : 5.5.12
3# maintainer : Yasufumi
4#
5#!!! notice !!!
6# Any small change to this file in the main branch
7# should be done or reviewed by the maintainer!
8diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
9--- a/storage/innobase/btr/btr0cur.c 2011-06-01 21:04:26.346416429 +0900
10+++ b/storage/innobase/btr/btr0cur.c 2011-06-01 21:04:53.718415294 +0900
11@@ -1167,6 +1167,11 @@
12 rec_t* rec;
13 roll_ptr_t roll_ptr;
14
15+ if (thr && thr_get_trx(thr)->fake_changes) {
16+ /* skip LOCK, UNDO */
17+ return(DB_SUCCESS);
18+ }
19+
20 /* Check if we have to wait for a lock: enqueue an explicit lock
21 request if yes */
22
23@@ -1298,7 +1303,7 @@
24 }
25 #endif /* UNIV_DEBUG */
26
27- ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
28+ ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
29 max_size = page_get_max_insert_size_after_reorganize(page, 1);
30 leaf = page_is_leaf(page);
31
32@@ -1393,6 +1398,12 @@
33 goto fail_err;
34 }
35
36+ if (thr && thr_get_trx(thr)->fake_changes) {
37+ /* skip CHANGE, LOG */
38+ *big_rec = big_rec_vec;
39+ return(err); /* == DB_SUCCESS */
40+ }
41+
42 page_cursor = btr_cur_get_page_cur(cursor);
43
44 /* Now, try the insert */
45@@ -1535,10 +1546,10 @@
46
47 *big_rec = NULL;
48
49- ut_ad(mtr_memo_contains(mtr,
50+ ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr,
51 dict_index_get_lock(btr_cur_get_index(cursor)),
52 MTR_MEMO_X_LOCK));
53- ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
54+ ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, btr_cur_get_block(cursor),
55 MTR_MEMO_PAGE_X_FIX));
56
57 /* Try first an optimistic insert; reset the cursor flag: we do not
58@@ -1604,6 +1615,16 @@
59 }
60 }
61
62+ if (thr && thr_get_trx(thr)->fake_changes) {
63+ /* skip CHANGE, LOG */
64+ if (n_extents > 0) {
65+ fil_space_release_free_extents(index->space,
66+ n_reserved);
67+ }
68+ *big_rec = big_rec_vec;
69+ return(DB_SUCCESS);
70+ }
71+
72 if (dict_index_get_page(index)
73 == buf_block_get_page_no(btr_cur_get_block(cursor))) {
74
75@@ -1660,6 +1681,11 @@
76
77 ut_ad(cursor && update && thr && roll_ptr);
78
79+ if (thr && thr_get_trx(thr)->fake_changes) {
80+ /* skip LOCK, UNDO */
81+ return(DB_SUCCESS);
82+ }
83+
84 rec = btr_cur_get_rec(cursor);
85 index = cursor->index;
86
87@@ -1958,6 +1984,14 @@
88 return(err);
89 }
90
91+ if (trx->fake_changes) {
92+ /* skip CHANGE, LOG */
93+ if (UNIV_LIKELY_NULL(heap)) {
94+ mem_heap_free(heap);
95+ }
96+ return(err); /* == DB_SUCCESS */
97+ }
98+
99 if (block->is_hashed) {
100 /* The function row_upd_changes_ord_field_binary works only
101 if the update vector was built for a clustered index, we must
102@@ -2061,7 +2095,7 @@
103 rec = btr_cur_get_rec(cursor);
104 index = cursor->index;
105 ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
106- ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
107+ ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
108 /* The insert buffer tree should never be updated in place. */
109 ut_ad(!dict_index_is_ibuf(index));
110
111@@ -2171,6 +2205,11 @@
112 goto err_exit;
113 }
114
115+ if (thr && thr_get_trx(thr)->fake_changes) {
116+ /* skip CHANGE, LOG */
117+ goto err_exit; /* == DB_SUCCESS */
118+ }
119+
120 /* Ok, we may do the replacement. Store on the page infimum the
121 explicit locks on rec, before deleting rec (see the comment in
122 btr_cur_pessimistic_update). */
123@@ -2321,9 +2360,9 @@
124 rec = btr_cur_get_rec(cursor);
125 index = cursor->index;
126
127- ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
128+ ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, dict_index_get_lock(index),
129 MTR_MEMO_X_LOCK));
130- ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
131+ ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
132 #ifdef UNIV_ZIP_DEBUG
133 ut_a(!page_zip || page_zip_validate(page_zip, page));
134 #endif /* UNIV_ZIP_DEBUG */
135@@ -2411,6 +2450,9 @@
136
137 ut_ad(big_rec_vec == NULL);
138
139+ /* fake_changes should not cause undo. so never reaches here */
140+ ut_ad(!(trx->fake_changes));
141+
142 btr_rec_free_updated_extern_fields(
143 index, rec, page_zip, offsets, update,
144 trx_is_recv(trx) ? RB_RECOVERY : RB_NORMAL, mtr);
145@@ -2445,6 +2487,12 @@
146 }
147 }
148
149+ if (trx->fake_changes) {
150+ /* skip CHANGE, LOG */
151+ err = DB_SUCCESS;
152+ goto return_after_reservations;
153+ }
154+
155 /* Store state of explicit locks on rec on the page infimum record,
156 before deleting rec. The page infimum acts as a dummy carrier of the
157 locks, taking care also of lock releases, before we can move the locks
158@@ -2746,6 +2794,11 @@
159 ut_ad(dict_index_is_clust(index));
160 ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
161
162+ if (thr && thr_get_trx(thr)->fake_changes) {
163+ /* skip LOCK, UNDO, CHANGE, LOG */
164+ return(DB_SUCCESS);
165+ }
166+
167 err = lock_clust_rec_modify_check_and_lock(flags, block,
168 rec, index, offsets, thr);
169
170@@ -2883,6 +2936,11 @@
171 rec_t* rec;
172 ulint err;
173
174+ if (thr && thr_get_trx(thr)->fake_changes) {
175+ /* skip LOCK, CHANGE, LOG */
176+ return(DB_SUCCESS);
177+ }
178+
179 block = btr_cur_get_block(cursor);
180 rec = btr_cur_get_rec(cursor);
181
182diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
183--- a/storage/innobase/handler/ha_innodb.cc 2011-06-01 21:04:26.511385596 +0900
184+++ b/storage/innobase/handler/ha_innodb.cc 2011-06-01 21:04:53.723390828 +0900
185@@ -484,6 +484,12 @@
186 " or 2 (write at commit, flush once per second).",
187 NULL, NULL, 1, 0, 2, 0);
188
189+static MYSQL_THDVAR_BOOL(fake_changes, PLUGIN_VAR_OPCMDARG,
190+ "In the transaction after enabled, UPDATE, INSERT and DELETE only move the cursor to the records "
191+ "and do nothing other operations (no changes, no ibuf, no undo, no transaction log) in the transaction. "
192+ "ATTENTION: the transaction started after enabled is affected.",
193+ NULL, NULL, FALSE);
194+
195
196 static handler *innobase_create_handler(handlerton *hton,
197 TABLE_SHARE *table,
198@@ -1675,6 +1681,8 @@
199 trx->check_unique_secondary = !thd_test_options(
200 thd, OPTION_RELAXED_UNIQUE_CHECKS);
201
202+ trx->fake_changes = THDVAR(thd, fake_changes);
203+
204 #ifdef EXTENDED_SLOWLOG
205 if (thd_log_slow_verbosity(thd) & SLOG_V_INNODB) {
206 trx->take_stats = TRUE;
207@@ -7486,12 +7494,20 @@
208
209 parent_trx = check_trx_exists(thd);
210
211+
212+ if (parent_trx->fake_changes
213+ && thd_sql_command(thd) != SQLCOM_CREATE_TABLE) {
214+ sql_print_error("innodb_fake_changes cannot treat new table during other than CREATE TABLE. (%s)\n", name);
215+ DBUG_RETURN(HA_ERR_WRONG_COMMAND);
216+ }
217+
218 /* In case MySQL calls this in the middle of a SELECT query, release
219 possible adaptive hash latch to avoid deadlocks of threads */
220
221 trx_search_latch_release_if_reserved(parent_trx);
222
223 trx = innobase_trx_allocate(thd);
224+ trx->fake_changes = FALSE;
225
226 /* Latch the InnoDB data dictionary exclusively so that no deadlocks
227 or lock waits can happen in it during a table create operation.
228@@ -7701,6 +7717,7 @@
229 /*==============================*/
230 {
231 int error;
232+ ibool fake_changes_reserved = FALSE;
233
234 DBUG_ENTER("ha_innobase::truncate");
235
236@@ -7713,10 +7730,21 @@
237 DBUG_RETURN(HA_ERR_CRASHED);
238 }
239
240+ if (prebuilt->trx->fake_changes) {
241+ /* disable temporally */
242+ prebuilt->trx->fake_changes = FALSE;
243+ fake_changes_reserved = TRUE;
244+ }
245+
246 /* Truncate the table in InnoDB */
247
248 error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx);
249
250+ if (fake_changes_reserved) {
251+ prebuilt->trx->fake_changes = TRUE;
252+ fake_changes_reserved = FALSE;
253+ }
254+
255 if (share->ib_table->is_corrupt) {
256 DBUG_RETURN(HA_ERR_CRASHED);
257 }
258@@ -7768,6 +7796,7 @@
259 trx_search_latch_release_if_reserved(parent_trx);
260
261 trx = innobase_trx_allocate(thd);
262+ trx->fake_changes = FALSE;
263
264 name_len = strlen(name);
265
266@@ -7855,6 +7884,7 @@
267 trx->mysql_thd = NULL;
268 #else
269 trx = innobase_trx_allocate(thd);
270+ trx->fake_changes = FALSE;
271 #endif
272 row_drop_database_for_mysql(namebuf, trx);
273 my_free(namebuf);
274@@ -7960,6 +7990,7 @@
275 trx_search_latch_release_if_reserved(parent_trx);
276
277 trx = innobase_trx_allocate(thd);
278+ trx->fake_changes = FALSE;
279
280 error = innobase_rename_table(trx, from, to, TRUE);
281
282@@ -12228,6 +12259,7 @@
283 MYSQL_SYSVAR(rollback_segments),
284 MYSQL_SYSVAR(corrupt_table_action),
285 MYSQL_SYSVAR(lazy_drop_table),
286+ MYSQL_SYSVAR(fake_changes),
287 NULL
288 };
289
290diff -ruN a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
291--- a/storage/innobase/handler/handler0alter.cc 2011-04-11 19:44:03.000000000 +0900
292+++ b/storage/innobase/handler/handler0alter.cc 2011-06-01 21:04:53.728495636 +0900
293@@ -641,6 +641,7 @@
294 ibool dict_locked = FALSE;
295 ulint new_primary;
296 int error;
297+ ulint should_fake_changes = FALSE;
298
299 DBUG_ENTER("ha_innobase::add_index");
300 ut_a(table);
301@@ -677,11 +678,17 @@
302 }
303
304 heap = mem_heap_create(1024);
305+
306+ if (prebuilt->trx->fake_changes) {
307+ prebuilt->trx->fake_changes = FALSE;
308+ should_fake_changes = TRUE;
309+ }
310 trx_start_if_not_started(prebuilt->trx);
311
312 /* Create a background transaction for the operations on
313 the data dictionary tables. */
314 trx = innobase_trx_allocate(user_thd);
315+ trx->fake_changes = FALSE;
316 trx_start_if_not_started(trx);
317
318 /* Create table containing all indexes to be built in this
319@@ -760,6 +767,9 @@
320 row_mysql_unlock_data_dictionary(trx);
321 trx_free_for_mysql(trx);
322 trx_commit_for_mysql(prebuilt->trx);
323+ if (should_fake_changes) {
324+ prebuilt->trx->fake_changes = TRUE;
325+ }
326 DBUG_RETURN(error);
327 }
328
329@@ -925,6 +935,9 @@
330 trx_commit_for_mysql(trx);
331 if (prebuilt->trx) {
332 trx_commit_for_mysql(prebuilt->trx);
333+ if (should_fake_changes) {
334+ prebuilt->trx->fake_changes = TRUE;
335+ }
336 }
337
338 if (dict_locked) {
339@@ -1172,6 +1185,7 @@
340 /* Create a background transaction for the operations on
341 the data dictionary tables. */
342 trx = innobase_trx_allocate(user_thd);
343+ trx->fake_changes = FALSE;
344 trx_start_if_not_started(trx);
345
346 /* Flag this transaction as a dictionary operation, so that
347diff -ruN a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
348--- a/storage/innobase/ibuf/ibuf0ibuf.c 2011-06-01 21:04:26.529383815 +0900
349+++ b/storage/innobase/ibuf/ibuf0ibuf.c 2011-06-01 21:04:53.732416483 +0900
350@@ -3496,6 +3496,8 @@
351
352 ut_a(trx_sys_multiple_tablespace_format);
353
354+ ut_ad(!(thr_get_trx(thr)->fake_changes));
355+
356 do_merge = FALSE;
357
358 /* Perform dirty reads of ibuf->size and ibuf->max_size, to
359diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
360--- a/storage/innobase/include/trx0trx.h 2011-06-01 21:04:25.762416618 +0900
361+++ b/storage/innobase/include/trx0trx.h 2011-06-01 21:04:53.736387944 +0900
362@@ -512,6 +512,7 @@
363 FALSE, one can save CPU time and about
364 150 bytes in the undo log size as then
365 we skip XA steps */
366+ ulint fake_changes;
367 ulint flush_log_later;/* In 2PC, we hold the
368 prepare_commit mutex across
369 both phases. In that case, we
370diff -ruN a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
371--- a/storage/innobase/lock/lock0lock.c 2011-06-01 21:04:26.543396960 +0900
372+++ b/storage/innobase/lock/lock0lock.c 2011-06-01 21:04:53.739416526 +0900
373@@ -3909,6 +3909,10 @@
374
375 trx = thr_get_trx(thr);
376
377+ if (trx->fake_changes && mode == LOCK_IX) {
378+ mode = LOCK_IS;
379+ }
380+
381 lock_mutex_enter_kernel();
382
383 /* Look for stronger locks the same trx already has on the table */
384@@ -5107,6 +5111,11 @@
385 }
386
387 trx = thr_get_trx(thr);
388+
389+ if (trx->fake_changes) {
390+ return(DB_SUCCESS);
391+ }
392+
393 next_rec = page_rec_get_next_const(rec);
394 next_rec_heap_no = page_rec_get_heap_no(next_rec);
395
396@@ -5275,6 +5284,10 @@
397 return(DB_SUCCESS);
398 }
399
400+ if (thr && thr_get_trx(thr)->fake_changes) {
401+ return(DB_SUCCESS);
402+ }
403+
404 heap_no = rec_offs_comp(offsets)
405 ? rec_get_heap_no_new(rec)
406 : rec_get_heap_no_old(rec);
407@@ -5333,6 +5346,10 @@
408 return(DB_SUCCESS);
409 }
410
411+ if (thr && thr_get_trx(thr)->fake_changes) {
412+ return(DB_SUCCESS);
413+ }
414+
415 heap_no = page_rec_get_heap_no(rec);
416
417 /* Another transaction cannot have an implicit lock on the record,
418@@ -5420,6 +5437,10 @@
419 return(DB_SUCCESS);
420 }
421
422+ if (thr && thr_get_trx(thr)->fake_changes && mode == LOCK_X) {
423+ mode = LOCK_S;
424+ }
425+
426 heap_no = page_rec_get_heap_no(rec);
427
428 lock_mutex_enter_kernel();
429@@ -5496,6 +5517,10 @@
430 return(DB_SUCCESS);
431 }
432
433+ if (thr && thr_get_trx(thr)->fake_changes && mode == LOCK_X) {
434+ mode = LOCK_S;
435+ }
436+
437 heap_no = page_rec_get_heap_no(rec);
438
439 lock_mutex_enter_kernel();
440diff -ruN a/storage/innobase/que/que0que.c b/storage/innobase/que/que0que.c
441--- a/storage/innobase/que/que0que.c 2011-06-01 21:04:25.553416889 +0900
442+++ b/storage/innobase/que/que0que.c 2011-06-01 21:04:53.743419001 +0900
443@@ -1417,6 +1417,12 @@
444
445 ut_a(trx->error_state == DB_SUCCESS);
446
447+ if (trx->fake_changes) {
448+ /* fake_changes should not access to system tables */
449+ fprintf(stderr, "InnoDB: ERROR: innodb_fake_changes tried to access to system tables.\n");
450+ return(DB_ERROR);
451+ }
452+
453 if (reserve_dict_mutex) {
454 mutex_enter(&dict_sys->mutex);
455 }
456diff -ruN a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
457--- a/storage/innobase/row/row0ins.c 2011-06-01 21:04:26.099449453 +0900
458+++ b/storage/innobase/row/row0ins.c 2011-06-01 21:04:53.746383371 +0900
459@@ -1499,6 +1499,11 @@
460 if (UNIV_LIKELY_NULL(heap)) {
461 mem_heap_free(heap);
462 }
463+
464+ if (trx->fake_changes) {
465+ err = DB_SUCCESS;
466+ }
467+
468 return(err);
469 }
470
471@@ -2004,7 +2009,7 @@
472 }
473
474 btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
475- search_mode,
476+ thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : search_mode,
477 &cursor, 0, __FILE__, __LINE__, &mtr);
478
479 if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
480@@ -2065,7 +2070,7 @@
481
482 btr_cur_search_to_nth_level(index, 0, entry,
483 PAGE_CUR_LE,
484- mode | BTR_INSERT,
485+ thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : (mode | BTR_INSERT),
486 &cursor, 0,
487 __FILE__, __LINE__, &mtr);
488 }
489@@ -2119,6 +2124,22 @@
490 if (UNIV_LIKELY_NULL(big_rec)) {
491 rec_t* rec;
492 ulint* offsets;
493+
494+ if (thr_get_trx(thr)->fake_changes) {
495+ /* skip store extern */
496+ if (modify) {
497+ dtuple_big_rec_free(big_rec);
498+ } else {
499+ dtuple_convert_back_big_rec(index, entry, big_rec);
500+ }
501+
502+ if (UNIV_LIKELY_NULL(heap)) {
503+ mem_heap_free(heap);
504+ }
505+
506+ return(err);
507+ }
508+
509 mtr_start(&mtr);
510
511 btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
512diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
513--- a/storage/innobase/row/row0mysql.c 2011-06-01 21:04:26.287385626 +0900
514+++ b/storage/innobase/row/row0mysql.c 2011-06-01 21:04:53.749372325 +0900
515@@ -1245,6 +1245,7 @@
516 prebuilt->table->stat_n_rows--;
517 }
518
519+ if (!(trx->fake_changes))
520 row_update_statistics_if_needed(prebuilt->table);
521 trx->op_info = "";
522
523@@ -1504,6 +1505,7 @@
524 that changes indexed columns, UPDATEs that change only non-indexed
525 columns would not affect statistics. */
526 if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
527+ if (!(trx->fake_changes))
528 row_update_statistics_if_needed(prebuilt->table);
529 }
530
531@@ -1721,6 +1723,7 @@
532 srv_n_rows_updated++;
533 }
534
535+ if (!(trx->fake_changes))
536 row_update_statistics_if_needed(table);
537
538 return(err);
539diff -ruN a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c
540--- a/storage/innobase/row/row0upd.c 2011-06-01 21:04:25.588384975 +0900
541+++ b/storage/innobase/row/row0upd.c 2011-06-01 21:04:53.753385366 +0900
542@@ -1603,7 +1603,8 @@
543 mode |= BTR_DELETE_MARK;
544 }
545
546- search_result = row_search_index_entry(index, entry, mode,
547+ search_result = row_search_index_entry(index, entry,
548+ trx->fake_changes ? BTR_SEARCH_LEAF : mode,
549 &pcur, &mtr);
550
551 btr_cur = btr_pcur_get_btr_cur(&pcur);
552@@ -1850,9 +1851,11 @@
553 the previous invocation of this function. Mark the
554 off-page columns in the entry inherited. */
555
556+ if (!(trx->fake_changes)) {
557 change_ownership = row_upd_clust_rec_by_insert_inherit(
558 NULL, NULL, entry, node->update);
559 ut_a(change_ownership);
560+ }
561 /* fall through */
562 case UPD_NODE_INSERT_CLUSTERED:
563 /* A lock wait occurred in row_ins_index_entry() in
564@@ -1882,7 +1885,7 @@
565 delete-marked old record, mark them disowned by the
566 old record and owned by the new entry. */
567
568- if (rec_offs_any_extern(offsets)) {
569+ if (rec_offs_any_extern(offsets) && !(trx->fake_changes)) {
570 change_ownership = row_upd_clust_rec_by_insert_inherit(
571 rec, offsets, entry, node->update);
572
573@@ -2012,7 +2015,8 @@
574 the same transaction do not modify the record in the meantime.
575 Therefore we can assert that the restoration of the cursor succeeds. */
576
577- ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
578+ ut_a(btr_pcur_restore_position(thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : BTR_MODIFY_TREE,
579+ pcur, mtr));
580
581 ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
582 dict_table_is_comp(index->table)));
583@@ -2022,7 +2026,8 @@
584 node->cmpl_info, thr, mtr);
585 mtr_commit(mtr);
586
587- if (err == DB_SUCCESS && big_rec) {
588+ /* skip store extern for fake_changes */
589+ if (err == DB_SUCCESS && big_rec && !(thr_get_trx(thr)->fake_changes)) {
590 ulint offsets_[REC_OFFS_NORMAL_SIZE];
591 rec_t* rec;
592 rec_offs_init(offsets_);
593@@ -2146,7 +2151,8 @@
594
595 ut_a(pcur->rel_pos == BTR_PCUR_ON);
596
597- success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr);
598+ success = btr_pcur_restore_position(thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : BTR_MODIFY_LEAF,
599+ pcur, mtr);
600
601 if (!success) {
602 err = DB_RECORD_NOT_FOUND;
603diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
604--- a/storage/innobase/trx/trx0trx.c 2011-06-01 21:04:26.411537237 +0900
605+++ b/storage/innobase/trx/trx0trx.c 2011-06-01 21:04:53.756415956 +0900
606@@ -121,6 +121,8 @@
607
608 trx->support_xa = TRUE;
609
610+ trx->fake_changes = FALSE;
611+
612 trx->check_foreigns = TRUE;
613 trx->check_unique_secondary = TRUE;
614
0615
=== modified file 'innodb_fast_checksum.patch'
--- innodb_fast_checksum.patch 2011-05-10 11:57:42 +0000
+++ innodb_fast_checksum.patch 2011-06-20 09:04:39 +0000
@@ -109,8 +109,34 @@
109diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c109diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
110--- a/storage/innobase/fil/fil0fil.c 2010-12-04 15:52:23.406513743 +0900110--- a/storage/innobase/fil/fil0fil.c 2010-12-04 15:52:23.406513743 +0900
111+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:53:45.020513800 +0900111+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:53:45.020513800 +0900
112@@ -3199,7 +3199,9 @@112@@ -3094,13 +3094,24 @@
113 mach_write_to_8(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);113 return(TRUE);
114 }
115
116- if (checksum_field != 0
117+ if (!srv_fast_checksum
118+ && checksum_field != 0
119 && checksum_field != BUF_NO_CHECKSUM_MAGIC
120 && checksum_field
121 != buf_calc_page_new_checksum(page)) {
122 return(TRUE);
123 }
124
125+ if (srv_fast_checksum
126+ && checksum_field != 0
127+ && checksum_field != BUF_NO_CHECKSUM_MAGIC
128+ && checksum_field
129+ != buf_calc_page_new_checksum_32(page)
130+ && checksum_field
131+ != buf_calc_page_new_checksum(page)) {
132+ return(TRUE);
133+ }
134+
135 return(FALSE);
136 }
137
138@@ -3116,7 +3127,9 @@
139 if (!zip_size) {
114 mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,140 mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
115 srv_use_checksums141 srv_use_checksums
116- ? buf_calc_page_new_checksum(page)142- ? buf_calc_page_new_checksum(page)
@@ -120,45 +146,6 @@
120 : BUF_NO_CHECKSUM_MAGIC);146 : BUF_NO_CHECKSUM_MAGIC);
121 mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,147 mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
122 srv_use_checksums148 srv_use_checksums
123@@ -3331,7 +3333,8 @@
124 page_is_corrupt = TRUE;
125 }
126
127- if (checksum_field != 0
128+ if (!srv_fast_checksum
129+ && checksum_field != 0
130 && checksum_field != BUF_NO_CHECKSUM_MAGIC
131 && checksum_field
132 != buf_calc_page_new_checksum(page)) {
133@@ -3339,6 +3342,17 @@
134 page_is_corrupt = TRUE;
135 }
136
137+ if (srv_fast_checksum
138+ && checksum_field != 0
139+ && checksum_field != BUF_NO_CHECKSUM_MAGIC
140+ && checksum_field
141+ != buf_calc_page_new_checksum_32(page)
142+ && checksum_field
143+ != buf_calc_page_new_checksum(page)) {
144+
145+ page_is_corrupt = TRUE;
146+ }
147+
148 /* if it is free page, inconsistency is acceptable */
149 if (!offset) {
150 /* header page*/
151@@ -3484,7 +3498,9 @@
152
153 mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
154 srv_use_checksums
155- ? buf_calc_page_new_checksum(page)
156+ ? (!srv_fast_checksum
157+ ? buf_calc_page_new_checksum(page)
158+ : buf_calc_page_new_checksum_32(page))
159 : BUF_NO_CHECKSUM_MAGIC);
160 mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
161 srv_use_checksums
162diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc149diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
163--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:52:23.420480329 +0900150--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:52:23.420480329 +0900
164+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:53:45.029551892 +0900151+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:53:45.029551892 +0900
@@ -170,7 +157,7 @@
170 static my_bool innobase_recovery_stats = TRUE;157 static my_bool innobase_recovery_stats = TRUE;
171 static my_bool innobase_locks_unsafe_for_binlog = FALSE;158 static my_bool innobase_locks_unsafe_for_binlog = FALSE;
172 static my_bool innobase_overwrite_relay_log_info = FALSE;159 static my_bool innobase_overwrite_relay_log_info = FALSE;
173@@ -2606,6 +2607,7 @@160@@ -2620,6 +2621,7 @@
174 161
175 srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;162 srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
176 srv_use_checksums = (ibool) innobase_use_checksums;163 srv_use_checksums = (ibool) innobase_use_checksums;
@@ -178,7 +165,7 @@
178 165
179 #ifdef HAVE_LARGE_PAGES166 #ifdef HAVE_LARGE_PAGES
180 if ((os_use_large_pages = (ibool) my_use_large_pages))167 if ((os_use_large_pages = (ibool) my_use_large_pages))
181@@ -11414,6 +11416,15 @@168@@ -11421,6 +11423,15 @@
182 "Disable with --skip-innodb-checksums.",169 "Disable with --skip-innodb-checksums.",
183 NULL, NULL, TRUE);170 NULL, NULL, TRUE);
184 171
@@ -194,7 +181,7 @@
194 static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,181 static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
195 PLUGIN_VAR_READONLY,182 PLUGIN_VAR_READONLY,
196 "The common part for InnoDB table spaces.",183 "The common part for InnoDB table spaces.",
197@@ -11922,6 +11933,7 @@184@@ -11930,6 +11941,7 @@
198 MYSQL_SYSVAR(buffer_pool_size),185 MYSQL_SYSVAR(buffer_pool_size),
199 MYSQL_SYSVAR(buffer_pool_instances),186 MYSQL_SYSVAR(buffer_pool_instances),
200 MYSQL_SYSVAR(checksums),187 MYSQL_SYSVAR(checksums),
@@ -231,7 +218,7 @@
231diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h218diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
232--- a/storage/innobase/include/srv0srv.h 2010-12-04 15:52:23.474482590 +0900219--- a/storage/innobase/include/srv0srv.h 2010-12-04 15:52:23.474482590 +0900
233+++ b/storage/innobase/include/srv0srv.h 2010-12-04 15:53:45.048512100 +0900220+++ b/storage/innobase/include/srv0srv.h 2010-12-04 15:53:45.048512100 +0900
234@@ -227,6 +227,7 @@221@@ -224,6 +224,7 @@
235 222
236 extern ibool srv_use_doublewrite_buf;223 extern ibool srv_use_doublewrite_buf;
237 extern ibool srv_use_checksums;224 extern ibool srv_use_checksums;
@@ -291,7 +278,7 @@
291diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c278diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
292--- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:52:23.498513634 +0900279--- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:52:23.498513634 +0900
293+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:53:45.053550283 +0900280+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:53:45.053550283 +0900
294@@ -420,6 +420,7 @@281@@ -414,6 +414,7 @@
295 282
296 UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;283 UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
297 UNIV_INTERN ibool srv_use_checksums = TRUE;284 UNIV_INTERN ibool srv_use_checksums = TRUE;
298285
=== modified file 'innodb_files_extend.patch'
--- innodb_files_extend.patch 2011-05-10 11:57:42 +0000
+++ innodb_files_extend.patch 2011-06-20 09:04:39 +0000
@@ -8,7 +8,7 @@
8diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c8diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
9--- a/storage/innobase/fil/fil0fil.c 2010-12-04 15:55:21.358513751 +09009--- a/storage/innobase/fil/fil0fil.c 2010-12-04 15:55:21.358513751 +0900
10+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:55:58.243481131 +090010+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:55:58.243481131 +0900
11@@ -729,7 +729,7 @@11@@ -731,7 +731,7 @@
12 ut_a(space->purpose != FIL_LOG);12 ut_a(space->purpose != FIL_LOG);
13 ut_a(!trx_sys_sys_space(space->id));13 ut_a(!trx_sys_sys_space(space->id));
14 14
@@ -17,16 +17,7 @@
17 fprintf(stderr,17 fprintf(stderr,
18 "InnoDB: Error: the size of single-table"18 "InnoDB: Error: the size of single-table"
19 " tablespace file %s\n"19 " tablespace file %s\n"
20@@ -3216,7 +3216,7 @@20@@ -4151,7 +4151,7 @@
21
22 if (size_bytes < free_limit_bytes) {
23 free_limit_bytes = size_bytes;
24- if (size_bytes >= FSP_EXTENT_SIZE * UNIV_PAGE_SIZE) {
25+ if (size_bytes >= (lint)FSP_EXTENT_SIZE * (lint)UNIV_PAGE_SIZE) {
26 fprintf(stderr, "InnoDB: free limit of %s is larger than its real size.\n", filepath);
27 file_is_corrupt = TRUE;
28 }
29@@ -3830,7 +3830,7 @@
30 21
31 size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;22 size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;
32 #ifndef UNIV_HOTBACKUP23 #ifndef UNIV_HOTBACKUP
@@ -35,7 +26,7 @@
35 fprintf(stderr,26 fprintf(stderr,
36 "InnoDB: Error: the size of single-table tablespace"27 "InnoDB: Error: the size of single-table tablespace"
37 " file %s\n"28 " file %s\n"
38@@ -3850,7 +3850,7 @@29@@ -4171,7 +4171,7 @@
39 /* Align the memory for file i/o if we might have O_DIRECT set */30 /* Align the memory for file i/o if we might have O_DIRECT set */
40 page = ut_align(buf2, UNIV_PAGE_SIZE);31 page = ut_align(buf2, UNIV_PAGE_SIZE);
41 32
@@ -44,7 +35,7 @@
44 success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);35 success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
45 36
46 /* We have to read the tablespace id from the file */37 /* We have to read the tablespace id from the file */
47@@ -4828,9 +4828,9 @@38@@ -5149,9 +5149,9 @@
48 ut_ad(ut_is_2pow(zip_size));39 ut_ad(ut_is_2pow(zip_size));
49 ut_ad(buf);40 ut_ad(buf);
50 ut_ad(len > 0);41 ut_ad(len > 0);
@@ -121,7 +112,7 @@
121 static my_bool innobase_thread_concurrency_timer_based;112 static my_bool innobase_thread_concurrency_timer_based;
122 static long long innobase_buffer_pool_size, innobase_log_file_size;113 static long long innobase_buffer_pool_size, innobase_log_file_size;
123 114
124@@ -2302,6 +2305,65 @@115@@ -2316,6 +2319,65 @@
125 }116 }
126 #endif /* DBUG_OFF */117 #endif /* DBUG_OFF */
127 118
@@ -187,7 +178,7 @@
187 #ifndef MYSQL_SERVER178 #ifndef MYSQL_SERVER
188 innodb_overwrite_relay_log_info = FALSE;179 innodb_overwrite_relay_log_info = FALSE;
189 #endif180 #endif
190@@ -7253,9 +7315,9 @@181@@ -7241,9 +7303,9 @@
191 | DICT_TF_COMPACT182 | DICT_TF_COMPACT
192 | DICT_TF_FORMAT_ZIP183 | DICT_TF_FORMAT_ZIP
193 << DICT_TF_FORMAT_SHIFT;184 << DICT_TF_FORMAT_SHIFT;
@@ -200,7 +191,7 @@
200 }191 }
201 }192 }
202 193
203@@ -11425,6 +11487,16 @@194@@ -11432,6 +11494,16 @@
204 "#### Attention: The checksum is not compatible for normal or disabled version! ####",195 "#### Attention: The checksum is not compatible for normal or disabled version! ####",
205 NULL, NULL, FALSE);196 NULL, NULL, FALSE);
206 197
@@ -217,7 +208,7 @@
217 static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,208 static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
218 PLUGIN_VAR_READONLY,209 PLUGIN_VAR_READONLY,
219 "The common part for InnoDB table spaces.",210 "The common part for InnoDB table spaces.",
220@@ -11928,6 +12000,8 @@211@@ -11936,6 +12008,8 @@
221 NULL, NULL, 0, &corrupt_table_action_typelib);212 NULL, NULL, 0, &corrupt_table_action_typelib);
222 213
223 static struct st_mysql_sys_var* innobase_system_variables[]= {214 static struct st_mysql_sys_var* innobase_system_variables[]= {
@@ -229,7 +220,7 @@
229diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h220diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
230--- a/storage/innobase/include/buf0buf.h 2010-12-04 15:55:21.375482937 +0900221--- a/storage/innobase/include/buf0buf.h 2010-12-04 15:55:21.375482937 +0900
231+++ b/storage/innobase/include/buf0buf.h 2010-12-04 15:55:58.258469088 +0900222+++ b/storage/innobase/include/buf0buf.h 2010-12-04 15:55:58.258469088 +0900
232@@ -1684,7 +1684,7 @@223@@ -1683,7 +1683,7 @@
233 time_t last_printout_time;224 time_t last_printout_time;
234 /*!< when buf_print_io was last time225 /*!< when buf_print_io was last time
235 called */226 called */
@@ -238,7 +229,7 @@
238 /*!< Statistics of buddy system,229 /*!< Statistics of buddy system,
239 indexed by block size */230 indexed by block size */
240 buf_pool_stat_t stat; /*!< current statistics */231 buf_pool_stat_t stat; /*!< current statistics */
241@@ -1780,7 +1780,7 @@232@@ -1779,7 +1779,7 @@
242 /* @{ */233 /* @{ */
243 UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;234 UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;
244 /*!< unmodified compressed pages */235 /*!< unmodified compressed pages */
@@ -247,7 +238,7 @@
247 /*!< buddy free lists */238 /*!< buddy free lists */
248 239
249 buf_page_t watch[BUF_POOL_WATCH_SIZE];240 buf_page_t watch[BUF_POOL_WATCH_SIZE];
250@@ -1788,9 +1788,9 @@241@@ -1787,9 +1787,9 @@
251 pool watches. Protected by242 pool watches. Protected by
252 buf_pool->mutex. */243 buf_pool->mutex. */
253 244
@@ -379,7 +370,7 @@
379diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i370diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
380--- a/storage/innobase/include/univ.i 2010-11-03 07:01:13.000000000 +0900371--- a/storage/innobase/include/univ.i 2010-11-03 07:01:13.000000000 +0900
381+++ b/storage/innobase/include/univ.i 2010-12-04 15:55:58.263549721 +0900372+++ b/storage/innobase/include/univ.i 2010-12-04 15:55:58.263549721 +0900
382@@ -298,9 +298,13 @@373@@ -311,9 +311,13 @@
383 */374 */
384 375
385 /* The 2-logarithm of UNIV_PAGE_SIZE: */376 /* The 2-logarithm of UNIV_PAGE_SIZE: */
@@ -395,7 +386,7 @@
395 386
396 /* Maximum number of parallel threads in a parallelized operation */387 /* Maximum number of parallel threads in a parallelized operation */
397 #define UNIV_MAX_PARALLELISM 32388 #define UNIV_MAX_PARALLELISM 32
398@@ -419,7 +423,7 @@389@@ -432,7 +436,7 @@
399 stored part of the field in the tablespace. The length field then390 stored part of the field in the tablespace. The length field then
400 contains the sum of the following flag and the locally stored len. */391 contains the sum of the following flag and the locally stored len. */
401 392
@@ -404,7 +395,7 @@
404 395
405 /* Some macros to improve branch prediction and reduce cache misses */396 /* Some macros to improve branch prediction and reduce cache misses */
406 #if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER)397 #if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER)
407@@ -522,4 +526,6 @@398@@ -535,4 +539,6 @@
408 UNIV_MEM_ALLOC(addr, size); \399 UNIV_MEM_ALLOC(addr, size); \
409 } while (0)400 } while (0)
410 401
@@ -547,7 +538,7 @@
547diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c538diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
548--- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:55:21.384486344 +0900539--- a/storage/innobase/srv/srv0srv.c 2010-12-04 15:55:21.384486344 +0900
549+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:55:58.282550845 +0900540+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:55:58.282550845 +0900
550@@ -240,6 +240,13 @@541@@ -234,6 +234,13 @@
551 UNIV_INTERN ulint srv_n_read_io_threads = ULINT_MAX;542 UNIV_INTERN ulint srv_n_read_io_threads = ULINT_MAX;
552 UNIV_INTERN ulint srv_n_write_io_threads = ULINT_MAX;543 UNIV_INTERN ulint srv_n_write_io_threads = ULINT_MAX;
553 544
554545
=== modified file 'innodb_fix_misc.patch'
--- innodb_fix_misc.patch 2011-05-18 00:03:53 +0000
+++ innodb_fix_misc.patch 2011-06-20 09:04:39 +0000
@@ -13,7 +13,7 @@
13diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c13diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
14--- a/storage/innobase/buf/buf0buf.c 2011-02-23 19:00:48.178696354 +090014--- a/storage/innobase/buf/buf0buf.c 2011-02-23 19:00:48.178696354 +0900
15+++ b/storage/innobase/buf/buf0buf.c 2011-02-23 19:01:19.138826278 +090015+++ b/storage/innobase/buf/buf0buf.c 2011-02-23 19:01:19.138826278 +0900
16@@ -4063,6 +4063,7 @@16@@ -4061,6 +4061,7 @@
17 bpage->state = BUF_BLOCK_ZIP_PAGE;17 bpage->state = BUF_BLOCK_ZIP_PAGE;
18 bpage->space = space;18 bpage->space = space;
19 bpage->offset = offset;19 bpage->offset = offset;
@@ -102,7 +102,7 @@
102diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c102diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
103--- a/storage/innobase/fil/fil0fil.c 2011-02-23 19:00:48.223696428 +0900103--- a/storage/innobase/fil/fil0fil.c 2011-02-23 19:00:48.223696428 +0900
104+++ b/storage/innobase/fil/fil0fil.c 2011-02-23 19:01:19.147655510 +0900104+++ b/storage/innobase/fil/fil0fil.c 2011-02-23 19:01:19.147655510 +0900
105@@ -252,6 +252,7 @@105@@ -254,6 +254,7 @@
106 struct fil_system_struct {106 struct fil_system_struct {
107 #ifndef UNIV_HOTBACKUP107 #ifndef UNIV_HOTBACKUP
108 mutex_t mutex; /*!< The mutex protecting the cache */108 mutex_t mutex; /*!< The mutex protecting the cache */
@@ -110,7 +110,7 @@
110 #endif /* !UNIV_HOTBACKUP */110 #endif /* !UNIV_HOTBACKUP */
111 hash_table_t* spaces; /*!< The hash table of spaces in the111 hash_table_t* spaces; /*!< The hash table of spaces in the
112 system; they are hashed on the space112 system; they are hashed on the space
113@@ -861,7 +862,7 @@113@@ -863,7 +864,7 @@
114 ut_ad(node && system);114 ut_ad(node && system);
115 ut_ad(mutex_own(&(system->mutex)));115 ut_ad(mutex_own(&(system->mutex)));
116 ut_a(node->open);116 ut_a(node->open);
@@ -119,7 +119,7 @@
119 ut_a(node->n_pending_flushes == 0);119 ut_a(node->n_pending_flushes == 0);
120 ut_a(node->modification_counter == node->flush_counter);120 ut_a(node->modification_counter == node->flush_counter);
121 121
122@@ -874,7 +875,7 @@122@@ -876,7 +877,7 @@
123 ut_a(system->n_open > 0);123 ut_a(system->n_open > 0);
124 system->n_open--;124 system->n_open--;
125 125
@@ -128,7 +128,7 @@
128 ut_a(UT_LIST_GET_LEN(system->LRU) > 0);128 ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
129 129
130 /* The node is in the LRU list, remove it */130 /* The node is in the LRU list, remove it */
131@@ -1073,7 +1074,7 @@131@@ -1075,7 +1076,7 @@
132 ut_ad(node && system && space);132 ut_ad(node && system && space);
133 ut_ad(mutex_own(&(system->mutex)));133 ut_ad(mutex_own(&(system->mutex)));
134 ut_a(node->magic_n == FIL_NODE_MAGIC_N);134 ut_a(node->magic_n == FIL_NODE_MAGIC_N);
@@ -137,7 +137,7 @@
137 137
138 if (node->open) {138 if (node->open) {
139 /* We fool the assertion in fil_node_close_file() to think139 /* We fool the assertion in fil_node_close_file() to think
140@@ -1595,6 +1596,8 @@140@@ -1597,6 +1598,8 @@
141 141
142 mutex_create(fil_system_mutex_key,142 mutex_create(fil_system_mutex_key,
143 &fil_system->mutex, SYNC_ANY_LATCH);143 &fil_system->mutex, SYNC_ANY_LATCH);
@@ -146,7 +146,7 @@
146 146
147 fil_system->spaces = hash_create(hash_size);147 fil_system->spaces = hash_create(hash_size);
148 fil_system->name_hash = hash_create(hash_size);148 fil_system->name_hash = hash_create(hash_size);
149@@ -2341,7 +2344,11 @@149@@ -2343,7 +2346,11 @@
150 completely and permanently. The flag is_being_deleted also prevents150 completely and permanently. The flag is_being_deleted also prevents
151 fil_flush() from being applied to this tablespace. */151 fil_flush() from being applied to this tablespace. */
152 152
@@ -158,7 +158,7 @@
158 #endif158 #endif
159 /* printf("Deleting tablespace %s id %lu\n", space->name, id); */159 /* printf("Deleting tablespace %s id %lu\n", space->name, id); */
160 160
161@@ -4400,6 +4407,10 @@161@@ -4721,6 +4728,10 @@
162 ulint page_size;162 ulint page_size;
163 ibool success = TRUE;163 ibool success = TRUE;
164 164
@@ -169,7 +169,7 @@
169 fil_mutex_enter_and_prepare_for_io(space_id);169 fil_mutex_enter_and_prepare_for_io(space_id);
170 170
171 space = fil_space_get_by_id(space_id);171 space = fil_space_get_by_id(space_id);
172@@ -4411,6 +4422,7 @@172@@ -4732,6 +4743,7 @@
173 *actual_size = space->size;173 *actual_size = space->size;
174 174
175 mutex_exit(&fil_system->mutex);175 mutex_exit(&fil_system->mutex);
@@ -177,7 +177,7 @@
177 177
178 return(TRUE);178 return(TRUE);
179 }179 }
180@@ -4443,6 +4455,8 @@180@@ -4764,6 +4776,8 @@
181 offset_low = ((start_page_no - file_start_page_no)181 offset_low = ((start_page_no - file_start_page_no)
182 % (4096 * ((1024 * 1024) / page_size)))182 % (4096 * ((1024 * 1024) / page_size)))
183 * page_size;183 * page_size;
@@ -186,7 +186,7 @@
186 #ifdef UNIV_HOTBACKUP186 #ifdef UNIV_HOTBACKUP
187 success = os_file_write(node->name, node->handle, buf,187 success = os_file_write(node->name, node->handle, buf,
188 offset_low, offset_high,188 offset_low, offset_high,
189@@ -4452,8 +4466,10 @@189@@ -4773,8 +4787,10 @@
190 node->name, node->handle, buf,190 node->name, node->handle, buf,
191 offset_low, offset_high,191 offset_low, offset_high,
192 page_size * n_pages,192 page_size * n_pages,
@@ -198,7 +198,7 @@
198 if (success) {198 if (success) {
199 node->size += n_pages;199 node->size += n_pages;
200 space->size += n_pages;200 space->size += n_pages;
201@@ -4499,6 +4515,7 @@201@@ -4820,6 +4836,7 @@
202 printf("Extended %s to %lu, actual size %lu pages\n", space->name,202 printf("Extended %s to %lu, actual size %lu pages\n", space->name,
203 size_after_extend, *actual_size); */203 size_after_extend, *actual_size); */
204 mutex_exit(&fil_system->mutex);204 mutex_exit(&fil_system->mutex);
@@ -206,7 +206,7 @@
206 206
207 fil_flush(space_id);207 fil_flush(space_id);
208 208
209@@ -4861,6 +4878,22 @@209@@ -5182,6 +5199,22 @@
210 srv_data_written+= len;210 srv_data_written+= len;
211 }211 }
212 212
@@ -216,7 +216,7 @@
216+ && ((buf_page_t*)message)->space_was_being_deleted) {216+ && ((buf_page_t*)message)->space_was_being_deleted) {
217+217+
218+ if (mode == OS_AIO_NORMAL) {218+ if (mode == OS_AIO_NORMAL) {
219+ buf_page_io_complete(message, trx);219+ buf_page_io_complete(message);
220+ return(DB_SUCCESS); /*fake*/220+ return(DB_SUCCESS); /*fake*/
221+ }221+ }
222+ if (type == OS_FILE_READ) {222+ if (type == OS_FILE_READ) {
@@ -229,7 +229,7 @@
229 /* Reserve the fil_system mutex and make sure that we can open at229 /* Reserve the fil_system mutex and make sure that we can open at
230 least one file while holding it, if the file is not already open */230 least one file while holding it, if the file is not already open */
231 231
232@@ -4990,10 +5023,24 @@232@@ -5323,10 +5356,24 @@
233 #else233 #else
234 /* Queue the aio request */234 /* Queue the aio request */
235 ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,235 ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
@@ -255,7 +255,7 @@
255 ut_a(ret);255 ut_a(ret);
256 256
257 if (mode == OS_AIO_SYNC) {257 if (mode == OS_AIO_SYNC) {
258@@ -5093,6 +5140,7 @@258@@ -5426,6 +5473,7 @@
259 fil_node_t* fil_node;259 fil_node_t* fil_node;
260 void* message;260 void* message;
261 ulint type;261 ulint type;
@@ -263,7 +263,7 @@
263 263
264 ut_ad(fil_validate_skip());264 ut_ad(fil_validate_skip());
265 265
266@@ -5100,10 +5148,10 @@266@@ -5433,10 +5481,10 @@
267 srv_set_io_thread_op_info(segment, "native aio handle");267 srv_set_io_thread_op_info(segment, "native aio handle");
268 #ifdef WIN_ASYNC_IO268 #ifdef WIN_ASYNC_IO
269 ret = os_aio_windows_handle(segment, 0, &fil_node,269 ret = os_aio_windows_handle(segment, 0, &fil_node,
@@ -274,9 +274,9 @@
274- &message, &type);274- &message, &type);
275+ &message, &type, &space_id);275+ &message, &type, &space_id);
276 #else276 #else
277 ut_error;
277 ret = 0; /* Eliminate compiler warning */278 ret = 0; /* Eliminate compiler warning */
278 ut_error;279@@ -5445,7 +5493,22 @@
279@@ -5112,7 +5160,22 @@
280 srv_set_io_thread_op_info(segment, "simulated aio handle");280 srv_set_io_thread_op_info(segment, "simulated aio handle");
281 281
282 ret = os_aio_simulated_handle(segment, &fil_node,282 ret = os_aio_simulated_handle(segment, &fil_node,
@@ -295,7 +295,7 @@
295+ || buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE);295+ || buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE);
296+296+
297+ srv_set_io_thread_op_info(segment, "complete io for buf page");297+ srv_set_io_thread_op_info(segment, "complete io for buf page");
298+ buf_page_io_complete(message, NULL);298+ buf_page_io_complete(message);
299+ return;299+ return;
300 }300 }
301 301
@@ -303,7 +303,7 @@
303diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc303diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
304--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:13.035513990 +0900304--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:13.035513990 +0900
305+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:53.084513775 +0900305+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:53.084513775 +0900
306@@ -11999,6 +11999,12 @@306@@ -12007,6 +12007,12 @@
307 "except for the deletion.",307 "except for the deletion.",
308 NULL, NULL, 0, &corrupt_table_action_typelib);308 NULL, NULL, 0, &corrupt_table_action_typelib);
309 309
@@ -316,7 +316,7 @@
316 static struct st_mysql_sys_var* innobase_system_variables[]= {316 static struct st_mysql_sys_var* innobase_system_variables[]= {
317 MYSQL_SYSVAR(page_size),317 MYSQL_SYSVAR(page_size),
318 MYSQL_SYSVAR(log_block_size),318 MYSQL_SYSVAR(log_block_size),
319@@ -12089,6 +12095,7 @@319@@ -12097,6 +12103,7 @@
320 MYSQL_SYSVAR(purge_batch_size),320 MYSQL_SYSVAR(purge_batch_size),
321 MYSQL_SYSVAR(rollback_segments),321 MYSQL_SYSVAR(rollback_segments),
322 MYSQL_SYSVAR(corrupt_table_action),322 MYSQL_SYSVAR(corrupt_table_action),
@@ -324,7 +324,7 @@
324 NULL324 NULL
325 };325 };
326 326
327@@ -12098,7 +12105,7 @@327@@ -12106,7 +12113,7 @@
328 &innobase_storage_engine,328 &innobase_storage_engine,
329 innobase_hton_name,329 innobase_hton_name,
330 plugin_author,330 plugin_author,
@@ -336,7 +336,7 @@
336diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h336diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
337--- a/storage/innobase/include/buf0buf.h 2011-02-23 19:00:48.252696774 +0900337--- a/storage/innobase/include/buf0buf.h 2011-02-23 19:00:48.252696774 +0900
338+++ b/storage/innobase/include/buf0buf.h 2011-02-23 19:01:19.182655902 +0900338+++ b/storage/innobase/include/buf0buf.h 2011-02-23 19:01:19.182655902 +0900
339@@ -1439,6 +1439,7 @@339@@ -1438,6 +1438,7 @@
340 0 if the block was never accessed340 0 if the block was never accessed
341 in the buffer pool */341 in the buffer pool */
342 /* @} */342 /* @} */
@@ -468,7 +468,7 @@
468diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h468diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
469--- a/storage/innobase/include/srv0srv.h 2011-02-23 19:00:48.212625715 +0900469--- a/storage/innobase/include/srv0srv.h 2011-02-23 19:00:48.212625715 +0900
470+++ b/storage/innobase/include/srv0srv.h 2011-02-23 19:01:19.193655990 +0900470+++ b/storage/innobase/include/srv0srv.h 2011-02-23 19:01:19.193655990 +0900
471@@ -247,6 +247,8 @@471@@ -244,6 +244,8 @@
472 extern ulint srv_pass_corrupt_table;472 extern ulint srv_pass_corrupt_table;
473 473
474 extern ulint srv_dict_size_limit;474 extern ulint srv_dict_size_limit;
@@ -480,7 +480,7 @@
480diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h480diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
481--- a/storage/innobase/include/sync0sync.h 2011-02-23 19:00:47.875625940 +0900481--- a/storage/innobase/include/sync0sync.h 2011-02-23 19:00:47.875625940 +0900
482+++ b/storage/innobase/include/sync0sync.h 2011-02-23 19:01:19.195703856 +0900482+++ b/storage/innobase/include/sync0sync.h 2011-02-23 19:01:19.195703856 +0900
483@@ -682,6 +682,7 @@483@@ -691,6 +691,7 @@
484 #define SYNC_BUF_POOL 150 /* Buffer pool mutex */484 #define SYNC_BUF_POOL 150 /* Buffer pool mutex */
485 #define SYNC_BUF_FLUSH_LIST 145 /* Buffer flush list mutex */485 #define SYNC_BUF_FLUSH_LIST 145 /* Buffer flush list mutex */
486 #define SYNC_DOUBLEWRITE 140486 #define SYNC_DOUBLEWRITE 140
@@ -493,7 +493,7 @@
493+++ b/storage/innobase/include/univ.i 2010-12-04 15:57:53.091592933 +0900493+++ b/storage/innobase/include/univ.i 2010-12-04 15:57:53.091592933 +0900
494@@ -53,6 +53,11 @@494@@ -53,6 +53,11 @@
495 #define INNODB_VERSION_MINOR 1495 #define INNODB_VERSION_MINOR 1
496 #define INNODB_VERSION_BUGFIX 6496 #define INNODB_VERSION_BUGFIX 7
497 497
498+#ifndef PERCONA_INNODB_VERSION498+#ifndef PERCONA_INNODB_VERSION
499+#define PERCONA_INNODB_VERSION 20.1499+#define PERCONA_INNODB_VERSION 20.1
@@ -550,7 +550,7 @@
550 trx_t* trx)550 trx_t* trx)
551 {551 {
552 os_aio_array_t* array;552 os_aio_array_t* array;
553@@ -4137,7 +4141,7 @@553@@ -4139,7 +4143,7 @@
554 trx->io_read += n;554 trx->io_read += n;
555 }555 }
556 slot = os_aio_array_reserve_slot(type, array, message1, message2, file,556 slot = os_aio_array_reserve_slot(type, array, message1, message2, file,
@@ -559,7 +559,7 @@
559 if (type == OS_FILE_READ) {559 if (type == OS_FILE_READ) {
560 if (srv_use_native_aio) {560 if (srv_use_native_aio) {
561 os_n_file_reads++;561 os_n_file_reads++;
562@@ -4256,7 +4260,8 @@562@@ -4258,7 +4262,8 @@
563 parameters are valid and can be used to563 parameters are valid and can be used to
564 restart the operation, for example */564 restart the operation, for example */
565 void** message2,565 void** message2,
@@ -569,7 +569,7 @@
569 {569 {
570 ulint orig_seg = segment;570 ulint orig_seg = segment;
571 os_aio_array_t* array;571 os_aio_array_t* array;
572@@ -4329,6 +4334,7 @@572@@ -4337,6 +4342,7 @@
573 *message2 = slot->message2;573 *message2 = slot->message2;
574 574
575 *type = slot->type;575 *type = slot->type;
@@ -577,7 +577,7 @@
577 577
578 if (ret && len == slot->len) {578 if (ret && len == slot->len) {
579 ret_val = TRUE;579 ret_val = TRUE;
580@@ -4569,7 +4575,8 @@580@@ -4565,7 +4571,8 @@
581 aio operation failed, these output581 aio operation failed, these output
582 parameters are valid and can be used to582 parameters are valid and can be used to
583 restart the operation. */583 restart the operation. */
@@ -587,7 +587,7 @@
587 {587 {
588 ulint segment;588 ulint segment;
589 os_aio_array_t* array;589 os_aio_array_t* array;
590@@ -4627,6 +4634,7 @@590@@ -4638,6 +4645,7 @@
591 *message2 = slot->message2;591 *message2 = slot->message2;
592 592
593 *type = slot->type;593 *type = slot->type;
@@ -595,7 +595,7 @@
595 595
596 if ((slot->ret == 0) && (slot->n_bytes == (long)slot->len)) {596 if ((slot->ret == 0) && (slot->n_bytes == (long)slot->len)) {
597 ret = TRUE;597 ret = TRUE;
598@@ -4680,7 +4688,8 @@598@@ -4691,7 +4699,8 @@
599 parameters are valid and can be used to599 parameters are valid and can be used to
600 restart the operation, for example */600 restart the operation, for example */
601 void** message2,601 void** message2,
@@ -605,7 +605,7 @@
605 {605 {
606 os_aio_array_t* array;606 os_aio_array_t* array;
607 ulint segment;607 ulint segment;
608@@ -4958,6 +4967,7 @@608@@ -4987,6 +4996,7 @@
609 *message2 = slot->message2;609 *message2 = slot->message2;
610 610
611 *type = slot->type;611 *type = slot->type;
@@ -624,7 +624,7 @@
624 624
625 /** Provide optional 4.x backwards compatibility for 5.0 and above */625 /** Provide optional 4.x backwards compatibility for 5.0 and above */
626 UNIV_INTERN ibool row_rollback_on_timeout = FALSE;626 UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
627@@ -1194,6 +1195,13 @@627@@ -1191,6 +1192,13 @@
628 628
629 thr = que_fork_get_first_thr(prebuilt->ins_graph);629 thr = que_fork_get_first_thr(prebuilt->ins_graph);
630 630
@@ -649,7 +649,7 @@
649 649
650 rec_offs_init(offsets_);650 rec_offs_init(offsets_);
651 651
652@@ -3732,6 +3733,17 @@652@@ -3737,6 +3738,17 @@
653 653
654 /* Do some start-of-statement preparations */654 /* Do some start-of-statement preparations */
655 655
@@ -667,7 +667,7 @@
667 if (!prebuilt->sql_stat_start) {667 if (!prebuilt->sql_stat_start) {
668 /* No need to set an intention lock or assign a read view */668 /* No need to set an intention lock or assign a read view */
669 669
670@@ -3742,6 +3754,18 @@670@@ -3747,6 +3759,18 @@
671 " perform a consistent read\n"671 " perform a consistent read\n"
672 "InnoDB: but the read view is not assigned!\n",672 "InnoDB: but the read view is not assigned!\n",
673 stderr);673 stderr);
@@ -689,7 +689,7 @@
689diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c689diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
690--- a/storage/innobase/srv/srv0srv.c 2011-02-23 19:00:48.283695497 +0900690--- a/storage/innobase/srv/srv0srv.c 2011-02-23 19:00:48.283695497 +0900
691+++ b/storage/innobase/srv/srv0srv.c 2011-02-23 19:01:19.204696643 +0900691+++ b/storage/innobase/srv/srv0srv.c 2011-02-23 19:01:19.204696643 +0900
692@@ -447,6 +447,8 @@692@@ -441,6 +441,8 @@
693 UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */693 UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
694 694
695 UNIV_INTERN ulint srv_dict_size_limit = 0;695 UNIV_INTERN ulint srv_dict_size_limit = 0;
@@ -713,7 +713,7 @@
713diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c713diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
714--- a/storage/innobase/sync/sync0sync.c 2011-02-25 14:18:55.817202060 +0900714--- a/storage/innobase/sync/sync0sync.c 2011-02-25 14:18:55.817202060 +0900
715+++ b/storage/innobase/sync/sync0sync.c 2011-02-25 14:19:44.596202017 +0900715+++ b/storage/innobase/sync/sync0sync.c 2011-02-25 14:19:44.596202017 +0900
716@@ -1175,6 +1175,7 @@716@@ -1220,6 +1220,7 @@
717 case SYNC_LOG_FLUSH_ORDER:717 case SYNC_LOG_FLUSH_ORDER:
718 case SYNC_THR_LOCAL:718 case SYNC_THR_LOCAL:
719 case SYNC_ANY_LATCH:719 case SYNC_ANY_LATCH:
720720
=== modified file 'innodb_io_patches.patch'
--- innodb_io_patches.patch 2011-05-10 11:57:42 +0000
+++ innodb_io_patches.patch 2011-06-20 09:04:39 +0000
@@ -84,7 +84,7 @@
84 /********************************************************************//**84 /********************************************************************//**
85 Obtain the InnoDB transaction of a MySQL thread.85 Obtain the InnoDB transaction of a MySQL thread.
86 @return reference to transaction pointer */86 @return reference to transaction pointer */
87@@ -2423,6 +2440,9 @@87@@ -2437,6 +2454,9 @@
88 srv_n_read_io_threads = (ulint) innobase_read_io_threads;88 srv_n_read_io_threads = (ulint) innobase_read_io_threads;
89 srv_n_write_io_threads = (ulint) innobase_write_io_threads;89 srv_n_write_io_threads = (ulint) innobase_write_io_threads;
90 90
@@ -94,7 +94,7 @@
94 srv_force_recovery = (ulint) innobase_force_recovery;94 srv_force_recovery = (ulint) innobase_force_recovery;
95 95
96 srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;96 srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
97@@ -11018,7 +11038,7 @@97@@ -11025,7 +11045,7 @@
98 PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,98 PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
99 "Purge threads can be either 0 or 1.",99 "Purge threads can be either 0 or 1.",
100 NULL, NULL,100 NULL, NULL,
@@ -103,7 +103,7 @@
103 0, /* Minimum value */103 0, /* Minimum value */
104 1, 0); /* Maximum value */104 1, 0); /* Maximum value */
105 105
106@@ -11060,12 +11080,18 @@106@@ -11067,12 +11087,18 @@
107 innodb_file_format_max_validate,107 innodb_file_format_max_validate,
108 innodb_file_format_max_update, "Antelope");108 innodb_file_format_max_update, "Antelope");
109 109
@@ -128,7 +128,7 @@
128 128
129 static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,129 static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,
130 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,130 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
131@@ -11160,7 +11186,7 @@131@@ -11167,7 +11193,7 @@
132 static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,132 static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
133 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,133 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
134 "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",134 "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
@@ -137,7 +137,7 @@
137 137
138 static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,138 static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
139 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,139 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
140@@ -11312,6 +11338,95 @@140@@ -11319,6 +11345,95 @@
141 "trigger a readahead.",141 "trigger a readahead.",
142 NULL, NULL, 56, 0, 64, 0);142 NULL, NULL, 56, 0, 64, 0);
143 143
@@ -233,7 +233,7 @@
233 static struct st_mysql_sys_var* innobase_system_variables[]= {233 static struct st_mysql_sys_var* innobase_system_variables[]= {
234 MYSQL_SYSVAR(additional_mem_pool_size),234 MYSQL_SYSVAR(additional_mem_pool_size),
235 MYSQL_SYSVAR(autoextend_increment),235 MYSQL_SYSVAR(autoextend_increment),
236@@ -11332,6 +11447,7 @@236@@ -11339,6 +11454,7 @@
237 MYSQL_SYSVAR(file_format_check),237 MYSQL_SYSVAR(file_format_check),
238 MYSQL_SYSVAR(file_format_max),238 MYSQL_SYSVAR(file_format_max),
239 MYSQL_SYSVAR(flush_log_at_trx_commit),239 MYSQL_SYSVAR(flush_log_at_trx_commit),
@@ -241,7 +241,7 @@
241 MYSQL_SYSVAR(flush_method),241 MYSQL_SYSVAR(flush_method),
242 MYSQL_SYSVAR(force_recovery),242 MYSQL_SYSVAR(force_recovery),
243 MYSQL_SYSVAR(locks_unsafe_for_binlog),243 MYSQL_SYSVAR(locks_unsafe_for_binlog),
244@@ -11369,6 +11485,13 @@244@@ -11376,6 +11492,13 @@
245 MYSQL_SYSVAR(show_verbose_locks),245 MYSQL_SYSVAR(show_verbose_locks),
246 MYSQL_SYSVAR(show_locks_held),246 MYSQL_SYSVAR(show_locks_held),
247 MYSQL_SYSVAR(version),247 MYSQL_SYSVAR(version),
@@ -271,7 +271,7 @@
271 271
272 mutex_create(ibuf_pessimistic_insert_mutex_key,272 mutex_create(ibuf_pessimistic_insert_mutex_key,
273 &ibuf_pessimistic_insert_mutex,273 &ibuf_pessimistic_insert_mutex,
274@@ -2764,9 +2766,11 @@274@@ -2753,9 +2755,11 @@
275 size = ibuf->size;275 size = ibuf->size;
276 max_size = ibuf->max_size;276 max_size = ibuf->max_size;
277 277
@@ -299,7 +299,7 @@
299diff -ruN a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h299diff -ruN a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
300--- a/storage/innobase/include/ha_prototypes.h 2010-11-03 07:01:13.000000000 +0900300--- a/storage/innobase/include/ha_prototypes.h 2010-11-03 07:01:13.000000000 +0900
301+++ b/storage/innobase/include/ha_prototypes.h 2010-12-03 15:10:09.078026360 +0900301+++ b/storage/innobase/include/ha_prototypes.h 2010-12-03 15:10:09.078026360 +0900
302@@ -284,5 +284,12 @@302@@ -284,6 +284,13 @@
303 /*===================*/303 /*===================*/
304 void* thd, /*!< in: thread handle (THD*) */304 void* thd, /*!< in: thread handle (THD*) */
305 ulint value); /*!< in: time waited for the lock */305 ulint value); /*!< in: time waited for the lock */
@@ -311,11 +311,12 @@
311+/*================================*/311+/*================================*/
312+ void* thd);312+ void* thd);
313 313
314 #endif314 /**********************************************************************//**
315 Get the current setting of the lower_case_table_names global parameter from
315diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h316diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
316--- a/storage/innobase/include/srv0srv.h 2010-12-03 15:09:51.291955835 +0900317--- a/storage/innobase/include/srv0srv.h 2010-12-03 15:09:51.291955835 +0900
317+++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:10:09.079029047 +0900318+++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:10:09.079029047 +0900
318@@ -141,7 +141,8 @@319@@ -138,7 +138,8 @@
319 extern ulint srv_n_log_files;320 extern ulint srv_n_log_files;
320 extern ulint srv_log_file_size;321 extern ulint srv_log_file_size;
321 extern ulint srv_log_buffer_size;322 extern ulint srv_log_buffer_size;
@@ -325,7 +326,7 @@
325 extern char srv_adaptive_flushing;326 extern char srv_adaptive_flushing;
326 327
327 328
328@@ -219,6 +220,16 @@329@@ -216,6 +217,16 @@
329 extern ulong srv_max_purge_lag;330 extern ulong srv_max_purge_lag;
330 331
331 extern ulong srv_replication_delay;332 extern ulong srv_replication_delay;
@@ -342,7 +343,7 @@
342 /*-------------------------------------------*/343 /*-------------------------------------------*/
343 344
344 extern ulint srv_n_rows_inserted;345 extern ulint srv_n_rows_inserted;
345@@ -397,8 +408,9 @@346@@ -394,8 +405,9 @@
346 when writing data files, but do flush347 when writing data files, but do flush
347 after writing to log files */348 after writing to log files */
348 SRV_UNIX_NOSYNC, /*!< do not flush after writing */349 SRV_UNIX_NOSYNC, /*!< do not flush after writing */
@@ -540,7 +541,7 @@
540diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c541diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
541--- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:09:51.301987792 +0900542--- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:09:51.301987792 +0900
542+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:13:29.369986988 +0900543+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:13:29.369986988 +0900
543@@ -189,7 +189,8 @@544@@ -183,7 +183,8 @@
544 UNIV_INTERN ulint srv_log_file_size = ULINT_MAX;545 UNIV_INTERN ulint srv_log_file_size = ULINT_MAX;
545 /* size in database pages */546 /* size in database pages */
546 UNIV_INTERN ulint srv_log_buffer_size = ULINT_MAX;547 UNIV_INTERN ulint srv_log_buffer_size = ULINT_MAX;
@@ -550,7 +551,7 @@
550 551
551 /* Try to flush dirty pages so as to avoid IO bursts at552 /* Try to flush dirty pages so as to avoid IO bursts at
552 the checkpoints. */553 the checkpoints. */
553@@ -408,6 +409,17 @@554@@ -402,6 +403,17 @@
554 555
555 UNIV_INTERN ulong srv_replication_delay = 0;556 UNIV_INTERN ulong srv_replication_delay = 0;
556 557
@@ -568,7 +569,7 @@
568 /*-------------------------------------------*/569 /*-------------------------------------------*/
569 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;570 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
570 UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;571 UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
571@@ -2733,6 +2745,7 @@572@@ -2742,6 +2754,7 @@
572 ulint n_pages_purged = 0;573 ulint n_pages_purged = 0;
573 ulint n_bytes_merged;574 ulint n_bytes_merged;
574 ulint n_pages_flushed;575 ulint n_pages_flushed;
@@ -576,7 +577,7 @@
576 ulint n_bytes_archived;577 ulint n_bytes_archived;
577 ulint n_tables_to_drop;578 ulint n_tables_to_drop;
578 ulint n_ios;579 ulint n_ios;
579@@ -2740,7 +2753,20 @@580@@ -2749,7 +2762,20 @@
580 ulint n_ios_very_old;581 ulint n_ios_very_old;
581 ulint n_pend_ios;582 ulint n_pend_ios;
582 ulint next_itr_time;583 ulint next_itr_time;
@@ -597,7 +598,7 @@
597 598
598 #ifdef UNIV_DEBUG_THREAD_CREATION599 #ifdef UNIV_DEBUG_THREAD_CREATION
599 fprintf(stderr, "Master thread starts, id %lu\n",600 fprintf(stderr, "Master thread starts, id %lu\n",
600@@ -2762,6 +2788,9 @@601@@ -2771,6 +2797,9 @@
601 602
602 mutex_exit(&kernel_mutex);603 mutex_exit(&kernel_mutex);
603 604
@@ -607,7 +608,7 @@
607 loop:608 loop:
608 /*****************************************************************/609 /*****************************************************************/
609 /* ---- When there is database activity by users, we cycle in this610 /* ---- When there is database activity by users, we cycle in this
610@@ -2792,9 +2821,13 @@611@@ -2801,9 +2830,13 @@
611 /* Sleep for 1 second on entrying the for loop below the first time. */612 /* Sleep for 1 second on entrying the for loop below the first time. */
612 next_itr_time = ut_time_ms() + 1000;613 next_itr_time = ut_time_ms() + 1000;
613 614
@@ -621,7 +622,7 @@
621 /* ALTER TABLE in MySQL requires on Unix that the table handler622 /* ALTER TABLE in MySQL requires on Unix that the table handler
622 can drop tables lazily after there no longer are SELECT623 can drop tables lazily after there no longer are SELECT
623 queries to them. */624 queries to them. */
624@@ -2818,6 +2851,7 @@625@@ -2827,6 +2860,7 @@
625 srv_main_thread_op_info = "sleeping";626 srv_main_thread_op_info = "sleeping";
626 srv_main_1_second_loops++;627 srv_main_1_second_loops++;
627 628
@@ -629,7 +630,7 @@
629 if (next_itr_time > cur_time630 if (next_itr_time > cur_time
630 && srv_shutdown_state == SRV_SHUTDOWN_NONE) {631 && srv_shutdown_state == SRV_SHUTDOWN_NONE) {
631 632
632@@ -2828,10 +2862,26 @@633@@ -2837,10 +2871,26 @@
633 (next_itr_time - cur_time)634 (next_itr_time - cur_time)
634 * 1000));635 * 1000));
635 srv_main_sleeps++;636 srv_main_sleeps++;
@@ -656,7 +657,7 @@
656 657
657 /* Flush logs if needed */658 /* Flush logs if needed */
658 srv_sync_log_buffer_in_background();659 srv_sync_log_buffer_in_background();
659@@ -2851,7 +2901,7 @@660@@ -2860,7 +2910,7 @@
660 if (n_pend_ios < SRV_PEND_IO_THRESHOLD661 if (n_pend_ios < SRV_PEND_IO_THRESHOLD
661 && (n_ios - n_ios_old < SRV_RECENT_IO_ACTIVITY)) {662 && (n_ios - n_ios_old < SRV_RECENT_IO_ACTIVITY)) {
662 srv_main_thread_op_info = "doing insert buffer merge";663 srv_main_thread_op_info = "doing insert buffer merge";
@@ -665,7 +666,7 @@
665 666
666 /* Flush logs if needed */667 /* Flush logs if needed */
667 srv_sync_log_buffer_in_background();668 srv_sync_log_buffer_in_background();
668@@ -2868,7 +2918,11 @@669@@ -2877,7 +2927,11 @@
669 n_pages_flushed = buf_flush_list(670 n_pages_flushed = buf_flush_list(
670 PCT_IO(100), IB_ULONGLONG_MAX);671 PCT_IO(100), IB_ULONGLONG_MAX);
671 672
@@ -678,7 +679,7 @@
678 679
679 /* Try to keep the rate of flushing of dirty680 /* Try to keep the rate of flushing of dirty
680 pages such that redo log generation does not681 pages such that redo log generation does not
681@@ -2884,6 +2938,224 @@682@@ -2893,6 +2947,224 @@
682 n_flush,683 n_flush,
683 IB_ULONGLONG_MAX);684 IB_ULONGLONG_MAX);
684 }685 }
@@ -903,7 +904,7 @@
903 }904 }
904 905
905 if (srv_activity_count == old_activity_count) {906 if (srv_activity_count == old_activity_count) {
906@@ -2932,7 +3204,7 @@907@@ -2941,7 +3213,7 @@
907 even if the server were active */908 even if the server were active */
908 909
909 srv_main_thread_op_info = "doing insert buffer merge";910 srv_main_thread_op_info = "doing insert buffer merge";
@@ -912,7 +913,7 @@
912 913
913 /* Flush logs if needed */914 /* Flush logs if needed */
914 srv_sync_log_buffer_in_background();915 srv_sync_log_buffer_in_background();
915@@ -3040,7 +3312,7 @@916@@ -3049,7 +3321,7 @@
916 buf_flush_list below. Otherwise, the system favors917 buf_flush_list below. Otherwise, the system favors
917 clean pages over cleanup throughput. */918 clean pages over cleanup throughput. */
918 n_bytes_merged = ibuf_contract_for_n_pages(FALSE,919 n_bytes_merged = ibuf_contract_for_n_pages(FALSE,
@@ -921,7 +922,7 @@
921 }922 }
922 923
923 srv_main_thread_op_info = "reserving kernel mutex";924 srv_main_thread_op_info = "reserving kernel mutex";
924@@ -3184,6 +3456,7 @@925@@ -3189,6 +3461,7 @@
925 srv_slot_t* slot;926 srv_slot_t* slot;
926 ulint retries = 0;927 ulint retries = 0;
927 ulint n_total_purged = ULINT_UNDEFINED;928 ulint n_total_purged = ULINT_UNDEFINED;
@@ -929,7 +930,7 @@
929 930
930 ut_a(srv_n_purge_threads == 1);931 ut_a(srv_n_purge_threads == 1);
931 932
932@@ -3204,9 +3477,12 @@933@@ -3209,9 +3482,12 @@
933 934
934 mutex_exit(&kernel_mutex);935 mutex_exit(&kernel_mutex);
935 936
@@ -942,7 +943,7 @@
942 943
943 /* If there are very few records to purge or the last944 /* If there are very few records to purge or the last
944 purge didn't purge any records then wait for activity.945 purge didn't purge any records then wait for activity.
945@@ -3253,6 +3529,16 @@946@@ -3258,6 +3534,16 @@
946 } while (n_pages_purged > 0 && !srv_fast_shutdown);947 } while (n_pages_purged > 0 && !srv_fast_shutdown);
947 948
948 srv_sync_log_buffer_in_background();949 srv_sync_log_buffer_in_background();
@@ -991,7 +992,7 @@
991diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c992diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
992--- a/storage/innobase/trx/trx0trx.c 2010-11-03 07:01:13.000000000 +0900993--- a/storage/innobase/trx/trx0trx.c 2010-11-03 07:01:13.000000000 +0900
993+++ b/storage/innobase/trx/trx0trx.c 2010-12-03 15:10:09.106023937 +0900994+++ b/storage/innobase/trx/trx0trx.c 2010-12-03 15:10:09.106023937 +0900
994@@ -924,6 +924,7 @@995@@ -984,6 +984,7 @@
995 trx->read_view = NULL;996 trx->read_view = NULL;
996 997
997 if (lsn) {998 if (lsn) {
@@ -999,7 +1000,7 @@
999 1000
1000 mutex_exit(&kernel_mutex);1001 mutex_exit(&kernel_mutex);
1001 1002
1002@@ -932,6 +933,12 @@1003@@ -992,6 +993,12 @@
1003 trx_undo_insert_cleanup(trx);1004 trx_undo_insert_cleanup(trx);
1004 }1005 }
1005 1006
@@ -1012,7 +1013,7 @@
1012 /* NOTE that we could possibly make a group commit more1013 /* NOTE that we could possibly make a group commit more
1013 efficient here: call os_thread_yield here to allow also other1014 efficient here: call os_thread_yield here to allow also other
1014 trxs to come to commit! */1015 trxs to come to commit! */
1015@@ -963,9 +970,9 @@1016@@ -1023,9 +1030,9 @@
1016 if (trx->flush_log_later) {1017 if (trx->flush_log_later) {
1017 /* Do nothing yet */1018 /* Do nothing yet */
1018 trx->must_flush_log_later = TRUE;1019 trx->must_flush_log_later = TRUE;
@@ -1024,7 +1025,7 @@
1024 if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {1025 if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
1025 /* Write the log but do not flush it to disk */1026 /* Write the log but do not flush it to disk */
1026 1027
1027@@ -977,7 +984,7 @@1028@@ -1037,7 +1044,7 @@
1028 1029
1029 log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);1030 log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
1030 }1031 }
@@ -1033,7 +1034,7 @@
1033 1034
1034 /* Write the log but do not flush it to disk */1035 /* Write the log but do not flush it to disk */
1035 1036
1036@@ -1641,16 +1648,23 @@1037@@ -1701,16 +1708,23 @@
1037 trx_t* trx) /*!< in: trx handle */1038 trx_t* trx) /*!< in: trx handle */
1038 {1039 {
1039 ib_uint64_t lsn = trx->commit_lsn;1040 ib_uint64_t lsn = trx->commit_lsn;
@@ -1059,7 +1060,7 @@
1059 if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {1060 if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
1060 /* Write the log but do not flush it to disk */1061 /* Write the log but do not flush it to disk */
1061 1062
1062@@ -1661,7 +1675,7 @@1063@@ -1721,7 +1735,7 @@
1063 1064
1064 log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);1065 log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
1065 }1066 }
@@ -1068,7 +1069,7 @@
1068 1069
1069 /* Write the log but do not flush it to disk */1070 /* Write the log but do not flush it to disk */
1070 1071
1071@@ -1914,6 +1928,8 @@1072@@ -1969,6 +1983,8 @@
1072 /*--------------------------------------*/1073 /*--------------------------------------*/
1073 1074
1074 if (lsn) {1075 if (lsn) {
@@ -1077,7 +1078,7 @@
1077 /* Depending on the my.cnf options, we may now write the log1078 /* Depending on the my.cnf options, we may now write the log
1078 buffer to the log files, making the prepared state of the1079 buffer to the log files, making the prepared state of the
1079 transaction durable if the OS does not crash. We may also1080 transaction durable if the OS does not crash. We may also
1080@@ -1933,9 +1949,15 @@1081@@ -1988,9 +2004,15 @@
1081 1082
1082 mutex_exit(&kernel_mutex);1083 mutex_exit(&kernel_mutex);
1083 1084
@@ -1095,7 +1096,7 @@
1095 if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {1096 if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
1096 /* Write the log but do not flush it to disk */1097 /* Write the log but do not flush it to disk */
1097 1098
1098@@ -1947,7 +1969,7 @@1099@@ -2002,7 +2024,7 @@
1099 1100
1100 log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);1101 log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
1101 }1102 }
11021103
=== modified file 'innodb_lru_dump_restore.patch'
--- innodb_lru_dump_restore.patch 2011-05-10 11:57:42 +0000
+++ innodb_lru_dump_restore.patch 2011-06-20 09:04:39 +0000
@@ -8,7 +8,7 @@
8diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c8diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
9--- a/storage/innobase/buf/buf0lru.c 2010-12-03 15:49:59.185023424 +09009--- a/storage/innobase/buf/buf0lru.c 2010-12-03 15:49:59.185023424 +0900
10+++ b/storage/innobase/buf/buf0lru.c 2010-12-04 15:33:37.626482350 +090010+++ b/storage/innobase/buf/buf0lru.c 2010-12-04 15:33:37.626482350 +0900
11@@ -2245,6 +2245,284 @@11@@ -2247,6 +2247,284 @@
12 memset(&buf_LRU_stat_cur, 0, sizeof buf_LRU_stat_cur);12 memset(&buf_LRU_stat_cur, 0, sizeof buf_LRU_stat_cur);
13 }13 }
14 14
@@ -308,7 +308,7 @@
308diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c308diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
309--- a/storage/innobase/fil/fil0fil.c 2010-12-03 17:49:11.581025127 +0900309--- a/storage/innobase/fil/fil0fil.c 2010-12-03 17:49:11.581025127 +0900
310+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:33:37.632482885 +0900310+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:33:37.632482885 +0900
311@@ -4965,6 +4965,70 @@311@@ -5289,6 +5289,70 @@
312 return(DB_SUCCESS);312 return(DB_SUCCESS);
313 }313 }
314 314
@@ -382,7 +382,7 @@
382diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc382diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
383--- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:49:11.589956135 +0900383--- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:49:11.589956135 +0900
384+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:33:37.645555490 +0900384+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:33:37.645555490 +0900
385@@ -11786,6 +11786,12 @@385@@ -11793,6 +11793,12 @@
386 "Limit the allocated memory for dictionary cache. (0: unlimited)",386 "Limit the allocated memory for dictionary cache. (0: unlimited)",
387 NULL, NULL, 0, 0, LONG_MAX, 0);387 NULL, NULL, 0, 0, LONG_MAX, 0);
388 388
@@ -395,7 +395,7 @@
395 static struct st_mysql_sys_var* innobase_system_variables[]= {395 static struct st_mysql_sys_var* innobase_system_variables[]= {
396 MYSQL_SYSVAR(additional_mem_pool_size),396 MYSQL_SYSVAR(additional_mem_pool_size),
397 MYSQL_SYSVAR(autoextend_increment),397 MYSQL_SYSVAR(autoextend_increment),
398@@ -11867,6 +11873,7 @@398@@ -11874,6 +11880,7 @@
399 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */399 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
400 MYSQL_SYSVAR(read_ahead_threshold),400 MYSQL_SYSVAR(read_ahead_threshold),
401 MYSQL_SYSVAR(io_capacity),401 MYSQL_SYSVAR(io_capacity),
@@ -535,7 +535,7 @@
535diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h535diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
536--- a/storage/innobase/include/srv0srv.h 2010-12-03 17:49:11.603969747 +0900536--- a/storage/innobase/include/srv0srv.h 2010-12-03 17:49:11.603969747 +0900
537+++ b/storage/innobase/include/srv0srv.h 2010-12-04 15:33:37.685550816 +0900537+++ b/storage/innobase/include/srv0srv.h 2010-12-04 15:33:37.685550816 +0900
538@@ -359,6 +359,9 @@538@@ -356,6 +356,9 @@
539 reading of a disk page */539 reading of a disk page */
540 extern ulint srv_buf_pool_reads;540 extern ulint srv_buf_pool_reads;
541 541
@@ -545,7 +545,7 @@
545 /** Status variables to be passed to MySQL */545 /** Status variables to be passed to MySQL */
546 typedef struct export_var_struct export_struc;546 typedef struct export_var_struct export_struc;
547 547
548@@ -664,6 +667,16 @@548@@ -661,6 +664,16 @@
549 /*=====================*/549 /*=====================*/
550 void* arg); /*!< in: a dummy parameter required by550 void* arg); /*!< in: a dummy parameter required by
551 os_thread_create */551 os_thread_create */
@@ -565,7 +565,7 @@
565diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c565diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
566--- a/storage/innobase/srv/srv0srv.c 2010-12-03 17:49:11.620986661 +0900566--- a/storage/innobase/srv/srv0srv.c 2010-12-03 17:49:11.620986661 +0900
567+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:33:37.708550811 +0900567+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 15:33:37.708550811 +0900
568@@ -336,6 +336,9 @@568@@ -330,6 +330,9 @@
569 reading of a disk page */569 reading of a disk page */
570 UNIV_INTERN ulint srv_buf_pool_reads = 0;570 UNIV_INTERN ulint srv_buf_pool_reads = 0;
571 571
@@ -575,7 +575,7 @@
575 /* structure to pass status variables to MySQL */575 /* structure to pass status variables to MySQL */
576 UNIV_INTERN export_struc export_vars;576 UNIV_INTERN export_struc export_vars;
577 577
578@@ -2691,6 +2694,56 @@578@@ -2701,6 +2704,56 @@
579 /* We count the number of threads in os_thread_exit(). A created579 /* We count the number of threads in os_thread_exit(). A created
580 thread should always use that to exit and not use return() to exit. */580 thread should always use that to exit and not use return() to exit. */
581 581
582582
=== modified file 'innodb_overwrite_relay_log_info.patch'
--- innodb_overwrite_relay_log_info.patch 2011-05-10 11:57:42 +0000
+++ innodb_overwrite_relay_log_info.patch 2011-06-20 09:04:39 +0000
@@ -56,7 +56,7 @@
56 static my_bool innobase_rollback_on_timeout = FALSE;56 static my_bool innobase_rollback_on_timeout = FALSE;
57 static my_bool innobase_create_status_file = FALSE;57 static my_bool innobase_create_status_file = FALSE;
58 static my_bool innobase_stats_on_metadata = TRUE;58 static my_bool innobase_stats_on_metadata = TRUE;
59@@ -2234,6 +2254,89 @@59@@ -2248,6 +2268,89 @@
60 }60 }
61 #endif /* DBUG_OFF */61 #endif /* DBUG_OFF */
62 62
@@ -146,7 +146,7 @@
146 /* Check that values don't overflow on 32-bit systems. */146 /* Check that values don't overflow on 32-bit systems. */
147 if (sizeof(ulint) == 4) {147 if (sizeof(ulint) == 4) {
148 if (innobase_buffer_pool_size > UINT_MAX32) {148 if (innobase_buffer_pool_size > UINT_MAX32) {
149@@ -2532,6 +2635,76 @@149@@ -2546,6 +2649,76 @@
150 goto mem_free_and_error;150 goto mem_free_and_error;
151 }151 }
152 152
@@ -223,7 +223,7 @@
223 innobase_old_blocks_pct = buf_LRU_old_ratio_update(223 innobase_old_blocks_pct = buf_LRU_old_ratio_update(
224 innobase_old_blocks_pct, TRUE);224 innobase_old_blocks_pct, TRUE);
225 225
226@@ -2644,6 +2817,25 @@226@@ -2658,6 +2831,25 @@
227 trx_t* trx) /*!< in: transaction handle */227 trx_t* trx) /*!< in: transaction handle */
228 {228 {
229 if (trx_is_started(trx)) {229 if (trx_is_started(trx)) {
@@ -249,7 +249,7 @@
249 249
250 trx_commit_for_mysql(trx);250 trx_commit_for_mysql(trx);
251 }251 }
252@@ -11007,6 +11199,12 @@252@@ -11014,6 +11206,12 @@
253 "The common part for InnoDB table spaces.",253 "The common part for InnoDB table spaces.",
254 NULL, NULL, NULL);254 NULL, NULL, NULL);
255 255
@@ -262,7 +262,7 @@
262 static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,262 static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
263 PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,263 PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
264 "Enable InnoDB doublewrite buffer (enabled by default). "264 "Enable InnoDB doublewrite buffer (enabled by default). "
265@@ -11467,6 +11665,7 @@265@@ -11474,6 +11672,7 @@
266 MYSQL_SYSVAR(old_blocks_pct),266 MYSQL_SYSVAR(old_blocks_pct),
267 MYSQL_SYSVAR(old_blocks_time),267 MYSQL_SYSVAR(old_blocks_time),
268 MYSQL_SYSVAR(open_files),268 MYSQL_SYSVAR(open_files),
@@ -312,7 +312,7 @@
312diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h312diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
313--- a/storage/innobase/include/trx0trx.h 2010-12-03 15:18:48.894955550 +0900313--- a/storage/innobase/include/trx0trx.h 2010-12-03 15:18:48.894955550 +0900
314+++ b/storage/innobase/include/trx0trx.h 2010-12-03 15:38:20.323953416 +0900314+++ b/storage/innobase/include/trx0trx.h 2010-12-03 15:38:20.323953416 +0900
315@@ -569,6 +569,21 @@315@@ -580,6 +580,20 @@
316 ib_int64_t mysql_log_offset;/* if MySQL binlog is used, this field316 ib_int64_t mysql_log_offset;/* if MySQL binlog is used, this field
317 contains the end offset of the binlog317 contains the end offset of the binlog
318 entry */318 entry */
@@ -330,14 +330,13 @@
330+ replication has processed */330+ replication has processed */
331+ const char* mysql_relay_log_file_name;331+ const char* mysql_relay_log_file_name;
332+ ib_int64_t mysql_relay_log_pos;332+ ib_int64_t mysql_relay_log_pos;
333+333 /*------------------------------*/
334 os_thread_id_t mysql_thread_id;/* id of the MySQL thread associated334 ulint n_mysql_tables_in_use; /* number of Innobase tables
335 with this transaction object */335 used in the processing of the current
336 ulint mysql_process_no;/* since in Linux, 'top' reports
337diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c336diff -ruN a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
338--- a/storage/innobase/trx/trx0sys.c 2010-11-03 07:01:13.000000000 +0900337--- a/storage/innobase/trx/trx0sys.c 2010-11-03 07:01:13.000000000 +0900
339+++ b/storage/innobase/trx/trx0sys.c 2010-12-03 15:38:20.325956917 +0900338+++ b/storage/innobase/trx/trx0sys.c 2010-12-03 15:38:20.325956917 +0900
340@@ -75,13 +75,16 @@339@@ -76,13 +76,16 @@
341 file name and position here. */340 file name and position here. */
342 /* @{ */341 /* @{ */
343 /** Master binlog file name */342 /** Master binlog file name */
@@ -355,7 +354,7 @@
355 /** If this MySQL server uses binary logging, after InnoDB has been inited354 /** If this MySQL server uses binary logging, after InnoDB has been inited
356 and if it has done a crash recovery, we store the binlog file name and position355 and if it has done a crash recovery, we store the binlog file name and position
357 here. */356 here. */
358@@ -683,23 +686,25 @@357@@ -684,23 +687,25 @@
359 void358 void
360 trx_sys_update_mysql_binlog_offset(359 trx_sys_update_mysql_binlog_offset(
361 /*===============================*/360 /*===============================*/
@@ -387,7 +386,7 @@
387 if (mach_read_from_4(sys_header + field386 if (mach_read_from_4(sys_header + field
388 + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)387 + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
389 != TRX_SYS_MYSQL_LOG_MAGIC_N) {388 != TRX_SYS_MYSQL_LOG_MAGIC_N) {
390@@ -821,13 +826,26 @@389@@ -822,13 +827,26 @@
391 + TRX_SYS_MYSQL_LOG_OFFSET_LOW),390 + TRX_SYS_MYSQL_LOG_OFFSET_LOW),
392 sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO391 sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
393 + TRX_SYS_MYSQL_LOG_NAME);392 + TRX_SYS_MYSQL_LOG_NAME);
@@ -415,7 +414,7 @@
415 414
416 trx_sys_mysql_master_log_pos415 trx_sys_mysql_master_log_pos
417 = (((ib_int64_t) mach_read_from_4(416 = (((ib_int64_t) mach_read_from_4(
418@@ -836,6 +854,19 @@417@@ -837,6 +855,19 @@
419 + ((ib_int64_t) mach_read_from_4(418 + ((ib_int64_t) mach_read_from_4(
420 sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO419 sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
421 + TRX_SYS_MYSQL_LOG_OFFSET_LOW));420 + TRX_SYS_MYSQL_LOG_OFFSET_LOW));
@@ -438,7 +437,7 @@
438diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c437diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
439--- a/storage/innobase/trx/trx0trx.c 2010-12-03 15:37:45.549028990 +0900438--- a/storage/innobase/trx/trx0trx.c 2010-12-03 15:37:45.549028990 +0900
440+++ b/storage/innobase/trx/trx0trx.c 2010-12-03 15:38:20.328957217 +0900439+++ b/storage/innobase/trx/trx0trx.c 2010-12-03 15:38:20.328957217 +0900
441@@ -135,6 +135,10 @@440@@ -138,6 +138,10 @@
442 441
443 trx->mysql_log_file_name = NULL;442 trx->mysql_log_file_name = NULL;
444 trx->mysql_log_offset = 0;443 trx->mysql_log_offset = 0;
@@ -449,7 +448,7 @@
449 448
450 mutex_create(trx_undo_mutex_key, &trx->undo_mutex, SYNC_TRX_UNDO);449 mutex_create(trx_undo_mutex_key, &trx->undo_mutex, SYNC_TRX_UNDO);
451 450
452@@ -765,6 +769,7 @@451@@ -820,6 +824,7 @@
453 {452 {
454 mtr_t mtr;453 mtr_t mtr;
455 trx_rseg_t* rseg;454 trx_rseg_t* rseg;
@@ -457,7 +456,7 @@
457 456
458 ut_ad(!mutex_own(&kernel_mutex));457 ut_ad(!mutex_own(&kernel_mutex));
459 458
460@@ -818,8 +823,12 @@459@@ -873,8 +878,12 @@
461 460
462 if (trx->mysql_log_file_name461 if (trx->mysql_log_file_name
463 && trx->mysql_log_file_name[0] != '\0') {462 && trx->mysql_log_file_name[0] != '\0') {
@@ -470,7 +469,7 @@
470 trx->mysql_log_file_name,469 trx->mysql_log_file_name,
471 trx->mysql_log_offset,470 trx->mysql_log_offset,
472 TRX_SYS_MYSQL_LOG_INFO, &mtr);471 TRX_SYS_MYSQL_LOG_INFO, &mtr);
473@@ -827,6 +836,27 @@472@@ -882,6 +891,27 @@
474 trx->mysql_log_file_name = NULL;473 trx->mysql_log_file_name = NULL;
475 }474 }
476 475
477476
=== modified file 'innodb_pass_corrupt_table.patch'
--- innodb_pass_corrupt_table.patch 2011-05-10 11:57:42 +0000
+++ innodb_pass_corrupt_table.patch 2011-06-20 09:04:39 +0000
@@ -343,37 +343,35 @@
343 if (!ready) {343 if (!ready) {
344 344
345 return(block);345 return(block);
346@@ -2475,6 +2481,14 @@346@@ -2475,6 +2481,13 @@
347 return(NULL);347 return(NULL);
348 }348 }
349 349
350+ if (srv_pass_corrupt_table) {350+ if (srv_pass_corrupt_table <= 1) {
351+ if (bpage->is_corrupt) {351+ if (bpage->is_corrupt) {
352+ rw_lock_s_unlock(&buf_pool->page_hash_latch);352+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
353+ return(NULL);353+ return(NULL);
354+ }354+ }
355+ }355+ }
356+ ut_a(!(bpage->is_corrupt));
357+356+
358 block_mutex = buf_page_get_mutex_enter(bpage);357 block_mutex = buf_page_get_mutex_enter(bpage);
359 358
360 rw_lock_s_unlock(&buf_pool->page_hash_latch);359 rw_lock_s_unlock(&buf_pool->page_hash_latch);
361@@ -3036,6 +3050,14 @@360@@ -3036,6 +3049,13 @@
362 return(NULL);361 return(NULL);
363 }362 }
364 363
365+ if (srv_pass_corrupt_table) {364+ if (srv_pass_corrupt_table <= 1) {
366+ if (block->page.is_corrupt) {365+ if (block->page.is_corrupt) {
367+ mutex_exit(block_mutex);366+ mutex_exit(block_mutex);
368+ return(NULL);367+ return(NULL);
369+ }368+ }
370+ }369+ }
371+ ut_a(!(block->page.is_corrupt));
372+370+
373 switch (buf_block_get_state(block)) {371 switch (buf_block_get_state(block)) {
374 buf_page_t* bpage;372 buf_page_t* bpage;
375 ibool success;373 ibool success;
376@@ -3710,6 +3732,7 @@374@@ -3710,6 +3730,7 @@
377 bpage->newest_modification = 0;375 bpage->newest_modification = 0;
378 bpage->oldest_modification = 0;376 bpage->oldest_modification = 0;
379 HASH_INVALIDATE(bpage, hash);377 HASH_INVALIDATE(bpage, hash);
@@ -381,17 +379,7 @@
381 #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG379 #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
382 bpage->file_page_was_freed = FALSE;380 bpage->file_page_was_freed = FALSE;
383 #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */381 #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
384@@ -4220,7 +4243,8 @@382@@ -4299,6 +4320,7 @@
385 void
386 buf_page_io_complete(
387 /*=================*/
388- buf_page_t* bpage) /*!< in: pointer to the block in question */
389+ buf_page_t* bpage, /*!< in: pointer to the block in question */
390+ trx_t* trx)
391 {
392 enum buf_io_fix io_type;
393 buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
394@@ -4299,6 +4323,7 @@
395 (ulong) bpage->offset);383 (ulong) bpage->offset);
396 }384 }
397 385
@@ -399,27 +387,31 @@
399 /* From version 3.23.38 up we store the page checksum387 /* From version 3.23.38 up we store the page checksum
400 to the 4 first bytes of the page end lsn field */388 to the 4 first bytes of the page end lsn field */
401 389
402@@ -4340,6 +4365,19 @@390@@ -4340,6 +4362,23 @@
403 REFMAN "forcing-innodb-recovery.html\n"391 REFMAN "forcing-innodb-recovery.html\n"
404 "InnoDB: about forcing recovery.\n", stderr);392 "InnoDB: about forcing recovery.\n", stderr);
405 393
406+ if (srv_pass_corrupt_table && !trx_sys_sys_space(bpage->space)394+ if (srv_pass_corrupt_table && !trx_sys_sys_space(bpage->space)
407+ && bpage->space < SRV_LOG_SPACE_FIRST_ID) {395+ && bpage->space < SRV_LOG_SPACE_FIRST_ID) {
396+ trx_t* trx;
397+
408+ fprintf(stderr,398+ fprintf(stderr,
409+ "InnoDB: space %u will be treated as corrupt.\n",399+ "InnoDB: space %u will be treated as corrupt.\n",
410+ bpage->space);400+ bpage->space);
411+ fil_space_set_corrupt(bpage->space);401+ fil_space_set_corrupt(bpage->space);
412+ if (trx && trx->dict_operation_lock_mode == 0) {402+
403+ trx = innobase_get_trx();
404+ if (trx && trx->dict_operation_lock_mode == RW_X_LATCH) {
405+ dict_table_set_corrupt_by_space(bpage->space, FALSE);
406+ } else {
413+ dict_table_set_corrupt_by_space(bpage->space, TRUE);407+ dict_table_set_corrupt_by_space(bpage->space, TRUE);
414+ } else {
415+ dict_table_set_corrupt_by_space(bpage->space, FALSE);
416+ }408+ }
417+ bpage->is_corrupt = TRUE;409+ bpage->is_corrupt = TRUE;
418+ } else410+ } else
419 if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {411 if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
420 fputs("InnoDB: Ending processing because of"412 fputs("InnoDB: Ending processing because of"
421 " a corrupt database page.\n",413 " a corrupt database page.\n",
422@@ -4347,6 +4385,7 @@414@@ -4347,6 +4386,7 @@
423 exit(1);415 exit(1);
424 }416 }
425 }417 }
@@ -427,7 +419,7 @@
427 419
428 if (recv_recovery_is_on()) {420 if (recv_recovery_is_on()) {
429 /* Pages must be uncompressed for crash recovery. */421 /* Pages must be uncompressed for crash recovery. */
430@@ -4356,8 +4395,11 @@422@@ -4356,8 +4396,11 @@
431 423
432 if (uncompressed && !recv_no_ibuf_operations) {424 if (uncompressed && !recv_no_ibuf_operations) {
433 ibuf_merge_or_delete_for_page(425 ibuf_merge_or_delete_for_page(
@@ -442,7 +434,7 @@
442diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c434diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
443--- a/storage/innobase/buf/buf0rea.c 2010-12-04 15:37:50.557553380 +0900435--- a/storage/innobase/buf/buf0rea.c 2010-12-04 15:37:50.557553380 +0900
444+++ b/storage/innobase/buf/buf0rea.c 2010-12-04 15:41:09.784467585 +0900436+++ b/storage/innobase/buf/buf0rea.c 2010-12-04 15:41:09.784467585 +0900
445@@ -193,12 +193,19 @@437@@ -193,7 +193,14 @@
446 ((buf_block_t*) bpage)->frame, bpage, trx);438 ((buf_block_t*) bpage)->frame, bpage, trx);
447 }439 }
448 thd_wait_end(NULL);440 thd_wait_end(NULL);
@@ -457,24 +449,18 @@
457 449
458 if (sync) {450 if (sync) {
459 /* The i/o is already completed when we arrive from451 /* The i/o is already completed when we arrive from
460 fil_read */
461- buf_page_io_complete(bpage);
462+ buf_page_io_complete(bpage, trx);
463 }
464
465 return(1);
466diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c452diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
467--- a/storage/innobase/dict/dict0dict.c 2010-12-03 17:30:16.248987063 +0900453--- a/storage/innobase/dict/dict0dict.c 2010-12-03 17:30:16.248987063 +0900
468+++ b/storage/innobase/dict/dict0dict.c 2010-12-04 15:45:23.808513973 +0900454+++ b/storage/innobase/dict/dict0dict.c 2010-12-04 15:45:23.808513973 +0900
469@@ -55,6 +55,7 @@455@@ -54,6 +54,7 @@
470 #include "srv0srv.h" /* srv_lower_case_table_names */456 #include "row0merge.h"
471 #include "m_ctype.h" /* my_isspace() */457 #include "m_ctype.h" /* my_isspace() */
472 #include "ha_prototypes.h" /* innobase_strcasecmp(), innobase_casedn_str()*/458 #include "ha_prototypes.h" /* innobase_strcasecmp(), innobase_casedn_str()*/
473+#include "srv0start.h" /* SRV_LOG_SPACE_FIRST_ID */459+#include "srv0start.h" /* SRV_LOG_SPACE_FIRST_ID */
474 460
475 #include <ctype.h>461 #include <ctype.h>
476 462
477@@ -751,7 +752,7 @@463@@ -750,7 +751,7 @@
478 464
479 mutex_exit(&(dict_sys->mutex));465 mutex_exit(&(dict_sys->mutex));
480 466
@@ -483,7 +469,7 @@
483 /* If table->ibd_file_missing == TRUE, this will469 /* If table->ibd_file_missing == TRUE, this will
484 print an error message and return without doing470 print an error message and return without doing
485 anything. */471 anything. */
486@@ -1294,7 +1295,7 @@472@@ -1293,7 +1294,7 @@
487 + dict_sys->size) > srv_dict_size_limit ) {473 + dict_sys->size) > srv_dict_size_limit ) {
488 prev_table = UT_LIST_GET_PREV(table_LRU, table);474 prev_table = UT_LIST_GET_PREV(table_LRU, table);
489 475
@@ -492,7 +478,7 @@
492 goto next_loop;478 goto next_loop;
493 479
494 cached_foreign_tables = 0;480 cached_foreign_tables = 0;
495@@ -4333,6 +4334,12 @@481@@ -4332,6 +4333,12 @@
496 heap = mem_heap_create(1000);482 heap = mem_heap_create(1000);
497 483
498 while (index) {484 while (index) {
@@ -505,7 +491,7 @@
505 size = btr_get_size(index, BTR_TOTAL_SIZE);491 size = btr_get_size(index, BTR_TOTAL_SIZE);
506 492
507 index->stat_index_size = size;493 index->stat_index_size = size;
508@@ -4480,6 +4487,12 @@494@@ -4479,6 +4486,12 @@
509 heap = mem_heap_create(1000);495 heap = mem_heap_create(1000);
510 496
511 while (index) {497 while (index) {
@@ -518,20 +504,21 @@
518 /*===========================================*/504 /*===========================================*/
519 {505 {
520 dict_table_t* sys_stats;506 dict_table_t* sys_stats;
521@@ -4666,6 +4679,12 @@507@@ -4671,6 +4684,13 @@
522 || (srv_force_recovery < SRV_FORCE_NO_LOG_REDO508 || (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
523 && dict_index_is_clust(index)))) {509 && dict_index_is_clust(index)))) {
524 ulint size;510 ulint size;
525+511+
526+ if (table->is_corrupt) {512+ if (table->is_corrupt) {
527+ ut_a(srv_pass_corrupt_table);513+ ut_a(srv_pass_corrupt_table);
514+ dict_table_stats_unlock(table, RW_X_LATCH);
528+ return;515+ return;
529+ }516+ }
530+517+
531 size = btr_get_size(index, BTR_TOTAL_SIZE);518 size = btr_get_size(index, BTR_TOTAL_SIZE);
532 519
533 index->stat_index_size = size;520 index->stat_index_size = size;
534@@ -5462,4 +5481,42 @@521@@ -5467,4 +5487,42 @@
535 rw_lock_free(&dict_table_stats_latches[i]);522 rw_lock_free(&dict_table_stats_latches[i]);
536 }523 }
537 }524 }
@@ -577,7 +564,7 @@
577diff -ruN a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c564diff -ruN a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c
578--- a/storage/innobase/dict/dict0mem.c 2010-11-03 07:01:13.000000000 +0900565--- a/storage/innobase/dict/dict0mem.c 2010-11-03 07:01:13.000000000 +0900
579+++ b/storage/innobase/dict/dict0mem.c 2010-12-04 15:38:18.126549463 +0900566+++ b/storage/innobase/dict/dict0mem.c 2010-12-04 15:38:18.126549463 +0900
580@@ -97,6 +97,8 @@567@@ -96,6 +96,8 @@
581 /* The number of transactions that are either waiting on the568 /* The number of transactions that are either waiting on the
582 AUTOINC lock or have been granted the lock. */569 AUTOINC lock or have been granted the lock. */
583 table->n_waiting_or_granted_auto_inc_locks = 0;570 table->n_waiting_or_granted_auto_inc_locks = 0;
@@ -589,7 +576,7 @@
589diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c576diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
590--- a/storage/innobase/fil/fil0fil.c 2010-12-04 15:37:50.564551587 +0900577--- a/storage/innobase/fil/fil0fil.c 2010-12-04 15:37:50.564551587 +0900
591+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:38:18.128549252 +0900578+++ b/storage/innobase/fil/fil0fil.c 2010-12-04 15:38:18.128549252 +0900
592@@ -233,6 +233,7 @@579@@ -235,6 +235,7 @@
593 file we have written to */580 file we have written to */
594 ibool is_in_unflushed_spaces; /*!< TRUE if this space is581 ibool is_in_unflushed_spaces; /*!< TRUE if this space is
595 currently in unflushed_spaces */582 currently in unflushed_spaces */
@@ -597,7 +584,7 @@
597 UT_LIST_NODE_T(fil_space_t) space_list;584 UT_LIST_NODE_T(fil_space_t) space_list;
598 /*!< list of all spaces */585 /*!< list of all spaces */
599 ulint magic_n;/*!< FIL_SPACE_MAGIC_N */586 ulint magic_n;/*!< FIL_SPACE_MAGIC_N */
600@@ -1291,6 +1292,8 @@587@@ -1293,6 +1294,8 @@
601 ut_fold_string(name), space);588 ut_fold_string(name), space);
602 space->is_in_unflushed_spaces = FALSE;589 space->is_in_unflushed_spaces = FALSE;
603 590
@@ -606,18 +593,18 @@
606 UT_LIST_ADD_LAST(space_list, fil_system->space_list, space);593 UT_LIST_ADD_LAST(space_list, fil_system->space_list, space);
607 594
608 mutex_exit(&fil_system->mutex);595 mutex_exit(&fil_system->mutex);
609@@ -4943,6 +4946,22 @@596@@ -5267,6 +5270,34 @@
610 ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);597 ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
611 ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);598 ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
612 599
613+ if (srv_pass_corrupt_table && space->is_corrupt) {600+ if (srv_pass_corrupt_table == 1 && space->is_corrupt) {
614+ /* should ignore i/o for the crashed space */601+ /* should ignore i/o for the crashed space */
615+ mutex_enter(&fil_system->mutex);602+ mutex_enter(&fil_system->mutex);
616+ fil_node_complete_io(node, fil_system, type);603+ fil_node_complete_io(node, fil_system, type);
617+ mutex_exit(&fil_system->mutex);604+ mutex_exit(&fil_system->mutex);
618+ if (mode == OS_AIO_NORMAL) {605+ if (mode == OS_AIO_NORMAL) {
619+ ut_a(space->purpose == FIL_TABLESPACE);606+ ut_a(space->purpose == FIL_TABLESPACE);
620+ buf_page_io_complete(message, trx);607+ buf_page_io_complete(message);
621+ }608+ }
622+ if (type == OS_FILE_READ) {609+ if (type == OS_FILE_READ) {
623+ return(DB_TABLESPACE_DELETED);610+ return(DB_TABLESPACE_DELETED);
@@ -625,11 +612,23 @@
625+ return(DB_SUCCESS);612+ return(DB_SUCCESS);
626+ }613+ }
627+ } else {614+ } else {
628+ ut_a(!space->is_corrupt);615+ if (srv_pass_corrupt_table > 1 && space->is_corrupt) {
616+ /* should ignore write i/o for the crashed space */
617+ if (type == OS_FILE_WRITE) {
618+ mutex_enter(&fil_system->mutex);
619+ fil_node_complete_io(node, fil_system, type);
620+ mutex_exit(&fil_system->mutex);
621+ if (mode == OS_AIO_NORMAL) {
622+ ut_a(space->purpose == FIL_TABLESPACE);
623+ buf_page_io_complete(message);
624+ }
625+ return(DB_SUCCESS);
626+ }
627+ }
629 #ifdef UNIV_HOTBACKUP628 #ifdef UNIV_HOTBACKUP
630 /* In ibbackup do normal i/o, not aio */629 /* In ibbackup do normal i/o, not aio */
631 if (type == OS_FILE_READ) {630 if (type == OS_FILE_READ) {
632@@ -4957,6 +4976,8 @@631@@ -5281,6 +5312,8 @@
633 ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,632 ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
634 offset_low, offset_high, len, node, message, trx);633 offset_low, offset_high, len, node, message, trx);
635 #endif634 #endif
@@ -638,16 +637,7 @@
638 ut_a(ret);637 ut_a(ret);
639 638
640 if (mode == OS_AIO_SYNC) {639 if (mode == OS_AIO_SYNC) {
641@@ -5098,7 +5119,7 @@640@@ -5780,3 +5813,46 @@
642
643 if (fil_node->space->purpose == FIL_TABLESPACE) {
644 srv_set_io_thread_op_info(segment, "complete io for buf page");
645- buf_page_io_complete(message);
646+ buf_page_io_complete(message, NULL);
647 } else {
648 srv_set_io_thread_op_info(segment, "complete io for log");
649 log_io_complete(message);
650@@ -5452,3 +5473,46 @@
651 return 0;641 return 0;
652 }642 }
653 }643 }
@@ -808,11 +798,11 @@
808diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc798diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
809--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:37:50.578486593 +0900799--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:37:50.578486593 +0900
810+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:38:18.137549396 +0900800+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:38:18.137549396 +0900
811@@ -3959,6 +3959,12 @@801@@ -3972,6 +3972,12 @@
812 DBUG_RETURN(1);802 DBUG_RETURN(1);
813 }803 }
814 804
815+ if (share->ib_table && share->ib_table->is_corrupt) {805+ if (srv_pass_corrupt_table <= 1 && share->ib_table && share->ib_table->is_corrupt) {
816+ free_share(share);806+ free_share(share);
817+807+
818+ DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);808+ DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
@@ -821,11 +811,11 @@
821 /* Create buffers for packing the fields of a record. Why811 /* Create buffers for packing the fields of a record. Why
822 table->reclength did not work here? Obviously, because char812 table->reclength did not work here? Obviously, because char
823 fields when packed actually became 1 byte longer, when we also813 fields when packed actually became 1 byte longer, when we also
824@@ -3986,6 +3992,19 @@814@@ -3999,6 +4005,19 @@
825 /* Get pointer to a table object in InnoDB dictionary cache */815 /* Get pointer to a table object in InnoDB dictionary cache */
826 ib_table = dict_table_get(norm_name, TRUE);816 ib_table = dict_table_get(norm_name, TRUE);
827 817
828+ if (ib_table && ib_table->is_corrupt) {818+ if (srv_pass_corrupt_table <= 1 && ib_table && ib_table->is_corrupt) {
829+ free_share(share);819+ free_share(share);
830+ my_free(upd_buff);820+ my_free(upd_buff);
831+821+
@@ -841,7 +831,7 @@
841 if (NULL == ib_table) {831 if (NULL == ib_table) {
842 if (is_part && retries < 10) {832 if (is_part && retries < 10) {
843 ++retries;833 ++retries;
844@@ -5150,6 +5169,10 @@834@@ -5163,6 +5182,10 @@
845 835
846 ha_statistic_increment(&SSV::ha_write_count);836 ha_statistic_increment(&SSV::ha_write_count);
847 837
@@ -852,7 +842,7 @@
852 if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)842 if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
853 table->timestamp_field->set_time();843 table->timestamp_field->set_time();
854 844
855@@ -5367,6 +5390,10 @@845@@ -5380,6 +5403,10 @@
856 func_exit:846 func_exit:
857 innobase_active_small();847 innobase_active_small();
858 848
@@ -863,7 +853,7 @@
863 DBUG_RETURN(error_result);853 DBUG_RETURN(error_result);
864 }854 }
865 855
866@@ -5543,6 +5570,10 @@856@@ -5556,6 +5583,10 @@
867 857
868 ha_statistic_increment(&SSV::ha_update_count);858 ha_statistic_increment(&SSV::ha_update_count);
869 859
@@ -874,7 +864,7 @@
874 if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)864 if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
875 table->timestamp_field->set_time();865 table->timestamp_field->set_time();
876 866
877@@ -5632,6 +5663,10 @@867@@ -5645,6 +5676,10 @@
878 868
879 innobase_active_small();869 innobase_active_small();
880 870
@@ -885,7 +875,7 @@
885 DBUG_RETURN(error);875 DBUG_RETURN(error);
886 }876 }
887 877
888@@ -5653,6 +5688,10 @@878@@ -5666,6 +5701,10 @@
889 879
890 ha_statistic_increment(&SSV::ha_delete_count);880 ha_statistic_increment(&SSV::ha_delete_count);
891 881
@@ -896,7 +886,7 @@
896 if (!prebuilt->upd_node) {886 if (!prebuilt->upd_node) {
897 row_get_prebuilt_update_vector(prebuilt);887 row_get_prebuilt_update_vector(prebuilt);
898 }888 }
899@@ -5679,6 +5718,10 @@889@@ -5692,6 +5731,10 @@
900 890
901 innobase_active_small();891 innobase_active_small();
902 892
@@ -907,62 +897,62 @@
907 DBUG_RETURN(error);897 DBUG_RETURN(error);
908 }898 }
909 899
910@@ -5918,6 +5961,10 @@900@@ -5931,6 +5974,10 @@
911 901
912 ha_statistic_increment(&SSV::ha_read_key_count);902 ha_statistic_increment(&SSV::ha_read_key_count);
913 903
914+ if (share->ib_table->is_corrupt) {904+ if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
915+ DBUG_RETURN(HA_ERR_CRASHED);905+ DBUG_RETURN(HA_ERR_CRASHED);
916+ }906+ }
917+907+
918 index = prebuilt->index;908 index = prebuilt->index;
919 909
920 if (UNIV_UNLIKELY(index == NULL)) {910 if (UNIV_UNLIKELY(index == NULL)) {
921@@ -5983,6 +6030,10 @@911@@ -5996,6 +6043,10 @@
922 ret = DB_UNSUPPORTED;912 ret = DB_UNSUPPORTED;
923 }913 }
924 914
925+ if (share->ib_table->is_corrupt) {915+ if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
926+ DBUG_RETURN(HA_ERR_CRASHED);916+ DBUG_RETURN(HA_ERR_CRASHED);
927+ }917+ }
928+918+
929 switch (ret) {919 switch (ret) {
930 case DB_SUCCESS:920 case DB_SUCCESS:
931 error = 0;921 error = 0;
932@@ -6098,6 +6149,10 @@922@@ -6111,6 +6162,10 @@
933 {923 {
934 DBUG_ENTER("change_active_index");924 DBUG_ENTER("change_active_index");
935 925
936+ if (share->ib_table->is_corrupt) {926+ if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
937+ DBUG_RETURN(HA_ERR_CRASHED);927+ DBUG_RETURN(HA_ERR_CRASHED);
938+ }928+ }
939+929+
940 ut_ad(user_thd == ha_thd());930 ut_ad(user_thd == ha_thd());
941 ut_a(prebuilt->trx == thd_to_trx(user_thd));931 ut_a(prebuilt->trx == thd_to_trx(user_thd));
942 932
943@@ -6188,6 +6243,10 @@933@@ -6201,6 +6256,10 @@
944 934
945 DBUG_ENTER("general_fetch");935 DBUG_ENTER("general_fetch");
946 936
947+ if (share->ib_table->is_corrupt) {937+ if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
948+ DBUG_RETURN(HA_ERR_CRASHED);938+ DBUG_RETURN(HA_ERR_CRASHED);
949+ }939+ }
950+940+
951 ut_a(prebuilt->trx == thd_to_trx(user_thd));941 ut_a(prebuilt->trx == thd_to_trx(user_thd));
952 942
953 innodb_srv_conc_enter_innodb(prebuilt->trx);943 innodb_srv_conc_enter_innodb(prebuilt->trx);
954@@ -6197,6 +6256,10 @@944@@ -6210,6 +6269,10 @@
955 945
956 innodb_srv_conc_exit_innodb(prebuilt->trx);946 innodb_srv_conc_exit_innodb(prebuilt->trx);
957 947
958+ if (share->ib_table->is_corrupt) {948+ if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
959+ DBUG_RETURN(HA_ERR_CRASHED);949+ DBUG_RETURN(HA_ERR_CRASHED);
960+ }950+ }
961+951+
962 switch (ret) {952 switch (ret) {
963 case DB_SUCCESS:953 case DB_SUCCESS:
964 error = 0;954 error = 0;
965@@ -7467,10 +7530,18 @@955@@ -7476,10 +7539,18 @@
966 956
967 update_thd(ha_thd());957 update_thd(ha_thd());
968 958
@@ -981,7 +971,7 @@
981 error = convert_error_code_to_mysql(error, prebuilt->table->flags,971 error = convert_error_code_to_mysql(error, prebuilt->table->flags,
982 NULL);972 NULL);
983 973
984@@ -7975,6 +8046,16 @@974@@ -7980,6 +8051,16 @@
985 return(ranges + (double) rows / (double) total_rows * time_for_scan);975 return(ranges + (double) rows / (double) total_rows * time_for_scan);
986 }976 }
987 977
@@ -998,7 +988,7 @@
998 /*********************************************************************//**988 /*********************************************************************//**
999 Calculates the key number used inside MySQL for an Innobase index. We will989 Calculates the key number used inside MySQL for an Innobase index. We will
1000 first check the "index translation table" for a match of the index to get990 first check the "index translation table" for a match of the index to get
1001@@ -8152,7 +8233,7 @@991@@ -8157,7 +8238,7 @@
1002 ib_table = prebuilt->table;992 ib_table = prebuilt->table;
1003 993
1004 if (flag & HA_STATUS_TIME) {994 if (flag & HA_STATUS_TIME) {
@@ -1007,7 +997,7 @@
1007 /* In sql_show we call with this flag: update997 /* In sql_show we call with this flag: update
1008 then statistics so that they are up-to-date */998 then statistics so that they are up-to-date */
1009 999
1010@@ -8445,10 +8526,18 @@1000@@ -8450,10 +8531,18 @@
1011 THD* thd, /*!< in: connection thread handle */1001 THD* thd, /*!< in: connection thread handle */
1012 HA_CHECK_OPT* check_opt) /*!< in: currently ignored */1002 HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
1013 {1003 {
@@ -1026,7 +1016,7 @@
1026 return(0);1016 return(0);
1027 }1017 }
1028 1018
1029@@ -8630,6 +8719,10 @@1019@@ -8635,6 +8724,10 @@
1030 my_error(ER_QUERY_INTERRUPTED, MYF(0));1020 my_error(ER_QUERY_INTERRUPTED, MYF(0));
1031 }1021 }
1032 1022
@@ -1037,7 +1027,7 @@
1037 DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);1027 DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
1038 }1028 }
1039 1029
1040@@ -9400,6 +9493,10 @@1030@@ -9405,6 +9498,10 @@
1041 1031
1042 update_thd(thd);1032 update_thd(thd);
1043 1033
@@ -1048,7 +1038,7 @@
1048 if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {1038 if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
1049 ut_print_timestamp(stderr);1039 ut_print_timestamp(stderr);
1050 fprintf(stderr,1040 fprintf(stderr,
1051@@ -11800,6 +11897,25 @@1041@@ -11807,6 +11904,26 @@
1052 "0 (the default) disables automatic dumps.",1042 "0 (the default) disables automatic dumps.",
1053 NULL, NULL, 0, 0, UINT_MAX32, 0);1043 NULL, NULL, 0, 0, UINT_MAX32, 0);
1054 1044
@@ -1056,6 +1046,7 @@
1056+{1046+{
1057+ "assert", /* 0 */1047+ "assert", /* 0 */
1058+ "warn", /* 1 */1048+ "warn", /* 1 */
1049+ "salvage", /* 2 */
1059+ NullS1050+ NullS
1060+};1051+};
1061+TYPELIB corrupt_table_action_typelib=1052+TYPELIB corrupt_table_action_typelib=
@@ -1074,7 +1065,7 @@
1074 static struct st_mysql_sys_var* innobase_system_variables[]= {1065 static struct st_mysql_sys_var* innobase_system_variables[]= {
1075 MYSQL_SYSVAR(additional_mem_pool_size),1066 MYSQL_SYSVAR(additional_mem_pool_size),
1076 MYSQL_SYSVAR(autoextend_increment),1067 MYSQL_SYSVAR(autoextend_increment),
1077@@ -11886,6 +12002,7 @@1068@@ -11893,6 +12010,7 @@
1078 MYSQL_SYSVAR(purge_threads),1069 MYSQL_SYSVAR(purge_threads),
1079 MYSQL_SYSVAR(purge_batch_size),1070 MYSQL_SYSVAR(purge_batch_size),
1080 MYSQL_SYSVAR(rollback_segments),1071 MYSQL_SYSVAR(rollback_segments),
@@ -1136,17 +1127,7 @@
1136 #endif /* UNIV_DEBUG */1127 #endif /* UNIV_DEBUG */
1137 /*********************************************************************//**1128 /*********************************************************************//**
1138 Gets the space id of a block.1129 Gets the space id of a block.
1139@@ -1118,7 +1118,8 @@1130@@ -1433,6 +1433,7 @@
1140 void
1141 buf_page_io_complete(
1142 /*=================*/
1143- buf_page_t* bpage); /*!< in: pointer to the block in question */
1144+ buf_page_t* bpage, /*!< in: pointer to the block in question */
1145+ trx_t* trx);
1146 /********************************************************************//**
1147 Calculates a folded value of a file page address to use in the page hash
1148 table.
1149@@ -1433,6 +1434,7 @@
1150 0 if the block was never accessed1131 0 if the block was never accessed
1151 in the buffer pool */1132 in the buffer pool */
1152 /* @} */1133 /* @} */
@@ -1201,7 +1182,7 @@
1201diff -ruN a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h1182diff -ruN a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
1202--- a/storage/innobase/include/dict0mem.h 2010-11-03 07:01:13.000000000 +09001183--- a/storage/innobase/include/dict0mem.h 2010-11-03 07:01:13.000000000 +0900
1203+++ b/storage/innobase/include/dict0mem.h 2010-12-04 15:38:18.171513956 +09001184+++ b/storage/innobase/include/dict0mem.h 2010-12-04 15:38:18.171513956 +0900
1204@@ -636,6 +636,7 @@1185@@ -640,6 +640,7 @@
1205 the AUTOINC lock on this table. */1186 the AUTOINC lock on this table. */
1206 /* @} */1187 /* @} */
1207 /*----------------------*/1188 /*----------------------*/
@@ -1296,7 +1277,7 @@
1296diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h1277diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
1297--- a/storage/innobase/include/srv0srv.h 2010-12-04 15:37:50.591516341 +09001278--- a/storage/innobase/include/srv0srv.h 2010-12-04 15:37:50.591516341 +0900
1298+++ b/storage/innobase/include/srv0srv.h 2010-12-04 15:38:18.180563749 +09001279+++ b/storage/innobase/include/srv0srv.h 2010-12-04 15:38:18.180563749 +0900
1299@@ -243,6 +243,7 @@1280@@ -240,6 +240,7 @@
1300 extern ulint srv_adaptive_flushing_method;1281 extern ulint srv_adaptive_flushing_method;
1301 1282
1302 extern ulint srv_expand_import;1283 extern ulint srv_expand_import;
@@ -1354,7 +1335,7 @@
1354diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c1335diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
1355--- a/storage/innobase/row/row0sel.c 2010-11-03 07:01:13.000000000 +09001336--- a/storage/innobase/row/row0sel.c 2010-11-03 07:01:13.000000000 +0900
1356+++ b/storage/innobase/row/row0sel.c 2010-12-04 15:38:18.205551115 +09001337+++ b/storage/innobase/row/row0sel.c 2010-12-04 15:38:18.205551115 +0900
1357@@ -3848,6 +3848,13 @@1338@@ -3853,6 +3853,13 @@
1358 /* PHASE 4: Look for matching records in a loop */1339 /* PHASE 4: Look for matching records in a loop */
1359 1340
1360 rec = btr_pcur_get_rec(pcur);1341 rec = btr_pcur_get_rec(pcur);
@@ -1368,10 +1349,35 @@
1368 ut_ad(!!page_rec_is_comp(rec) == comp);1349 ut_ad(!!page_rec_is_comp(rec) == comp);
1369 #ifdef UNIV_SEARCH_DEBUG1350 #ifdef UNIV_SEARCH_DEBUG
1370 /*1351 /*
1352@@ -3930,7 +3937,13 @@
1353 if (UNIV_UNLIKELY(next_offs >= UNIV_PAGE_SIZE - PAGE_DIR)) {
1354
1355 wrong_offs:
1356- if (srv_force_recovery == 0 || moves_up == FALSE) {
1357+ if (srv_pass_corrupt_table && !trx_sys_sys_space(index->table->space)) {
1358+ index->table->is_corrupt = TRUE;
1359+ fil_space_set_corrupt(index->table->space);
1360+ }
1361+
1362+ if ((srv_force_recovery == 0 || moves_up == FALSE)
1363+ && srv_pass_corrupt_table <= 1) {
1364 ut_print_timestamp(stderr);
1365 buf_page_print(page_align(rec), 0);
1366 fprintf(stderr,