Below is the list of changes that have just been committed into a local
5.1 repository of emurphy. When emurphy does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-09-27 17:20:45-04:00, elliot@stripped +1 -0
Merge mysql.com:/Users/emurphy/src/mysql/clean/mysql-5.0-maint-gca
into mysql.com:/Users/emurphy/src/mysql/clean/mysql-5.1-new-maint
MERGE: 1.1810.2123.1
storage/innobase/srv/srv0start.c@stripped, 2006-09-27 17:20:32-04:00, elliot@stripped +0
-0
Auto merged
MERGE: 1.80.13.2
storage/innobase/srv/srv0start.c@stripped, 2006-09-27 17:20:32-04:00, elliot@stripped
+0 -0
Merge rename: innobase/srv/srv0start.c -> storage/innobase/srv/srv0start.c
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: elliot
# Host: lost.local
# Root: /Users/emurphy/src/mysql/clean/mysql-5.1-new-maint/RESYNC
--- 1.80.13.1/innobase/srv/srv0start.c 2006-09-27 17:21:03 -04:00
+++ 1.100/storage/innobase/srv/srv0start.c 2006-09-27 17:21:03 -04:00
@@ -66,22 +66,22 @@
ibool srv_have_fullfsync = FALSE;
#endif
-ibool srv_start_raw_disk_in_use = FALSE;
+ibool srv_start_raw_disk_in_use = FALSE;
-static ibool srv_start_has_been_called = FALSE;
+ulint srv_sizeof_trx_t_in_ha_innodb_cc;
-ulint srv_sizeof_trx_t_in_ha_innodb_cc;
-
-ibool srv_startup_is_before_trx_rollback_phase = FALSE;
-ibool srv_is_being_started = FALSE;
-static ibool srv_was_started = FALSE;
+ibool srv_startup_is_before_trx_rollback_phase = FALSE;
+ibool srv_is_being_started = FALSE;
+#ifndef UNIV_HOTBACKUP
+static ibool srv_start_has_been_called = FALSE;
+static ibool srv_was_started = FALSE;
+#endif /* !UNIV_HOTBACKUP */
/* At a shutdown the value first climbs to SRV_SHUTDOWN_CLEANUP
and then to SRV_SHUTDOWN_LAST_PHASE */
ulint srv_shutdown_state = 0;
-ibool measure_cont = FALSE;
-
+#ifndef UNIV_HOTBACKUP
static os_file_t files[1000];
static mutex_t ios_mutex;
@@ -96,8 +96,9 @@
/* Name of srv_monitor_file */
static char* srv_monitor_file_name;
+#endif /* !UNIV_HOTBACKUP */
-#define SRV_N_PENDING_IOS_PER_THREAD OS_AIO_N_PENDING_IOS_PER_THREAD
+#define SRV_N_PENDING_IOS_PER_THREAD OS_AIO_N_PENDING_IOS_PER_THREAD
#define SRV_MAX_N_PENDING_SYNC_IOS 100
@@ -105,14 +106,47 @@
#ifdef HAVE_purify
static int inno_bcmp(register const char *s1, register const char *s2,
- register uint len)
+ register uint len)
{
- while (len-- != 0 && *s1++ == *s2++) ;
- return len+1;
+ while ((len-- != 0) && (*s1++ == *s2++))
+ ;
+
+ return(len + 1);
}
#define memcmp(A,B,C) inno_bcmp((A),(B),(C))
#endif
+static
+char*
+srv_parse_megabytes(
+/*================*/
+ /* out: next character in string */
+ char* str, /* in: string containing a quantity in bytes */
+ ulint* megs) /* out: the number in megabytes */
+{
+ char* endp;
+ ulint size;
+
+ size = strtoul(str, &endp, 10);
+
+ str = endp;
+
+ switch (*str) {
+ case 'G': case 'g':
+ size *= 1024;
+ /* fall through */
+ case 'M': case 'm':
+ str++;
+ break;
+ default:
+ size /= 1024 * 1024;
+ break;
+ }
+
+ *megs = size;
+ return(str);
+}
+
/*************************************************************************
Reads the data files and their sizes from a character string given in
the .cnf file. */
@@ -137,7 +171,6 @@
last file if specified, 0 if not */
{
char* input_str;
- char* endp;
char* path;
ulint size;
ulint i = 0;
@@ -146,7 +179,7 @@
*max_auto_extend_size = 0;
input_str = str;
-
+
/* First calculate the number of data files and check syntax:
path:size[M | G];path:size[M | G]... . Note that a Windows path may
contain a drive name and a ':'. */
@@ -157,7 +190,7 @@
while ((*str != ':' && *str != '\0')
|| (*str == ':'
&& (*(str + 1) == '\\' || *(str + 1) == '/'
- || *(str + 1) == ':'))) {
+ || *(str + 1) == ':'))) {
str++;
}
@@ -167,39 +200,19 @@
str++;
- size = strtoul(str, &endp, 10);
+ str = srv_parse_megabytes(str, &size);
- str = endp;
-
- if (*str != 'M' && *str != 'G') {
- size = size / (1024 * 1024);
- } else if (*str == 'G') {
- size = size * 1024;
- str++;
- } else {
- str++;
- }
-
- if (0 == memcmp(str, ":autoextend", (sizeof ":autoextend") - 1)) {
+ if (0 == memcmp(str, ":autoextend",
+ (sizeof ":autoextend") - 1)) {
str += (sizeof ":autoextend") - 1;
- if (0 == memcmp(str, ":max:", (sizeof ":max:") - 1)) {
+ if (0 == memcmp(str, ":max:",
+ (sizeof ":max:") - 1)) {
str += (sizeof ":max:") - 1;
- size = strtoul(str, &endp, 10);
-
- str = endp;
-
- if (*str != 'M' && *str != 'G') {
- size = size / (1024 * 1024);
- } else if (*str == 'G') {
- size = size * 1024;
- str++;
- } else {
- str++;
- }
+ str = srv_parse_megabytes(str, &size);
}
if (*str != '\0') {
@@ -208,15 +221,15 @@
}
}
- if (strlen(str) >= 6
- && *str == 'n'
- && *(str + 1) == 'e'
- && *(str + 2) == 'w') {
- str += 3;
+ if (strlen(str) >= 6
+ && *str == 'n'
+ && *(str + 1) == 'e'
+ && *(str + 2) == 'w') {
+ str += 3;
}
- if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') {
- str += 3;
+ if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') {
+ str += 3;
}
if (size == 0) {
@@ -239,7 +252,7 @@
return(FALSE);
}
-
+
*data_file_names = (char**)ut_malloc(i * sizeof(void*));
*data_file_sizes = (ulint*)ut_malloc(i * sizeof(ulint));
*data_file_is_raw_partition = (ulint*)ut_malloc(i * sizeof(ulint));
@@ -262,7 +275,7 @@
while ((*str != ':' && *str != '\0')
|| (*str == ':'
&& (*(str + 1) == '\\' || *(str + 1) == '/'
- || *(str + 1) == ':'))) {
+ || *(str + 1) == ':'))) {
str++;
}
@@ -272,46 +285,24 @@
str++;
}
- size = strtoul(str, &endp, 10);
-
- str = endp;
-
- if ((*str != 'M') && (*str != 'G')) {
- size = size / (1024 * 1024);
- } else if (*str == 'G') {
- size = size * 1024;
- str++;
- } else {
- str++;
- }
+ str = srv_parse_megabytes(str, &size);
(*data_file_names)[i] = path;
(*data_file_sizes)[i] = size;
- if (0 == memcmp(str, ":autoextend", (sizeof ":autoextend") - 1)) {
+ if (0 == memcmp(str, ":autoextend",
+ (sizeof ":autoextend") - 1)) {
*is_auto_extending = TRUE;
str += (sizeof ":autoextend") - 1;
- if (0 == memcmp(str, ":max:", (sizeof ":max:") - 1)) {
+ if (0 == memcmp(str, ":max:", (sizeof ":max:") - 1)) {
str += (sizeof ":max:") - 1;
- size = strtoul(str, &endp, 10);
-
- str = endp;
-
- if (*str != 'M' && *str != 'G') {
- size = size / (1024 * 1024);
- } else if (*str == 'G') {
- size = size * 1024;
- str++;
- } else {
- str++;
- }
-
- *max_auto_extend_size = size;
+ str = srv_parse_megabytes(
+ str, max_auto_extend_size);
}
if (*str != '\0') {
@@ -319,23 +310,23 @@
return(FALSE);
}
}
-
+
(*data_file_is_raw_partition)[i] = 0;
- if (strlen(str) >= 6
- && *str == 'n'
- && *(str + 1) == 'e'
- && *(str + 2) == 'w') {
- str += 3;
- (*data_file_is_raw_partition)[i] = SRV_NEW_RAW;
+ if (strlen(str) >= 6
+ && *str == 'n'
+ && *(str + 1) == 'e'
+ && *(str + 2) == 'w') {
+ str += 3;
+ (*data_file_is_raw_partition)[i] = SRV_NEW_RAW;
}
if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') {
- str += 3;
-
- if ((*data_file_is_raw_partition)[i] == 0) {
- (*data_file_is_raw_partition)[i] = SRV_OLD_RAW;
- }
+ str += 3;
+
+ if ((*data_file_is_raw_partition)[i] == 0) {
+ (*data_file_is_raw_partition)[i] = SRV_OLD_RAW;
+ }
}
i++;
@@ -365,7 +356,7 @@
ulint i = 0;
input_str = str;
-
+
/* First calculate the number of directories and check syntax:
path;path;... */
@@ -389,10 +380,10 @@
if (i != 1) {
/* If innodb_log_group_home_dir was defined it must
contain exactly one path definition under current MySQL */
-
+
return(FALSE);
}
-
+
*log_group_home_dirs = (char**) ut_malloc(i * sizeof(void*));
/* Then store the actual values to our array */
@@ -420,27 +411,24 @@
return(TRUE);
}
+#ifndef UNIV_HOTBACKUP
/************************************************************************
I/o-handler thread function. */
static
-#ifndef __WIN__
-void*
-#else
-ulint
-#endif
+os_thread_ret_t
io_handler_thread(
/*==============*/
void* arg)
{
ulint segment;
ulint i;
-
+
segment = *((ulint*)arg);
#ifdef UNIV_DEBUG_THREAD_CREATION
fprintf(stderr, "Io handler thread %lu starts, id %lu\n", segment,
- os_thread_pf(os_thread_get_curr_id()));
+ os_thread_pf(os_thread_get_curr_id()));
#endif
for (i = 0;; i++) {
fil_aio_wait(segment);
@@ -457,12 +445,9 @@
os_thread_exit(NULL);
-#ifndef __WIN__
- return(NULL); /* Not reached */
-#else
- return(0);
-#endif
+ OS_THREAD_DUMMY_RETURN;
}
+#endif /* !UNIV_HOTBACKUP */
#ifdef __WIN__
#define SRV_PATH_SEPARATOR '\\'
@@ -477,7 +462,7 @@
srv_normalize_path_for_win(
/*=======================*/
char* str __attribute__((unused))) /* in/out: null-terminated
- character string */
+ character string */
{
#ifdef __WIN__
for (; *str; str++) {
@@ -488,7 +473,7 @@
}
#endif
}
-
+
/*************************************************************************
Adds a slash or a backslash to the end of a string if it is missing
and the string is not empty. */
@@ -516,6 +501,7 @@
return(out_str);
}
+#ifndef UNIV_HOTBACKUP
/*************************************************************************
Calculates the low 32 bits when a file size which is given as a number
database pages is converted to the number of bytes. */
@@ -544,7 +530,6 @@
return(file_size >> (32 - UNIV_PAGE_SIZE_SHIFT));
}
-#ifndef UNIV_HOTBACKUP
/*************************************************************************
Creates or opens the log files and closes them. */
static
@@ -552,8 +537,8 @@
open_or_create_log_file(
/*====================*/
/* out: DB_SUCCESS or error code */
- ibool create_new_db, /* in: TRUE if we should create a
- new database */
+ ibool create_new_db, /* in: TRUE if we should create a
+ new database */
ibool* log_file_created, /* out: TRUE if new log file
created */
ibool log_file_has_been_opened,/* in: TRUE if a log file has been
@@ -573,80 +558,87 @@
srv_normalize_path_for_win(srv_log_group_home_dirs[k]);
srv_log_group_home_dirs[k] = srv_add_path_separator_if_needed(
- srv_log_group_home_dirs[k]);
+ srv_log_group_home_dirs[k]);
- ut_a(strlen(srv_log_group_home_dirs[k]) <
- (sizeof name) - 10 - sizeof "ib_logfile");
- sprintf(name, "%s%s%lu", srv_log_group_home_dirs[k], "ib_logfile", (ulong) i);
+ ut_a(strlen(srv_log_group_home_dirs[k])
+ < (sizeof name) - 10 - sizeof "ib_logfile");
+ sprintf(name, "%s%s%lu", srv_log_group_home_dirs[k],
+ "ib_logfile", (ulong) i);
files[i] = os_file_create(name, OS_FILE_CREATE, OS_FILE_NORMAL,
- OS_LOG_FILE, &ret);
+ OS_LOG_FILE, &ret);
if (ret == FALSE) {
if (os_file_get_last_error(FALSE) != OS_FILE_ALREADY_EXISTS
#ifdef UNIV_AIX
- /* AIX 5.1 after security patch ML7 may have errno set
- to 0 here, which causes our function to return 100;
- work around that AIX problem */
- && os_file_get_last_error(FALSE) != 100
+ /* AIX 5.1 after security patch ML7 may have errno set
+ to 0 here, which causes our function to return 100;
+ work around that AIX problem */
+ && os_file_get_last_error(FALSE) != 100
#endif
- ) {
+ ) {
fprintf(stderr,
- "InnoDB: Error in creating or opening %s\n", name);
-
+ "InnoDB: Error in creating"
+ " or opening %s\n", name);
+
return(DB_ERROR);
}
files[i] = os_file_create(name, OS_FILE_OPEN, OS_FILE_AIO,
- OS_LOG_FILE, &ret);
+ OS_LOG_FILE, &ret);
if (!ret) {
fprintf(stderr,
- "InnoDB: Error in opening %s\n", name);
-
+ "InnoDB: Error in opening %s\n", name);
+
return(DB_ERROR);
}
ret = os_file_get_size(files[i], &size, &size_high);
ut_a(ret);
-
+
if (size != srv_calc_low32(srv_log_file_size)
|| size_high != srv_calc_high32(srv_log_file_size)) {
-
+
fprintf(stderr,
-"InnoDB: Error: log file %s is of different size %lu %lu bytes\n"
-"InnoDB: than specified in the .cnf file %lu %lu bytes!\n",
+ "InnoDB: Error: log file %s is"
+ " of different size %lu %lu bytes\n"
+ "InnoDB: than specified in the .cnf"
+ " file %lu %lu bytes!\n",
name, (ulong) size_high, (ulong) size,
(ulong) srv_calc_high32(srv_log_file_size),
(ulong) srv_calc_low32(srv_log_file_size));
-
+
return(DB_ERROR);
- }
+ }
} else {
*log_file_created = TRUE;
- ut_print_timestamp(stderr);
+ ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Log file %s did not exist: new to be created\n",
- name);
+ " InnoDB: Log file %s did not exist:"
+ " new to be created\n",
+ name);
if (log_file_has_been_opened) {
return(DB_ERROR);
}
fprintf(stderr, "InnoDB: Setting log file %s size to %lu MB\n",
- name, (ulong) srv_log_file_size
+ name, (ulong) srv_log_file_size
>> (20 - UNIV_PAGE_SIZE_SHIFT));
fprintf(stderr,
- "InnoDB: Database physically writes the file full: wait...\n");
+ "InnoDB: Database physically writes the file"
+ " full: wait...\n");
ret = os_file_set_size(name, files[i],
- srv_calc_low32(srv_log_file_size),
- srv_calc_high32(srv_log_file_size));
+ srv_calc_low32(srv_log_file_size),
+ srv_calc_high32(srv_log_file_size));
if (!ret) {
fprintf(stderr,
- "InnoDB: Error in creating %s: probably out of disk space\n",
- name);
+ "InnoDB: Error in creating %s:"
+ " probably out of disk space\n",
+ name);
return(DB_ERROR);
}
@@ -658,15 +650,15 @@
if (i == 0) {
/* Create in memory the file space object
which is for this log group */
-
+
fil_space_create(name,
- 2 * k + SRV_LOG_SPACE_FIRST_ID, FIL_LOG);
+ 2 * k + SRV_LOG_SPACE_FIRST_ID, FIL_LOG);
}
ut_a(fil_validate());
fil_node_create(name, srv_log_file_size,
- 2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE);
+ 2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE);
#ifdef UNIV_LOG_ARCHIVE
/* If this is the first log group, create the file space object
for archived logs.
@@ -675,17 +667,17 @@
if (k == 0 && i == 0) {
arch_space_id = 2 * k + 1 + SRV_LOG_SPACE_FIRST_ID;
- fil_space_create("arch_log_space", arch_space_id, FIL_LOG);
+ fil_space_create("arch_log_space", arch_space_id, FIL_LOG);
} else {
arch_space_id = ULINT_UNDEFINED;
}
#endif /* UNIV_LOG_ARCHIVE */
if (i == 0) {
log_group_init(k, srv_n_log_files,
- srv_log_file_size * UNIV_PAGE_SIZE,
- 2 * k + SRV_LOG_SPACE_FIRST_ID,
- SRV_LOG_SPACE_FIRST_ID + 1); /* dummy arch
- space id */
+ srv_log_file_size * UNIV_PAGE_SIZE,
+ 2 * k + SRV_LOG_SPACE_FIRST_ID,
+ SRV_LOG_SPACE_FIRST_ID + 1); /* dummy arch
+ space id */
}
return(DB_SUCCESS);
@@ -721,13 +713,13 @@
if (srv_n_data_files >= 1000) {
fprintf(stderr, "InnoDB: can only have < 1000 data files\n"
- "InnoDB: you have defined %lu\n",
- (ulong) srv_n_data_files);
+ "InnoDB: you have defined %lu\n",
+ (ulong) srv_n_data_files);
return(DB_ERROR);
}
*sum_of_new_sizes = 0;
-
+
*create_new_db = FALSE;
srv_normalize_path_for_win(srv_data_home);
@@ -737,29 +729,31 @@
srv_normalize_path_for_win(srv_data_file_names[i]);
ut_a(strlen(srv_data_home) + strlen(srv_data_file_names[i])
- < (sizeof name) - 1);
+ < (sizeof name) - 1);
sprintf(name, "%s%s", srv_data_home, srv_data_file_names[i]);
-
+
if (srv_data_file_is_raw_partition[i] == 0) {
/* First we try to create the file: if it already
exists, ret will get value FALSE */
files[i] = os_file_create(name, OS_FILE_CREATE,
- OS_FILE_NORMAL, OS_DATA_FILE, &ret);
+ OS_FILE_NORMAL,
+ OS_DATA_FILE, &ret);
- if (ret == FALSE && os_file_get_last_error(FALSE) !=
- OS_FILE_ALREADY_EXISTS
+ if (ret == FALSE && os_file_get_last_error(FALSE)
+ != OS_FILE_ALREADY_EXISTS
#ifdef UNIV_AIX
- /* AIX 5.1 after security patch ML7 may have
- errno set to 0 here, which causes our function
- to return 100; work around that AIX problem */
- && os_file_get_last_error(FALSE) != 100
+ /* AIX 5.1 after security patch ML7 may have
+ errno set to 0 here, which causes our function
+ to return 100; work around that AIX problem */
+ && os_file_get_last_error(FALSE) != 100
#endif
- ) {
+ ) {
fprintf(stderr,
- "InnoDB: Error in creating or opening %s\n",
- name);
+ "InnoDB: Error in creating"
+ " or opening %s\n",
+ name);
return(DB_ERROR);
}
@@ -770,12 +764,12 @@
srv_start_raw_disk_in_use = TRUE;
srv_created_new_raw = TRUE;
- files[i] = os_file_create(
- name, OS_FILE_OPEN_RAW, OS_FILE_NORMAL,
- OS_DATA_FILE, &ret);
+ files[i] = os_file_create(name, OS_FILE_OPEN_RAW,
+ OS_FILE_NORMAL,
+ OS_DATA_FILE, &ret);
if (!ret) {
fprintf(stderr,
- "InnoDB: Error in opening %s\n", name);
+ "InnoDB: Error in opening %s\n", name);
return(DB_ERROR);
}
@@ -792,31 +786,32 @@
if (one_created) {
fprintf(stderr,
- "InnoDB: Error: data files can only be added at the end\n");
+ "InnoDB: Error: data files can only"
+ " be added at the end\n");
fprintf(stderr,
- "InnoDB: of a tablespace, but data file %s existed beforehand.\n",
- name);
+ "InnoDB: of a tablespace, but"
+ " data file %s existed beforehand.\n",
+ name);
return(DB_ERROR);
}
-
+
if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
files[i] = os_file_create(
- name, OS_FILE_OPEN_RAW, OS_FILE_NORMAL,
- OS_DATA_FILE, &ret);
+ name, OS_FILE_OPEN_RAW,
+ OS_FILE_NORMAL, OS_DATA_FILE, &ret);
} else if (i == 0) {
files[i] = os_file_create(
name, OS_FILE_OPEN_RETRY,
- OS_FILE_NORMAL,
- OS_DATA_FILE, &ret);
+ OS_FILE_NORMAL, OS_DATA_FILE, &ret);
} else {
files[i] = os_file_create(
name, OS_FILE_OPEN, OS_FILE_NORMAL,
- OS_DATA_FILE, &ret);
+ OS_DATA_FILE, &ret);
}
if (!ret) {
fprintf(stderr,
- "InnoDB: Error in opening %s\n", name);
+ "InnoDB: Error in opening %s\n", name);
os_file_get_last_error(TRUE);
return(DB_ERROR);
@@ -830,93 +825,111 @@
ret = os_file_get_size(files[i], &size, &size_high);
ut_a(ret);
/* Round size downward to megabytes */
-
- rounded_size_pages = (size / (1024 * 1024)
- + 4096 * size_high)
- << (20 - UNIV_PAGE_SIZE_SHIFT);
+
+ rounded_size_pages
+ = (size / (1024 * 1024) + 4096 * size_high)
+ << (20 - UNIV_PAGE_SIZE_SHIFT);
if (i == srv_n_data_files - 1
- && srv_auto_extend_last_data_file) {
+ && srv_auto_extend_last_data_file) {
+
+ if (srv_data_file_sizes[i] > rounded_size_pages
+ || (srv_last_file_size_max > 0
+ && srv_last_file_size_max
+ < rounded_size_pages)) {
- if (srv_data_file_sizes[i] >
- rounded_size_pages
- || (srv_last_file_size_max > 0
- && srv_last_file_size_max <
- rounded_size_pages)) {
-
fprintf(stderr,
-"InnoDB: Error: auto-extending data file %s is of a different size\n"
-"InnoDB: %lu pages (rounded down to MB) than specified in the .cnf file:\n"
-"InnoDB: initial %lu pages, max %lu (relevant if non-zero) pages!\n",
- name, (ulong) rounded_size_pages,
- (ulong) srv_data_file_sizes[i],
- (ulong) srv_last_file_size_max);
+ "InnoDB: Error: auto-extending"
+ " data file %s is"
+ " of a different size\n"
+ "InnoDB: %lu pages (rounded"
+ " down to MB) than specified"
+ " in the .cnf file:\n"
+ "InnoDB: initial %lu pages,"
+ " max %lu (relevant if"
+ " non-zero) pages!\n",
+ name,
+ (ulong) rounded_size_pages,
+ (ulong) srv_data_file_sizes[i],
+ (ulong)
+ srv_last_file_size_max);
return(DB_ERROR);
}
-
+
srv_data_file_sizes[i] = rounded_size_pages;
}
-
+
if (rounded_size_pages != srv_data_file_sizes[i]) {
fprintf(stderr,
-"InnoDB: Error: data file %s is of a different size\n"
-"InnoDB: %lu pages (rounded down to MB)\n"
-"InnoDB: than specified in the .cnf file %lu pages!\n", name,
- (ulong) rounded_size_pages,
- (ulong) srv_data_file_sizes[i]);
-
+ "InnoDB: Error: data file %s"
+ " is of a different size\n"
+ "InnoDB: %lu pages"
+ " (rounded down to MB)\n"
+ "InnoDB: than specified"
+ " in the .cnf file %lu pages!\n",
+ name,
+ (ulong) rounded_size_pages,
+ (ulong) srv_data_file_sizes[i]);
+
return(DB_ERROR);
}
skip_size_check:
- fil_read_flushed_lsn_and_arch_log_no(files[i],
- one_opened,
+ fil_read_flushed_lsn_and_arch_log_no(
+ files[i], one_opened,
#ifdef UNIV_LOG_ARCHIVE
- min_arch_log_no, max_arch_log_no,
+ min_arch_log_no, max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
- min_flushed_lsn, max_flushed_lsn);
+ min_flushed_lsn, max_flushed_lsn);
one_opened = TRUE;
} else {
- /* We created the data file and now write it full of
+ /* We created the data file and now write it full of
zeros */
one_created = TRUE;
if (i > 0) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Data file %s did not exist: new to be created\n",
- name);
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " 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"
- "InnoDB: a new database to be created!\n", name);
+ fprintf(stderr,
+ "InnoDB: The first specified"
+ " data file %s did not exist:\n"
+ "InnoDB: a new database"
+ " to be created!\n", name);
*create_new_db = TRUE;
}
-
- ut_print_timestamp(stderr);
- fprintf(stderr,
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
" InnoDB: Setting file %s size to %lu MB\n",
- name, (ulong) (srv_data_file_sizes[i]
- >> (20 - UNIV_PAGE_SIZE_SHIFT)));
+ name,
+ (ulong) (srv_data_file_sizes[i]
+ >> (20 - UNIV_PAGE_SIZE_SHIFT)));
fprintf(stderr,
- "InnoDB: Database physically writes the file full: wait...\n");
+ "InnoDB: Database physically writes the"
+ " file full: wait...\n");
- ret = os_file_set_size(name, files[i],
+ ret = os_file_set_size(
+ name, files[i],
srv_calc_low32(srv_data_file_sizes[i]),
srv_calc_high32(srv_data_file_sizes[i]));
if (!ret) {
- fprintf(stderr,
- "InnoDB: Error in creating %s: probably out of disk space\n", name);
+ fprintf(stderr,
+ "InnoDB: Error in creating %s:"
+ " probably out of disk space\n", name);
return(DB_ERROR);
}
*sum_of_new_sizes = *sum_of_new_sizes
- + srv_data_file_sizes[i];
+ + srv_data_file_sizes[i];
}
ret = os_file_close(files[i]);
@@ -930,17 +943,16 @@
if (srv_data_file_is_raw_partition[i]) {
- fil_node_create(name, srv_data_file_sizes[i], 0, TRUE);
+ fil_node_create(name, srv_data_file_sizes[i], 0, TRUE);
} else {
- fil_node_create(name, srv_data_file_sizes[i], 0,
- FALSE);
+ fil_node_create(name, srv_data_file_sizes[i], 0,
+ FALSE);
}
}
ios = 0;
- mutex_create(&ios_mutex);
- mutex_set_level(&ios_mutex, SYNC_NO_ORDER_CHECK);
+ mutex_create(&ios_mutex, SYNC_NO_ORDER_CHECK);
return(DB_SUCCESS);
}
@@ -966,13 +978,13 @@
ulint min_arch_log_no;
ulint max_arch_log_no;
#endif /* UNIV_LOG_ARCHIVE */
- ulint sum_of_new_sizes;
+ ulint sum_of_new_sizes;
ulint sum_of_data_file_sizes;
ulint tablespace_size_in_header;
ulint err;
ulint i;
ibool srv_file_per_table_original_value = srv_file_per_table;
- mtr_t mtr;
+ mtr_t mtr;
#ifdef HAVE_DARWIN_THREADS
# ifdef F_FULLFSYNC
/* This executable has been compiled on Mac OS X 10.3 or later.
@@ -989,67 +1001,74 @@
srv_have_fullfsync = strcmp(utsname.release, "7.") >= 0;
}
if (!srv_have_fullfsync) {
- fputs(
-"InnoDB: On Mac OS X, fsync() may be broken on internal drives,\n"
-"InnoDB: making transactions unsafe!\n", stderr);
+ fputs("InnoDB: On Mac OS X, fsync() may be"
+ " broken on internal drives,\n"
+ "InnoDB: making transactions unsafe!\n", stderr);
}
# endif /* F_FULLFSYNC */
#endif /* HAVE_DARWIN_THREADS */
if (sizeof(ulint) != sizeof(void*)) {
fprintf(stderr,
-"InnoDB: Error: size of InnoDB's ulint is %lu, but size of void* is %lu.\n"
-"InnoDB: The sizes should be the same so that on a 64-bit platform you can\n"
-"InnoDB: allocate more than 4 GB of memory.",
+ "InnoDB: Error: size of InnoDB's ulint is %lu,"
+ " but size of void* is %lu.\n"
+ "InnoDB: The sizes should be the same"
+ " so that on a 64-bit platform you can\n"
+ "InnoDB: allocate more than 4 GB of memory.",
(ulong)sizeof(ulint), (ulong)sizeof(void*));
}
srv_file_per_table = FALSE; /* system tables are created in tablespace
- 0 */
+ 0 */
#ifdef UNIV_DEBUG
fprintf(stderr,
-"InnoDB: !!!!!!!!!!!!!! UNIV_DEBUG switched on !!!!!!!!!!!!!!!\n");
+ "InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_SYNC_DEBUG
fprintf(stderr,
-"InnoDB: !!!!!!!!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!!!!!!!\n");
+ "InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_SEARCH_DEBUG
fprintf(stderr,
-"InnoDB: !!!!!!!!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!!!!!!!\n");
+ "InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_MEM_DEBUG
fprintf(stderr,
-"InnoDB: !!!!!!!!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!!!!!!!\n");
+ "InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_SIMULATE_AWE
fprintf(stderr,
-"InnoDB: !!!!!!!!!!!!!! UNIV_SIMULATE_AWE switched on !!!!!!!!!!!!!!!!!\n");
+ "InnoDB: !!!!!!!! UNIV_SIMULATE_AWE switched on !!!!!!!!!\n");
#endif
- if (srv_sizeof_trx_t_in_ha_innodb_cc != (ulint)sizeof(trx_t)) {
- fprintf(stderr,
- "InnoDB: Error: trx_t size is %lu in ha_innodb.cc but %lu in srv0start.c\n"
- "InnoDB: Check that pthread_mutex_t is defined in the same way in these\n"
- "InnoDB: compilation modules. Cannot continue.\n",
- (ulong) srv_sizeof_trx_t_in_ha_innodb_cc,
- (ulong) sizeof(trx_t));
+ if (srv_sizeof_trx_t_in_ha_innodb_cc != (ulint)sizeof(trx_t)) {
+ fprintf(stderr,
+ "InnoDB: Error: trx_t size is %lu in ha_innodb.cc"
+ " but %lu in srv0start.c\n"
+ "InnoDB: Check that pthread_mutex_t is defined"
+ " in the same way in these\n"
+ "InnoDB: compilation modules. Cannot continue.\n",
+ (ulong) srv_sizeof_trx_t_in_ha_innodb_cc,
+ (ulong) sizeof(trx_t));
return(DB_ERROR);
}
/* Since InnoDB does not currently clean up all its internal data
- structures in MySQL Embedded Server Library server_end(), we
- print an error message if someone tries to start up InnoDB a
- second time during the process lifetime. */
+ structures in MySQL Embedded Server Library server_end(), we
+ print an error message if someone tries to start up InnoDB a
+ second time during the process lifetime. */
if (srv_start_has_been_called) {
- fprintf(stderr,
-"InnoDB: Error:startup called second time during the process lifetime.\n"
-"InnoDB: In the MySQL Embedded Server Library you cannot call server_init()\n"
-"InnoDB: more than once during the process lifetime.\n");
+ fprintf(stderr,
+ "InnoDB: Error:startup called second time"
+ " during the process lifetime.\n"
+ "InnoDB: In the MySQL Embedded Server Library"
+ " you cannot call server_init()\n"
+ "InnoDB: more than once during"
+ " the process lifetime.\n");
}
srv_start_has_been_called = TRUE;
@@ -1057,21 +1076,24 @@
#ifdef UNIV_DEBUG
log_do_write = TRUE;
#endif /* UNIV_DEBUG */
-/* yydebug = TRUE; */
+ /* yydebug = TRUE; */
srv_is_being_started = TRUE;
- srv_startup_is_before_trx_rollback_phase = TRUE;
+ srv_startup_is_before_trx_rollback_phase = TRUE;
os_aio_use_native_aio = FALSE;
#if !defined(__WIN2000__) && !defined(UNIV_SIMULATE_AWE)
if (srv_use_awe) {
- fprintf(stderr,
-"InnoDB: Error: You have specified innodb_buffer_pool_awe_mem_mb\n"
-"InnoDB: in my.cnf, but AWE can only be used in Windows 2000 and later.\n"
-"InnoDB: To use AWE, InnoDB must be compiled with __WIN2000__ defined.\n");
+ fprintf(stderr,
+ "InnoDB: Error: You have specified"
+ " innodb_buffer_pool_awe_mem_mb\n"
+ "InnoDB: in my.cnf, but AWE can only"
+ " be used in Windows 2000 and later.\n"
+ "InnoDB: To use AWE, InnoDB must"
+ " be compiled with __WIN2000__ defined.\n");
- return(DB_ERROR);
+ return(DB_ERROR);
}
#endif
@@ -1080,90 +1102,91 @@
|| os_get_os_version() == OS_WIN31
|| os_get_os_version() == OS_WINNT) {
- /* On Win 95, 98, ME, Win32 subsystem for Windows 3.1,
+ /* On Win 95, 98, ME, Win32 subsystem for Windows 3.1,
and NT use simulated aio. In NT Windows provides async i/o,
but when run in conjunction with InnoDB Hot Backup, it seemed
to corrupt the data files. */
- os_aio_use_native_aio = FALSE;
+ os_aio_use_native_aio = FALSE;
} else {
- /* On Win 2000 and XP use async i/o */
- os_aio_use_native_aio = TRUE;
+ /* On Win 2000 and XP use async i/o */
+ os_aio_use_native_aio = TRUE;
}
-#endif
- if (srv_file_flush_method_str == NULL) {
- /* These are the default options */
+#endif
+ if (srv_file_flush_method_str == NULL) {
+ /* These are the default options */
srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
-#ifndef __WIN__
+#ifndef __WIN__
} else if (0 == ut_strcmp(srv_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_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_file_flush_method_str, "O_DIRECT")) {
- srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
+ srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "littlesync")) {
- srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
+ srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "nosync")) {
- srv_unix_file_flush_method = SRV_UNIX_NOSYNC;
+ srv_unix_file_flush_method = SRV_UNIX_NOSYNC;
#else
} else if (0 == ut_strcmp(srv_file_flush_method_str, "normal")) {
- srv_win_file_flush_method = SRV_WIN_IO_NORMAL;
- os_aio_use_native_aio = FALSE;
+ srv_win_file_flush_method = SRV_WIN_IO_NORMAL;
+ os_aio_use_native_aio = FALSE;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "unbuffered")) {
- srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
- os_aio_use_native_aio = FALSE;
+ srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
+ os_aio_use_native_aio = FALSE;
} else if (0 == ut_strcmp(srv_file_flush_method_str,
- "async_unbuffered")) {
- srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
+ "async_unbuffered")) {
+ srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
#endif
} else {
- fprintf(stderr,
- "InnoDB: Unrecognized value %s for innodb_flush_method\n",
- srv_file_flush_method_str);
- return(DB_ERROR);
+ fprintf(stderr,
+ "InnoDB: Unrecognized value %s for"
+ " innodb_flush_method\n",
+ srv_file_flush_method_str);
+ return(DB_ERROR);
}
/* Note that the call srv_boot() also changes the values of
srv_pool_size etc. to the units used by InnoDB internally */
- /* Set the maximum number of threads which can wait for a semaphore
- inside InnoDB: this is the 'sync wait array' size, as well as the
+ /* Set the maximum number of threads which can wait for a semaphore
+ inside InnoDB: this is the 'sync wait array' size, as well as the
maximum number of threads that can wait in the 'srv_conc array' for
their time to enter InnoDB. */
#if defined(__NETWARE__)
-/* Create less event semaphores because Win 98/ME had difficulty creating
-40000 event semaphores.
-Comment from Novell, Inc.: also, these just take a lot of memory on
-NetWare. */
- srv_max_n_threads = 1000;
+ /* Create less event semaphores because Win 98/ME had
+ difficulty creating 40000 event semaphores. Comment from
+ Novell, Inc.: also, these just take a lot of memory on
+ NetWare. */
+ srv_max_n_threads = 1000;
#else
- if (srv_pool_size >= 1000 * 1024) {
- /* Here we still have srv_pool_size counted
- in kilobytes (in 4.0 this was in bytes)
- srv_boot() converts the value to
- pages; if buffer pool is less than 1000 MB,
- assume fewer threads. */
- srv_max_n_threads = 50000;
-
- } else if (srv_pool_size >= 8 * 1024) {
-
- srv_max_n_threads = 10000;
- } else {
- srv_max_n_threads = 1000; /* saves several MB of memory,
- especially in 64-bit
- computers */
- }
+ if (srv_pool_size >= 1000 * 1024) {
+ /* Here we still have srv_pool_size counted
+ in kilobytes (in 4.0 this was in bytes)
+ srv_boot() converts the value to
+ pages; if buffer pool is less than 1000 MB,
+ assume fewer threads. */
+ srv_max_n_threads = 50000;
+
+ } else if (srv_pool_size >= 8 * 1024) {
+
+ srv_max_n_threads = 10000;
+ } else {
+ srv_max_n_threads = 1000; /* saves several MB of memory,
+ especially in 64-bit
+ computers */
+ }
#endif
err = srv_boot(); /* This changes srv_pool_size to units of a page */
@@ -1172,12 +1195,12 @@
return((int) err);
}
- mutex_create(&srv_monitor_file_mutex);
- mutex_set_level(&srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK);
+ mutex_create(&srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK);
+
if (srv_innodb_status) {
srv_monitor_file_name = mem_alloc(
- strlen(fil_path_to_mysql_datadir) +
- 20 + sizeof "/innodb_status.");
+ strlen(fil_path_to_mysql_datadir)
+ + 20 + sizeof "/innodb_status.");
sprintf(srv_monitor_file_name, "%s/innodb_status.%lu",
fil_path_to_mysql_datadir, os_proc_get_number());
srv_monitor_file = fopen(srv_monitor_file_name, "w+");
@@ -1194,15 +1217,15 @@
}
}
- mutex_create(&srv_dict_tmpfile_mutex);
- mutex_set_level(&srv_dict_tmpfile_mutex, SYNC_DICT_OPERATION);
+ mutex_create(&srv_dict_tmpfile_mutex, SYNC_DICT_OPERATION);
+
srv_dict_tmpfile = os_file_create_tmpfile();
if (!srv_dict_tmpfile) {
return(DB_ERROR);
}
- mutex_create(&srv_misc_tmpfile_mutex);
- mutex_set_level(&srv_misc_tmpfile_mutex, SYNC_ANY_LATCH);
+ mutex_create(&srv_misc_tmpfile_mutex, SYNC_ANY_LATCH);
+
srv_misc_tmpfile = os_file_create_tmpfile();
if (!srv_misc_tmpfile) {
return(DB_ERROR);
@@ -1215,49 +1238,53 @@
}
if (!os_aio_use_native_aio) {
- /* In simulated aio we currently have use only for 4 threads */
+ /* In simulated aio we currently have use only for 4 threads */
srv_n_file_io_threads = 4;
os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD
- * srv_n_file_io_threads,
- srv_n_file_io_threads,
- SRV_MAX_N_PENDING_SYNC_IOS);
+ * srv_n_file_io_threads,
+ srv_n_file_io_threads,
+ SRV_MAX_N_PENDING_SYNC_IOS);
} else {
os_aio_init(SRV_N_PENDING_IOS_PER_THREAD
- * srv_n_file_io_threads,
- srv_n_file_io_threads,
- SRV_MAX_N_PENDING_SYNC_IOS);
+ * srv_n_file_io_threads,
+ srv_n_file_io_threads,
+ SRV_MAX_N_PENDING_SYNC_IOS);
}
-
+
fil_init(srv_max_n_open_files);
if (srv_use_awe) {
fprintf(stderr,
-"InnoDB: Using AWE: Memory window is %lu MB and AWE memory is %lu MB\n",
- (ulong) (srv_awe_window_size / ((1024 * 1024) / UNIV_PAGE_SIZE)),
- (ulong) (srv_pool_size / ((1024 * 1024) / UNIV_PAGE_SIZE)));
+ "InnoDB: Using AWE: Memory window is %lu MB"
+ " and AWE memory is %lu MB\n",
+ (ulong) (srv_awe_window_size / ((1024 * 1024)
+ / UNIV_PAGE_SIZE)),
+ (ulong) (srv_pool_size / ((1024 * 1024)
+ / UNIV_PAGE_SIZE)));
/* We must disable adaptive hash indexes because they do not
tolerate remapping of pages in AWE */
-
+
srv_use_adaptive_hash_indexes = FALSE;
ret = buf_pool_init(srv_pool_size, srv_pool_size,
- srv_awe_window_size);
+ srv_awe_window_size);
} else {
ret = buf_pool_init(srv_pool_size, srv_pool_size,
- srv_pool_size);
+ srv_pool_size);
}
if (ret == NULL) {
fprintf(stderr,
-"InnoDB: Fatal error: cannot allocate the memory for the buffer pool\n");
+ "InnoDB: Fatal error: cannot allocate the memory"
+ " for the buffer pool\n");
return(DB_ERROR);
}
fsp_init();
log_init();
-
+
lock_sys_create(srv_lock_table_size);
/* Create i/o-handler threads: */
@@ -1266,13 +1293,14 @@
n[i] = i;
os_thread_create(io_handler_thread, n + i, thread_ids + i);
- }
+ }
#ifdef UNIV_LOG_ARCHIVE
if (0 != ut_strcmp(srv_log_group_home_dirs[0], srv_arch_dir)) {
fprintf(stderr,
- "InnoDB: Error: you must set the log group home dir in my.cnf the\n"
- "InnoDB: same as log arch dir.\n");
+ "InnoDB: Error: you must set the log group"
+ " home dir in my.cnf the\n"
+ "InnoDB: same as log arch dir.\n");
return(DB_ERROR);
}
@@ -1280,31 +1308,35 @@
if (srv_n_log_files * srv_log_file_size >= 262144) {
fprintf(stderr,
- "InnoDB: Error: combined size of log files must be < 4 GB\n");
+ "InnoDB: Error: combined size of log files"
+ " must be < 4 GB\n");
return(DB_ERROR);
}
sum_of_new_sizes = 0;
-
+
for (i = 0; i < srv_n_data_files; i++) {
#ifndef __WIN__
if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) {
- fprintf(stderr,
- "InnoDB: Error: file size must be < 4 GB with this MySQL binary\n"
- "InnoDB: and operating system combination, in some OS's < 2 GB\n");
+ fprintf(stderr,
+ "InnoDB: Error: file size must be < 4 GB"
+ " with this MySQL binary\n"
+ "InnoDB: and operating system combination,"
+ " in some OS's < 2 GB\n");
- return(DB_ERROR);
+ return(DB_ERROR);
}
#endif
sum_of_new_sizes += srv_data_file_sizes[i];
}
if (sum_of_new_sizes < 640) {
- fprintf(stderr,
- "InnoDB: Error: tablespace size must be at least 10 MB\n");
+ 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,
@@ -1314,14 +1346,20 @@
&min_flushed_lsn, &max_flushed_lsn,
&sum_of_new_sizes);
if (err != DB_SUCCESS) {
- fprintf(stderr,
-"InnoDB: Could not open or create data files.\n"
-"InnoDB: If you tried to add new data files, and it failed here,\n"
-"InnoDB: you should now edit innodb_data_file_path in my.cnf back\n"
-"InnoDB: to what it was, and remove the new ibdata files InnoDB created\n"
-"InnoDB: in this failed attempt. InnoDB only wrote those files full of\n"
-"InnoDB: zeros, but did not yet use them in any way. But be careful: do not\n"
-"InnoDB: remove old data files which contain your precious data!\n");
+ fprintf(stderr,
+ "InnoDB: Could not open or create data files.\n"
+ "InnoDB: If you tried to add new data files,"
+ " and it failed here,\n"
+ "InnoDB: you should now edit innodb_data_file_path"
+ " in my.cnf back\n"
+ "InnoDB: to what it was, and remove the"
+ " new ibdata files InnoDB created\n"
+ "InnoDB: in this failed attempt. InnoDB only wrote"
+ " those files full of\n"
+ "InnoDB: zeros, but did not yet use them in any way."
+ " But be careful: do not\n"
+ "InnoDB: remove old data files"
+ " which contain your precious data!\n");
return((int) err);
}
@@ -1330,10 +1368,10 @@
srv_normalize_path_for_win(srv_arch_dir);
srv_arch_dir = srv_add_path_separator_if_needed(srv_arch_dir);
#endif /* UNIV_LOG_ARCHIVE */
-
+
for (i = 0; i < srv_n_log_files; i++) {
err = open_or_create_log_file(create_new_db, &log_file_created,
- log_opened, 0, i);
+ log_opened, 0, i);
if (err != DB_SUCCESS) {
return((int) err);
@@ -1345,14 +1383,19 @@
log_opened = TRUE;
}
if ((log_opened && create_new_db)
- || (log_opened && log_created)) {
- fprintf(stderr,
- "InnoDB: Error: all log files must be created at the same time.\n"
- "InnoDB: All log files must be created also in database creation.\n"
- "InnoDB: If you want bigger or smaller log files, shut down the\n"
- "InnoDB: database and make sure there were no errors in shutdown.\n"
- "InnoDB: Then delete the existing log files. Edit the .cnf file\n"
- "InnoDB: and start the database again.\n");
+ || (log_opened && log_created)) {
+ fprintf(stderr,
+ "InnoDB: Error: all log files must be"
+ " created at the same time.\n"
+ "InnoDB: All log files must be"
+ " created also in database creation.\n"
+ "InnoDB: If you want bigger or smaller"
+ " log files, shut down the\n"
+ "InnoDB: database and make sure there"
+ " were no errors in shutdown.\n"
+ "InnoDB: Then delete the existing log files."
+ " Edit the .cnf file\n"
+ "InnoDB: and start the database again.\n");
return(DB_ERROR);
}
@@ -1365,30 +1408,36 @@
if (log_created && !create_new_db
#ifdef UNIV_LOG_ARCHIVE
- && !srv_archive_recovery
+ && !srv_archive_recovery
#endif /* UNIV_LOG_ARCHIVE */
- ) {
+ ) {
if (ut_dulint_cmp(max_flushed_lsn, min_flushed_lsn) != 0
#ifdef UNIV_LOG_ARCHIVE
- || max_arch_log_no != min_arch_log_no
+ || max_arch_log_no != min_arch_log_no
#endif /* UNIV_LOG_ARCHIVE */
- ) {
- fprintf(stderr,
- "InnoDB: Cannot initialize created log files because\n"
- "InnoDB: data files were not in sync with each other\n"
- "InnoDB: or the data files are corrupt.\n");
+ ) {
+ fprintf(stderr,
+ "InnoDB: Cannot initialize created"
+ " log files because\n"
+ "InnoDB: data files were not in sync"
+ " with each other\n"
+ "InnoDB: or the data files are corrupt.\n");
return(DB_ERROR);
}
if (ut_dulint_cmp(max_flushed_lsn, ut_dulint_create(0, 1000))
< 0) {
- fprintf(stderr,
- "InnoDB: Cannot initialize created log files because\n"
- "InnoDB: data files are corrupt, or new data files were\n"
- "InnoDB: created when the database was started previous\n"
- "InnoDB: time but the database was not shut down\n"
- "InnoDB: normally after that.\n");
+ fprintf(stderr,
+ "InnoDB: Cannot initialize created"
+ " log files because\n"
+ "InnoDB: data files are corrupt,"
+ " or new data files were\n"
+ "InnoDB: created when the database"
+ " was started previous\n"
+ "InnoDB: time but the database"
+ " was not shut down\n"
+ "InnoDB: normally after that.\n");
return(DB_ERROR);
}
@@ -1409,22 +1458,22 @@
if (create_new_db) {
mtr_start(&mtr);
- fsp_header_init(0, sum_of_new_sizes, &mtr);
+ fsp_header_init(0, sum_of_new_sizes, &mtr);
mtr_commit(&mtr);
trx_sys_create();
dict_create();
- srv_startup_is_before_trx_rollback_phase = FALSE;
+ srv_startup_is_before_trx_rollback_phase = FALSE;
#ifdef UNIV_LOG_ARCHIVE
} else if (srv_archive_recovery) {
fprintf(stderr,
- "InnoDB: Starting archive recovery from a backup...\n");
+ "InnoDB: Starting archive"
+ " recovery from a backup...\n");
err = recv_recovery_from_archive_start(
- min_flushed_lsn,
- srv_archive_recovery_limit_lsn,
- min_arch_log_no);
+ min_flushed_lsn, srv_archive_recovery_limit_lsn,
+ min_arch_log_no);
if (err != DB_SUCCESS) {
return(DB_ERROR);
@@ -1434,7 +1483,7 @@
dict_boot();
trx_sys_init_at_db_start();
- srv_startup_is_before_trx_rollback_phase = FALSE;
+ srv_startup_is_before_trx_rollback_phase = FALSE;
/* Initialize the fsp free limit global variable in the log
system */
@@ -1445,11 +1494,11 @@
} else {
/* We always try to do a recovery, even if the database had
been shut down normally: this is the normal startup path */
-
+
err = recv_recovery_from_checkpoint_start(LOG_CHECKPOINT,
- ut_dulint_max,
- min_flushed_lsn,
- max_flushed_lsn);
+ ut_dulint_max,
+ min_flushed_lsn,
+ max_flushed_lsn);
if (err != DB_SUCCESS) {
return(DB_ERROR);
@@ -1478,7 +1527,7 @@
In a normal startup, we create the space objects for
every table in the InnoDB data dictionary that has
an .ibd file.
-
+
We also determine the maximum tablespace id used.
TODO: We may have incomplete transactions in the
@@ -1486,10 +1535,10 @@
the data dictionary below? */
dict_check_tablespaces_and_store_max_id(
- recv_needed_recovery);
+ recv_needed_recovery);
}
- srv_startup_is_before_trx_rollback_phase = FALSE;
+ srv_startup_is_before_trx_rollback_phase = FALSE;
/* Initialize the fsp free limit global variable in the log
system */
@@ -1500,12 +1549,12 @@
recv_recovery_from_checkpoint_finish();
}
-
+
if (!create_new_db && sum_of_new_sizes > 0) {
/* New data file(s) were added */
mtr_start(&mtr);
- fsp_header_inc_size(0, sum_of_new_sizes, &mtr);
+ fsp_header_inc_size(0, sum_of_new_sizes, &mtr);
mtr_commit(&mtr);
@@ -1537,38 +1586,33 @@
}
#endif /* UNIV_LOG_ARCHIVE */
- if (srv_measure_contention) {
- /* os_thread_create(&test_measure_cont, NULL, thread_ids +
- SRV_MAX_N_IO_THREADS); */
- }
-
/* fprintf(stderr, "Max allowed record size %lu\n",
- page_get_free_space_of_empty() / 2); */
+ page_get_free_space_of_empty() / 2); */
/* Create the thread which watches the timeouts for lock waits
and prints InnoDB monitor info */
-
+
os_thread_create(&srv_lock_timeout_and_monitor_thread, NULL,
- thread_ids + 2 + SRV_MAX_N_IO_THREADS);
+ thread_ids + 2 + SRV_MAX_N_IO_THREADS);
/* Create the thread which warns of long semaphore waits */
os_thread_create(&srv_error_monitor_thread, NULL,
- thread_ids + 3 + SRV_MAX_N_IO_THREADS);
+ thread_ids + 3 + SRV_MAX_N_IO_THREADS);
srv_was_started = TRUE;
srv_is_being_started = FALSE;
#ifdef UNIV_DEBUG
- /* Wait a while so that the created threads have time to suspend
+ /* Wait a while so that the created threads have time to suspend
themselves before we switch sync debugging on; otherwise a thread may
execute mutex_enter() before the checks are on, and mutex_exit() after
the checks are on, which will cause an assertion failure in sync
debug. */
- os_thread_sleep(3000000);
+ os_thread_sleep(3000000);
#endif
sync_order_checks_on = TRUE;
- if (trx_doublewrite == NULL) {
+ if (trx_doublewrite == NULL) {
/* Create the doublewrite buffer to a new tablespace */
trx_sys_create_doublewrite_buf();
@@ -1579,17 +1623,17 @@
if (err != DB_SUCCESS) {
return((int)DB_ERROR);
}
-
+
/* Create the master thread which does purge and other utility
operations */
- os_thread_create(&srv_master_thread, NULL, thread_ids + 1 +
- SRV_MAX_N_IO_THREADS);
+ os_thread_create(&srv_master_thread, NULL, thread_ids
+ + (1 + SRV_MAX_N_IO_THREADS));
#ifdef UNIV_DEBUG
/* buf_debug_prints = TRUE; */
#endif /* UNIV_DEBUG */
sum_of_data_file_sizes = 0;
-
+
for (i = 0; i < srv_n_data_files; i++) {
sum_of_data_file_sizes += srv_data_file_sizes[i];
}
@@ -1597,12 +1641,13 @@
tablespace_size_in_header = fsp_header_get_tablespace_size(0);
if (!srv_auto_extend_last_data_file
- && sum_of_data_file_sizes != tablespace_size_in_header) {
+ && sum_of_data_file_sizes != tablespace_size_in_header) {
fprintf(stderr,
-"InnoDB: Error: tablespace size stored in header is %lu pages, but\n"
-"InnoDB: the sum of data file sizes is %lu pages\n",
- (ulong) tablespace_size_in_header,
+ "InnoDB: Error: tablespace size"
+ " stored in header is %lu pages, but\n"
+ "InnoDB: the sum of data file sizes is %lu pages\n",
+ (ulong) tablespace_size_in_header,
(ulong) sum_of_data_file_sizes);
if (srv_force_recovery == 0
@@ -1611,33 +1656,45 @@
missing */
fprintf(stderr,
-"InnoDB: Cannot start InnoDB. The tail of the system tablespace is\n"
-"InnoDB: missing. Have you edited innodb_data_file_path in my.cnf in an\n"
-"InnoDB: inappropriate way, removing ibdata files from there?\n"
-"InnoDB: You can set innodb_force_recovery=1 in my.cnf to force\n"
-"InnoDB: a startup if you are trying to recover a badly corrupt database.\n");
+ "InnoDB: Cannot start InnoDB."
+ " The tail of the system tablespace is\n"
+ "InnoDB: missing. Have you edited"
+ " innodb_data_file_path in my.cnf in an\n"
+ "InnoDB: inappropriate way, removing"
+ " ibdata files from there?\n"
+ "InnoDB: You can set innodb_force_recovery=1"
+ " in my.cnf to force\n"
+ "InnoDB: a startup if you are trying"
+ " to recover a badly corrupt database.\n");
return(DB_ERROR);
}
}
if (srv_auto_extend_last_data_file
- && sum_of_data_file_sizes < tablespace_size_in_header) {
+ && sum_of_data_file_sizes < tablespace_size_in_header) {
fprintf(stderr,
-"InnoDB: Error: tablespace size stored in header is %lu pages, but\n"
-"InnoDB: the sum of data file sizes is only %lu pages\n",
- (ulong) tablespace_size_in_header,
+ "InnoDB: Error: tablespace size stored in header"
+ " is %lu pages, but\n"
+ "InnoDB: the sum of data file sizes"
+ " is only %lu pages\n",
+ (ulong) tablespace_size_in_header,
(ulong) sum_of_data_file_sizes);
if (srv_force_recovery == 0) {
fprintf(stderr,
-"InnoDB: Cannot start InnoDB. The tail of the system tablespace is\n"
-"InnoDB: missing. Have you edited innodb_data_file_path in my.cnf in an\n"
-"InnoDB: inappropriate way, removing ibdata files from there?\n"
-"InnoDB: You can set innodb_force_recovery=1 in my.cnf to force\n"
-"InnoDB: a startup if you are trying to recover a badly corrupt database.\n");
+ "InnoDB: Cannot start InnoDB. The tail of"
+ " the system tablespace is\n"
+ "InnoDB: missing. Have you edited"
+ " innodb_data_file_path in my.cnf in an\n"
+ "InnoDB: inappropriate way, removing"
+ " ibdata files from there?\n"
+ "InnoDB: You can set innodb_force_recovery=1"
+ " in my.cnf to force\n"
+ "InnoDB: a startup if you are trying to"
+ " recover a badly corrupt database.\n");
return(DB_ERROR);
}
@@ -1647,31 +1704,33 @@
os_fast_mutex_init(&srv_os_test_mutex);
if (0 != os_fast_mutex_trylock(&srv_os_test_mutex)) {
- fprintf(stderr,
-"InnoDB: Error: pthread_mutex_trylock returns an unexpected value on\n"
-"InnoDB: success! Cannot continue.\n");
- exit(1);
+ fprintf(stderr,
+ "InnoDB: Error: pthread_mutex_trylock returns"
+ " an unexpected value on\n"
+ "InnoDB: success! Cannot continue.\n");
+ exit(1);
}
os_fast_mutex_unlock(&srv_os_test_mutex);
- os_fast_mutex_lock(&srv_os_test_mutex);
+ os_fast_mutex_lock(&srv_os_test_mutex);
os_fast_mutex_unlock(&srv_os_test_mutex);
os_fast_mutex_free(&srv_os_test_mutex);
if (srv_print_verbose_log) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
-" InnoDB: Started; log sequence number %lu %lu\n",
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Started; log sequence number %lu %lu\n",
(ulong) ut_dulint_get_high(srv_start_lsn),
(ulong) ut_dulint_get_low(srv_start_lsn));
}
if (srv_force_recovery > 0) {
fprintf(stderr,
- "InnoDB: !!! innodb_force_recovery is set to %lu !!!\n",
+ "InnoDB: !!! innodb_force_recovery"
+ " is set to %lu !!!\n",
(ulong) srv_force_recovery);
}
@@ -1686,15 +1745,17 @@
history list in all cases so that it would become empty
after a full purge. That mean that we may purge 4.0 type
undo log even after this phase.
-
+
The insert buffer record format changed between 4.0 and
4.1.1. It is essential that the insert buffer is emptied
here! */
fprintf(stderr,
-"InnoDB: You are upgrading to an InnoDB version which allows multiple\n"
-"InnoDB: tablespaces. Wait that purge and insert buffer merge run to\n"
-"InnoDB: completion...\n");
+ "InnoDB: You are upgrading to an"
+ " InnoDB version which allows multiple\n"
+ "InnoDB: tablespaces. Wait that purge"
+ " and insert buffer merge run to\n"
+ "InnoDB: completion...\n");
for (;;) {
os_thread_sleep(1000000);
@@ -1702,21 +1763,26 @@
"waiting for server activity")) {
ut_a(ibuf_is_empty());
-
+
break;
}
}
fprintf(stderr,
-"InnoDB: Full purge and insert buffer merge completed.\n");
+ "InnoDB: Full purge and insert buffer merge"
+ " completed.\n");
- trx_sys_mark_upgraded_to_multiple_tablespaces();
+ trx_sys_mark_upgraded_to_multiple_tablespaces();
fprintf(stderr,
-"InnoDB: You have now successfully upgraded to the multiple tablespaces\n"
-"InnoDB: format. You should NOT DOWNGRADE to an earlier version of\n"
-"InnoDB: InnoDB! But if you absolutely need to downgrade, see\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.0/en/multiple-tablespaces.html\n"
-"InnoDB: for instructions.\n");
+ "InnoDB: You have now successfully upgraded"
+ " to the multiple tablespaces\n"
+ "InnoDB: format. You should NOT DOWNGRADE"
+ " to an earlier version of\n"
+ "InnoDB: InnoDB! But if you absolutely need to"
+ " downgrade, see\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "multiple-tablespaces.html\n"
+ "InnoDB: for instructions.\n");
}
if (srv_force_recovery == 0) {
@@ -1737,23 +1803,24 @@
Shuts down the InnoDB database. */
int
-innobase_shutdown_for_mysql(void)
+innobase_shutdown_for_mysql(void)
/*=============================*/
/* out: DB_SUCCESS or error code */
{
- ulint i;
+ ulint i;
#ifdef __NETWARE__
extern ibool panic_shutdown;
#endif
- if (!srv_was_started) {
- if (srv_is_being_started) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
-" InnoDB: Warning: shutting down a not properly started\n"
-" InnoDB: or created database!\n");
- }
+ if (!srv_was_started) {
+ if (srv_is_being_started) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Warning: shutting down"
+ " a not properly started\n"
+ "InnoDB: or created database!\n");
+ }
- return(DB_SUCCESS);
+ return(DB_SUCCESS);
}
/* 1. Flush the buffer pool to disk, write the current lsn to
@@ -1763,32 +1830,35 @@
if (srv_fast_shutdown == 2) {
- ut_print_timestamp(stderr);
+ ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: MySQL has requested a very fast shutdown without flushing "
-"the InnoDB buffer pool to data files. At the next mysqld startup "
-"InnoDB will do a crash recovery!\n");
+ " InnoDB: MySQL has requested a very fast shutdown"
+ " without flushing "
+ "the InnoDB buffer pool to data files."
+ " At the next mysqld startup "
+ "InnoDB will do a crash recovery!\n");
}
#ifdef __NETWARE__
if(!panic_shutdown)
-#endif
- logs_empty_and_mark_files_at_shutdown();
+#endif
+ logs_empty_and_mark_files_at_shutdown();
if (srv_conc_n_threads != 0) {
fprintf(stderr,
- "InnoDB: Warning: query counter shows %ld queries still\n"
- "InnoDB: inside InnoDB at shutdown\n",
- srv_conc_n_threads);
+ "InnoDB: Warning: query counter shows %ld queries"
+ " still\n"
+ "InnoDB: inside InnoDB at shutdown\n",
+ srv_conc_n_threads);
}
/* 2. Make all threads created by InnoDB to exit */
srv_shutdown_state = SRV_SHUTDOWN_EXIT_THREADS;
- /* In a 'very fast' shutdown, we do not need to wait for these threads
- to die; all which counts is that we flushed the log; a 'very fast'
- shutdown is essentially a crash. */
+ /* In a 'very fast' shutdown, we do not need to wait for these threads
+ to die; all which counts is that we flushed the log; a 'very fast'
+ shutdown is essentially a crash. */
if (srv_fast_shutdown == 2) {
return(DB_SUCCESS);
@@ -1799,11 +1869,11 @@
os_thread_event_wait(). */
for (i = 0; i < 1000; i++) {
- /* NOTE: IF YOU CREATE THREADS IN INNODB, YOU MUST EXIT THEM
- HERE OR EARLIER */
-
+ /* NOTE: IF YOU CREATE THREADS IN INNODB, YOU MUST EXIT THEM
+ HERE OR EARLIER */
+
/* a. Let the lock timeout thread exit */
- os_event_set(srv_lock_timeout_thread_event);
+ os_event_set(srv_lock_timeout_thread_event);
/* b. srv error monitor thread exits automatically, no need
to do anything here */
@@ -1818,7 +1888,7 @@
os_mutex_enter(os_sync_mutex);
if (os_thread_count == 0) {
- /* All the threads have exited or are just exiting;
+ /* All the threads have exited or are just exiting;
NOTE that the threads may not have completed their
exit yet. Should we use pthread_join() to make sure
they have exited? Now we just sleep 0.1 seconds and
@@ -1837,9 +1907,10 @@
}
if (i == 1000) {
- fprintf(stderr,
-"InnoDB: Warning: %lu threads created by InnoDB had not exited at shutdown!\n",
- (ulong) os_thread_count);
+ fprintf(stderr,
+ "InnoDB: Warning: %lu threads created by InnoDB"
+ " had not exited at shutdown!\n",
+ (ulong) os_thread_count);
}
if (srv_monitor_file) {
@@ -1877,10 +1948,11 @@
by a purge. */
if (UT_LIST_GET_LEN(trx_sys->view_list) > 1) {
- fprintf(stderr,
-"InnoDB: Error: all read views were not closed before shutdown:\n"
-"InnoDB: %lu read views open \n",
- UT_LIST_GET_LEN(trx_sys->view_list) - 1);
+ fprintf(stderr,
+ "InnoDB: Error: all read views were not closed"
+ " before shutdown:\n"
+ "InnoDB: %lu read views open \n",
+ UT_LIST_GET_LEN(trx_sys->view_list) - 1);
}
/* 5. Free all allocated memory and the os_fast_mutex created in
@@ -1892,9 +1964,11 @@
|| os_event_count != 0
|| os_mutex_count != 0
|| os_fast_mutex_count != 0) {
- fprintf(stderr,
-"InnoDB: Warning: some resources were not cleaned up in shutdown:\n"
-"InnoDB: threads %lu, events %lu, os_mutexes %lu, os_fast_mutexes %lu\n",
+ fprintf(stderr,
+ "InnoDB: Warning: some resources were not"
+ " cleaned up in shutdown:\n"
+ "InnoDB: threads %lu, events %lu,"
+ " os_mutexes %lu, os_fast_mutexes %lu\n",
(ulong) os_thread_count, (ulong) os_event_count,
(ulong) os_mutex_count, (ulong) os_fast_mutex_count);
}
@@ -1907,11 +1981,12 @@
}
if (srv_print_verbose_log) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
-" InnoDB: Shutdown completed; log sequence number %lu %lu\n",
- (ulong) ut_dulint_get_high(srv_shutdown_lsn),
- (ulong) ut_dulint_get_low(srv_shutdown_lsn));
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Shutdown completed;"
+ " log sequence number %lu %lu\n",
+ (ulong) ut_dulint_get_high(srv_shutdown_lsn),
+ (ulong) ut_dulint_get_low(srv_shutdown_lsn));
}
return((int) DB_SUCCESS);
| Thread |
|---|
| • bk commit into 5.1 tree (elliot:1.2332) | Elliot Murphy | 27 Sep |