Merge lp:~percona-dev/percona-xtradb/fix-bugs-mysql-42101 into lp:~percona-dev/percona-xtradb/extensions-1.0

Proposed by Yasufumi Kinoshita
Status: Merged
Merged at revision: not available
Proposed branch: lp:~percona-dev/percona-xtradb/fix-bugs-mysql-42101
Merge into: lp:~percona-dev/percona-xtradb/extensions-1.0
Diff against target: None lines
To merge this branch: bzr merge lp:~percona-dev/percona-xtradb/fix-bugs-mysql-42101
Reviewer Review Type Date Requested Status
Aleksandr Kuzminsky (community) Approve
Review via email: mp+9917@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :

Aleksandr, please check this branch.

Revision history for this message
Aleksandr Kuzminsky (akuzminsky) wrote :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innodb_1.0.3_fix_from_5.1_builtin.patch'
2--- innodb_1.0.3_fix_from_5.1_builtin.patch 2009-07-31 01:41:55 +0000
3+++ innodb_1.0.3_fix_from_5.1_builtin.patch 2009-08-10 13:35:05 +0000
4@@ -1,6 +1,6 @@
5 diff -ru innodb_plugin-1.0.3_orig/dict/dict0dict.c innodb_plugin-1.0.3_tmp/dict/dict0dict.c
6---- innodb_plugin-1.0.3_orig/dict/dict0dict.c 2009-07-31 09:52:14.000000000 +0900
7-+++ innodb_plugin-1.0.3_tmp/dict/dict0dict.c 2009-07-31 09:54:22.000000000 +0900
8+--- innodb_plugin-1.0.3_orig/dict/dict0dict.c 2009-08-10 16:45:09.000000000 +0900
9++++ innodb_plugin-1.0.3_tmp/dict/dict0dict.c 2009-08-10 16:45:37.000000000 +0900
10 @@ -3049,7 +3049,7 @@
11 } else if (quote) {
12 /* Within quotes: do not look for
13@@ -11,10 +11,211 @@
14 quote = *sptr;
15 } else if (*sptr == '#'
16 diff -ru innodb_plugin-1.0.3_orig/handler/ha_innodb.cc innodb_plugin-1.0.3_tmp/handler/ha_innodb.cc
17---- innodb_plugin-1.0.3_orig/handler/ha_innodb.cc 2009-07-31 09:52:14.000000000 +0900
18-+++ innodb_plugin-1.0.3_tmp/handler/ha_innodb.cc 2009-07-31 09:54:22.000000000 +0900
19-@@ -9319,7 +9319,8 @@
20-
21+--- innodb_plugin-1.0.3_orig/handler/ha_innodb.cc 2009-08-10 16:45:09.000000000 +0900
22++++ innodb_plugin-1.0.3_tmp/handler/ha_innodb.cc 2009-08-10 22:27:35.000000000 +0900
23+@@ -160,6 +160,7 @@
24+ innobase_additional_mem_pool_size, innobase_file_io_threads,
25+ innobase_force_recovery, innobase_open_files,
26+ innobase_autoinc_lock_mode;
27++static unsigned long innobase_commit_concurrency = 0;
28+
29+ static unsigned long innobase_read_io_threads, innobase_write_io_threads;
30+ static my_bool innobase_thread_concurrency_timer_based;
31+@@ -278,6 +279,53 @@
32+
33+ static const char innobase_hton_name[]= "InnoDB";
34+
35++/** @brief Initialize the default value of innodb_commit_concurrency.
36++
37++Once InnoDB is running, the innodb_commit_concurrency must not change
38++from zero to nonzero. (Bug #42101)
39++
40++The initial default value is 0, and without this extra initialization,
41++SET GLOBAL innodb_commit_concurrency=DEFAULT would set the parameter
42++to 0, even if it was initially set to nonzero at the command line
43++or configuration file. */
44++static
45++void
46++innobase_commit_concurrency_init_default(void);
47++/*==========================================*/
48++
49++/*****************************************************************
50++Check for a valid value of innobase_commit_concurrency. */
51++static
52++int
53++innobase_commit_concurrency_validate(
54++/*=================================*/
55++ /* out: 0 for valid
56++ innodb_commit_concurrency */
57++ THD* thd, /* in: thread handle */
58++ struct st_mysql_sys_var* var, /* in: pointer to system
59++ variable */
60++ void* save, /* out: immediate result
61++ for update function */
62++ struct st_mysql_value* value) /* in: incoming string */
63++{
64++ long long intbuf;
65++ ulong commit_concurrency;
66++
67++ DBUG_ENTER("innobase_commit_concurrency_validate");
68++
69++ if (value->val_int(value, &intbuf)) {
70++ /* The value is NULL. That is invalid. */
71++ DBUG_RETURN(1);
72++ }
73++
74++ *reinterpret_cast<ulong*>(save) = commit_concurrency
75++ = static_cast<ulong>(intbuf);
76++
77++ /* Allow the value to be updated, as long as it remains zero
78++ or nonzero. */
79++ DBUG_RETURN(!(!commit_concurrency == !innobase_commit_concurrency));
80++}
81++
82+ static MYSQL_THDVAR_BOOL(support_xa, PLUGIN_VAR_OPCMDARG,
83+ "Enable InnoDB support for the XA two-phase commit",
84+ /* check_func */ NULL, /* update_func */ NULL,
85+@@ -2261,6 +2309,8 @@
86+ ut_a(0 == strcmp(my_charset_latin1.name, "latin1_swedish_ci"));
87+ srv_latin1_ordering = my_charset_latin1.sort_order;
88+
89++ innobase_commit_concurrency_init_default();
90++
91+ /* Since we in this module access directly the fields of a trx
92+ struct, and due to different headers and flags it might happen that
93+ mutex_t has a different size in this module and in InnoDB
94+@@ -2582,11 +2632,11 @@
95+ Note, the position is current because of
96+ prepare_commit_mutex */
97+ retry:
98+- if (srv_commit_concurrency > 0) {
99++ if (innobase_commit_concurrency > 0) {
100+ pthread_mutex_lock(&commit_cond_m);
101+ commit_threads++;
102+
103+- if (commit_threads > srv_commit_concurrency) {
104++ if (commit_threads > innobase_commit_concurrency) {
105+ commit_threads--;
106+ pthread_cond_wait(&commit_cond,
107+ &commit_cond_m);
108+@@ -2603,7 +2653,7 @@
109+
110+ innobase_commit_low(trx);
111+
112+- if (srv_commit_concurrency > 0) {
113++ if (innobase_commit_concurrency > 0) {
114+ pthread_mutex_lock(&commit_cond_m);
115+ commit_threads--;
116+ pthread_cond_signal(&commit_cond);
117+@@ -9302,6 +9352,97 @@
118+ }
119+
120+
121++/***********************************************************************
122++Check whether any of the given columns is being renamed in the table. */
123++static
124++bool
125++column_is_being_renamed(
126++/*====================*/
127++ /* out: true if any of col_names is
128++ being renamed in table */
129++ TABLE* table, /* in: MySQL table */
130++ uint n_cols, /* in: number of columns */
131++ const char** col_names) /* in: names of the columns */
132++{
133++ uint j;
134++ uint k;
135++ Field* field;
136++ const char* col_name;
137++
138++ for (j = 0; j < n_cols; j++) {
139++ col_name = col_names[j];
140++ for (k = 0; k < table->s->fields; k++) {
141++ field = table->field[k];
142++ if ((field->flags & FIELD_IS_RENAMED)
143++ && innobase_strcasecmp(field->field_name,
144++ col_name) == 0) {
145++ return(true);
146++ }
147++ }
148++ }
149++
150++ return(false);
151++}
152++
153++/***********************************************************************
154++Check whether a column in table "table" is being renamed and if this column
155++is part of a foreign key, either part of another table, referencing this
156++table or part of this table, referencing another table. */
157++static
158++bool
159++foreign_key_column_is_being_renamed(
160++/*================================*/
161++ /* out: true if a column that
162++ participates in a foreign key definition
163++ is being renamed */
164++ row_prebuilt_t* prebuilt, /* in: InnoDB prebuilt struct */
165++ TABLE* table) /* in: MySQL table */
166++{
167++ dict_foreign_t* foreign;
168++
169++ /* check whether there are foreign keys at all */
170++ if (UT_LIST_GET_LEN(prebuilt->table->foreign_list) == 0
171++ && UT_LIST_GET_LEN(prebuilt->table->referenced_list) == 0) {
172++ /* no foreign keys involved with prebuilt->table */
173++
174++ return(false);
175++ }
176++
177++ row_mysql_lock_data_dictionary(prebuilt->trx);
178++
179++ /* Check whether any column in the foreign key constraints which refer
180++ to this table is being renamed. */
181++ for (foreign = UT_LIST_GET_FIRST(prebuilt->table->referenced_list);
182++ foreign != NULL;
183++ foreign = UT_LIST_GET_NEXT(referenced_list, foreign)) {
184++
185++ if (column_is_being_renamed(table, foreign->n_fields,
186++ foreign->referenced_col_names)) {
187++
188++ row_mysql_unlock_data_dictionary(prebuilt->trx);
189++ return(true);
190++ }
191++ }
192++
193++ /* Check whether any column in the foreign key constraints in the
194++ table is being renamed. */
195++ for (foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
196++ foreign != NULL;
197++ foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
198++
199++ if (column_is_being_renamed(table, foreign->n_fields,
200++ foreign->foreign_col_names)) {
201++
202++ row_mysql_unlock_data_dictionary(prebuilt->trx);
203++ return(true);
204++ }
205++ }
206++
207++ row_mysql_unlock_data_dictionary(prebuilt->trx);
208++
209++ return(false);
210++}
211++
212+ UNIV_INTERN
213+ bool
214+ ha_innobase::check_if_incompatible_data(
215+@@ -9320,9 +9461,17 @@
216+ return(COMPATIBLE_DATA_NO);
217+ }
218+
219++ /* Check if a column participating in a foreign key is being renamed.
220++ There is no mechanism for updating InnoDB foreign key definitions. */
221++ if (foreign_key_column_is_being_renamed(prebuilt, table)) {
222++
223++ return(COMPATIBLE_DATA_NO);
224++ }
225++
226 /* Check that row format didn't change */
227 if ((info->used_fields & HA_CREATE_USED_ROW_FORMAT) &&
228 - get_row_type() != info->row_type) {
229@@ -23,9 +224,47 @@
230
231 return(COMPATIBLE_DATA_NO);
232 }
233+@@ -9882,10 +10031,10 @@
234+ "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
235+ NULL, NULL, 8*1024*1024L, 5*1024*1024L, LONGLONG_MAX, 1024*1024L);
236+
237+-static MYSQL_SYSVAR_ULONG(commit_concurrency, srv_commit_concurrency,
238++static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
239+ PLUGIN_VAR_RQCMDARG,
240+ "Helps in performance tuning in heavily concurrent environments.",
241+- NULL, NULL, 0, 0, 1000, 0);
242++ innobase_commit_concurrency_validate, NULL, 0, 0, 1000, 0);
243+
244+ static MYSQL_SYSVAR_ULONG(concurrency_tickets, srv_n_free_tickets_to_enter,
245+ PLUGIN_VAR_RQCMDARG,
246+@@ -10365,6 +10514,24 @@
247+ i_s_innodb_patches
248+ mysql_declare_plugin_end;
249+
250++/** @brief Initialize the default value of innodb_commit_concurrency.
251++
252++Once InnoDB is running, the innodb_commit_concurrency must not change
253++from zero to nonzero. (Bug #42101)
254++
255++The initial default value is 0, and without this extra initialization,
256++SET GLOBAL innodb_commit_concurrency=DEFAULT would set the parameter
257++to 0, even if it was initially set to nonzero at the command line
258++or configuration file. */
259++static
260++void
261++innobase_commit_concurrency_init_default(void)
262++/*==========================================*/
263++{
264++ MYSQL_SYSVAR_NAME(commit_concurrency).def_val
265++ = innobase_commit_concurrency;
266++}
267++
268+ #ifdef UNIV_COMPILE_TEST_FUNCS
269+
270+ typedef struct innobase_convert_name_test_struct {
271 diff -ru innodb_plugin-1.0.3_orig/include/row0mysql.h innodb_plugin-1.0.3_tmp/include/row0mysql.h
272 --- innodb_plugin-1.0.3_orig/include/row0mysql.h 2009-02-17 18:33:38.000000000 +0900
273-+++ innodb_plugin-1.0.3_tmp/include/row0mysql.h 2009-07-31 09:54:22.000000000 +0900
274++++ innodb_plugin-1.0.3_tmp/include/row0mysql.h 2009-08-10 16:45:37.000000000 +0900
275 @@ -695,6 +695,21 @@
276 This eliminates lock waits in some
277 cases; note that this breaks
278@@ -48,9 +287,20 @@
279 ulint mysql_prefix_len;/* byte offset of the end of
280 the last requested column */
281 ulint mysql_row_len; /* length in bytes of a row in the
282+diff -ru innodb_plugin-1.0.3_orig/include/srv0srv.h innodb_plugin-1.0.3_tmp/include/srv0srv.h
283+--- innodb_plugin-1.0.3_orig/include/srv0srv.h 2009-08-10 16:45:09.000000000 +0900
284++++ innodb_plugin-1.0.3_tmp/include/srv0srv.h 2009-08-10 16:48:52.000000000 +0900
285+@@ -151,7 +151,6 @@
286+
287+ extern ulint srv_force_recovery;
288+ extern ulong srv_thread_concurrency;
289+-extern ulong srv_commit_concurrency;
290+
291+ extern ulint srv_max_n_threads;
292+
293 diff -ru innodb_plugin-1.0.3_orig/include/trx0trx.h innodb_plugin-1.0.3_tmp/include/trx0trx.h
294---- innodb_plugin-1.0.3_orig/include/trx0trx.h 2009-07-31 09:52:14.000000000 +0900
295-+++ innodb_plugin-1.0.3_tmp/include/trx0trx.h 2009-07-31 09:54:22.000000000 +0900
296+--- innodb_plugin-1.0.3_orig/include/trx0trx.h 2009-08-10 16:45:09.000000000 +0900
297++++ innodb_plugin-1.0.3_tmp/include/trx0trx.h 2009-08-10 16:45:37.000000000 +0900
298 @@ -43,34 +43,6 @@
299 the kernel mutex */
300 extern ulint trx_n_mysql_transactions;
301@@ -109,7 +359,7 @@
302 UT_LIST_NODE_T(trx_t)
303 diff -ru innodb_plugin-1.0.3_orig/include/trx0trx.ic innodb_plugin-1.0.3_tmp/include/trx0trx.ic
304 --- innodb_plugin-1.0.3_orig/include/trx0trx.ic 2009-02-17 18:43:50.000000000 +0900
305-+++ innodb_plugin-1.0.3_tmp/include/trx0trx.ic 2009-07-31 09:54:22.000000000 +0900
306++++ innodb_plugin-1.0.3_tmp/include/trx0trx.ic 2009-08-10 16:45:37.000000000 +0900
307 @@ -55,64 +55,6 @@
308 }
309 }
310@@ -176,8 +426,8 @@
311 Retrieves the error_info field from a trx. */
312 UNIV_INLINE
313 diff -ru innodb_plugin-1.0.3_orig/lock/lock0lock.c innodb_plugin-1.0.3_tmp/lock/lock0lock.c
314---- innodb_plugin-1.0.3_orig/lock/lock0lock.c 2009-07-31 09:52:14.000000000 +0900
315-+++ innodb_plugin-1.0.3_tmp/lock/lock0lock.c 2009-07-31 09:54:22.000000000 +0900
316+--- innodb_plugin-1.0.3_orig/lock/lock0lock.c 2009-08-10 16:45:08.000000000 +0900
317++++ innodb_plugin-1.0.3_tmp/lock/lock0lock.c 2009-08-10 16:45:37.000000000 +0900
318 @@ -1976,12 +1976,6 @@
319 if (lock == NULL) {
320 if (!impl) {
321@@ -227,8 +477,8 @@
322
323 err = DB_SUCCESS;
324 diff -ru innodb_plugin-1.0.3_orig/row/row0mysql.c innodb_plugin-1.0.3_tmp/row/row0mysql.c
325---- innodb_plugin-1.0.3_orig/row/row0mysql.c 2009-07-31 09:52:14.000000000 +0900
326-+++ innodb_plugin-1.0.3_tmp/row/row0mysql.c 2009-07-31 09:57:21.000000000 +0900
327+--- innodb_plugin-1.0.3_orig/row/row0mysql.c 2009-08-10 16:45:09.000000000 +0900
328++++ innodb_plugin-1.0.3_tmp/row/row0mysql.c 2009-08-10 16:45:37.000000000 +0900
329 @@ -1452,12 +1452,9 @@
330 and clust_pcur, and we do not need to
331 reposition the cursors. */
332@@ -294,6 +544,8 @@
333 + transaction, do not unlock it. */
334
335 - goto func_exit;
336+- }
337+- }
338 + if (index->trx_id_offset) {
339 + rec_trx_id = trx_read_trx_id(rec
340 + + index->trx_id_offset);
341@@ -305,46 +557,43 @@
342 + *offsets_ = (sizeof offsets_) / sizeof *offsets_;
343 + offsets = rec_get_offsets(rec, index, offsets,
344 + ULINT_UNDEFINED, &heap);
345-+
346+
347+- index = btr_pcur_get_btr_cur(clust_pcur)->index;
348 + rec_trx_id = row_get_rec_trx_id(rec, index, offsets);
349-+
350+
351+- if (index != NULL && trx_new_rec_locks_contain(trx, index)) {
352 + if (UNIV_LIKELY_NULL(heap)) {
353 + mem_heap_free(heap);
354 + }
355- }
356-- }
357--
358-- index = btr_pcur_get_btr_cur(clust_pcur)->index;
359++ }
360
361-- if (index != NULL && trx_new_rec_locks_contain(trx, index)) {
362+- mtr_start(&mtr);
363 + if (ut_dulint_cmp(rec_trx_id, trx->id) != 0) {
364 + /* We did not update the record: unlock it */
365
366-- mtr_start(&mtr);
367+- /* Restore the cursor position and find the record */
368 + rec = btr_pcur_get_rec(pcur);
369 + index = btr_pcur_get_btr_cur(pcur)->index;
370
371-- /* Restore the cursor position and find the record */
372-+ lock_rec_unlock(trx, btr_pcur_get_block(pcur),
373-+ rec, prebuilt->select_lock_type);
374-
375 - if (!has_latches_on_recs) {
376 - btr_pcur_restore_position(BTR_SEARCH_LEAF, clust_pcur,
377 - &mtr);
378+- }
379++ lock_rec_unlock(trx, btr_pcur_get_block(pcur),
380++ rec, prebuilt->select_lock_type);
381+
382+- rec = btr_pcur_get_rec(clust_pcur);
383 + if (prebuilt->new_rec_locks >= 2) {
384 + rec = btr_pcur_get_rec(clust_pcur);
385 + index = btr_pcur_get_btr_cur(clust_pcur)->index;
386-+
387+
388+- lock_rec_unlock(trx, btr_pcur_get_block(clust_pcur),
389+- rec, prebuilt->select_lock_type);
390 + lock_rec_unlock(trx, btr_pcur_get_block(clust_pcur),
391 + rec, prebuilt->select_lock_type);
392 + }
393- }
394++ }
395
396-- rec = btr_pcur_get_rec(clust_pcur);
397--
398-- lock_rec_unlock(trx, btr_pcur_get_block(clust_pcur),
399-- rec, prebuilt->select_lock_type);
400--
401 +no_unlock:
402 mtr_commit(&mtr);
403 }
404@@ -355,7 +604,7 @@
405 return(DB_SUCCESS);
406 diff -ru innodb_plugin-1.0.3_orig/row/row0sel.c innodb_plugin-1.0.3_tmp/row/row0sel.c
407 --- innodb_plugin-1.0.3_orig/row/row0sel.c 2009-02-17 16:56:33.000000000 +0900
408-+++ innodb_plugin-1.0.3_tmp/row/row0sel.c 2009-07-31 09:54:22.000000000 +0900
409++++ innodb_plugin-1.0.3_tmp/row/row0sel.c 2009-08-10 16:45:37.000000000 +0900
410 @@ -3002,8 +3002,9 @@
411 func_exit:
412 *out_rec = clust_rec;
413@@ -455,9 +704,20 @@
414 }
415
416 mode = pcur->search_mode;
417+diff -ru innodb_plugin-1.0.3_orig/srv/srv0srv.c innodb_plugin-1.0.3_tmp/srv/srv0srv.c
418+--- innodb_plugin-1.0.3_orig/srv/srv0srv.c 2009-08-10 16:45:09.000000000 +0900
419++++ innodb_plugin-1.0.3_tmp/srv/srv0srv.c 2009-08-10 16:48:25.000000000 +0900
420+@@ -289,7 +289,6 @@
421+
422+ UNIV_INTERN ibool srv_thread_concurrency_timer_based = FALSE;
423+ UNIV_INTERN ulong srv_thread_concurrency = 0;
424+-UNIV_INTERN ulong srv_commit_concurrency = 0;
425+
426+ /* this mutex protects srv_conc data structures */
427+ UNIV_INTERN os_fast_mutex_t srv_conc_mutex;
428 diff -ru innodb_plugin-1.0.3_orig/trx/trx0trx.c innodb_plugin-1.0.3_tmp/trx/trx0trx.c
429---- innodb_plugin-1.0.3_orig/trx/trx0trx.c 2009-07-31 09:52:14.000000000 +0900
430-+++ innodb_plugin-1.0.3_tmp/trx/trx0trx.c 2009-07-31 09:54:22.000000000 +0900
431+--- innodb_plugin-1.0.3_orig/trx/trx0trx.c 2009-08-10 16:45:09.000000000 +0900
432++++ innodb_plugin-1.0.3_tmp/trx/trx0trx.c 2009-08-10 16:45:37.000000000 +0900
433 @@ -187,8 +187,6 @@
434 trx->autoinc_locks = ib_vector_create(
435 mem_heap_create(sizeof(ib_vector_t) + sizeof(void*) * 4), 4);

Subscribers

People subscribed via source and target branches

to all changes: