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 @@ -1877,15 +1879,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 @@ -1898,12 +1902,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 4
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 (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
101 /* auxiliary macros to help creating the version as string */
102 -#define __INNODB_VERSION(a, b, c) (#a "." #b "." #c)
103 -#define _INNODB_VERSION(a, b, c) __INNODB_VERSION(a, b, c)
104 +#define __INNODB_VERSION(a, b, c, d) (#a "." #b "." #c "-" #d)
105 +#define _INNODB_VERSION(a, b, c, d) __INNODB_VERSION(a, b, c, d)
108 #define INNODB_VERSION_STR \
109 _INNODB_VERSION(INNODB_VERSION_MAJOR, \
110 INNODB_VERSION_MINOR, \
111 - INNODB_VERSION_BUGFIX)
112 + INNODB_VERSION_BUGFIX, \
113 + PERCONA_INNODB_VERSION)
115 #define REFMAN "http://dev.mysql.com/doc/refman/5.1/en/"
117 diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
118 --- a/storage/innobase/row/row0mysql.c 2010-12-04 15:37:50.598481116 +0900
119 +++ b/storage/innobase/row/row0mysql.c 2010-12-04 15:57:53.092563335 +0900
120 @@ -1194,6 +1194,13 @@
122 thr = que_fork_get_first_thr(prebuilt->ins_graph);
124 + if (!prebuilt->mysql_has_locked && !(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) {
125 + fprintf(stderr, "InnoDB: Error: row_insert_for_mysql is called without ha_innobase::external_lock()\n");
126 + if (trx->mysql_thd != NULL) {
127 + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
131 if (prebuilt->sql_stat_start) {
132 node->state = INS_NODE_SET_IX_LOCK;
133 prebuilt->sql_stat_start = FALSE;
134 diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
135 --- a/storage/innobase/row/row0sel.c 2010-12-04 15:52:23.494514495 +0900
136 +++ b/storage/innobase/row/row0sel.c 2010-12-04 16:01:38.320883699 +0900
137 @@ -3366,6 +3366,7 @@
138 ulint offsets_[REC_OFFS_NORMAL_SIZE];
139 ulint* offsets = offsets_;
140 ibool table_lock_waited = FALSE;
141 + ibool problematic_use = FALSE;
143 rec_offs_init(offsets_);
145 @@ -3732,6 +3733,17 @@
147 /* Do some start-of-statement preparations */
149 + if (!prebuilt->mysql_has_locked) {
150 + if (!(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) {
151 + fprintf(stderr, "InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock()\n");
152 + if (trx->mysql_thd != NULL) {
153 + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
156 + problematic_use = TRUE;
160 if (!prebuilt->sql_stat_start) {
161 /* No need to set an intention lock or assign a read view */
163 @@ -3742,6 +3754,18 @@
164 " perform a consistent read\n"
165 "InnoDB: but the read view is not assigned!\n",
167 + if (problematic_use) {
168 + fprintf(stderr, "InnoDB: It may be caused by calling "
169 + "without ha_innobase::external_lock()\n"
170 + "InnoDB: For the first-aid, avoiding the crash. "
171 + "But it should be fixed ASAP.\n");
172 + if (prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT)
173 + && trx->mysql_thd != NULL) {
174 + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
176 + prebuilt->sql_stat_start = TRUE;
179 trx_print(stderr, trx, 600);
182 diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
183 --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:57:13.073495392 +0900
184 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 16:02:50.704884053 +0900
185 @@ -2032,7 +2032,7 @@
186 if (srv_print_verbose_log) {
187 ut_print_timestamp(stderr);
189 - " InnoDB: %s started; "
190 + " Percona XtraDB (http://www.percona.com) %s started; "
191 "log sequence number %llu\n",
192 INNODB_VERSION_STR, srv_start_lsn);
194 diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
195 --- a/storage/innobase/trx/trx0purge.c 2010-11-03 07:01:13.000000000 +0900
196 +++ b/storage/innobase/trx/trx0purge.c 2010-12-04 15:57:53.106551154 +0900
197 @@ -1131,8 +1131,7 @@
198 /* If we cannot advance the 'purge view' because of an old
199 'consistent read view', then the DML statements cannot be delayed.
200 Also, srv_max_purge_lag <= 0 means 'infinity'. */
201 - if (srv_max_purge_lag > 0
202 - && !UT_LIST_GET_LAST(trx_sys->view_list)) {
203 + if (srv_max_purge_lag > 0) {
204 float ratio = (float) trx_sys->rseg_history_len
206 if (ratio > ULINT_MAX / 10000) {