Merge lp:~laurynas-biveinis/percona-server/i-s-temp-tables-fixes-1-5.5 into lp:percona-server/5.5

Proposed by Laurynas Biveinis
Status: Work in progress
Proposed branch: lp:~laurynas-biveinis/percona-server/i-s-temp-tables-fixes-1-5.5
Merge into: lp:percona-server/5.5
Diff against target: 250 lines (+115/-37)
7 files modified
Percona-Server/mysql-test/r/percona_bug_1113388.result (+16/-0)
Percona-Server/mysql-test/t/percona_bug_1113388.test (+34/-0)
Percona-Server/sql/ha_partition.cc (+6/-0)
Percona-Server/sql/handler.cc (+11/-0)
Percona-Server/sql/handler.h (+9/-1)
Percona-Server/sql/sql_show.cc (+38/-36)
Percona-Server/sql/sql_table.cc (+1/-0)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/i-s-temp-tables-fixes-1-5.5
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Needs Resubmitting
George Ormond Lorch III (community) g2 Approve
Review via email: mp+178094@code.launchpad.net

Description of the change

http://jenkins.percona.com/job/percona-server-5.5-param/814/

Fix several INFORMATION_SCHEMA.GLOBAL_TEMPORARY_TABLES bugs. No BT or ST, but bug 1193308 is a 5.6 QA blocker.

548. By Laurynas Biveinis 4 hours ago

    Merge bug 1113388 fix from 5.1.

    Add a testcase and supporting DEBUG_SYNC points.
547. By Laurynas Biveinis 7 hours ago

    Automerge bug 1193264 fix from 5.1.
546. By Laurynas Biveinis 7 hours ago

    Automerge bug 1193308 fix from 5.1.
545. By Laurynas Biveinis 8 hours ago

    Automerge bug 1206486 fix from 5.1.

To post a comment you must log in.
Revision history for this message
George Ormond Lorch III (gl-az) :
review: Approve (g2)
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Bug 1222709 means that this needs reworking even if OK technically.

review: Needs Resubmitting

Unmerged revisions

548. By Laurynas Biveinis

Merge bug 1113388 fix from 5.1.

Add a testcase and supporting DEBUG_SYNC points.

547. By Laurynas Biveinis

Automerge bug 1193264 fix from 5.1.

546. By Laurynas Biveinis

Automerge bug 1193308 fix from 5.1.

545. By Laurynas Biveinis

