]> git.pld-linux.org Git - packages/mysql.git/blob - innodb_fix_misc.patch
- more mysqld.conf changes: skip-locking, default-character-set
[packages/mysql.git] / innodb_fix_misc.patch
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 @@ -1868,6 +1868,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 @@ -1894,15 +1896,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 @@ -1915,12 +1919,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 @@ -1928,7 +1927,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 @@ -53,6 +53,11 @@
87  #define INNODB_VERSION_MINOR   1
88  #define INNODB_VERSION_BUGFIX  5
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 @@ -65,7 +70,8 @@
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)
105  
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
111 @@ -408,7 +408,7 @@
112         ptr += 2;
113  
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;
118  
119                 return(NULL);
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
123 @@ -51,6 +51,7 @@
124  #include "btr0sea.h"
125  #include "fil0fil.h"
126  #include "ibuf0ibuf.h"
127 +#include "ha_prototypes.h"
128  
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 @@
132  
133         thr = que_fork_get_first_thr(prebuilt->ins_graph);
134  
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);
139 +               }
140 +       }
141 +
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;
153  
154         rec_offs_init(offsets_);
155  
156 @@ -3732,6 +3733,17 @@
157  
158         /* Do some start-of-statement preparations */
159  
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);
165 +                       }
166 +               }
167 +               problematic_use = TRUE;
168 +       }
169 +retry_check:
170 +       
171         if (!prebuilt->sql_stat_start) {
172                 /* No need to set an intention lock or assign a read view */
173  
174 @@ -3742,6 +3754,18 @@
175                               " perform a consistent read\n"
176                               "InnoDB: but the read view is not assigned!\n",
177                               stderr);
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);
186 +                               }
187 +                               prebuilt->sql_stat_start = TRUE;
188 +                               goto retry_check;
189 +                       }
190                         trx_print(stderr, trx, 600);
191                         fputc('\n', stderr);
192                         ut_error;
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);
199                 fprintf(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);
204         }
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
216                         / srv_max_purge_lag;
217                 if (ratio > ULINT_MAX / 10000) {
This page took 0.045802 seconds and 3 git commands to generate.