Commit a1b0139f authored by unknown's avatar unknown

BUG#9911 RENAME TABLE of type ARCHIVE fails with .ARN file error

 - Different behaviuor in 5.0 pushes a warning when renaming a non existent file. Avoid that by checking that the file exists before renaming.


mysql-test/r/archive.result:
  Warning is not produced anymore
sql/examples/ha_archive.cc:
  Change ha_archive::rename_table to avoid warning when trying to rename non existent file.
parent cde34dfb
...@@ -192,8 +192,6 @@ select count(*) from t3; ...@@ -192,8 +192,6 @@ select count(*) from t3;
count(*) count(*)
1199 1199
rename table t3 to t4; rename table t3 to t4;
Warnings:
Error 7 Error on rename of './test/t3.ARN' to './test/t4.ARN' (Errcode: 2)
select * from t4 where fld3='bonfire'; select * from t4 where fld3='bonfire';
auto fld1 companynr fld3 fld4 fld5 fld6 auto fld1 companynr fld3 fld4 fld5 fld6
1191 068504 00 bonfire corresponds positively 1191 068504 00 bonfire corresponds positively
......
...@@ -455,17 +455,22 @@ const char **ha_archive::bas_ext() const ...@@ -455,17 +455,22 @@ const char **ha_archive::bas_ext() const
int ha_archive::rename_table(const char * from, const char * to) int ha_archive::rename_table(const char * from, const char * to)
{ {
DBUG_ENTER("ha_archive::rename_table"); DBUG_ENTER("ha_archive::rename_table");
DBUG_PRINT("enter", ("from: %s, to: %s", from, to));
for (const char **ext=bas_ext(); *ext ; ext++) for (const char **ext=bas_ext(); *ext ; ext++)
{ {
if (rename_file_ext(from,to,*ext)) // Check if the .arn file exists before rename
if (!my_strcasecmp(system_charset_info, *ext, ARN))
{ {
if (my_errno == ENOENT && char name[FN_REFLEN];
!my_strcasecmp(system_charset_info, *ext, ARN)) (void)strxnmov(name, FN_REFLEN, from, ARN, NullS);
if (access(name, F_OK))
{
DBUG_PRINT("info", ("%s does not exist on disk, skipping it", name));
continue; continue;
}
DBUG_RETURN(my_errno);
} }
if (rename_file_ext(from,to,*ext))
DBUG_RETURN(my_errno);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment