diff options
author | unknown <gkodinov/kgeorge@macbook.gmz> | 2007-06-04 18:56:29 +0300 |
---|---|---|
committer | unknown <gkodinov/kgeorge@macbook.gmz> | 2007-06-04 18:56:29 +0300 |
commit | fce63f8f3f773f8013787f216a20ee67fc3e8f3e (patch) | |
tree | 00fdd7e24fdb43ecbf220bfec2b742ae6d90c4d1 /sql/sql_table.cc | |
parent | 272a54568ece68e08fac672759f27ca741715e79 (diff) | |
download | mariadb-git-fce63f8f3f773f8013787f216a20ee67fc3e8f3e.tar.gz |
Bug #28488: Incorrect information in file: './test/t1_test#.frm'
While executing ALTER TABLE ... PARTITION the server uses
a temporary "shadow" table to create the updated table.
This shadow table then gets renamed as the original table.
The shadow table was not prefixed with the special prefix that
marks temporary tables so it was picked up by SHOW TABLE STATUS.
Fixed by isolating the code to create the shadow table name in a
separate function and prefixing the shadow table name with the
special prefix to exclude it from the list of user tables.
See bug 18775 and WL1324 for details.
mysql-test/r/partition.result:
Bug #28488: test case
mysql-test/t/partition.test:
Bug #28488: test case
sql/mysql_priv.h:
Bug #28488: prefix shadow file with the temp prefix
sql/sql_partition.cc:
Bug #28488: prefix shadow file with the temp prefix
sql/sql_table.cc:
Bug #28488: prefix shadow file with the temp prefix
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 6d5860240be..007315ce5f9 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1262,6 +1262,31 @@ void release_ddl_log() */ +/** + @brief construct a temporary shadow file name. + + @details Make a shadow file name used by ALTER TABLE to construct the + modified table (with keeping the original). The modified table is then + moved back as original table. The name must start with the temp file + prefix so it gets filtered out by table files listing routines. + + @param[out] buff buffer to receive the constructed name + @param bufflen size of buff + @param lpt alter table data structure + + @retval path length +*/ + +uint build_table_shadow_filename(char *buff, size_t bufflen, + ALTER_PARTITION_PARAM_TYPE *lpt) +{ + char tmp_name[FN_REFLEN]; + my_snprintf (tmp_name, sizeof (tmp_name), "%s-%s", tmp_file_prefix, + lpt->table_name); + return build_table_filename(buff, bufflen, lpt->db, tmp_name, "", FN_IS_TMP); +} + + /* SYNOPSIS mysql_write_frm() @@ -1302,8 +1327,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) /* Build shadow frm file name */ - build_table_filename(shadow_path, sizeof(shadow_path), lpt->db, - lpt->table_name, "#", 0); + build_table_shadow_filename(shadow_path, sizeof(shadow_path), lpt); strxmov(shadow_frm_name, shadow_path, reg_ext, NullS); if (flags & WFRM_WRITE_SHADOW) { |