Commit ee5633a3 authored by josh4trunks's avatar josh4trunks

Apply fix for raw devices to XtraDB

parent d9835658
/*********************************************************************** /***********************************************************************
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. Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted Portions of this file contain modifications contributed and copyrighted
...@@ -404,10 +404,10 @@ to original un-instrumented file I/O APIs */ ...@@ -404,10 +404,10 @@ to original un-instrumented file I/O APIs */
enum os_file_type_t { enum os_file_type_t {
OS_FILE_TYPE_UNKNOWN = 0, 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_DIR, /* directory */
OS_FILE_TYPE_LINK, /* symbolic link */ OS_FILE_TYPE_LINK /* symbolic link */
OS_FILE_TYPE_BLOCK /* block device */
}; };
/* Maximum path string length in bytes when referring to tables with in the /* 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. Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted Portions of this file contain modifications contributed and copyrighted
...@@ -3388,8 +3388,9 @@ os_file_get_status( ...@@ -3388,8 +3388,9 @@ os_file_get_status(
stat_info->type = OS_FILE_TYPE_LINK; stat_info->type = OS_FILE_TYPE_LINK;
break; break;
case S_IFBLK: case S_IFBLK:
stat_info->type = OS_FILE_TYPE_BLOCK; /* Handle block device as regular file. */
break; case S_IFCHR:
/* Handle character device as regular file. */
case S_IFREG: case S_IFREG:
stat_info->type = OS_FILE_TYPE_FILE; stat_info->type = OS_FILE_TYPE_FILE;
break; break;
...@@ -3398,8 +3399,8 @@ os_file_get_status( ...@@ -3398,8 +3399,8 @@ os_file_get_status(
} }
if (check_rw_perm && (stat_info->type == OS_FILE_TYPE_FILE if (check_rw_perm && stat_info->type == OS_FILE_TYPE_FILE) {
|| stat_info->type == OS_FILE_TYPE_BLOCK)) {
int fh; int fh;
int access; int access;
......
...@@ -1324,19 +1324,15 @@ row_insert_for_mysql( ...@@ -1324,19 +1324,15 @@ row_insert_for_mysql(
mem_analyze_corruption(prebuilt); mem_analyze_corruption(prebuilt);
ut_error; ut_error;
} else if (srv_created_new_raw || srv_force_recovery) { } else if (srv_force_recovery) {
fputs("InnoDB: A new raw disk partition was initialized or\n" fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n" "InnoDB: database modifications by the user. Shut down\n"
"InnoDB: mysqld and edit my.cnf so that" "InnoDB: mysqld and edit my.cnf so that"
" newraw is replaced\n" "InnoDB: innodb_force_... is removed.\n",
"InnoDB: with raw, and innodb_force_... is removed.\n",
stderr); stderr);
if(srv_force_recovery) {
return(DB_READ_ONLY); return(DB_READ_ONLY);
} }
return(DB_ERROR);
}
trx->op_info = "inserting"; trx->op_info = "inserting";
...@@ -1730,19 +1726,15 @@ row_update_for_mysql( ...@@ -1730,19 +1726,15 @@ row_update_for_mysql(
ut_error; ut_error;
} }
if (UNIV_UNLIKELY(srv_created_new_raw || srv_force_recovery)) { if (UNIV_UNLIKELY(srv_force_recovery)) {
fputs("InnoDB: A new raw disk partition was initialized or\n" fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n" "InnoDB: database modifications by the user. Shut down\n"
"InnoDB: mysqld and edit my.cnf so that newraw" "InnoDB: mysqld and edit my.cnf so that"
" is replaced\n" "InnoDB: innodb_force_... is removed.\n",
"InnoDB: with raw, and innodb_force_... is removed.\n",
stderr); stderr);
if(srv_force_recovery) {
return(DB_READ_ONLY); return(DB_READ_ONLY);
} }
return(DB_ERROR);
}
DEBUG_SYNC_C("innodb_row_update_for_mysql_begin"); DEBUG_SYNC_C("innodb_row_update_for_mysql_begin");
...@@ -2250,22 +2242,6 @@ row_create_table_for_mysql( ...@@ -2250,22 +2242,6 @@ row_create_table_for_mysql(
goto err_exit; 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"; trx->op_info = "creating table";
if (row_mysql_is_system_table(table->name)) { if (row_mysql_is_system_table(table->name)) {
...@@ -2276,7 +2252,17 @@ row_create_table_for_mysql( ...@@ -2276,7 +2252,17 @@ row_create_table_for_mysql(
"InnoDB: MySQL system tables must be" "InnoDB: MySQL system tables must be"
" of the MyISAM type!\n", " of the MyISAM type!\n",
table->name); table->name);
goto err_exit;
err_exit:
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); trx_start_if_not_started_xa(trx);
...@@ -3326,16 +3312,6 @@ row_truncate_table_for_mysql( ...@@ -3326,16 +3312,6 @@ row_truncate_table_for_mysql(
ut_ad(table); 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)) { if (dict_table_is_discarded(table)) {
return(DB_TABLESPACE_DELETED); return(DB_TABLESPACE_DELETED);
} else if (table->ibd_file_missing) { } else if (table->ibd_file_missing) {
...@@ -3815,16 +3791,6 @@ row_drop_table_for_mysql( ...@@ -3815,16 +3791,6 @@ row_drop_table_for_mysql(
ut_a(name != NULL); 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 '/'. /* The table name is prefixed with the database name and a '/'.
Certain table names starting with 'innodb_' have their special Certain table names starting with 'innodb_' have their special
meaning regardless of the database name. Thus, we need to meaning regardless of the database name. Thus, we need to
...@@ -4838,19 +4804,16 @@ row_rename_table_for_mysql( ...@@ -4838,19 +4804,16 @@ row_rename_table_for_mysql(
ut_a(new_name != NULL); ut_a(new_name != NULL);
ut_ad(trx->state == TRX_STATE_ACTIVE); ut_ad(trx->state == TRX_STATE_ACTIVE);
if (srv_created_new_raw || srv_force_recovery) { if (srv_force_recovery) {
fputs("InnoDB: A new raw disk partition was initialized or\n" fputs("InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: innodb_force_recovery is on: we do not allow\n"
"InnoDB: database modifications by the user. Shut down\n" "InnoDB: database modifications by the user. Shut down\n"
"InnoDB: mysqld and edit my.cnf so that newraw" "InnoDB: mysqld and edit my.cnf so that"
" is replaced\n" "InnoDB: innodb_force_... is removed.\n",
"InnoDB: with raw, and innodb_force_... is removed.\n",
stderr); stderr);
if(srv_force_recovery) {
err = DB_READ_ONLY;
}
err = DB_READ_ONLY;
goto funct_exit; goto funct_exit;
} else if (row_mysql_is_system_table(new_name)) { } else if (row_mysql_is_system_table(new_name)) {
fprintf(stderr, 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) 2008, Google Inc.
Copyright (c) 2009, Percona Inc. Copyright (c) 2009, Percona Inc.
...@@ -251,8 +251,8 @@ srv_file_check_mode( ...@@ -251,8 +251,8 @@ srv_file_check_mode(
/* Note: stat.rw_perm is only valid of files */ /* Note: stat.rw_perm is only valid of files */
if (stat.type == OS_FILE_TYPE_FILE if (stat.type == OS_FILE_TYPE_FILE {
|| stat.type == OS_FILE_TYPE_BLOCK) {
if (!stat.rw_perm) { if (!stat.rw_perm) {
ib_logf(IB_LOG_LEVEL_ERROR, ib_logf(IB_LOG_LEVEL_ERROR,
...@@ -449,14 +449,18 @@ srv_parse_data_file_paths_and_sizes( ...@@ -449,14 +449,18 @@ srv_parse_data_file_paths_and_sizes(
&& *(str + 1) == 'e' && *(str + 1) == 'e'
&& *(str + 2) == 'w') { && *(str + 2) == 'w') {
str += 3; 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') { if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') {
str += 3; str += 3;
/* Initialize new raw device only during bootstrap */
if ((srv_data_file_is_raw_partition)[i] == 0) { 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( ...@@ -929,6 +933,24 @@ open_or_create_data_files(
return(DB_ERROR); 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) { } else if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
srv_start_raw_disk_in_use = TRUE; 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