4784 Satya Bodapati 2012-12-20
Bug #15927620 - AFTER DROPING A TABLE , THE PFS TABLE STILL, WILL HAVE
THE ENTRY OF THE *.IBD
When PFS is enabled, create table operation adds entries to PFS table
performance_schema.file_instances. After the drop table operation,
the entries in PFS table are left over.
This is because PFS_FILE_DELETE operation is not instrumented for
file deletion functions.
Fixed by instrumenting os_file_delete() and os_file_delete_if_exists()
with PFS_FILE_DELETE.
modified:
storage/innobase/dict/dict0dict.cc
storage/innobase/fil/fil0fil.cc
storage/innobase/fts/fts0fts.cc
storage/innobase/include/os0file.h
storage/innobase/include/os0file.ic
storage/innobase/os/os0file.cc
storage/innobase/row/row0quiesce.cc
4783 Bill Qu 2012-12-14
bug15842637 empty patch
modified:
storage/innobase/row/row0mysql.cc
=== modified file 'storage/innobase/dict/dict0dict.cc'
--- a/storage/innobase/dict/dict0dict.cc revid:bill.qu@stripped
+++ b/storage/innobase/dict/dict0dict.cc revid:satya.bodapati@stripped
@@ -1464,7 +1464,8 @@ dict_table_rename_in_cache(
/* Delete any temp file hanging around. */
if (os_file_status(filepath, &exists, &type)
&& exists
- && !os_file_delete_if_exists(filepath)) {
+ && !os_file_delete_if_exists(innodb_file_temp_key,
+ filepath)) {
ib_logf(IB_LOG_LEVEL_INFO,
"Delete of %s failed.", filepath);
=== modified file 'storage/innobase/fil/fil0fil.cc'
--- a/storage/innobase/fil/fil0fil.cc revid:bill.qu@stripped
+++ b/storage/innobase/fil/fil0fil.cc revid:satya.bodapati@stripped
@@ -2567,7 +2567,7 @@ fil_close_tablespace(
char* cfg_name = fil_make_cfg_name(path);
- os_file_delete_if_exists(cfg_name);
+ os_file_delete_if_exists(innodb_file_data_key, cfg_name);
mem_free(path);
mem_free(cfg_name);
@@ -2650,7 +2650,7 @@ fil_delete_tablespace(
when we drop the database the remove directory will fail. */
{
char* cfg_name = fil_make_cfg_name(path);
- os_file_delete_if_exists(cfg_name);
+ os_file_delete_if_exists(innodb_file_data_key, cfg_name);
mem_free(cfg_name);
}
@@ -2678,7 +2678,8 @@ fil_delete_tablespace(
if (err != DB_SUCCESS) {
rw_lock_x_unlock(&space->latch);
- } else if (!os_file_delete(path) && !os_file_delete_if_exists(path)) {
+ } else if (!os_file_delete(innodb_file_data_key, path)
+ && !os_file_delete_if_exists(innodb_file_data_key, path)) {
/* Note: This is because we have removed the
tablespace instance from the cache. */
@@ -3147,7 +3148,7 @@ fil_delete_link_file(
{
char* link_filepath = fil_make_isl_name(tablename);
- os_file_delete_if_exists(link_filepath);
+ os_file_delete_if_exists(innodb_file_data_key, link_filepath);
mem_free(link_filepath);
}
@@ -3458,7 +3459,7 @@ error_exit_1:
error_exit_2:
os_file_close(file);
if (err != DB_SUCCESS) {
- os_file_delete(path);
+ os_file_delete(innodb_file_data_key, path);
}
error_exit_3:
mem_free(path);
@@ -6109,11 +6110,11 @@ fil_delete_file(
ib_logf(IB_LOG_LEVEL_INFO, "Deleting %s", ibd_name);
- os_file_delete_if_exists(ibd_name);
+ os_file_delete_if_exists(innodb_file_data_key, ibd_name);
char* cfg_name = fil_make_cfg_name(ibd_name);
- os_file_delete_if_exists(cfg_name);
+ os_file_delete_if_exists(innodb_file_data_key, cfg_name);
mem_free(cfg_name);
}
=== modified file 'storage/innobase/fts/fts0fts.cc'
--- a/storage/innobase/fts/fts0fts.cc revid:bill.qu@stripped
+++ b/storage/innobase/fts/fts0fts.cc revid:satya.bodapati@stripped
@@ -5845,7 +5845,8 @@ fts_check_and_drop_orphaned_tables(
path = fil_make_ibd_name(
aux_table->name, false);
- os_file_delete_if_exists(path);
+ os_file_delete_if_exists(innodb_file_data_key,
+ path);
mem_free(path);
}
=== modified file 'storage/innobase/include/os0file.h'
--- a/storage/innobase/include/os0file.h revid:bill.qu@stripped
+++ b/storage/innobase/include/os0file.h revid:satya.bodapati@stripped
@@ -213,7 +213,9 @@ various file I/O operations with perform
1) register_pfs_file_open_begin() and register_pfs_file_open_end() are
used to register file creation, opening, closing and renaming.
2) register_pfs_file_io_begin() and register_pfs_file_io_end() are
-used to register actual file read, write and flush */
+used to register actual file read, write and flush
+3) register_pfs_file_close_begin() and register_pfs_file_close_end()
+are used to register file deletion operations*/
# define register_pfs_file_open_begin(state, locker, key, op, name, \
src_file, src_line) \
do { \
@@ -233,6 +235,25 @@ do { \
} \
} while (0)
+# define register_pfs_file_close_begin(state, locker, key, op, name, \
+ src_file, src_line) \
+do { \
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)( \
+ state, key, op, name, &locker); \
+ if (UNIV_LIKELY(locker != NULL)) { \
+ PSI_FILE_CALL(start_file_close_wait)( \
+ locker, src_file, src_line); \
+ } \
+} while (0)
+
+# define register_pfs_file_close_end(locker, result) \
+do { \
+ if (UNIV_LIKELY(locker != NULL)) { \
+ PSI_FILE_CALL(end_file_close_wait)( \
+ locker, result); \
+ } \
+} while (0)
+
# define register_pfs_file_io_begin(state, locker, file, count, op, \
src_file, src_line) \
do { \
@@ -306,6 +327,12 @@ The wrapper functions have the prefix of
# define os_file_rename(key, oldpath, newpath) \
pfs_os_file_rename_func(key, oldpath, newpath, __FILE__, __LINE__)
+
+# define os_file_delete(key, name) \
+ pfs_os_file_delete_func(key, name, __FILE__, __LINE__)
+
+# define os_file_delete_if_exists(key, name) \
+ pfs_os_file_delete_if_exists_func(key, name, __FILE__, __LINE__)
#else /* UNIV_PFS_IO */
/* If UNIV_PFS_IO is not defined, these I/O APIs point
@@ -341,6 +368,11 @@ to original un-instrumented file I/O API
# define os_file_rename(key, oldpath, newpath) \
os_file_rename_func(oldpath, newpath)
+# define os_file_delete(key, name) os_file_delete_func(name)
+
+# define os_file_delete_if_exists(key, name) \
+ os_file_delete_if_exists_func(name)
+
#endif /* UNIV_PFS_IO */
/* File types for directory entry data type */
@@ -527,8 +559,8 @@ Deletes a file. The file has to be close
@return TRUE if success */
UNIV_INTERN
bool
-os_file_delete(
-/*===========*/
+os_file_delete_func(
+/*================*/
const char* name); /*!< in: file path as a null-terminated
string */
@@ -537,8 +569,8 @@ Deletes a file if it exists. The file ha
@return TRUE if success */
UNIV_INTERN
bool
-os_file_delete_if_exists(
-/*=====================*/
+os_file_delete_if_exists_func(
+/*==========================*/
const char* name); /*!< in: file path as a null-terminated
string */
/***********************************************************************//**
@@ -767,6 +799,38 @@ pfs_os_file_rename_func(
const char* newpath,/*!< in: new file path */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line);/*!< in: line where the func invoked */
+
+/***********************************************************************//**
+NOTE! Please use the corresponding macro os_file_delete(), not directly
+this function!
+This is the performance schema instrumented wrapper function for
+os_file_delete()
+@return TRUE if success */
+UNIV_INLINE
+bool
+pfs_os_file_delete_func(
+/*====================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* name, /*!< in: old file path as a null-terminated
+ string */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
+
+/***********************************************************************//**
+NOTE! Please use the corresponding macro os_file_delete_if_exists(), not
+directly this function!
+This is the performance schema instrumented wrapper function for
+os_file_delete_if_exists()
+@return TRUE if success */
+UNIV_INLINE
+bool
+pfs_os_file_delete_if_exists_func(
+/*==============================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* name, /*!< in: old file path as a null-terminated
+ string */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line);/*!< in: line where the func invoked */
#endif /* UNIV_PFS_IO */
#ifdef UNIV_HOTBACKUP
=== modified file 'storage/innobase/include/os0file.ic'
--- a/storage/innobase/include/os0file.ic revid:bill.qu@stripped
+++ b/storage/innobase/include/os0file.ic revid:satya.bodapati@stripped
@@ -386,4 +386,64 @@ pfs_os_file_rename_func(
return(result);
}
+
+/***********************************************************************//**
+NOTE! Please use the corresponding macro os_file_delete(), not directly
+this function!
+This is the performance schema instrumented wrapper function for
+os_file_delete()
+@return TRUE if success */
+UNIV_INLINE
+bool
+pfs_os_file_delete_func(
+/*====================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* name, /*!< in: file path as a null-terminated
+ string */
+ const char* src_file, /*!< in: file name where func invoked */
+ ulint src_line) /*!< in: line where the func invoked */
+{
+ bool result;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ register_pfs_file_close_begin(&state, locker, key, PSI_FILE_DELETE,
+ name, src_file, src_line);
+
+ result = os_file_delete_func(name);
+
+ register_pfs_file_close_end(locker, 0);
+
+ return(result);
+}
+
+/***********************************************************************//**
+NOTE! Please use the corresponding macro os_file_delete_if_exists(), not
+directly this function!
+This is the performance schema instrumented wrapper function for
+os_file_delete_if_exists()
+@return TRUE if success */
+UNIV_INLINE
+bool
+pfs_os_file_delete_if_exists_func(
+/*==============================*/
+ mysql_pfs_key_t key, /*!< in: Performance Schema Key */
+ const char* name, /*!< in: file path as a null-terminated
+ string */
+ const char* src_file, /*!< in: file name where func invoked */
+ ulint src_line) /*!< in: line where the func invoked */
+{
+ bool result;
+ struct PSI_file_locker* locker = NULL;
+ PSI_file_locker_state state;
+
+ register_pfs_file_close_begin(&state, locker, key, PSI_FILE_DELETE,
+ name, src_file, src_line);
+
+ result = os_file_delete_if_exists_func(name);
+
+ register_pfs_file_close_end(locker, 0);
+
+ return(result);
+}
#endif /* UNIV_PFS_IO */
=== modified file 'storage/innobase/os/os0file.cc'
--- a/storage/innobase/os/os0file.cc revid:bill.qu@stripped
+++ b/storage/innobase/os/os0file.cc revid:satya.bodapati@stripped
@@ -1800,8 +1800,8 @@ Deletes a file if it exists. The file ha
@return TRUE if success */
UNIV_INTERN
bool
-os_file_delete_if_exists(
-/*=====================*/
+os_file_delete_if_exists_func(
+/*==========================*/
const char* name) /*!< in: file path as a null-terminated
string */
{
@@ -1862,8 +1862,8 @@ Deletes a file. The file has to be close
@return TRUE if success */
UNIV_INTERN
bool
-os_file_delete(
-/*===========*/
+os_file_delete_func(
+/*================*/
const char* name) /*!< in: file path as a null-terminated
string */
{
=== modified file 'storage/innobase/row/row0quiesce.cc'
--- a/storage/innobase/row/row0quiesce.cc revid:bill.qu@stripped
+++ b/storage/innobase/row/row0quiesce.cc revid:satya.bodapati@stripped
@@ -610,7 +610,7 @@ row_quiesce_table_complete(
srv_get_meta_data_filename(table, cfg_name, sizeof(cfg_name));
- os_file_delete_if_exists(cfg_name);
+ os_file_delete_if_exists(innodb_file_data_key, cfg_name);
ib_logf(IB_LOG_LEVEL_INFO,
"Deleting the meta-data file '%s'", cfg_name);
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.6 branch (satya.bodapati:4783 to 4784) Bug#15927620 | Satya Bodapati | 20 Dec |