Merge lp:~laurynas-biveinis/percona-server/i-s-temp-tables-fixes-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-5.5
Merge into: lp:percona-server/5.5
Diff against target: 151 lines (+50/-23)
2 files modified
Percona-Server/sql/sql_show.cc (+46/-23)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+4/-0)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/i-s-temp-tables-fixes-5.5
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Needs Fixing
Laurynas Biveinis (community) Needs Fixing
Review via email: mp+185498@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Same comment as for 5.1.

review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Same comments as in 5.1.

review: Needs Fixing

Unmerged revisions

559. By Laurynas Biveinis

Merge bug 1222709, bug 1113388, and bug 1223335 fixes from 5.1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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-09-13 13:44:20 +0000
@@ -3692,13 +3692,20 @@
3692 @param[in] table I_S table3692 @param[in] table I_S table
3693 @param[in] tmp_table temporary table3693 @param[in] tmp_table temporary table
3694 @param[in] db database name3694 @param[in] db database name
3695 @param[in] table_name_only whether to return only session_id,
3696 database, and table fields
3697 @param[in] thd_is_current_thd whether the temp table belongs to
3698 the current connection
36953699
3696 @return Operation status3700 @return Operation status
3697 @retval 0 success3701 @retval 0 success
3698 @retval 1 error3702 @retval 1 error
3699*/3703*/
37003704
3701static int store_temporary_table_record(THD *thd, TABLE *table, TABLE *tmp_table, const char *db, bool table_name_only)3705static int store_temporary_table_record(THD *thd, TABLE *table,
3706 TABLE *tmp_table, const char *db,
3707 bool table_name_only,
3708 bool thd_is_current_thd)
3702{3709{
3703 CHARSET_INFO *cs= system_charset_info;3710 CHARSET_INFO *cs= system_charset_info;
3704 DBUG_ENTER("store_temporary_table_record");3711 DBUG_ENTER("store_temporary_table_record");
@@ -3738,11 +3745,6 @@
37383745
3739 MYSQL_TIME time;3746 MYSQL_TIME time;
37403747
3741 /* We have only one handler object for a temp table globally and it might
3742 be in use by other thread. Do not trash it by invoking handler methods on
3743 it but rather clone it. */
3744 file = file->clone(tmp_table->s->normalized_path.str, thd->mem_root);
3745
3746 /**3748 /**
3747 TODO: InnoDB stat(file) checks file on short names within data dictionary3749 TODO: InnoDB stat(file) checks file on short names within data dictionary
3748 rather than using full path, because of that, temp files created in3750 rather than using full path, because of that, temp files created in
@@ -3750,14 +3752,33 @@
37503752
3751 The fix is to patch InnoDB to use full path3753 The fix is to patch InnoDB to use full path
3752 */3754 */
3753 file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_NO_LOCK);3755 if (thd_is_current_thd)
37543756 file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_NO_LOCK);
3755 table->field[5]->store((longlong) file->stats.records, TRUE);3757
3756 table->field[5]->set_notnull();3758 if (file->stats.records)
37573759 {
3758 table->field[6]->store((longlong) file->stats.mean_rec_length, TRUE);3760 table->field[5]->store((longlong) file->stats.records, TRUE);
3759 table->field[7]->store((longlong) file->stats.data_file_length, TRUE);3761 table->field[5]->set_notnull();
3760 table->field[8]->store((longlong) file->stats.index_file_length, TRUE);3762 }
3763
3764 if (file->stats.mean_rec_length)
3765 {
3766 table->field[6]->store((longlong) file->stats.mean_rec_length, TRUE);
3767 table->field[6]->set_notnull();
3768 }
3769
3770 if (file->stats.data_file_length)
3771 {
3772 table->field[7]->store((longlong) file->stats.data_file_length, TRUE);
3773 table->field[7]->set_notnull();
3774 }
3775
3776 if (file->stats.index_file_length)
3777 {
3778 table->field[8]->store((longlong) file->stats.index_file_length, TRUE);
3779 table->field[8]->set_notnull();
3780 }
3781
3761 if (file->stats.create_time)3782 if (file->stats.create_time)
3762 {3783 {
3763 thd->variables.time_zone->gmt_sec_to_TIME(&time,3784 thd->variables.time_zone->gmt_sec_to_TIME(&time,
@@ -3765,6 +3786,7 @@
3765 table->field[9]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);3786 table->field[9]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
3766 table->field[9]->set_notnull();3787 table->field[9]->set_notnull();
3767 }3788 }
3789
3768 if (file->stats.update_time)3790 if (file->stats.update_time)
3769 {3791 {
3770 thd->variables.time_zone->gmt_sec_to_TIME(&time,3792 thd->variables.time_zone->gmt_sec_to_TIME(&time,
@@ -3772,8 +3794,6 @@
3772 table->field[10]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);3794 table->field[10]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
3773 table->field[10]->set_notnull();3795 table->field[10]->set_notnull();
3774 }3796 }
3775
3776 file->close();
3777 }3797 }
37783798
3779 DBUG_RETURN(schema_table_store_record(thd, table));3799 DBUG_RETURN(schema_table_store_record(thd, table));
@@ -3823,17 +3843,14 @@
3823 }3843 }
3824#endif3844#endif
38253845
3826 THD *t= tmp->in_use;3846 if (store_temporary_table_record(thd_item, tables->table, tmp,
3827 tmp->in_use= thd;3847 thd->lex->select_lex.db,
38283848 table_names_only, thd_item == thd)) {
3829 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);3849 mysql_mutex_unlock(&thd_item->LOCK_temporary_tables);
3832 mysql_mutex_unlock(&LOCK_thread_count); 3850 mysql_mutex_unlock(&LOCK_thread_count);
3833 DBUG_RETURN(1);3851 DBUG_RETURN(1);
3834 }3852 }
38353853
3836 tmp->in_use= t;
3837 }3854 }
3838 mysql_mutex_unlock(&thd_item->LOCK_temporary_tables);3855 mysql_mutex_unlock(&thd_item->LOCK_temporary_tables);
3839 }3856 }
@@ -3864,11 +3881,17 @@
3864 bool table_names_only= (thd->lex->sql_command == SQLCOM_SHOW_TEMPORARY_TABLES) ? 1 : 0;3881 bool table_names_only= (thd->lex->sql_command == SQLCOM_SHOW_TEMPORARY_TABLES) ? 1 : 0;
3865 TABLE *tmp;3882 TABLE *tmp;
38663883
3884 mysql_mutex_lock(&thd->LOCK_temporary_tables);
3885
3867 for (tmp=thd->temporary_tables; tmp; tmp=tmp->next) {3886 for (tmp=thd->temporary_tables; tmp; tmp=tmp->next) {
3868 if (store_temporary_table_record(thd, tables->table, tmp, thd->lex->select_lex.db, table_names_only)) {3887 if (store_temporary_table_record(thd, tables->table, tmp,
3888 thd->lex->select_lex.db,
3889 table_names_only, true)) {
3890 mysql_mutex_unlock(&thd->LOCK_temporary_tables);
3869 DBUG_RETURN(1);3891 DBUG_RETURN(1);
3870 }3892 }
3871 }3893 }
3894 mysql_mutex_unlock(&thd->LOCK_temporary_tables);
3872 DBUG_RETURN(0);3895 DBUG_RETURN(0);
3873}3896}
38743897
38753898
=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-09-06 13:24:59 +0000
+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-09-13 13:44:20 +0000
@@ -5045,6 +5045,10 @@
5045 new_handler = static_cast<ha_innobase*>(handler::clone(name,5045 new_handler = static_cast<ha_innobase*>(handler::clone(name,
5046 mem_root));5046 mem_root));
5047 if (new_handler) {5047 if (new_handler) {
5048 DBUG_ASSERT(new_handler->prebuilt != NULL);
5049 DBUG_ASSERT(new_handler->user_thd == user_thd);
5050 DBUG_ASSERT(new_handler->prebuilt->trx == prebuilt->trx);
5051
5048 new_handler->prebuilt->select_lock_type5052 new_handler->prebuilt->select_lock_type
5049 = prebuilt->select_lock_type;5053 = prebuilt->select_lock_type;
5050 }5054 }

Subscribers

People subscribed via source and target branches