Below is the list of changes that have just been committed into a local
5.1 repository of mydev. When mydev does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2195 06/06/16 09:02:03 ingo@stripped +1 -0
Bug#18775 - Temporary table from alter table visible to other threads
The intermediate (not temporary) files of the new table
during ALTER TABLE was visible for SHOW TABLES. These
intermediate files are copies of the original table with
the changes done by ALTER TABLE. After all the data is
copied over from the original table, these files are renamed
to the original tables file names. So they are not temporary
files. They persist after ALTER TABLE, but just with another
name.
Normal GRANT checking takes place for the intermediate table.
Everyone who can see the original table (and hence the final
table) can also see the intermediate table. But noone else.
In 5.0 the intermediate files are invisible for SHOW TABLES
because all file names beginning with "#sql" were suppressed.
In 5.1 temporary files are created in TMPDIR, so that they
don't appear in the database directories. Also in 5.1 a
translation between table names and file names is done. The
tmp_file_prefix on file level is now "@0023sql".
The suppression of files starting with tmp_file_prefix is
still in place, but still only files beginning with "#sql"
were suppressed.
I do now translate tmp_file_prefix from table name to file
name before comparing it with the files in a directory.
This suppresses the intermediate files again.
No test case. The test case looks so that a reasonable big
table is altered while a second thread runs SHOW TABLES.
This in itself would be possible to do, but on slow machines
it would add too much time to the test suite, while on fast
machines the ALTER TABLE might have finished before SHOW
TABLES looks at the directory. Even if there might be a good
balance for todays machines, one day the test would become
void as the intermediate table would not be seen even with
the bug in place. I added a test script to the bug report.
It can easily be changed so that it uses a table size that
is appropriate for the test machine.
sql/sql_show.cc
1.348 06/06/16 09:01:57 ingo@stripped +4 -1
Bug#18775 - Temporary table from alter table visible to other threads
Translating tmp_file_prefix to filename before comparison.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: ingo
# Host: chilla.local
# Root: /home/mydev/mysql-5.1-bug18775
--- 1.347/sql/sql_show.cc 2006-06-06 13:48:09 +02:00
+++ 1.348/sql/sql_show.cc 2006-06-16 09:01:57 +02:00
@@ -438,6 +438,7 @@ mysql_find_files(THD *thd,List<char> *fi
uint col_access=thd->col_access;
#endif
TABLE_LIST table_list;
+ char tbbuff[FN_REFLEN];
DBUG_ENTER("mysql_find_files");
if (wild && !wild[0])
@@ -454,6 +455,8 @@ mysql_find_files(THD *thd,List<char> *fi
DBUG_RETURN(-1);
}
+ VOID(tablename_to_filename(tmp_file_prefix, tbbuff, sizeof(tbbuff)));
+
for (i=0 ; i < (uint) dirp->number_off_files ; i++)
{
char uname[NAME_LEN*3+1]; /* Unencoded name */
@@ -491,7 +494,7 @@ mysql_find_files(THD *thd,List<char> *fi
{
// Return only .frm files which aren't temp files.
if (my_strcasecmp(system_charset_info, ext=fn_rext(file->name),reg_ext) ||
- is_prefix(file->name,tmp_file_prefix))
+ is_prefix(file->name,tbbuff))
continue;
*ext=0;
VOID(filename_to_tablename(file->name, uname, sizeof(uname)));
| Thread |
|---|
| • bk commit into 5.1 tree (ingo:1.2195) BUG#18775 | ingo | 16 Jun |