Commit 1116aced authored by unknown's avatar unknown

srv0srv.h Support raw disk as a data file

srv0start.c	Support raw disk as a data file
srv0srv.c	Support raw disk as a data file
ha_innobase.cc	Some error messages and support raw disk as a data file


sql/ha_innobase.cc:
  Some error messages and support raw disk as a data file
innobase/srv/srv0srv.c:
  Support raw disk as a data file
innobase/srv/srv0start.c:
  Support raw disk as a data file
innobase/include/srv0srv.h:
  Support raw disk as a data file
parent dece009c
...@@ -25,6 +25,7 @@ extern char* srv_arch_dir; ...@@ -25,6 +25,7 @@ extern char* srv_arch_dir;
extern ulint srv_n_data_files; extern ulint srv_n_data_files;
extern char** srv_data_file_names; extern char** srv_data_file_names;
extern ulint* srv_data_file_sizes; extern ulint* srv_data_file_sizes;
extern ulint* srv_data_file_is_raw_partition;
extern char** srv_log_group_home_dirs; extern char** srv_log_group_home_dirs;
...@@ -103,13 +104,26 @@ typedef struct srv_sys_struct srv_sys_t; ...@@ -103,13 +104,26 @@ typedef struct srv_sys_struct srv_sys_t;
/* The server system */ /* The server system */
extern srv_sys_t* srv_sys; 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 */ what these mean */
#define SRV_UNIX_FDATASYNC 1 #define SRV_UNIX_FDATASYNC 1
#define SRV_UNIX_O_DSYNC 2 #define SRV_UNIX_O_DSYNC 2
#define SRV_UNIX_LITTLESYNC 3 #define SRV_UNIX_LITTLESYNC 3
#define SRV_UNIX_NOSYNC 4 #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. */ Boots Innobase server. */
......
...@@ -64,6 +64,8 @@ ulint srv_n_data_files = 0; ...@@ -64,6 +64,8 @@ ulint srv_n_data_files = 0;
char** srv_data_file_names = NULL; char** srv_data_file_names = NULL;
ulint* srv_data_file_sizes = NULL; /* size in database pages */ 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; char** srv_log_group_home_dirs = NULL;
ulint srv_n_log_groups = ULINT_MAX; ulint srv_n_log_groups = ULINT_MAX;
...@@ -1490,6 +1492,7 @@ srv_init(void) ...@@ -1490,6 +1492,7 @@ srv_init(void)
slot = srv_mysql_table + i; slot = srv_mysql_table + i;
slot->in_use = FALSE; slot->in_use = FALSE;
slot->event = os_event_create(NULL); slot->event = os_event_create(NULL);
slot->suspended = FALSE;
ut_a(slot->event); ut_a(slot->event);
} }
...@@ -1658,6 +1661,7 @@ srv_suspend_mysql_thread( ...@@ -1658,6 +1661,7 @@ srv_suspend_mysql_thread(
slot->thr = thr; slot->thr = thr;
os_event_reset(event); os_event_reset(event);
slot->suspended = TRUE;
slot->suspend_time = ut_time(); slot->suspend_time = ut_time();
...@@ -1689,6 +1693,27 @@ srv_suspend_mysql_thread( ...@@ -1689,6 +1693,27 @@ srv_suspend_mysql_thread(
return(FALSE); 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 Releases a MySQL OS thread waiting for a lock to be released, if the
thread is already suspended. */ thread is already suspended. */
...@@ -1712,6 +1737,7 @@ srv_release_mysql_thread_if_suspended( ...@@ -1712,6 +1737,7 @@ srv_release_mysql_thread_if_suspended(
/* Found */ /* Found */
os_event_set(slot->event); os_event_set(slot->event);
slot->suspended = FALSE;
return; return;
} }
...@@ -1720,6 +1746,59 @@ srv_release_mysql_thread_if_suspended( ...@@ -1720,6 +1746,59 @@ srv_release_mysql_thread_if_suspended(
/* not found */ /* 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. */ A thread which wakes up threads whose lock wait may have lasted too long. */
...@@ -1907,6 +1986,11 @@ srv_master_thread( ...@@ -1907,6 +1986,11 @@ srv_master_thread(
} }
background_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 /* In this loop we run background operations while the server
is quiet */ is quiet */
...@@ -1967,9 +2051,15 @@ srv_master_thread( ...@@ -1967,9 +2051,15 @@ srv_master_thread(
} }
/* mem_print_new_info(); /* 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 #ifdef UNIV_SEARCH_PERF_STAT
/* btr_search_print_info(); */ /* btr_search_print_info(); */
#endif #endif
......
...@@ -330,10 +330,28 @@ open_or_create_data_files( ...@@ -330,10 +330,28 @@ open_or_create_data_files(
sprintf(name, "%s%s", srv_data_home, srv_data_file_names[i]); 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, files[i] = os_file_create(name, OS_FILE_CREATE,
OS_FILE_NORMAL, &ret); 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 (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) { OS_FILE_ALREADY_EXISTS) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error in creating or opening %s\n", "InnoDB: Error in creating or opening %s\n",
...@@ -364,8 +382,10 @@ open_or_create_data_files( ...@@ -364,8 +382,10 @@ open_or_create_data_files(
ret = os_file_get_size(files[i], &size, &size_high); ret = os_file_get_size(files[i], &size, &size_high);
ut_a(ret); ut_a(ret);
if (size != UNIV_PAGE_SIZE * srv_data_file_sizes[i] if (srv_data_file_is_raw_partition[i] == 0
|| size_high != 0) { && (size != UNIV_PAGE_SIZE * srv_data_file_sizes[i]
|| size_high != 0)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: data file %s is of different size\n" "InnoDB: Error: data file %s is of different size\n"
"InnoDB: than specified in the .cnf file!\n", name); "InnoDB: than specified in the .cnf file!\n", name);
...@@ -722,6 +742,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -722,6 +742,7 @@ innobase_start_or_create_for_mysql(void)
mutex_exit(&(log_sys->mutex)); mutex_exit(&(log_sys->mutex));
} }
mutex_create(&row_mysql_thread_mutex);
sess_sys_init_at_db_start(); sess_sys_init_at_db_start();
if (create_new_db) { if (create_new_db) {
......
...@@ -287,6 +287,26 @@ innobase_parse_data_file_paths_and_sizes(void) ...@@ -287,6 +287,26 @@ innobase_parse_data_file_paths_and_sizes(void)
str++; 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) { if (size == 0) {
return(FALSE); return(FALSE);
} }
...@@ -301,8 +321,9 @@ innobase_parse_data_file_paths_and_sizes(void) ...@@ -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_sizes = (ulint*)ut_malloc(i * sizeof(ulint));
srv_data_file_is_raw_partition = (ulint*)ut_malloc(i * sizeof(ulint));
srv_n_data_files = i; srv_n_data_files = i;
...@@ -337,6 +358,27 @@ innobase_parse_data_file_paths_and_sizes(void) ...@@ -337,6 +358,27 @@ innobase_parse_data_file_paths_and_sizes(void)
str++; 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_names[i] = path;
srv_data_file_sizes[i] = size; srv_data_file_sizes[i] = size;
...@@ -464,6 +506,7 @@ innobase_init(void) ...@@ -464,6 +506,7 @@ innobase_init(void)
ret = innobase_parse_data_file_paths_and_sizes(); ret = innobase_parse_data_file_paths_and_sizes();
if (ret == FALSE) { if (ret == FALSE) {
fprintf(stderr, "InnoDB: syntax error in innodb_data_file_path\n");
DBUG_RETURN(TRUE); 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