Commit 7bd8a1dc authored by serg@serg.mysql.com's avatar serg@serg.mysql.com

Merge serg.mysql.com:/usr/home/serg/Abk/mysql

into serg.mysql.com:/usr/home/serg/Abk/mysql-4.0
parents da4f1400 147c51b5
......@@ -25,6 +25,7 @@ extern char* srv_arch_dir;
extern ulint srv_n_data_files;
extern char** srv_data_file_names;
extern ulint* srv_data_file_sizes;
extern ulint* srv_data_file_is_raw_partition;
extern char** srv_log_group_home_dirs;
......@@ -103,13 +104,26 @@ typedef struct srv_sys_struct srv_sys_t;
/* The server system */
extern srv_sys_t* srv_sys;
/* Alternatives for fiel flush option in Unix; see the InnoDB manual about
/* Alternatives for file flush option in Unix; see the InnoDB manual about
what these mean */
#define SRV_UNIX_FDATASYNC 1
#define SRV_UNIX_O_DSYNC 2
#define SRV_UNIX_LITTLESYNC 3
#define SRV_UNIX_NOSYNC 4
/* Raw partition flags */
#define SRV_OLD_RAW 1
#define SRV_NEW_RAW 2
void
srv_mysql_thread_release(void);
/*==========================*/
os_event_t
srv_mysql_thread_event_get(void);
void
srv_mysql_thread_slot_free(
/*==========================*/
os_event_t event);
/*************************************************************************
Boots Innobase server. */
......
......@@ -2537,7 +2537,10 @@ row_search_for_mysql(
unique_search_from_clust_index = TRUE;
if (trx->mysql_n_tables_locked == 0
/* Disable this optimization (hence FALSE below) until
the hang of Peter Zaitsev has been tracked down */
if (FALSE && trx->mysql_n_tables_locked == 0
&& !prebuilt->sql_stat_start) {
/* This is a SELECT query done as a consistent read,
......
......@@ -64,6 +64,8 @@ ulint srv_n_data_files = 0;
char** srv_data_file_names = NULL;
ulint* srv_data_file_sizes = NULL; /* size in database pages */
ulint* srv_data_file_is_raw_partition = NULL;
char** srv_log_group_home_dirs = NULL;
ulint srv_n_log_groups = ULINT_MAX;
......@@ -1490,6 +1492,7 @@ srv_init(void)
slot = srv_mysql_table + i;
slot->in_use = FALSE;
slot->event = os_event_create(NULL);
slot->suspended = FALSE;
ut_a(slot->event);
}
......@@ -1658,6 +1661,7 @@ srv_suspend_mysql_thread(
slot->thr = thr;
os_event_reset(event);
slot->suspended = TRUE;
slot->suspend_time = ut_time();
......@@ -1689,6 +1693,27 @@ srv_suspend_mysql_thread(
return(FALSE);
}
os_event_t
srv_mysql_thread_event_get(void)
{
srv_slot_t* slot;
os_event_t event;
mutex_enter(&kernel_mutex);
slot = srv_table_reserve_slot_for_mysql();
event = slot->event;
os_event_reset(event);
slot->suspended = TRUE;
mutex_exit(&kernel_mutex);
return(event);
}
/************************************************************************
Releases a MySQL OS thread waiting for a lock to be released, if the
thread is already suspended. */
......@@ -1712,6 +1737,7 @@ srv_release_mysql_thread_if_suspended(
/* Found */
os_event_set(slot->event);
slot->suspended = FALSE;
return;
}
......@@ -1720,6 +1746,59 @@ srv_release_mysql_thread_if_suspended(
/* not found */
}
void
srv_mysql_thread_release(void)
/*==========================*/
{
srv_slot_t* slot;
ulint i;
mutex_enter(&kernel_mutex);
for (i = 0; i < OS_THREAD_MAX_N; i++) {
slot = srv_mysql_table + i;
if (slot->in_use && slot->suspended) {
/* Found */
slot->suspended = FALSE;
mutex_exit(&kernel_mutex);
os_event_set(slot->event);
return;
}
}
ut_a(0);
}
void
srv_mysql_thread_slot_free(
/*==========================*/
os_event_t event)
{
srv_slot_t* slot;
ulint i;
mutex_enter(&kernel_mutex);
for (i = 0; i < OS_THREAD_MAX_N; i++) {
slot = srv_mysql_table + i;
if (slot->in_use && slot->event == event) {
/* Found */
slot->in_use = FALSE;
mutex_exit(&kernel_mutex);
return;
}
}
ut_a(0);
}
/*************************************************************************
A thread which wakes up threads whose lock wait may have lasted too long. */
......@@ -1907,6 +1986,11 @@ loop:
}
background_loop:
/*
sync_array_print_info(sync_primary_wait_array);
os_aio_print();
buf_print_io();
*/
/* In this loop we run background operations while the server
is quiet */
......@@ -1967,9 +2051,15 @@ background_loop:
}
/* mem_print_new_info();
*/
fsp_print(0);
/* fsp_print(0); */
/* fprintf(stderr, "Validating tablespace\n");
fsp_validate(0);
fprintf(stderr, "Validation ok\n");
*/
#ifdef UNIV_SEARCH_PERF_STAT
/* btr_search_print_info(); */
#endif
......
......@@ -330,10 +330,28 @@ open_or_create_data_files(
sprintf(name, "%s%s", srv_data_home, srv_data_file_names[i]);
files[i] = os_file_create(name, OS_FILE_CREATE,
if (srv_data_file_is_raw_partition[i] == 0) {
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) {
files[i] = os_file_create(
name, OS_FILE_OPEN, OS_FILE_NORMAL, &ret);
if (!ret) {
fprintf(stderr,
"InnoDB: Error in opening %s\n", name);
return(DB_ERROR);
}
}
if (ret == FALSE) {
if (os_file_get_last_error() !=
if (srv_data_file_is_raw_partition[i] == 0
&& os_file_get_last_error() !=
OS_FILE_ALREADY_EXISTS) {
fprintf(stderr,
"InnoDB: Error in creating or opening %s\n",
......@@ -364,8 +382,10 @@ open_or_create_data_files(
ret = os_file_get_size(files[i], &size, &size_high);
ut_a(ret);
if (size != UNIV_PAGE_SIZE * srv_data_file_sizes[i]
|| size_high != 0) {
if (srv_data_file_is_raw_partition[i] == 0
&& (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);
......@@ -722,6 +742,7 @@ 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) {
......
......@@ -287,6 +287,26 @@ innobase_parse_data_file_paths_and_sizes(void)
str++;
}
if (size >= 4096) {
fprintf(stderr,
"InnoDB: error: data file size must not be >= 4096M\n");
return(FALSE);
}
if (strlen(str) >= 6
&& *str == 'n'
&& *(str + 1) == 'e'
&& *(str + 2) == 'w') {
str += 3;
}
if (strlen(str) >= 3
&& *str == 'r'
&& *(str + 1) == 'a'
&& *(str + 2) == 'w') {
str += 3;
}
if (size == 0) {
return(FALSE);
}
......@@ -301,8 +321,9 @@ innobase_parse_data_file_paths_and_sizes(void)
}
}
srv_data_file_names = (char**) ut_malloc(i * sizeof(void*));
srv_data_file_names = (char**)ut_malloc(i * sizeof(void*));
srv_data_file_sizes = (ulint*)ut_malloc(i * sizeof(ulint));
srv_data_file_is_raw_partition = (ulint*)ut_malloc(i * sizeof(ulint));
srv_n_data_files = i;
......@@ -337,6 +358,27 @@ innobase_parse_data_file_paths_and_sizes(void)
str++;
}
srv_data_file_is_raw_partition[i] = 0;
if (strlen(str) >= 6
&& *str == 'n'
&& *(str + 1) == 'e'
&& *(str + 2) == 'w') {
str += 3;
srv_data_file_is_raw_partition[i] = SRV_NEW_RAW;
}
if (strlen(str) >= 3
&& *str == 'r'
&& *(str + 1) == 'a'
&& *(str + 2) == 'w') {
str += 3;
if (srv_data_file_is_raw_partition[i] == 0) {
srv_data_file_is_raw_partition[i] = SRV_OLD_RAW;
}
}
srv_data_file_names[i] = path;
srv_data_file_sizes[i] = size;
......@@ -464,6 +506,7 @@ innobase_init(void)
ret = innobase_parse_data_file_paths_and_sizes();
if (ret == FALSE) {
fprintf(stderr, "InnoDB: syntax error in innodb_data_file_path\n");
DBUG_RETURN(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