Commit 3bbffc21 authored by Jan Lindström's avatar Jan Lindström

Merge pull request #85 from josh4trunks/10.0

Apply fixes for raw devices to XtraDB in MariaDB 10.0
parents d9835658 a95be964
/***********************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
......@@ -404,10 +404,10 @@ to original un-instrumented file I/O APIs */
enum os_file_type_t {
OS_FILE_TYPE_UNKNOWN = 0,
OS_FILE_TYPE_FILE, /* regular file */
OS_FILE_TYPE_FILE, /* regular file
(or a character/block device) */
OS_FILE_TYPE_DIR, /* directory */
OS_FILE_TYPE_LINK, /* symbolic link */
OS_FILE_TYPE_BLOCK /* block device */
OS_FILE_TYPE_LINK /* symbolic link */
};
/* Maximum path string length in bytes when referring to tables with in the
......
/***********************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
......@@ -3388,8 +3388,9 @@ os_file_get_status(
stat_info->type = OS_FILE_TYPE_LINK;
break;
case S_IFBLK:
stat_info->type = OS_FILE_TYPE_BLOCK;
break;
/* Handle block device as regular file. */
case S_IFCHR:
/* Handle character device as regular file. */
case S_IFREG:
stat_info->type = OS_FILE_TYPE_FILE;
break;
......@@ -3398,8 +3399,8 @@ os_file_get_status(
}
if (check_rw_perm && (stat_info->type == OS_FILE_TYPE_FILE
|| stat_info->type == OS_FILE_TYPE_BLOCK)) {
if (check_rw_perm && stat_info->type == OS_FILE_TYPE_FILE) {
int fh;
int access;
......
......@@ -1324,18 +1324,14 @@ row_insert_for_mysql(
mem_analyze_corruption(prebuilt);
ut_error;
} else if (srv_created_new_raw || srv_force_recovery) {
fputs("InnoDB: A new raw disk partition was initialized or\n"
"InnoDB: innodb_force_recovery is on: we do not allow\n"
} else if (srv_force_recovery) {
fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
"InnoDB: mysqld and edit my.cnf so that"
" newraw is replaced\n"
"InnoDB: with raw, and innodb_force_... is removed.\n",
"InnoDB: innodb_force_... is removed.\n",
stderr);
if(srv_force_recovery) {
return(DB_READ_ONLY);
}
return(DB_ERROR);
return(DB_READ_ONLY);
}
trx->op_info = "inserting";
......@@ -1730,18 +1726,14 @@ row_update_for_mysql(
ut_error;
}
if (UNIV_UNLIKELY(srv_created_new_raw || srv_force_recovery)) {
fputs("InnoDB: A new raw disk partition was initialized or\n"
"InnoDB: innodb_force_recovery is on: we do not allow\n"
if (UNIV_UNLIKELY(srv_force_recovery)) {
fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
"InnoDB: mysqld and edit my.cnf so that newraw"
" is replaced\n"
"InnoDB: with raw, and innodb_force_... is removed.\n",
"InnoDB: mysqld and edit my.cnf so that"
"InnoDB: innodb_force_... is removed.\n",
stderr);
if(srv_force_recovery) {
return(DB_READ_ONLY);
}
return(DB_ERROR);
return(DB_READ_ONLY);
}
DEBUG_SYNC_C("innodb_row_update_for_mysql_begin");
......@@ -2250,22 +2242,6 @@ row_create_table_for_mysql(
goto err_exit;
);
if (srv_created_new_raw) {
fputs("InnoDB: A new raw disk partition was initialized:\n"
"InnoDB: we do not allow database modifications"
" by the user.\n"
"InnoDB: Shut down mysqld and edit my.cnf so that newraw"
" is replaced with raw.\n", stderr);
err_exit:
dict_mem_table_free(table);
if (commit) {
trx_commit_for_mysql(trx);
}
return(DB_ERROR);
}
trx->op_info = "creating table";
if (row_mysql_is_system_table(table->name)) {
......@@ -2276,7 +2252,19 @@ row_create_table_for_mysql(
"InnoDB: MySQL system tables must be"
" of the MyISAM type!\n",
table->name);
goto err_exit;
#ifndef DBUG_OFF
err_exit:
#endif /* !DBUG_OFF */
dict_mem_table_free(table);
if (commit) {
trx_commit_for_mysql(trx);
}
trx->op_info = "";
return(DB_ERROR);
}
trx_start_if_not_started_xa(trx);
......@@ -3326,16 +3314,6 @@ row_truncate_table_for_mysql(
ut_ad(table);
if (srv_created_new_raw) {
fputs("InnoDB: A new raw disk partition was initialized:\n"
"InnoDB: we do not allow database modifications"
" by the user.\n"
"InnoDB: Shut down mysqld and edit my.cnf so that newraw"
" is replaced with raw.\n", stderr);
return(DB_ERROR);
}
if (dict_table_is_discarded(table)) {
return(DB_TABLESPACE_DELETED);
} else if (table->ibd_file_missing) {
......@@ -3815,16 +3793,6 @@ row_drop_table_for_mysql(
ut_a(name != NULL);
if (srv_created_new_raw) {
fputs("InnoDB: A new raw disk partition was initialized:\n"
"InnoDB: we do not allow database modifications"
" by the user.\n"
"InnoDB: Shut down mysqld and edit my.cnf so that newraw"
" is replaced with raw.\n", stderr);
DBUG_RETURN(DB_ERROR);
}
/* The table name is prefixed with the database name and a '/'.
Certain table names starting with 'innodb_' have their special
meaning regardless of the database name. Thus, we need to
......@@ -4838,19 +4806,16 @@ row_rename_table_for_mysql(
ut_a(new_name != NULL);
ut_ad(trx->state == TRX_STATE_ACTIVE);
if (srv_created_new_raw || srv_force_recovery) {
fputs("InnoDB: A new raw disk partition was initialized or\n"
"InnoDB: innodb_force_recovery is on: we do not allow\n"
if (srv_force_recovery) {
fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n"
"InnoDB: mysqld and edit my.cnf so that newraw"
" is replaced\n"
"InnoDB: with raw, and innodb_force_... is removed.\n",
"InnoDB: mysqld and edit my.cnf so that"
"InnoDB: innodb_force_... is removed.\n",
stderr);
if(srv_force_recovery) {
err = DB_READ_ONLY;
}
err = DB_READ_ONLY;
goto funct_exit;
} else if (row_mysql_is_system_table(new_name)) {
fprintf(stderr,
......
/*****************************************************************************
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
......@@ -251,8 +251,8 @@ srv_file_check_mode(
/* Note: stat.rw_perm is only valid of files */
if (stat.type == OS_FILE_TYPE_FILE
|| stat.type == OS_FILE_TYPE_BLOCK) {
if (stat.type == OS_FILE_TYPE_FILE {
if (!stat.rw_perm) {
ib_logf(IB_LOG_LEVEL_ERROR,
......@@ -449,14 +449,18 @@ srv_parse_data_file_paths_and_sizes(
&& *(str + 1) == 'e'
&& *(str + 2) == 'w') {
str += 3;
(srv_data_file_is_raw_partition)[i] = SRV_NEW_RAW;
/* Initialize new raw device only during bootstrap */
(srv_data_file_is_raw_partition)[i] =
opt_bootstrap ? SRV_NEW_RAW : SRV_OLD_RAW;
}
if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') {
str += 3;
/* Initialize new raw device only during bootstrap */
if ((srv_data_file_is_raw_partition)[i] == 0) {
(srv_data_file_is_raw_partition)[i] = SRV_OLD_RAW;
(srv_data_file_is_raw_partition)[i] =
opt_bootstrap ? SRV_NEW_RAW : SRV_OLD_RAW;
}
}
......@@ -929,6 +933,24 @@ open_or_create_data_files(
return(DB_ERROR);
}
const char* check_msg;
check_msg = fil_read_first_page(
files[i], FALSE, &flags, &space,
#ifdef UNIV_LOG_ARCHIVE
min_arch_log_no, max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
min_flushed_lsn, max_flushed_lsn);
/* If first page is valid, don't overwrite DB.
It prevents overwriting DB when mysql_install_db
starts mysqld multiple times during bootstrap. */
if (check_msg == NULL) {
srv_created_new_raw = FALSE;
ret = FALSE;
}
} else if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
srv_start_raw_disk_in_use = TRUE;
......
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