1 # name : innodb_fix_misc.patch
2 # introduced : 11 or before
3 # maintainer : Yasufumi
6 # Any small change to this file in the main branch
7 # should be done or reviewed by the maintainer!
9 # comment: http://lists.mysql.com/commits/112400 is applied also for innodb_plugin
10 # to pass innodb_bug53756.test by innodb_plugin
11 diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
12 --- a/storage/innobase/dict/dict0load.c 2010-12-04 15:37:50.559480289 +0900
13 +++ b/storage/innobase/dict/dict0load.c 2010-12-04 15:57:53.078513745 +0900
16 ut_ad(mutex_own(&(dict_sys->mutex)));
20 /* NOTE that the operation of this function is protected by
21 the dictionary mutex, and therefore no deadlocks can occur
22 with other dictionary operations. */
23 @@ -1894,15 +1896,17 @@
24 BTR_SEARCH_LEAF, &pcur, &mtr);
25 rec = btr_pcur_get_rec(&pcur);
27 - if (!btr_pcur_is_on_user_rec(&pcur)
28 - || rec_get_deleted_flag(rec, 0)) {
29 + if (!btr_pcur_is_on_user_rec(&pcur)) {
34 - btr_pcur_close(&pcur);
36 - mem_heap_free(heap);
39 + /* Find the first record that is not delete marked */
40 + while (rec_get_deleted_flag(rec, 0)) {
41 + if (!btr_pcur_move_to_next_user_rec(&pcur, &mtr)) {
44 + rec = btr_pcur_get_rec(&pcur);
47 /*---------------------------------------------------*/
48 @@ -1915,12 +1919,7 @@
50 /* Check if the table id in record is the one searched for */
51 if (table_id != mach_read_from_8(field)) {
53 - btr_pcur_close(&pcur);
55 - mem_heap_free(heap);
61 /* Now we get the table name from the record */
63 /* Load the table definition to memory */
64 table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len),
68 btr_pcur_close(&pcur);
71 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
72 --- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:13.035513990 +0900
73 +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:53.084513775 +0900
74 @@ -12007,7 +12007,7 @@
75 &innobase_storage_engine,
78 - "Supports transactions, row-level locking, and foreign keys",
79 + "Percona-XtraDB, Supports transactions, row-level locking, and foreign keys",
81 innobase_init, /* Plugin Init */
82 NULL, /* Plugin Deinit */
83 diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
84 --- a/storage/innobase/include/univ.i 2010-12-04 15:57:13.050485224 +0900
85 +++ b/storage/innobase/include/univ.i 2010-12-04 15:57:53.091592933 +0900
87 #define INNODB_VERSION_MINOR 1
88 #define INNODB_VERSION_BUGFIX 5
90 +#ifndef PERCONA_INNODB_VERSION
91 +#define PERCONA_INNODB_VERSION 12.1
95 /* The following is the InnoDB version as shown in
96 SELECT plugin_version FROM information_schema.plugins;
97 calculated in make_version_string() in sql/sql_show.cc like this:
99 #define INNODB_VERSION_STR \
100 IB_TO_STR(INNODB_VERSION_MAJOR) "." \
101 IB_TO_STR(INNODB_VERSION_MINOR) "." \
102 - IB_TO_STR(INNODB_VERSION_BUGFIX)
103 + IB_TO_STR(INNODB_VERSION_BUGFIX) "-" \
104 + IB_TO_STR(PERCONA_INNODB_VERSION)
106 #define REFMAN "http://dev.mysql.com/doc/refman/" \
107 IB_TO_STR(MYSQL_MAJOR_VERSION) "." \
108 diff -ruN a/storage/innobase/mtr/mtr0log.c b/storage/innobase/mtr/mtr0log.c
109 --- a/storage/innobase/mtr/mtr0log.c 2010-12-04 02:58:26.000000000 +0900
110 +++ b/storage/innobase/mtr/mtr0log.c 2011-02-03 15:17:14.000000000 +0900
114 if (UNIV_UNLIKELY(offset >= UNIV_PAGE_SIZE)
115 - || UNIV_UNLIKELY(len + offset) > UNIV_PAGE_SIZE) {
116 + || UNIV_UNLIKELY(len + offset > UNIV_PAGE_SIZE)) {
117 recv_sys->found_corrupt_log = TRUE;
120 diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
121 --- a/storage/innobase/row/row0mysql.c 2010-12-04 15:37:50.598481116 +0900
122 +++ b/storage/innobase/row/row0mysql.c 2010-12-04 15:57:53.092563335 +0900
126 #include "ibuf0ibuf.h"
127 +#include "ha_prototypes.h"
129 /** Provide optional 4.x backwards compatibility for 5.0 and above */
130 UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
131 @@ -1194,6 +1195,13 @@
133 thr = que_fork_get_first_thr(prebuilt->ins_graph);
135 + if (!prebuilt->mysql_has_locked && !(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) {
136 + fprintf(stderr, "InnoDB: Error: row_insert_for_mysql is called without ha_innobase::external_lock()\n");
137 + if (trx->mysql_thd != NULL) {
138 + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
142 if (prebuilt->sql_stat_start) {
143 node->state = INS_NODE_SET_IX_LOCK;
144 prebuilt->sql_stat_start = FALSE;
145 diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
146 --- a/storage/innobase/row/row0sel.c 2010-12-04 15:52:23.494514495 +0900
147 +++ b/storage/innobase/row/row0sel.c 2010-12-04 16:01:38.320883699 +0900
148 @@ -3366,6 +3366,7 @@
149 ulint offsets_[REC_OFFS_NORMAL_SIZE];
150 ulint* offsets = offsets_;
151 ibool table_lock_waited = FALSE;
152 + ibool problematic_use = FALSE;
154 rec_offs_init(offsets_);
156 @@ -3732,6 +3733,17 @@
158 /* Do some start-of-statement preparations */
160 + if (!prebuilt->mysql_has_locked) {
161 + if (!(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) {
162 + fprintf(stderr, "InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock()\n");
163 + if (trx->mysql_thd != NULL) {
164 + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
167 + problematic_use = TRUE;
171 if (!prebuilt->sql_stat_start) {
172 /* No need to set an intention lock or assign a read view */
174 @@ -3742,6 +3754,18 @@
175 " perform a consistent read\n"
176 "InnoDB: but the read view is not assigned!\n",
178 + if (problematic_use) {
179 + fprintf(stderr, "InnoDB: It may be caused by calling "
180 + "without ha_innobase::external_lock()\n"
181 + "InnoDB: For the first-aid, avoiding the crash. "
182 + "But it should be fixed ASAP.\n");
183 + if (prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT)
184 + && trx->mysql_thd != NULL) {
185 + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
187 + prebuilt->sql_stat_start = TRUE;
190 trx_print(stderr, trx, 600);
193 diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
194 --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:57:13.073495392 +0900
195 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 16:02:50.704884053 +0900
196 @@ -2153,7 +2153,7 @@
197 if (srv_print_verbose_log) {
198 ut_print_timestamp(stderr);
200 - " InnoDB: %s started; "
201 + " Percona XtraDB (http://www.percona.com) %s started; "
202 "log sequence number %llu\n",
203 INNODB_VERSION_STR, srv_start_lsn);
205 diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
206 --- a/storage/innobase/trx/trx0purge.c 2010-11-03 07:01:13.000000000 +0900
207 +++ b/storage/innobase/trx/trx0purge.c 2010-12-04 15:57:53.106551154 +0900
208 @@ -1131,8 +1131,7 @@
209 /* If we cannot advance the 'purge view' because of an old
210 'consistent read view', then the DML statements cannot be delayed.
211 Also, srv_max_purge_lag <= 0 means 'infinity'. */
212 - if (srv_max_purge_lag > 0
213 - && !UT_LIST_GET_LAST(trx_sys->view_list)) {
214 + if (srv_max_purge_lag > 0) {
215 float ratio = (float) trx_sys->rseg_history_len
217 if (ratio > ULINT_MAX / 10000) {