Automerge bug 1206486 fix from 5.1.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'Percona-Server/mysql-test/r/percona_bug_1113388.result'
--- Percona-Server/mysql-test/r/percona_bug_1113388.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/r/percona_bug_1113388.result 2013-08-01 15:13:09 +0000
@@ -0,0 +1,16 @@
1DROP TABLE IF EXISTS t1;
2CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
3INSERT INTO t1 VALUES (1);
4INSERT INTO t1 VALUES (2);
5SET DEBUG_SYNC= 'after_copy_data_between_tables_one_row SIGNAL optimize_ready WAIT_FOR i_s_stopped';
6OPTIMIZE TABLE t1;
7SET DEBUG_SYNC= 'now WAIT_FOR optimize_ready';
8SET DEBUG_SYNC= 'before_store_temporary_table_record SIGNAL i_s_stopped';
9SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_TEMPORARY_TABLES;
10Table Op Msg_type Msg_text
11test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
12test.t1 optimize status OK
13SET DEBUG_SYNC= 'now SIGNAL optimize_completed';
14COUNT(*)
151
16DROP TABLE t1;
017
=== added file 'Percona-Server/mysql-test/t/percona_bug_1113388.test'
--- Percona-Server/mysql-test/t/percona_bug_1113388.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/t/percona_bug_1113388.test 2013-08-01 15:13:09 +0000
@@ -0,0 +1,34 @@
1# Test for bug 1113388 (field.cc:3822: virtual longlong Field_long::val_int(): Assertion `table->in_use == _current_thd()' failed)
2
3--source include/have_innodb.inc
4--source include/have_debug_sync.inc
5
6--disable_warnings
7DROP TABLE IF EXISTS t1;
8--enable_warnings
9
10CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
11INSERT INTO t1 VALUES (1);
12INSERT INTO t1 VALUES (2);
13
14SET DEBUG_SYNC= 'after_copy_data_between_tables_one_row SIGNAL optimize_ready WAIT_FOR i_s_stopped';
15send OPTIMIZE TABLE t1;
16
17connect (conn2,localhost,root,,);
18connection conn2;
19
20SET DEBUG_SYNC= 'now WAIT_FOR optimize_ready';
21SET DEBUG_SYNC= 'before_store_temporary_table_record SIGNAL i_s_stopped';
22send SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_TEMPORARY_TABLES;
23
24connection default;
25reap;
26SET DEBUG_SYNC= 'now SIGNAL optimize_completed';
27
28connection conn2;
29reap;
30
31disconnect conn2;
32connection default;
33
34DROP TABLE t1;
035
=== modified file 'Percona-Server/sql/ha_partition.cc'
--- Percona-Server/sql/ha_partition.cc 2013-02-14 16:03:49 +0000
+++ Percona-Server/sql/ha_partition.cc 2013-08-01 15:13:09 +0000
@@ -2872,6 +2872,12 @@
2872 ha_partition *new_handler;2872 ha_partition *new_handler;
28732873
2874 DBUG_ENTER("ha_partition::clone");2874 DBUG_ENTER("ha_partition::clone");
2875
2876 /* If this->table == NULL, then the current handler has been created but not
2877 opened. Prohibit cloning such handler. */
2878 if (!table)
2879 DBUG_RETURN(NULL);
2880
2875 new_handler= new (mem_root) ha_partition(ht, table_share, m_part_info,2881 new_handler= new (mem_root) ha_partition(ht, table_share, m_part_info,
2876 this, mem_root);2882 this, mem_root);
2877 /*2883 /*
28782884
=== modified file 'Percona-Server/sql/handler.cc'
--- Percona-Server/sql/handler.cc 2013-06-27 15:35:20 +0000
+++ Percona-Server/sql/handler.cc 2013-08-01 15:13:09 +0000
@@ -2251,6 +2251,11 @@
2251****************************************************************************/2251****************************************************************************/
2252handler *handler::clone(const char *name, MEM_ROOT *mem_root)2252handler *handler::clone(const char *name, MEM_ROOT *mem_root)
2253{2253{
2254 /* If this->table == NULL, then the current handler has been created but not
2255 opened. Prohibit cloning such handler. */
2256 if (!table)
2257 return NULL;
2258
2254 handler *new_handler= get_new_handler(table->s, mem_root, ht);2259 handler *new_handler= get_new_handler(table->s, mem_root, ht);
2255 /*2260 /*
2256 Allocate handler->ref here because otherwise ha_open will allocate it2261 Allocate handler->ref here because otherwise ha_open will allocate it
@@ -2261,6 +2266,10 @@
2261 !(new_handler->ref= (uchar*) alloc_root(mem_root,2266 !(new_handler->ref= (uchar*) alloc_root(mem_root,
2262 ALIGN_SIZE(ref_length)*2)))2267 ALIGN_SIZE(ref_length)*2)))
2263 new_handler= NULL;2268 new_handler= NULL;
2269
2270 if (new_handler)
2271 new_handler->cloned = true;
2272
2264 /*2273 /*
2265 TODO: Implement a more efficient way to have more than one index open for2274 TODO: Implement a more efficient way to have more than one index open for
2266 the same table instance. The ha_open call is not cachable for clone.2275 the same table instance. The ha_open call is not cachable for clone.
@@ -2288,6 +2297,8 @@
22882297
2289THD *handler::ha_thd(void) const2298THD *handler::ha_thd(void) const
2290{2299{
2300 if (unlikely(cloned))
2301 return current_thd;
2291 DBUG_ASSERT(!table || !table->in_use || table->in_use == current_thd);2302 DBUG_ASSERT(!table || !table->in_use || table->in_use == current_thd);
2292 return (table && table->in_use) ? table->in_use : current_thd;2303 return (table && table->in_use) ? table->in_use : current_thd;
2293}2304}
22942305
=== modified file 'Percona-Server/sql/handler.h'
--- Percona-Server/sql/handler.h 2013-01-22 16:32:44 +0000
+++ Percona-Server/sql/handler.h 2013-08-01 15:13:09 +0000
@@ -1399,7 +1399,8 @@
1399 locked(FALSE), implicit_emptied(0),1399 locked(FALSE), implicit_emptied(0),
1400 pushed_cond(0), rows_read(0), rows_changed(0), next_insert_id(0), insert_id_for_cur_row(0),1400 pushed_cond(0), rows_read(0), rows_changed(0), next_insert_id(0), insert_id_for_cur_row(0),
1401 auto_inc_intervals_count(0),1401 auto_inc_intervals_count(0),
1402 m_psi(NULL)1402 m_psi(NULL),
1403 cloned(false)
1403 {1404 {
1404 memset(index_rows_read, 0, sizeof(index_rows_read));1405 memset(index_rows_read, 0, sizeof(index_rows_read));
1405 }1406 }
@@ -2119,6 +2120,13 @@
2119 */2120 */
2120 virtual int delete_table(const char *name);2121 virtual int delete_table(const char *name);
2121private:2122private:
2123
2124 /**
2125 If true, the current handler is a clone. In that case certain invariants
2126 such as table->in_use == current_thd do not hold.
2127 */
2128 bool cloned;
2129
2122 /* Private helpers */2130 /* Private helpers */
2123 inline void mark_trx_read_write();2131 inline void mark_trx_read_write();
2124private:2132private:
21252133
=== modified file 'Percona-Server/sql/sql_show.cc'
--- Percona-Server/sql/sql_show.cc 2013-06-27 15:11:49 +0000
+++ Percona-Server/sql/sql_show.cc 2013-08-01 15:13:09 +0000
@@ -3743,37 +3743,43 @@
3743 it but rather clone it. */3743 it but rather clone it. */
3744 file = file->clone(tmp_table->s->normalized_path.str, thd->mem_root);3744 file = file->clone(tmp_table->s->normalized_path.str, thd->mem_root);
37453745
3746 /**3746 if (file) {
3747 TODO: InnoDB stat(file) checks file on short names within data dictionary3747
3748 rather than using full path, because of that, temp files created in3748 /**
3749 TMPDIR will not have access/create time as it will not find the file3749 TODO: InnoDB stat(file) checks file on short names within data
37503750 dictionary rather than using full path, because of that, temp files
3751 The fix is to patch InnoDB to use full path3751 created in TMPDIR will not have access/create time as it will not find
3752 */3752 the file
3753 file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_NO_LOCK);3753
37543754 The fix is to patch InnoDB to use full path
3755 table->field[5]->store((longlong) file->stats.records, TRUE);3755 */
3756 table->field[5]->set_notnull();3756 file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_NO_LOCK);
37573757
3758 table->field[6]->store((longlong) file->stats.mean_rec_length, TRUE);3758 table->field[5]->store((longlong) file->stats.records, TRUE);
3759 table->field[7]->store((longlong) file->stats.data_file_length, TRUE);3759 table->field[5]->set_notnull();
3760 table->field[8]->store((longlong) file->stats.index_file_length, TRUE);3760
3761 if (file->stats.create_time)3761 table->field[6]->store((longlong) file->stats.mean_rec_length, TRUE);
3762 {3762 table->field[7]->store((longlong) file->stats.data_file_length, TRUE);
3763 thd->variables.time_zone->gmt_sec_to_TIME(&time,3763 table->field[8]->store((longlong) file->stats.index_file_length, TRUE);
3764 (my_time_t) file->stats.create_time);3764 if (file->stats.create_time)
3765 table->field[9]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);3765 {
3766 table->field[9]->set_notnull();3766 thd->variables.time_zone->gmt_sec_to_TIME(&time,
3767 }3767 (my_time_t)
3768 if (file->stats.update_time)3768 file->stats.create_time);
3769 {3769 table->field[9]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
3770 thd->variables.time_zone->gmt_sec_to_TIME(&time,3770 table->field[9]->set_notnull();
3771 (my_time_t) file->stats.update_time);3771 }
3772 table->field[10]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);3772 if (file->stats.update_time)
3773 table->field[10]->set_notnull();3773 {
3774 }3774 thd->variables.time_zone->gmt_sec_to_TIME(&time,
37753775 (my_time_t)
3776 file->close();3776 file->stats.update_time);
3777 table->field[10]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
3778 table->field[10]->set_notnull();
3779 }
3780
3781 file->close();
3782 }
3777 }3783 }
37783784
3779 DBUG_RETURN(schema_table_store_record(thd, table));3785 DBUG_RETURN(schema_table_store_record(thd, table));
@@ -3823,17 +3829,13 @@
3823 }3829 }
3824#endif3830#endif
38253831
3826 THD *t= tmp->in_use;3832 DEBUG_SYNC(thd, "before_store_temporary_table_record");
3827 tmp->in_use= thd;
3828
3829 if (store_temporary_table_record(thd_item, tables->table, tmp, thd->lex->select_lex.db, table_names_only)) {3833 if (store_temporary_table_record(thd_item, tables->table, tmp, thd->lex->select_lex.db, table_names_only)) {
3830 tmp->in_use= t;
3831 mysql_mutex_unlock(&thd_item->LOCK_temporary_tables);3834 mysql_mutex_unlock(&thd_item->LOCK_temporary_tables);
3832 mysql_mutex_unlock(&LOCK_thread_count); 3835 mysql_mutex_unlock(&LOCK_thread_count);
3833 DBUG_RETURN(1);3836 DBUG_RETURN(1);
3834 }3837 }
38353838
3836 tmp->in_use= t;
3837 }3839 }
3838 mysql_mutex_unlock(&thd_item->LOCK_temporary_tables);3840 mysql_mutex_unlock(&thd_item->LOCK_temporary_tables);
3839 }3841 }
38403842
=== modified file 'Percona-Server/sql/sql_table.cc'
--- Percona-Server/sql/sql_table.cc 2013-06-26 07:01:13 +0000
+++ Percona-Server/sql/sql_table.cc 2013-08-01 15:13:09 +0000
@@ -7381,6 +7381,7 @@
7381 }7381 }
7382 prev_insert_id= to->file->next_insert_id;7382 prev_insert_id= to->file->next_insert_id;
7383 error=to->file->ha_write_row(to->record[0]);7383 error=to->file->ha_write_row(to->record[0]);
7384 DEBUG_SYNC(thd, "after_copy_data_between_tables_one_row");
7384 to->auto_increment_field_not_null= FALSE;7385 to->auto_increment_field_not_null= FALSE;
7385 if (error)7386 if (error)
7386 {7387 {

Subscribers

People subscribed via source and target branches