]>
Commit | Line | Data |
---|---|---|
b4e1fa2c AM |
1 | # name : innodb_fix_misc.patch |
2 | # introduced : 11 or before | |
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! | |
8 | # | |
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 | |
14 | @@ -1851,6 +1851,8 @@ | |
15 | ||
16 | ut_ad(mutex_own(&(dict_sys->mutex))); | |
17 | ||
18 | + table = NULL; | |
19 | + | |
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); | |
26 | ||
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)) { | |
30 | /* Not found */ | |
31 | + goto func_exit; | |
32 | + } | |
33 | ||
34 | - btr_pcur_close(&pcur); | |
35 | - mtr_commit(&mtr); | |
36 | - mem_heap_free(heap); | |
37 | - | |
38 | - return(NULL); | |
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)) { | |
42 | + goto func_exit; | |
43 | + } | |
44 | + rec = btr_pcur_get_rec(&pcur); | |
45 | } | |
46 | ||
47 | /*---------------------------------------------------*/ | |
48 | @@ -1898,12 +1902,7 @@ | |
49 | ||
50 | /* Check if the table id in record is the one searched for */ | |
51 | if (table_id != mach_read_from_8(field)) { | |
52 | - | |
53 | - btr_pcur_close(&pcur); | |
54 | - mtr_commit(&mtr); | |
55 | - mem_heap_free(heap); | |
56 | - | |
57 | - return(NULL); | |
58 | + goto func_exit; | |
59 | } | |
60 | ||
61 | /* Now we get the table name from the record */ | |
62 | @@ -1911,7 +1910,7 @@ | |
63 | /* Load the table definition to memory */ | |
64 | table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len), | |
65 | TRUE); | |
66 | - | |
67 | +func_exit: | |
68 | btr_pcur_close(&pcur); | |
69 | mtr_commit(&mtr); | |
70 | mem_heap_free(heap); | |
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, | |
76 | innobase_hton_name, | |
77 | "Innobase Oy", | |
78 | - "Supports transactions, row-level locking, and foreign keys", | |
79 | + "Percona-XtraDB, Supports transactions, row-level locking, and foreign keys", | |
80 | PLUGIN_LICENSE_GPL, | |
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 | |
86 | @@ -48,6 +48,11 @@ | |
87 | #define INNODB_VERSION_MINOR 1 | |
88 | #define INNODB_VERSION_BUGFIX 4 | |
89 | ||
90 | +#ifndef PERCONA_INNODB_VERSION | |
91 | +#define PERCONA_INNODB_VERSION 12.1 | |
92 | +#endif | |
93 | + | |
94 | + | |
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: | |
98 | @@ -58,13 +63,15 @@ | |
99 | (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) | |
100 | ||
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) | |
106 | + | |
107 | ||
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) | |
114 | ||
115 | #define REFMAN "http://dev.mysql.com/doc/refman/5.1/en/" | |
116 | ||
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 @@ | |
121 | ||
122 | thr = que_fork_get_first_thr(prebuilt->ins_graph); | |
123 | ||
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); | |
128 | + } | |
129 | + } | |
130 | + | |
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; | |
142 | ||
143 | rec_offs_init(offsets_); | |
144 | ||
145 | @@ -3732,6 +3733,17 @@ | |
146 | ||
147 | /* Do some start-of-statement preparations */ | |
148 | ||
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); | |
154 | + } | |
155 | + } | |
156 | + problematic_use = TRUE; | |
157 | + } | |
158 | +retry_check: | |
159 | + | |
160 | if (!prebuilt->sql_stat_start) { | |
161 | /* No need to set an intention lock or assign a read view */ | |
162 | ||
163 | @@ -3742,6 +3754,18 @@ | |
164 | " perform a consistent read\n" | |
165 | "InnoDB: but the read view is not assigned!\n", | |
166 | stderr); | |
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); | |
175 | + } | |
176 | + prebuilt->sql_stat_start = TRUE; | |
177 | + goto retry_check; | |
178 | + } | |
179 | trx_print(stderr, trx, 600); | |
180 | fputc('\n', stderr); | |
181 | ut_error; | |
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); | |
188 | fprintf(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); | |
193 | } | |
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 | |
205 | / srv_max_purge_lag; | |
206 | if (ratio > ULINT_MAX / 10000) { |