Merge lp:~laurynas-biveinis/percona-server/bug951588-5.5 into lp:percona-server/5.5

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 265
Proposed branch: lp:~laurynas-biveinis/percona-server/bug951588-5.5
Merge into: lp:percona-server/5.5
Diff against target: 120 lines (+52/-8)
5 files modified
Percona-Server/mysql-test/suite/innodb/r/percona_bug_951588.result (+12/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_bug_951588.test (+29/-0)
Percona-Server/sql/handler.cc (+1/-0)
Percona-Server/sql/sql_show.cc (+10/-4)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+0/-4)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug951588-5.5
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+109273@code.launchpad.net

This proposal supersedes a proposal from 2012-06-06.

Description of the change

Merge bug 951588 fix from 5.1.
http://jenkins.percona.com/job/percona-server-5.5-param/421/
Issue 23438.

Changes from the previous 5.5 MP:
- 5.5.25 in trunk merged
- Adjust ha_innobase::clone() method not to assert that cloned handler
user_thd and prebuilt->trx are identical to original. This check is a
violation of handler::clone() contract that is supposed to create a
new handler not sharing the old one's state.

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_bug_951588.result'
2--- Percona-Server/mysql-test/suite/innodb/r/percona_bug_951588.result 1970-01-01 00:00:00 +0000
3+++ Percona-Server/mysql-test/suite/innodb/r/percona_bug_951588.result 2012-06-08 04:01:22 +0000
4@@ -0,0 +1,12 @@
5+DROP TABLE IF EXISTS t1;
6+CREATE TEMPORARY TABLE t1 (a INT) ENGINE=InnoDB;
7+INSERT INTO t1 VALUES (1), (2), (3);
8+SET DEBUG_SYNC= 'start_ha_write_row SIGNAL write_in_progress WAIT_FOR i_s_completed';
9+ALTER TABLE t1 ADD COLUMN b VARCHAR(10);
10+SET DEBUG_SYNC= 'now WAIT_FOR write_in_progress';
11+SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_TEMPORARY_TABLES;
12+COUNT(*)
13+2
14+SET DEBUG_SYNC= 'now SIGNAL i_s_completed';
15+DROP TABLE t1;
16+SET DEBUG_SYNC='reset';
17
18=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_bug_951588.test'
19--- Percona-Server/mysql-test/suite/innodb/t/percona_bug_951588.test 1970-01-01 00:00:00 +0000
20+++ Percona-Server/mysql-test/suite/innodb/t/percona_bug_951588.test 2012-06-08 04:01:22 +0000
21@@ -0,0 +1,29 @@
22+# Test for bug 951588 (Querying I_S.TEMPORARY_TABLES crashes parallel threads working on temp tables)
23+
24+--source include/have_innodb.inc
25+--source include/have_debug_sync.inc
26+
27+--disable_warnings
28+DROP TABLE IF EXISTS t1;
29+--enable_warnings
30+
31+CREATE TEMPORARY TABLE t1 (a INT) ENGINE=InnoDB;
32+INSERT INTO t1 VALUES (1), (2), (3);
33+
34+SET DEBUG_SYNC= 'start_ha_write_row SIGNAL write_in_progress WAIT_FOR i_s_completed';
35+send ALTER TABLE t1 ADD COLUMN b VARCHAR(10);
36+
37+connect (conn2,localhost,root,,);
38+connection conn2;
39+
40+SET DEBUG_SYNC= 'now WAIT_FOR write_in_progress';
41+SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_TEMPORARY_TABLES;
42+SET DEBUG_SYNC= 'now SIGNAL i_s_completed';
43+
44+disconnect conn2;
45+connection default;
46+reap;
47+
48+DROP TABLE t1;
49+
50+SET DEBUG_SYNC='reset';
51
52=== modified file 'Percona-Server/sql/handler.cc'
53--- Percona-Server/sql/handler.cc 2012-05-18 04:37:44 +0000
54+++ Percona-Server/sql/handler.cc 2012-06-08 04:01:22 +0000
55@@ -5315,6 +5315,7 @@
56 int error;
57 Log_func *log_func= Write_rows_log_event::binlog_row_logging_function;
58 DBUG_ENTER("handler::ha_write_row");
59+ DEBUG_SYNC(ha_thd(), "start_ha_write_row");
60
61 MYSQL_INSERT_ROW_START(table_share->db.str, table_share->table_name.str);
62 mark_trx_read_write();
63
64=== modified file 'Percona-Server/sql/sql_show.cc'
65--- Percona-Server/sql/sql_show.cc 2012-06-05 10:36:15 +0000
66+++ Percona-Server/sql/sql_show.cc 2012-06-08 04:01:22 +0000
67@@ -3728,8 +3728,9 @@
68 DBUG_RETURN(schema_table_store_record(thd, table));
69
70 //engine
71- handler *handle= tmp_table->file;
72- char *engineType = (char *)(handle ? handle->table_type() : "UNKNOWN");
73+ handler *file= tmp_table->file;
74+ // Assume that invoking handler::table_type() on a shared handler is safe
75+ const char *engineType = (file) ? file->table_type() : "UNKNOWN";
76 table->field[3]->store(engineType, strlen(engineType), cs);
77
78 //name
79@@ -3740,12 +3741,15 @@
80 }
81
82 // file stats
83- handler *file= tmp_table->file;
84-
85 if (file) {
86
87 MYSQL_TIME time;
88
89+ /* We have only one handler object for a temp table globally and it might
90+ be in use by other thread. Do not trash it by invoking handler methods on
91+ it but rather clone it. */
92+ file = file->clone(tmp_table->s->normalized_path.str, thd->mem_root);
93+
94 /**
95 TODO: InnoDB stat(file) checks file on short names within data dictionary
96 rather than using full path, because of that, temp files created in
97@@ -3775,6 +3779,8 @@
98 table->field[10]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
99 table->field[10]->set_notnull();
100 }
101+
102+ file->close();
103 }
104
105 DBUG_RETURN(schema_table_store_record(thd, table));
106
107=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
108--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-06-05 10:36:15 +0000
109+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-06-08 04:01:22 +0000
110@@ -4821,10 +4821,6 @@
111 new_handler = static_cast<ha_innobase*>(handler::clone(name,
112 mem_root));
113 if (new_handler) {
114- DBUG_ASSERT(new_handler->prebuilt != NULL);
115- DBUG_ASSERT(new_handler->user_thd == user_thd);
116- DBUG_ASSERT(new_handler->prebuilt->trx == prebuilt->trx);
117-
118 new_handler->prebuilt->select_lock_type
119 = prebuilt->select_lock_type;
120 }

Subscribers

People subscribed via source and target branches