diff options
author | Gleb Shchepa <gshchepa@mysql.com> | 2008-11-14 21:25:57 +0400 |
---|---|---|
committer | Gleb Shchepa <gshchepa@mysql.com> | 2008-11-14 21:25:57 +0400 |
commit | 56b9586fd1d94ebd70662417a1d2ac1921da4ad2 (patch) | |
tree | 979c9700862ad4a8b78ff72ed209daf34270c76e /sql/parse_file.h | |
parent | dbc062bf2c5fe8a38151e72eb7a3c110da6d856b (diff) | |
download | mariadb-git-56b9586fd1d94ebd70662417a1d2ac1921da4ad2.tar.gz |
Bug #40021: Renaming view fails, archived .frm for view is
missing after downgrade
Obsolete arc/ directory and view .frm file backup support
has been removed by the patch for bug 17823. However, that
bugfix caused a problem with "live downgrades" of the
server: if we rename some view 4 times under 5.1.29/5.0.72
and then try to rename it under 5.1.28/5.0.70 on the same
database, the server fails with a error:
query 'RENAME TABLE ... TO ...' failed: 6: Error on
delete of '....frm-0001' (Errcode: 2)
Also .frm file of that view may be lost (renamed to .frm~).
The server failed because it tried to rename latest 3
backup .frm files renaming the view: the server used an
integer value of the "revision" field of .frm file to
extract those file names. After the fix for bug 17823 those
files were not created/maintained any more, however the
"revision" field was incremented as usual. So, the server
failed renaming non existent files.
This fix solves the problem by removing the support for
"revision" .frm file field:
1. New server silently ignores existent "revision" fields
in old .frm files and never write it down;
2. Old server assumes, that missing "revision" field in new
.frm files means default value of 0.
3. Accordingly to the fix for bug 17823 the new server
drops arc/ directory on alter/rename view, so after
"live downgrade" old server begins maintenance of the
arc/ directory from scratch without conflicts with .frm
files.
sql/parse_file.cc:
Bug #40021: Renaming view fails, archived .frm for view is
missing after downgrade
1. static write_parameter(): the old_version parameter
and the section for FILE_OPTIONS_REV have been re moved.
2. write_parameter(): the max_versions parameter has been
removed;
3. sql_create_definition_file(): removal of dead code;
4. rename_in_schema_file(): revision and num_view_backups
parameters and dead code have been removed;
5. File_parser::parse(): FILE_OPTIONS_REV section has been
removed.
sql/parse_file.h:
Bug #40021: Renaming view fails, archived .frm for view is
missing after downgrade
1. The FILE_OPTIONS_REV constant has been removed.
2. sql_create_definition_file and rename_in_schema_file
functions: obsolete versions, revision and
num_view_backups parameters have been removed.
sql/sql_db.cc:
Bug #40021: Renaming view fails, archived .frm for view is
missing after downgrade
Commentary update.
sql/sql_trigger.cc:
Bug #40021: Renaming view fails, archived .frm for view is
missing after downgrade
sql_create_definition_file() calls have been updates to
new parameter lists.
sql/sql_view.cc:
Bug #40021: Renaming view fails, archived .frm for view is
missing after downgrade
1. The mysql_create_view function code is used for both
CREATE VIEW and ALTER queries, but query cache is
necessary for ALTER command only. Check for a non first
view revision has been replaced with a direct check for
ALTER query.
2. The num_view_backups global constant has been removed.
3. view_parameters: the "revision" .frm field support has
been removed.
4. sql_create_definition_file and rename_in_schema_file
function calls have been updates to new parameter lists.
sql/table.h:
Bug #40021: Renaming view fails, archived .frm for view is
missing after downgrade
TABLE_LIST: the revision field has been removed.
Diffstat (limited to 'sql/parse_file.h')
-rw-r--r-- | sql/parse_file.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sql/parse_file.h b/sql/parse_file.h index ec920b58667..ad7d1629e0a 100644 --- a/sql/parse_file.h +++ b/sql/parse_file.h @@ -23,7 +23,6 @@ enum file_opt_type { FILE_OPTIONS_STRING, /* String (LEX_STRING) */ FILE_OPTIONS_ESTRING, /* Escaped string (LEX_STRING) */ FILE_OPTIONS_ULONGLONG, /* ulonglong parameter (ulonglong) */ - FILE_OPTIONS_REV, /* Revision version number (ulonglong) */ FILE_OPTIONS_TIMESTAMP, /* timestamp (LEX_STRING have to be allocated with length 20 (19+1) */ FILE_OPTIONS_STRLIST, /* list of escaped strings @@ -81,11 +80,10 @@ File_parser *sql_parse_prepare(const LEX_STRING *file_name, my_bool sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, const LEX_STRING *type, - gptr base, File_option *parameters, uint versions); + gptr base, File_option *parameters); my_bool rename_in_schema_file(THD *thd, const char *schema, const char *old_name, - const char *new_name, ulonglong revision, - uint num_view_backups); + const char *new_name); class File_parser: public Sql_alloc { |