Bug #72022 Replaying MLOG_FILE_CREATE2 for a remote tablespace is broken
Submitted: 12 Mar 2014 13:56 Modified: 13 Mar 2014 13:27
Reporter: Alexey Kopytov Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any

[12 Mar 2014 13:56] Alexey Kopytov
Description:
The comment for fil_op_log_parse_or_replay() says:

"TODO: If remote tablespaces are used,
ibbackup will only create tables in the default directory since MLOG_FILE_CREATE
and MLOG_FILE_CREATE2 only know the tablename, not the path."

What actually happens when fil_create_new_single_table_tablespace() is called from fil_op_log_parse_or_replay() for a remote tablespace is that dir_path is always NULL:

			const char*	path = NULL;

			/* Create the database directory for name, if it does
			not exist yet */
			fil_create_directory_for_tablename(name);

			if (fil_create_new_single_table_tablespace(
				    space_id, name, path, flags,
				    DICT_TF2_USE_TABLESPACE,
				    FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
				ut_error;
			}

 but it is not expected to be NULL when has_data_dir is true:

	} else if (has_data_dir) {
		ut_ad(dir_path);
		path = os_file_make_remote_pathname(dir_path, tablename, "ibd");

As a result, os_file_make_remote_pathname() crashes on the NULL argument to strrchr().

I don't have a test case, because InnoDB does not replay MLOG_FILE_CREATE2 on recovery, but it affects XtraBackup, see https://bugs.launchpad.net/percona-xtrabackup/+bug/1291299. MEB should also be affected.

How to repeat:
Examine the relevant code.
[13 Mar 2014 13:27] MySQL Verification Team
Hello Alexey,

Thank you for the bug report.

Thanks,
Umesh