From: Mayank Prasad Date: July 13 2012 10:59am Subject: bzr push into mysql-trunk branch (mayank.prasad:4050 to 4051) Bug#14113704 List-Archive: http://lists.mysql.com/commits/144445 X-Bug: 14113704 Message-Id: <201207131059.q6DAx6eN017422@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4051 Mayank Prasad 2012-07-13 [merge] Bug#14113704 : A STAT ON A NON EXISTING FILE CREATING A FILE RECORD IN PFS Merge : 5.6->trunk modified: include/mysql/psi/mysql_file.h include/mysql/psi/psi.h include/mysql/psi/psi_abi_v1.h.pp mysql-test/suite/perfschema/r/misc.result mysql-test/suite/perfschema/t/disabled.def mysql-test/suite/perfschema/t/misc.test mysys/psi_noop.c storage/perfschema/pfs.cc storage/perfschema/unittest/pfs-t.cc 4050 Jimmy Yang 2012-07-13 [merge] Merge from mysql-5.6 to mysql-trunk === modified file 'include/mysql/psi/mysql_file.h' --- a/include/mysql/psi/mysql_file.h 2012-05-15 09:39:47 +0000 +++ b/include/mysql/psi/mysql_file.h 2012-07-13 10:55:34 +0000 @@ -759,7 +759,7 @@ inline_mysql_file_stat( { PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); result= my_stat(path, stat_area, flags); - PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); + PSI_FILE_CALL(end_file_open_wait)(locker, result); return result; } #endif @@ -816,7 +816,7 @@ inline_mysql_file_fopen( that->m_psi= PSI_FILE_CALL(start_file_open_wait) (locker, src_file, src_line); that->m_file= my_fopen(filename, flags, myFlags); - PSI_FILE_CALL(end_file_open_wait)(locker); + PSI_FILE_CALL(end_file_open_wait)(locker, NULL); if (unlikely(that->m_file == NULL)) { my_free(that); === modified file 'include/mysql/psi/psi.h' --- a/include/mysql/psi/psi.h 2012-05-21 12:00:48 +0000 +++ b/include/mysql/psi/psi.h 2012-07-13 10:55:34 +0000 @@ -1581,7 +1581,8 @@ typedef struct PSI_file* (*start_file_op End a file instrumentation open operation, for file streams. @param locker the file locker. */ -typedef void (*end_file_open_wait_v1_t)(struct PSI_file_locker *locker); +typedef void (*end_file_open_wait_v1_t)(struct PSI_file_locker *locker, + void *result); /** End a file instrumentation open operation, for non stream files. === modified file 'include/mysql/psi/psi_abi_v1.h.pp' --- a/include/mysql/psi/psi_abi_v1.h.pp 2012-05-02 11:04:32 +0000 +++ b/include/mysql/psi/psi_abi_v1.h.pp 2012-07-13 10:55:34 +0000 @@ -423,7 +423,8 @@ typedef struct PSI_table_locker* (*start typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker); typedef struct PSI_file* (*start_file_open_wait_v1_t) (struct PSI_file_locker *locker, const char *src_file, uint src_line); -typedef void (*end_file_open_wait_v1_t)(struct PSI_file_locker *locker); +typedef void (*end_file_open_wait_v1_t)(struct PSI_file_locker *locker, + void *result); typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t) (struct PSI_file_locker *locker, File file); typedef void (*start_file_wait_v1_t) === modified file 'mysql-test/suite/perfschema/r/misc.result' --- a/mysql-test/suite/perfschema/r/misc.result 2012-01-06 15:54:45 +0000 +++ b/mysql-test/suite/perfschema/r/misc.result 2012-07-13 10:55:34 +0000 @@ -42,12 +42,12 @@ AND EVENT_NAME IN WHERE NAME LIKE "wait/synch/%") LIMIT 1; create table test.t1(a int) engine=performance_schema; -ERROR HY000: Can't create table 'test.t1' (errno: 131) +ERROR HY000: Invalid performance_schema usage. SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type WHERE object_schema='test'; object_schema object_name create table test.t1 like performance_schema.events_waits_current; -ERROR HY000: Can't create table 'test.t1' (errno: 131) +ERROR HY000: Invalid performance_schema usage. SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type WHERE object_schema='test'; object_schema object_name === modified file 'mysql-test/suite/perfschema/t/disabled.def' --- a/mysql-test/suite/perfschema/t/disabled.def 2012-05-25 11:14:08 +0000 +++ b/mysql-test/suite/perfschema/t/disabled.def 2012-07-13 10:55:34 +0000 @@ -9,4 +9,3 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -misc : bug#14113704 24/04/2012 Mayank issue reported causing failure === modified file 'mysql-test/suite/perfschema/t/misc.test' --- a/mysql-test/suite/perfschema/t/misc.test 2012-01-06 15:54:45 +0000 +++ b/mysql-test/suite/perfschema/t/misc.test 2012-07-13 10:55:34 +0000 @@ -77,7 +77,7 @@ LIMIT 1; # Bug#45088 Should not be able to create tables of engine PERFORMANCE_SCHEMA # ---error ER_CANT_CREATE_TABLE +--error ER_WRONG_PERFSCHEMA_USAGE create table test.t1(a int) engine=performance_schema; # The table should not appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE @@ -89,7 +89,7 @@ SELECT object_schema, object_name FROM p # Bug#44897 Performance Schema: can create a ghost table in another database # ---error ER_CANT_CREATE_TABLE +--error ER_WRONG_PERFSCHEMA_USAGE create table test.t1 like performance_schema.events_waits_current; # The table should not appear in OBJECTS_SUMMARY_GLOBAL_BY_TYPE === modified file 'mysys/psi_noop.c' --- a/mysys/psi_noop.c 2012-05-02 11:04:32 +0000 +++ b/mysys/psi_noop.c 2012-07-13 10:55:34 +0000 @@ -408,7 +408,8 @@ static PSI_file* start_file_open_wait_no return NULL; } -static void end_file_open_wait_noop(PSI_file_locker *locker NNN) +static void end_file_open_wait_noop(PSI_file_locker *locker NNN, + void *result NNN) { return; } === modified file 'storage/perfschema/pfs.cc' --- a/storage/perfschema/pfs.cc 2012-07-13 08:50:05 +0000 +++ b/storage/perfschema/pfs.cc 2012-07-13 10:58:11 +0000 @@ -3885,9 +3885,28 @@ static PSI_file* start_file_open_wait_v1 Implementation of the file instrumentation interface. @sa PSI_v1::end_file_open_wait. */ -static void end_file_open_wait_v1(PSI_file_locker *locker) +static void end_file_open_wait_v1(PSI_file_locker *locker, + void *result) { + PSI_file_locker_state *state= reinterpret_cast (locker); + DBUG_ASSERT(state != NULL); + end_file_wait_v1(locker, 0); + + /* + If its a stat operation and file doesn't exist, + destory all collected information. + */ + if(state->m_operation == PSI_FILE_STAT && + result == NULL) + { + PFS_file *file= reinterpret_cast (state->m_file); + DBUG_ASSERT(file != NULL); + PFS_thread *thread= reinterpret_cast (state->m_thread); + + DBUG_ASSERT(thread != NULL); + destroy_file(thread, file); + } } /** @@ -4054,7 +4073,7 @@ static void end_file_wait_v1(PSI_file_lo thread->m_events_waits_current--; } } - + /* Release or destroy the file if necessary */ switch(state->m_operation) { === modified file 'storage/perfschema/unittest/pfs-t.cc' --- a/storage/perfschema/unittest/pfs-t.cc 2012-06-01 03:42:14 +0000 +++ b/storage/perfschema/unittest/pfs-t.cc 2012-07-13 10:55:34 +0000 @@ -1299,7 +1299,7 @@ void test_locker_disabled() file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker != NULL, "locker"); psi->start_file_open_wait(file_locker, __FILE__, __LINE__); - psi->end_file_open_wait(file_locker); + psi->end_file_open_wait(file_locker, NULL); file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); No bundle (reason: useless for push emails).