mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
srv0srv.h Support raw disk partitions as data files
srv0start.c Support raw disk partitions as data files srv0srv.c Support raw disk partitions as data files row0purge.c < 4 GB rows, doublewrite, hang fixes row0row.c < 4 GB rows, doublewrite, hang fixes row0sel.c < 4 GB rows, doublewrite, hang fixes row0uins.c < 4 GB rows, doublewrite, hang fixes row0umod.c < 4 GB rows, doublewrite, hang fixes row0undo.c < 4 GB rows, doublewrite, hang fixes row0upd.c < 4 GB rows, doublewrite, hang fixes srv0srv.c < 4 GB rows, doublewrite, hang fixes srv0start.c < 4 GB rows, doublewrite, hang fixes sync0rw.c < 4 GB rows, doublewrite, hang fixes sync0sync.c < 4 GB rows, doublewrite, hang fixes trx0purge.c < 4 GB rows, doublewrite, hang fixes trx0rec.c < 4 GB rows, doublewrite, hang fixes trx0sys.c < 4 GB rows, doublewrite, hang fixes btr0btr.c < 4 GB rows, doublewrite, hang fixes btr0cur.c < 4 GB rows, doublewrite, hang fixes buf0buf.c < 4 GB rows, doublewrite, hang fixes buf0flu.c < 4 GB rows, doublewrite, hang fixes buf0rea.c < 4 GB rows, doublewrite, hang fixes data0data.c < 4 GB rows, doublewrite, hang fixes fil0fil.c < 4 GB rows, doublewrite, hang fixes fsp0fsp.c < 4 GB rows, doublewrite, hang fixes ibuf0ibuf.c < 4 GB rows, doublewrite, hang fixes lock0lock.c < 4 GB rows, doublewrite, hang fixes log0log.c < 4 GB rows, doublewrite, hang fixes log0recv.c < 4 GB rows, doublewrite, hang fixes os0file.c < 4 GB rows, doublewrite, hang fixes page0cur.c < 4 GB rows, doublewrite, hang fixes pars0pars.c < 4 GB rows, doublewrite, hang fixes rem0cmp.c < 4 GB rows, doublewrite, hang fixes rem0rec.c < 4 GB rows, doublewrite, hang fixes row0ins.c < 4 GB rows, doublewrite, hang fixes row0mysql.c < 4 GB rows, doublewrite, hang fixes univ.i < 4 GB rows, doublewrite, hang fixes data0data.ic < 4 GB rows, doublewrite, hang fixes mach0data.ic < 4 GB rows, doublewrite, hang fixes rem0rec.ic < 4 GB rows, doublewrite, hang fixes row0upd.ic < 4 GB rows, doublewrite, hang fixes trx0rec.ic < 4 GB rows, doublewrite, hang fixes rem0cmp.h < 4 GB rows, doublewrite, hang fixes rem0rec.h < 4 GB rows, doublewrite, hang fixes row0ins.h < 4 GB rows, doublewrite, hang fixes row0mysql.h < 4 GB rows, doublewrite, hang fixes row0row.h < 4 GB rows, doublewrite, hang fixes row0upd.h < 4 GB rows, doublewrite, hang fixes srv0srv.h < 4 GB rows, doublewrite, hang fixes sync0sync.h < 4 GB rows, doublewrite, hang fixes trx0rec.h < 4 GB rows, doublewrite, hang fixes trx0sys.h < 4 GB rows, doublewrite, hang fixes trx0types.h < 4 GB rows, doublewrite, hang fixes trx0undo.h < 4 GB rows, doublewrite, hang fixes ut0dbg.h < 4 GB rows, doublewrite, hang fixes ut0ut.h < 4 GB rows, doublewrite, hang fixes btr0btr.h < 4 GB rows, doublewrite, hang fixes btr0cur.h < 4 GB rows, doublewrite, hang fixes buf0buf.h < 4 GB rows, doublewrite, hang fixes buf0flu.h < 4 GB rows, doublewrite, hang fixes data0data.h < 4 GB rows, doublewrite, hang fixes dict0mem.h < 4 GB rows, doublewrite, hang fixes fil0fil.h < 4 GB rows, doublewrite, hang fixes fsp0fsp.h < 4 GB rows, doublewrite, hang fixes os0file.h < 4 GB rows, doublewrite, hang fixes innobase/include/btr0btr.h: < 4 GB rows, doublewrite, hang fixes innobase/include/btr0cur.h: < 4 GB rows, doublewrite, hang fixes innobase/include/buf0buf.h: < 4 GB rows, doublewrite, hang fixes innobase/include/buf0flu.h: < 4 GB rows, doublewrite, hang fixes innobase/include/data0data.h: < 4 GB rows, doublewrite, hang fixes innobase/include/dict0mem.h: < 4 GB rows, doublewrite, hang fixes innobase/include/fil0fil.h: < 4 GB rows, doublewrite, hang fixes innobase/include/fsp0fsp.h: < 4 GB rows, doublewrite, hang fixes innobase/include/os0file.h: < 4 GB rows, doublewrite, hang fixes innobase/include/rem0cmp.h: < 4 GB rows, doublewrite, hang fixes innobase/include/rem0rec.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0ins.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0mysql.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0row.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0upd.h: < 4 GB rows, doublewrite, hang fixes innobase/include/sync0sync.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0rec.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0sys.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0types.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0undo.h: < 4 GB rows, doublewrite, hang fixes innobase/include/ut0dbg.h: < 4 GB rows, doublewrite, hang fixes innobase/include/ut0ut.h: < 4 GB rows, doublewrite, hang fixes innobase/include/data0data.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/mach0data.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/rem0rec.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/row0upd.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0rec.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/univ.i: < 4 GB rows, doublewrite, hang fixes innobase/btr/btr0btr.c: < 4 GB rows, doublewrite, hang fixes innobase/btr/btr0cur.c: < 4 GB rows, doublewrite, hang fixes innobase/buf/buf0buf.c: < 4 GB rows, doublewrite, hang fixes innobase/buf/buf0flu.c: < 4 GB rows, doublewrite, hang fixes innobase/buf/buf0rea.c: < 4 GB rows, doublewrite, hang fixes innobase/data/data0data.c: < 4 GB rows, doublewrite, hang fixes innobase/fil/fil0fil.c: < 4 GB rows, doublewrite, hang fixes innobase/fsp/fsp0fsp.c: < 4 GB rows, doublewrite, hang fixes innobase/ibuf/ibuf0ibuf.c: < 4 GB rows, doublewrite, hang fixes innobase/lock/lock0lock.c: < 4 GB rows, doublewrite, hang fixes innobase/log/log0log.c: < 4 GB rows, doublewrite, hang fixes innobase/log/log0recv.c: < 4 GB rows, doublewrite, hang fixes innobase/os/os0file.c: < 4 GB rows, doublewrite, hang fixes innobase/page/page0cur.c: < 4 GB rows, doublewrite, hang fixes innobase/pars/pars0pars.c: < 4 GB rows, doublewrite, hang fixes innobase/rem/rem0cmp.c: < 4 GB rows, doublewrite, hang fixes innobase/rem/rem0rec.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0ins.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0mysql.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0purge.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0row.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0sel.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0uins.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0umod.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0undo.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0upd.c: < 4 GB rows, doublewrite, hang fixes innobase/sync/sync0rw.c: < 4 GB rows, doublewrite, hang fixes innobase/sync/sync0sync.c: < 4 GB rows, doublewrite, hang fixes innobase/trx/trx0purge.c: < 4 GB rows, doublewrite, hang fixes innobase/trx/trx0rec.c: < 4 GB rows, doublewrite, hang fixes innobase/trx/trx0sys.c: < 4 GB rows, doublewrite, hang fixes innobase/srv/srv0srv.c: Support raw disk partitions as data files innobase/srv/srv0start.c: Support raw disk partitions as data files innobase/include/srv0srv.h: Support raw disk partitions as data files
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
/************************************************************************
|
||||
Starts the InnoDB database server
|
||||
|
||||
(c) 1996-2000 InnoDB Oy
|
||||
(c) 1996-2000 Innobase Oy
|
||||
|
||||
Created 2/16/1996 Heikki Tuuri
|
||||
*************************************************************************/
|
||||
@ -203,8 +203,8 @@ open_or_create_log_file(
|
||||
|
||||
sprintf(name, "%s%s%lu", srv_log_group_home_dirs[k], "ib_logfile", i);
|
||||
|
||||
files[i] = os_file_create(name, OS_FILE_CREATE, OS_FILE_NORMAL, &ret);
|
||||
|
||||
files[i] = os_file_create(name, OS_FILE_CREATE, OS_FILE_NORMAL,
|
||||
OS_LOG_FILE, &ret);
|
||||
if (ret == FALSE) {
|
||||
if (os_file_get_last_error() != OS_FILE_ALREADY_EXISTS) {
|
||||
fprintf(stderr,
|
||||
@ -214,7 +214,8 @@ open_or_create_log_file(
|
||||
}
|
||||
|
||||
files[i] = os_file_create(
|
||||
name, OS_FILE_OPEN, OS_FILE_AIO, &ret);
|
||||
name, OS_FILE_OPEN, OS_FILE_AIO,
|
||||
OS_LOG_FILE, &ret);
|
||||
if (!ret) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error in opening %s\n", name);
|
||||
@ -239,7 +240,7 @@ open_or_create_log_file(
|
||||
fprintf(stderr,
|
||||
"InnoDB: Log file %s did not exist: new to be created\n",
|
||||
name);
|
||||
printf("InnoDB: Setting log file %s size to %lu\n",
|
||||
fprintf(stderr, "InnoDB: Setting log file %s size to %lu\n",
|
||||
name, UNIV_PAGE_SIZE * srv_log_file_size);
|
||||
|
||||
ret = os_file_set_size(name, files[i],
|
||||
@ -330,27 +331,28 @@ open_or_create_data_files(
|
||||
|
||||
sprintf(name, "%s%s", srv_data_home, srv_data_file_names[i]);
|
||||
|
||||
if (srv_data_file_is_raw_partition[i] == 0) {
|
||||
files[i] = os_file_create(name, OS_FILE_CREATE,
|
||||
OS_FILE_NORMAL, OS_DATA_FILE, &ret);
|
||||
|
||||
files[i] = os_file_create(name, OS_FILE_CREATE,
|
||||
OS_FILE_NORMAL, &ret);
|
||||
} else if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
|
||||
ret = FALSE;
|
||||
} else if (srv_data_file_is_raw_partition[i] == SRV_NEW_RAW) {
|
||||
if (srv_data_file_is_raw_partition[i] == SRV_NEW_RAW) {
|
||||
/* The partition is opened, not created; then it is
|
||||
written over */
|
||||
|
||||
files[i] = os_file_create(
|
||||
name, OS_FILE_OPEN, OS_FILE_NORMAL, &ret);
|
||||
|
||||
if (!ret) {
|
||||
files[i] = os_file_create(
|
||||
name, OS_FILE_OPEN, OS_FILE_NORMAL,
|
||||
OS_DATA_FILE, &ret);
|
||||
if (!ret) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error in opening %s\n", name);
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
}
|
||||
} else if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
if (ret == FALSE) {
|
||||
if (srv_data_file_is_raw_partition[i] == 0
|
||||
if (srv_data_file_is_raw_partition[i] != SRV_OLD_RAW
|
||||
&& os_file_get_last_error() !=
|
||||
OS_FILE_ALREADY_EXISTS) {
|
||||
fprintf(stderr,
|
||||
@ -370,8 +372,8 @@ open_or_create_data_files(
|
||||
}
|
||||
|
||||
files[i] = os_file_create(
|
||||
name, OS_FILE_OPEN, OS_FILE_NORMAL, &ret);
|
||||
|
||||
name, OS_FILE_OPEN, OS_FILE_NORMAL,
|
||||
OS_DATA_FILE, &ret);
|
||||
if (!ret) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error in opening %s\n", name);
|
||||
@ -379,18 +381,21 @@ open_or_create_data_files(
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
ret = os_file_get_size(files[i], &size, &size_high);
|
||||
ut_a(ret);
|
||||
if (srv_data_file_is_raw_partition[i] != SRV_OLD_RAW) {
|
||||
|
||||
ret = os_file_get_size(files[i], &size,
|
||||
&size_high);
|
||||
ut_a(ret);
|
||||
|
||||
if (srv_data_file_is_raw_partition[i] == 0
|
||||
&& (size != UNIV_PAGE_SIZE * srv_data_file_sizes[i]
|
||||
|| size_high != 0)) {
|
||||
|
||||
fprintf(stderr,
|
||||
if (size !=
|
||||
UNIV_PAGE_SIZE * srv_data_file_sizes[i]
|
||||
|| size_high != 0) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: data file %s is of different size\n"
|
||||
"InnoDB: than specified in the .cnf file!\n", name);
|
||||
|
||||
return(DB_ERROR);
|
||||
return(DB_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
fil_read_flushed_lsn_and_arch_log_no(files[i],
|
||||
@ -403,7 +408,8 @@ open_or_create_data_files(
|
||||
|
||||
if (i > 0) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Data file %s did not exist: new to be created\n", name);
|
||||
"InnoDB: Data file %s did not exist: new to be created\n",
|
||||
name);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"InnoDB: The first specified data file %s did not exist:\n"
|
||||
@ -411,10 +417,10 @@ open_or_create_data_files(
|
||||
*create_new_db = TRUE;
|
||||
}
|
||||
|
||||
printf("InnoDB: Setting file %s size to %lu\n",
|
||||
fprintf(stderr, "InnoDB: Setting file %s size to %lu\n",
|
||||
name, UNIV_PAGE_SIZE * srv_data_file_sizes[i]);
|
||||
|
||||
printf(
|
||||
fprintf(stderr,
|
||||
"InnoDB: Database physically writes the file full: wait...\n");
|
||||
|
||||
ret = os_file_set_size(name, files[i],
|
||||
@ -555,19 +561,22 @@ innobase_start_or_create_for_mysql(void)
|
||||
srv_startup_is_before_trx_rollback_phase = TRUE;
|
||||
|
||||
if (0 == ut_strcmp(srv_unix_file_flush_method_str, "fdatasync")) {
|
||||
srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
|
||||
srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
|
||||
|
||||
} else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "O_DSYNC")) {
|
||||
srv_unix_file_flush_method = SRV_UNIX_O_DSYNC;
|
||||
srv_unix_file_flush_method = SRV_UNIX_O_DSYNC;
|
||||
|
||||
} else if (0 == ut_strcmp(srv_unix_file_flush_method_str,
|
||||
"littlesync")) {
|
||||
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
|
||||
} else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "nosync")) {
|
||||
srv_unix_file_flush_method = SRV_UNIX_NOSYNC;
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Unrecognized value for innodb_unix_file_flush_method\n");
|
||||
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
|
||||
|
||||
return(DB_ERROR);
|
||||
} else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "nosync")) {
|
||||
srv_unix_file_flush_method = SRV_UNIX_NOSYNC;
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Unrecognized value %s for innodb_flush_method\n",
|
||||
srv_unix_file_flush_method_str);
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -593,14 +602,15 @@ innobase_start_or_create_for_mysql(void)
|
||||
#ifdef __WIN__
|
||||
if (os_get_os_version() == OS_WIN95
|
||||
|| os_get_os_version() == OS_WIN31) {
|
||||
/* On Win 95, 98, ME, and Win32 subsystem for Windows 3.1 use
|
||||
simulated aio */
|
||||
|
||||
os_aio_use_native_aio = FALSE;
|
||||
srv_n_file_io_threads = 4;
|
||||
/* On Win 95, 98, ME, and Win32 subsystem for Windows 3.1 use
|
||||
simulated aio */
|
||||
|
||||
os_aio_use_native_aio = FALSE;
|
||||
srv_n_file_io_threads = 4;
|
||||
} else {
|
||||
/* On NT and Win 2000 always use aio */
|
||||
os_aio_use_native_aio = TRUE;
|
||||
/* On NT and Win 2000 always use aio */
|
||||
os_aio_use_native_aio = TRUE;
|
||||
}
|
||||
#endif
|
||||
if (!os_aio_use_native_aio) {
|
||||
@ -652,14 +662,21 @@ innobase_start_or_create_for_mysql(void)
|
||||
sum_of_new_sizes = 0;
|
||||
|
||||
for (i = 0; i < srv_n_data_files; i++) {
|
||||
sum_of_new_sizes += srv_data_file_sizes[i];
|
||||
if (srv_data_file_sizes[i] >= 262144) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: file size must be < 4 GB, or on some OS's < 2 GB\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
sum_of_new_sizes += srv_data_file_sizes[i];
|
||||
}
|
||||
|
||||
if (sum_of_new_sizes < 640) {
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: tablespace size must be at least 10 MB\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
err = open_or_create_data_files(&create_new_db,
|
||||
@ -673,6 +690,15 @@ innobase_start_or_create_for_mysql(void)
|
||||
return((int) err);
|
||||
}
|
||||
|
||||
if (!create_new_db) {
|
||||
/* If we are using the doublewrite method, we will
|
||||
check if there are half-written pages in data files,
|
||||
and restore them from the doublewrite buffer if
|
||||
possible */
|
||||
|
||||
trx_sys_doublewrite_restore_corrupt_pages();
|
||||
}
|
||||
|
||||
srv_normalize_path_for_win(srv_arch_dir);
|
||||
srv_arch_dir = srv_add_path_separator_if_needed(srv_arch_dir);
|
||||
|
||||
@ -742,7 +768,6 @@ innobase_start_or_create_for_mysql(void)
|
||||
mutex_exit(&(log_sys->mutex));
|
||||
}
|
||||
|
||||
/* mutex_create(&row_mysql_thread_mutex); */
|
||||
sess_sys_init_at_db_start();
|
||||
|
||||
if (create_new_db) {
|
||||
@ -834,7 +859,7 @@ innobase_start_or_create_for_mysql(void)
|
||||
}
|
||||
|
||||
if (srv_measure_contention) {
|
||||
/* os_thread_create(&test_measure_cont, NULL, thread_ids +
|
||||
/* os_thread_create(&test_measure_cont, NULL, thread_ids +
|
||||
SRV_MAX_N_IO_THREADS); */
|
||||
}
|
||||
|
||||
@ -849,16 +874,20 @@ innobase_start_or_create_for_mysql(void)
|
||||
/* Create the thread which watches the timeouts for lock waits */
|
||||
os_thread_create(&srv_lock_timeout_monitor_thread, NULL,
|
||||
thread_ids + 2 + SRV_MAX_N_IO_THREADS);
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, " InnoDB: Started\n");
|
||||
|
||||
srv_was_started = TRUE;
|
||||
srv_is_being_started = FALSE;
|
||||
|
||||
sync_order_checks_on = TRUE;
|
||||
|
||||
if (srv_use_doublewrite_buf && trx_doublewrite == NULL) {
|
||||
trx_sys_create_doublewrite_buf();
|
||||
}
|
||||
|
||||
/* buf_debug_prints = TRUE; */
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, " InnoDB: Started\n");
|
||||
|
||||
return((int) DB_SUCCESS);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user