Commit 1daf856d authored by unknown's avatar unknown

fil0fil.h, fil0fil.c:

  ibbackup --apply-log must be able to rename a table based only on the space id


innobase/fil/fil0fil.c:
  ibbackup --apply-log must be able to rename a table based only on the space id
innobase/include/fil0fil.h:
  ibbackup --apply-log must be able to rename a table based only on the space id
parent 44004501
......@@ -84,7 +84,8 @@ completes, we decrement the count and return the file node to the LRU-list if
the count drops to zero. */
/* When mysqld is run, the default directory "." is the mysqld datadir,
but in ibbackup we must set it explicitly */
but in the MySQL Embedded Server Library and ibbackup it is not the default
directory, and we must set the base file path explicitly */
char* fil_path_to_mysql_datadir = (char*)".";
ulint fil_n_pending_log_flushes = 0;
......@@ -1576,7 +1577,8 @@ fil_op_write_log(
mlog_close(mtr, log_ptr);
mlog_catenate_string(mtr, (byte*) new_name, ut_strlen(new_name) + 1);
mlog_catenate_string(mtr, (byte*) new_name,
ut_strlen(new_name) + 1);
}
}
#endif
......@@ -1696,7 +1698,9 @@ fil_op_log_parse_or_replay(
if (fil_get_space_id_for_table(new_name)
== ULINT_UNDEFINED) {
ut_a(fil_rename_tablespace(name, space_id,
/* We do not care of the old name, that is
why we pass NULL as the first argument */
ut_a(fil_rename_tablespace(NULL, space_id,
new_name));
}
}
......@@ -1956,7 +1960,9 @@ fil_rename_tablespace(
/*==================*/
/* out: TRUE if success */
char* old_name, /* in: old table name in the standard
databasename/tablename format of InnoDB */
databasename/tablename format of InnoDB, or
NULL if we do the rename based on the space
id only */
ulint id, /* in: space id */
char* new_name) /* in: new table name in the standard
databasename/tablename format of InnoDB */
......@@ -1967,9 +1973,15 @@ fil_rename_tablespace(
fil_node_t* node;
ulint count = 0;
char* path = NULL;
ibool old_name_was_specified = TRUE;
char old_path[OS_FILE_MAX_PATH];
ut_a(id != 0);
if (old_name == NULL) {
old_name = (char*)"(name not specified)";
old_name_was_specified = FALSE;
}
retry:
count++;
......@@ -2038,16 +2050,19 @@ fil_rename_tablespace(
}
/* Check that the old name in the space is right */
ut_a(strlen(old_name) + strlen(fil_path_to_mysql_datadir)
< OS_FILE_MAX_PATH - 10);
sprintf(old_path, "%s/%s.ibd", fil_path_to_mysql_datadir, old_name);
srv_normalize_path_for_win(old_path);
if (old_name_was_specified) {
ut_a(strlen(old_name) + strlen(fil_path_to_mysql_datadir)
< OS_FILE_MAX_PATH - 10);
sprintf(old_path, "%s/%s.ibd", fil_path_to_mysql_datadir,
old_name);
srv_normalize_path_for_win(old_path);
ut_a(strcmp(space->name, old_path) == 0);
ut_a(strcmp(node->name, old_path) == 0);
ut_a(strcmp(space->name, old_path) == 0);
ut_a(strcmp(node->name, old_path) == 0);
} else {
sprintf(old_path, "%s", space->name);
}
/* Rename the tablespace and the node in the memory cache */
......@@ -2066,8 +2081,6 @@ fil_rename_tablespace(
goto func_exit;
}
/* printf("Renaming tablespace %s to %s id %lu\n", path, old_path, id);
*/
success = os_file_rename(old_path, path);
if (!success) {
......
......@@ -329,7 +329,9 @@ fil_rename_tablespace(
/*==================*/
/* out: TRUE if success */
char* old_name, /* in: old table name in the standard
databasename/tablename format of InnoDB */
databasename/tablename format of InnoDB, or
NULL if we do the rename based on the space
id only */
ulint id, /* in: space id */
char* new_name); /* in: new table name in the standard
databasename/tablename format of InnoDB */
......
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