mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 11:57:38 +02:00
merge with 4.0 to get security fixes and latest bug fixes
BitKeeper/etc/logging_ok: auto-union configure.in: Auto merged BitKeeper/deleted/.del-mini_client.cc~8677895ec8169183: Auto merged VC++Files/mysql.dsw: Auto merged VC++Files/mysys/mysys.dsp: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/include/srv0start.h: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/mem/mem0dbg.c: Auto merged innobase/que/que0que.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/sync/sync0rw.c: Auto merged innobase/sync/sync0sync.c: Auto merged innobase/trx/trx0trx.c: Auto merged libmysql/manager.c: Auto merged sql/ha_innodb.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/unireg.cc: Auto merged VC++Files/sql/mysqld.dsp: Removed wrong define USE_SYMLINK include/config-win.h: Use original code innobase/srv/srv0srv.c: merge innobase/usr/usr0sess.c: merge libmysql/libmysql.c: merge mysql-test/r/func_test.result: merge mysql-test/t/func_test.test: merge sql/log.cc: merge sql/mysqld.cc: merge
This commit is contained in:
commit
8b2b219fb5
112 changed files with 2328 additions and 49895 deletions
|
|
@ -883,122 +883,6 @@ srv_release_max_if_no_queries(void)
|
|||
mutex_exit(&kernel_mutex);
|
||||
}
|
||||
|
||||
#ifdef notdefined
|
||||
/***********************************************************************
|
||||
Releases one utility thread if no queries are active and
|
||||
the high-water mark 2 for the utility is exceeded. */
|
||||
static
|
||||
void
|
||||
srv_release_one_if_no_queries(void)
|
||||
/*===============================*/
|
||||
{
|
||||
ulint m;
|
||||
ulint type;
|
||||
|
||||
mutex_enter(&kernel_mutex);
|
||||
|
||||
if (srv_n_threads_active[SRV_COM] > 0) {
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
type = SRV_RECOVERY;
|
||||
|
||||
m = 1;
|
||||
|
||||
if ((srv_meter[type] > srv_meter_high_water2[type])
|
||||
&& (srv_n_threads_active[type] < m)) {
|
||||
|
||||
srv_release_threads(type, m - srv_n_threads_active[type]);
|
||||
|
||||
printf("Releasing one background\n");
|
||||
}
|
||||
|
||||
mutex_exit(&kernel_mutex);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Decrements the utility meter by the value given and suspends the calling
|
||||
thread, which must be an utility thread of the type given, if necessary. */
|
||||
static
|
||||
void
|
||||
srv_decrement_meter(
|
||||
/*================*/
|
||||
ulint type, /* in: utility type */
|
||||
ulint n) /* in: value to subtract from meter */
|
||||
{
|
||||
ulint opt;
|
||||
os_event_t event;
|
||||
|
||||
mutex_enter(&kernel_mutex);
|
||||
|
||||
if (srv_meter[type] < n) {
|
||||
srv_meter[type] = 0;
|
||||
} else {
|
||||
srv_meter[type] -= n;
|
||||
}
|
||||
|
||||
opt = srv_max_n_utilities(type);
|
||||
|
||||
if (opt < srv_n_threads_active[type]) {
|
||||
|
||||
event = srv_suspend_thread();
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
os_event_wait(event);
|
||||
} else {
|
||||
mutex_exit(&kernel_mutex);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
Implements the server console. */
|
||||
|
||||
ulint
|
||||
srv_console(
|
||||
/*========*/
|
||||
/* out: return code, not used */
|
||||
void* arg) /* in: argument, not used */
|
||||
{
|
||||
char command[256];
|
||||
|
||||
UT_NOT_USED(arg);
|
||||
|
||||
mutex_enter(&kernel_mutex);
|
||||
srv_table_reserve_slot(SRV_CONSOLE);
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
os_event_wait(srv_sys->operational);
|
||||
|
||||
for (;;) {
|
||||
scanf("%s", command);
|
||||
|
||||
srv_inc_thread_count(SRV_CONSOLE);
|
||||
|
||||
if (command[0] == 'c') {
|
||||
printf("Making checkpoint\n");
|
||||
|
||||
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
||||
|
||||
printf("Checkpoint completed\n");
|
||||
|
||||
} else if (command[0] == 'd') {
|
||||
srv_sim_disk_wait_pct = atoi(command + 1);
|
||||
|
||||
printf(
|
||||
"Starting disk access simulation with pct %lu\n",
|
||||
(ulong) srv_sim_disk_wait_pct);
|
||||
} else {
|
||||
printf("\nNot supported!\n");
|
||||
}
|
||||
|
||||
srv_dec_thread_count(SRV_CONSOLE);
|
||||
}
|
||||
|
||||
return(0); /* Not reached */
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Creates the first communication endpoint for the server. This
|
||||
|
|
@ -1028,69 +912,6 @@ srv_communication_init(
|
|||
ut_a(ret == 0);
|
||||
}
|
||||
|
||||
#ifdef notdefined
|
||||
|
||||
/*************************************************************************
|
||||
Implements the recovery utility. */
|
||||
static
|
||||
ulint
|
||||
srv_recovery_thread(
|
||||
/*================*/
|
||||
/* out: return code, not used */
|
||||
void* arg) /* in: not used */
|
||||
{
|
||||
ulint slot_no;
|
||||
os_event_t event;
|
||||
|
||||
UT_NOT_USED(arg);
|
||||
|
||||
slot_no = srv_table_reserve_slot(SRV_RECOVERY);
|
||||
|
||||
os_event_wait(srv_sys->operational);
|
||||
|
||||
for (;;) {
|
||||
/* Finish a possible recovery */
|
||||
|
||||
srv_inc_thread_count(SRV_RECOVERY);
|
||||
|
||||
/* recv_recovery_from_checkpoint_finish(); */
|
||||
|
||||
srv_dec_thread_count(SRV_RECOVERY);
|
||||
|
||||
mutex_enter(&kernel_mutex);
|
||||
event = srv_suspend_thread();
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
/* Wait for somebody to release this thread; (currently, this
|
||||
should never be released) */
|
||||
|
||||
os_event_wait(event);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Implements the purge utility. */
|
||||
|
||||
ulint
|
||||
srv_purge_thread(
|
||||
/*=============*/
|
||||
/* out: return code, not used */
|
||||
void* arg) /* in: not used */
|
||||
{
|
||||
UT_NOT_USED(arg);
|
||||
|
||||
os_event_wait(srv_sys->operational);
|
||||
|
||||
for (;;) {
|
||||
trx_purge();
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif /* notdefined */
|
||||
|
||||
/*************************************************************************
|
||||
Creates the utility threads. */
|
||||
|
||||
|
|
@ -1120,58 +941,6 @@ srv_create_utility_threads(void)
|
|||
ut_a(thread); */
|
||||
}
|
||||
|
||||
#ifdef notdefined
|
||||
/*************************************************************************
|
||||
Implements the communication threads. */
|
||||
static
|
||||
ulint
|
||||
srv_com_thread(
|
||||
/*===========*/
|
||||
/* out: return code; not used */
|
||||
void* arg) /* in: not used */
|
||||
{
|
||||
byte* msg_buf;
|
||||
byte* addr_buf;
|
||||
ulint msg_len;
|
||||
ulint addr_len;
|
||||
ulint ret;
|
||||
|
||||
UT_NOT_USED(arg);
|
||||
|
||||
srv_table_reserve_slot(SRV_COM);
|
||||
|
||||
os_event_wait(srv_sys->operational);
|
||||
|
||||
msg_buf = mem_alloc(com_endpoint_get_max_size(srv_sys->endpoint));
|
||||
addr_buf = mem_alloc(COM_MAX_ADDR_LEN);
|
||||
|
||||
for (;;) {
|
||||
ret = com_recvfrom(srv_sys->endpoint, msg_buf,
|
||||
com_endpoint_get_max_size(srv_sys->endpoint),
|
||||
&msg_len, (char*)addr_buf, COM_MAX_ADDR_LEN,
|
||||
&addr_len);
|
||||
ut_a(ret == 0);
|
||||
|
||||
srv_inc_thread_count(SRV_COM);
|
||||
|
||||
sess_process_cli_msg(msg_buf, msg_len, addr_buf, addr_len);
|
||||
|
||||
/* srv_increment_meter(SRV_RECOVERY, 1); */
|
||||
|
||||
srv_dec_thread_count(SRV_COM);
|
||||
|
||||
/* Release one utility thread for each utility if
|
||||
high water mark 2 is exceeded and there are no
|
||||
active queries. This is done to utilize possible
|
||||
quiet time in the server. */
|
||||
|
||||
srv_release_one_if_no_queries();
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
Creates the communication threads. */
|
||||
|
||||
|
|
@ -1191,53 +960,6 @@ srv_create_com_threads(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef notdefined
|
||||
/*************************************************************************
|
||||
Implements the worker threads. */
|
||||
static
|
||||
ulint
|
||||
srv_worker_thread(
|
||||
/*==============*/
|
||||
/* out: return code, not used */
|
||||
void* arg) /* in: not used */
|
||||
{
|
||||
os_event_t event;
|
||||
|
||||
UT_NOT_USED(arg);
|
||||
|
||||
srv_table_reserve_slot(SRV_WORKER);
|
||||
|
||||
os_event_wait(srv_sys->operational);
|
||||
|
||||
for (;;) {
|
||||
mutex_enter(&kernel_mutex);
|
||||
event = srv_suspend_thread();
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
/* Wait for somebody to release this thread */
|
||||
os_event_wait(event);
|
||||
|
||||
srv_inc_thread_count(SRV_WORKER);
|
||||
|
||||
/* Check in the server task queue if there is work for this
|
||||
thread, and do the work */
|
||||
|
||||
srv_que_task_queue_check();
|
||||
|
||||
srv_dec_thread_count(SRV_WORKER);
|
||||
|
||||
/* Release one utility thread for each utility if
|
||||
high water mark 2 is exceeded and there are no
|
||||
active queries. This is done to utilize possible
|
||||
quiet time in the server. */
|
||||
|
||||
srv_release_one_if_no_queries();
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
Creates the worker threads. */
|
||||
|
||||
|
|
@ -1258,403 +980,6 @@ srv_create_worker_threads(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef notdefined
|
||||
/*************************************************************************
|
||||
Reads a keyword and a value from a file. */
|
||||
|
||||
ulint
|
||||
srv_read_init_val(
|
||||
/*==============*/
|
||||
/* out: DB_SUCCESS or error code */
|
||||
FILE* initfile, /* in: file pointer */
|
||||
char* keyword, /* in: keyword before value(s), or NULL if
|
||||
no keyword read */
|
||||
char* str_buf, /* in/out: buffer for a string value to read,
|
||||
buffer size must be 10000 bytes, if NULL
|
||||
then not read */
|
||||
ulint* num_val, /* out: numerical value to read, if NULL
|
||||
then not read */
|
||||
ibool print_not_err) /* in: if TRUE, then we will not print
|
||||
error messages to console */
|
||||
{
|
||||
ulint ret;
|
||||
char scan_buf[10000];
|
||||
|
||||
if (keyword == NULL) {
|
||||
|
||||
goto skip_keyword;
|
||||
}
|
||||
|
||||
ret = fscanf(initfile, "%9999s", scan_buf);
|
||||
|
||||
if (ret == 0 || ret == EOF || 0 != ut_strcmp(scan_buf, keyword)) {
|
||||
if (print_not_err) {
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
printf("Error in InnoDB booting: keyword %s not found\n",
|
||||
keyword);
|
||||
printf("from the initfile!\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
skip_keyword:
|
||||
if (num_val == NULL && str_buf == NULL) {
|
||||
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
ret = fscanf(initfile, "%9999s", scan_buf);
|
||||
|
||||
if (ret == EOF || ret == 0) {
|
||||
if (print_not_err) {
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
printf(
|
||||
"Error in InnoDB booting: could not read first value after %s\n",
|
||||
keyword);
|
||||
printf("from the initfile!\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
if (str_buf) {
|
||||
ut_memcpy(str_buf, scan_buf, 10000);
|
||||
|
||||
printf("init keyword %s value %s read\n", keyword, str_buf);
|
||||
|
||||
if (!num_val) {
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
ret = fscanf(initfile, "%9999s", scan_buf);
|
||||
|
||||
if (ret == EOF || ret == 0) {
|
||||
|
||||
if (print_not_err) {
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
printf(
|
||||
"Error in InnoDB booting: could not read second value after %s\n",
|
||||
keyword);
|
||||
printf("from the initfile!\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if (ut_strlen(scan_buf) > 9) {
|
||||
|
||||
if (print_not_err) {
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
printf(
|
||||
"Error in InnoDB booting: numerical value too big after %s\n",
|
||||
keyword);
|
||||
printf("in the initfile!\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
*num_val = (ulint)atoi(scan_buf);
|
||||
|
||||
if (*num_val >= 1000000000) {
|
||||
|
||||
if (print_not_err) {
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
printf(
|
||||
"Error in InnoDB booting: numerical value too big after %s\n",
|
||||
keyword);
|
||||
printf("in the initfile!\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
printf("init keyword %s value %lu read\n", keyword, *num_val);
|
||||
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Reads keywords and values from an initfile. */
|
||||
|
||||
ulint
|
||||
srv_read_initfile(
|
||||
/*==============*/
|
||||
/* out: DB_SUCCESS or error code */
|
||||
FILE* initfile) /* in: file pointer */
|
||||
{
|
||||
char str_buf[10000];
|
||||
ulint n;
|
||||
ulint i;
|
||||
ulint ulint_val;
|
||||
ulint val1;
|
||||
ulint val2;
|
||||
ulint err;
|
||||
|
||||
err = srv_read_init_val(initfile, "INNOBASE_DATA_HOME_DIR",
|
||||
str_buf, NULL, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
srv_data_home = ut_malloc(ut_strlen(str_buf) + 1);
|
||||
ut_memcpy(srv_data_home, str_buf, ut_strlen(str_buf) + 1);
|
||||
|
||||
err = srv_read_init_val(initfile,"TABLESPACE_NUMBER_OF_DATA_FILES",
|
||||
NULL, &n, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
srv_n_data_files = n;
|
||||
|
||||
srv_data_file_names = ut_malloc(n * sizeof(char*));
|
||||
srv_data_file_sizes = ut_malloc(n * sizeof(ulint));
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
err = srv_read_init_val(initfile,
|
||||
"DATA_FILE_PATH_AND_SIZE_MB",
|
||||
str_buf, &ulint_val, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
srv_data_file_names[i] = ut_malloc(ut_strlen(str_buf) + 1);
|
||||
ut_memcpy(srv_data_file_names[i], str_buf,
|
||||
ut_strlen(str_buf) + 1);
|
||||
srv_data_file_sizes[i] = ulint_val
|
||||
* ((1024 * 1024) / UNIV_PAGE_SIZE);
|
||||
}
|
||||
|
||||
err = srv_read_init_val(initfile,
|
||||
"NUMBER_OF_MIRRORED_LOG_GROUPS", NULL,
|
||||
&srv_n_log_groups, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
err = srv_read_init_val(initfile,
|
||||
"NUMBER_OF_LOG_FILES_IN_GROUP", NULL,
|
||||
&srv_n_log_files, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
err = srv_read_init_val(initfile, "LOG_FILE_SIZE_KB", NULL,
|
||||
&srv_log_file_size, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
srv_log_file_size = srv_log_file_size / (UNIV_PAGE_SIZE / 1024);
|
||||
|
||||
srv_log_group_home_dirs = ut_malloc(srv_n_log_files * sizeof(char*));
|
||||
|
||||
for (i = 0; i < srv_n_log_groups; i++) {
|
||||
|
||||
err = srv_read_init_val(initfile,
|
||||
"INNOBASE_LOG_GROUP_HOME_DIR",
|
||||
str_buf, NULL, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
srv_log_group_home_dirs[i] = ut_malloc(ut_strlen(str_buf) + 1);
|
||||
ut_memcpy(srv_log_group_home_dirs[i], str_buf,
|
||||
ut_strlen(str_buf) + 1);
|
||||
}
|
||||
|
||||
err = srv_read_init_val(initfile, "INNOBASE_LOG_ARCH_DIR",
|
||||
str_buf, NULL, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
srv_arch_dir = ut_malloc(ut_strlen(str_buf) + 1);
|
||||
ut_memcpy(srv_arch_dir, str_buf, ut_strlen(str_buf) + 1);
|
||||
|
||||
err = srv_read_init_val(initfile, "LOG_ARCHIVE_ON(1/0)", NULL,
|
||||
&srv_log_archive_on, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
err = srv_read_init_val(initfile, "LOG_BUFFER_SIZE_KB", NULL,
|
||||
&srv_log_buffer_size, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
srv_log_buffer_size = srv_log_buffer_size / (UNIV_PAGE_SIZE / 1024);
|
||||
|
||||
err = srv_read_init_val(initfile, "FLUSH_LOG_AT_TRX_COMMIT(1/0)", NULL,
|
||||
&srv_flush_log_at_trx_commit, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
err = srv_read_init_val(initfile, "BUFFER_POOL_SIZE_MB", NULL,
|
||||
&srv_pool_size, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
srv_pool_size = srv_pool_size * ((1024 * 1024) / UNIV_PAGE_SIZE);
|
||||
|
||||
err = srv_read_init_val(initfile, "ADDITIONAL_MEM_POOL_SIZE_MB", NULL,
|
||||
&srv_mem_pool_size, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
srv_mem_pool_size = srv_mem_pool_size * 1024 * 1024;
|
||||
|
||||
srv_lock_table_size = 20 * srv_pool_size;
|
||||
|
||||
err = srv_read_init_val(initfile, "NUMBER_OF_FILE_IO_THREADS", NULL,
|
||||
&srv_n_file_io_threads, FALSE);
|
||||
if (err != DB_SUCCESS) return(err);
|
||||
|
||||
err = srv_read_init_val(initfile, "SRV_RECOVER_FROM_BACKUP",
|
||||
NULL, NULL, TRUE);
|
||||
if (err == DB_SUCCESS) {
|
||||
srv_archive_recovery = TRUE;
|
||||
srv_archive_recovery_limit_lsn = ut_dulint_max;
|
||||
|
||||
err = srv_read_init_val(initfile, NULL, NULL, &val1, TRUE);
|
||||
err = srv_read_init_val(initfile, NULL, NULL, &val2, TRUE);
|
||||
|
||||
if (err == DB_SUCCESS) {
|
||||
srv_archive_recovery_limit_lsn =
|
||||
ut_dulint_create(val1, val2);
|
||||
}
|
||||
}
|
||||
|
||||
/* err = srv_read_init_val(initfile,
|
||||
"SYNC_NUMBER_OF_SPIN_WAIT_ROUNDS", NULL,
|
||||
&srv_n_spin_wait_rounds);
|
||||
|
||||
err = srv_read_init_val(initfile, "SYNC_SPIN_WAIT_DELAY", NULL,
|
||||
&srv_spin_wait_delay); */
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Reads keywords and a values from an initfile. In case of an error, exits
|
||||
from the process. */
|
||||
|
||||
void
|
||||
srv_read_initfile(
|
||||
/*==============*/
|
||||
FILE* initfile) /* in: file pointer */
|
||||
{
|
||||
char str_buf[10000];
|
||||
ulint ulint_val;
|
||||
|
||||
srv_read_init_val(initfile, FALSE, "SRV_ENDPOINT_NAME", str_buf,
|
||||
&ulint_val);
|
||||
ut_a(ut_strlen(str_buf) < COM_MAX_ADDR_LEN);
|
||||
|
||||
ut_memcpy(srv_endpoint_name, str_buf, COM_MAX_ADDR_LEN);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "SRV_N_COM_THREADS", str_buf,
|
||||
&srv_n_com_threads);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "SRV_N_WORKER_THREADS", str_buf,
|
||||
&srv_n_worker_threads);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "SYNC_N_SPIN_WAIT_ROUNDS", str_buf,
|
||||
&srv_n_spin_wait_rounds);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "SYNC_SPIN_WAIT_DELAY", str_buf,
|
||||
&srv_spin_wait_delay);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "THREAD_PRIORITY_BOOST", str_buf,
|
||||
&srv_priority_boost);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "N_SPACES", str_buf, &srv_n_spaces);
|
||||
srv_read_init_val(initfile, TRUE, "N_FILES", str_buf, &srv_n_files);
|
||||
srv_read_init_val(initfile, TRUE, "FILE_SIZE", str_buf,
|
||||
&srv_file_size);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "N_LOG_GROUPS", str_buf,
|
||||
&srv_n_log_groups);
|
||||
srv_read_init_val(initfile, TRUE, "N_LOG_FILES", str_buf,
|
||||
&srv_n_log_files);
|
||||
srv_read_init_val(initfile, TRUE, "LOG_FILE_SIZE", str_buf,
|
||||
&srv_log_file_size);
|
||||
srv_read_init_val(initfile, TRUE, "LOG_ARCHIVE_ON", str_buf,
|
||||
&srv_log_archive_on);
|
||||
srv_read_init_val(initfile, TRUE, "LOG_BUFFER_SIZE", str_buf,
|
||||
&srv_log_buffer_size);
|
||||
srv_read_init_val(initfile, TRUE, "FLUSH_LOG_AT_TRX_COMMIT", str_buf,
|
||||
&srv_flush_log_at_trx_commit);
|
||||
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "POOL_SIZE", str_buf,
|
||||
&srv_pool_size);
|
||||
srv_read_init_val(initfile, TRUE, "MEM_POOL_SIZE", str_buf,
|
||||
&srv_mem_pool_size);
|
||||
srv_read_init_val(initfile, TRUE, "LOCK_TABLE_SIZE", str_buf,
|
||||
&srv_lock_table_size);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "SIM_DISK_WAIT_PCT", str_buf,
|
||||
&srv_sim_disk_wait_pct);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "SIM_DISK_WAIT_LEN", str_buf,
|
||||
&srv_sim_disk_wait_len);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "SIM_DISK_WAIT_BY_YIELD", str_buf,
|
||||
&srv_sim_disk_wait_by_yield);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "SIM_DISK_WAIT_BY_WAIT", str_buf,
|
||||
&srv_sim_disk_wait_by_wait);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "MEASURE_CONTENTION", str_buf,
|
||||
&srv_measure_contention);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "MEASURE_BY_SPIN", str_buf,
|
||||
&srv_measure_by_spin);
|
||||
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "PRINT_THREAD_RELEASES", str_buf,
|
||||
&srv_print_thread_releases);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "PRINT_LOCK_WAITS", str_buf,
|
||||
&srv_print_lock_waits);
|
||||
if (srv_print_lock_waits) {
|
||||
lock_print_waits = TRUE;
|
||||
}
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "PRINT_BUF_IO", str_buf,
|
||||
&srv_print_buf_io);
|
||||
if (srv_print_buf_io) {
|
||||
buf_debug_prints = TRUE;
|
||||
}
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "PRINT_LOG_IO", str_buf,
|
||||
&srv_print_log_io);
|
||||
if (srv_print_log_io) {
|
||||
log_debug_writes = TRUE;
|
||||
}
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "PRINT_PARSED_SQL", str_buf,
|
||||
&srv_print_parsed_sql);
|
||||
if (srv_print_parsed_sql) {
|
||||
pars_print_lexed = TRUE;
|
||||
}
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "PRINT_LATCH_WAITS", str_buf,
|
||||
&srv_print_latch_waits);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "TEST_EXTRA_MUTEXES", str_buf,
|
||||
&srv_test_extra_mutexes);
|
||||
srv_read_init_val(initfile, TRUE, "TEST_NOCACHE", str_buf,
|
||||
&srv_test_nocache);
|
||||
srv_read_init_val(initfile, TRUE, "TEST_CACHE_EVICT", str_buf,
|
||||
&srv_test_cache_evict);
|
||||
|
||||
srv_read_init_val(initfile, TRUE, "TEST_SYNC", str_buf,
|
||||
&srv_test_sync);
|
||||
srv_read_init_val(initfile, TRUE, "TEST_N_THREADS", str_buf,
|
||||
&srv_test_n_threads);
|
||||
srv_read_init_val(initfile, TRUE, "TEST_N_LOOPS", str_buf,
|
||||
&srv_test_n_loops);
|
||||
srv_read_init_val(initfile, TRUE, "TEST_N_FREE_RNDS", str_buf,
|
||||
&srv_test_n_free_rnds);
|
||||
srv_read_init_val(initfile, TRUE, "TEST_N_RESERVED_RNDS", str_buf,
|
||||
&srv_test_n_reserved_rnds);
|
||||
srv_read_init_val(initfile, TRUE, "TEST_N_MUTEXES", str_buf,
|
||||
&srv_test_n_mutexes);
|
||||
srv_read_init_val(initfile, TRUE, "TEST_ARRAY_SIZE", str_buf,
|
||||
&srv_test_array_size);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
Initializes the server. */
|
||||
|
|
|
|||
|
|
@ -447,9 +447,9 @@ io_handler_thread(
|
|||
}
|
||||
|
||||
#ifdef __WIN__
|
||||
#define SRV_PATH_SEPARATOR "\\"
|
||||
#define SRV_PATH_SEPARATOR '\\'
|
||||
#else
|
||||
#define SRV_PATH_SEPARATOR "/"
|
||||
#define SRV_PATH_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
|
|
@ -477,31 +477,26 @@ srv_normalize_path_for_win(
|
|||
Adds a slash or a backslash to the end of a string if it is missing
|
||||
and the string is not empty. */
|
||||
|
||||
static
|
||||
char*
|
||||
srv_add_path_separator_if_needed(
|
||||
/*=============================*/
|
||||
/* out, own: string which has the separator if the
|
||||
/* out: string which has the separator if the
|
||||
string is not empty */
|
||||
char* str) /* in: null-terminated character string */
|
||||
{
|
||||
char* out_str;
|
||||
ulint len = ut_strlen(str);
|
||||
|
||||
if (ut_strlen(str) == 0) {
|
||||
if (len == 0 || str[len - 1] == SRV_PATH_SEPARATOR) {
|
||||
|
||||
return(str);
|
||||
}
|
||||
|
||||
if (str[ut_strlen(str) - 1] == SRV_PATH_SEPARATOR[0]) {
|
||||
out_str = ut_malloc(ut_strlen(str) + 1);
|
||||
|
||||
sprintf(out_str, "%s", str);
|
||||
|
||||
return(out_str);
|
||||
}
|
||||
|
||||
out_str = ut_malloc(ut_strlen(str) + 2);
|
||||
|
||||
sprintf(out_str, "%s%s", str, SRV_PATH_SEPARATOR);
|
||||
out_str = ut_malloc(len + 2);
|
||||
memcpy(out_str, str, len);
|
||||
out_str[len] = SRV_PATH_SEPARATOR;
|
||||
out_str[len + 1] = 0;
|
||||
|
||||
return(out_str);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
|
||||
|
||||
include ..\..\makefile.i
|
||||
|
||||
tssrv: ..\srv.lib tssrv.c makefile
|
||||
$(CCOM) $(CFL) -I.. -I..\.. ..\srv.lib ..\..\trx.lib ..\..\pars.lib ..\..\que.lib ..\..\lock.lib ..\..\row.lib ..\..\read.lib ..\..\com.lib ..\..\usr.lib ..\..\thr.lib ..\..\btr.lib ..\..\fut.lib ..\..\fsp.lib ..\..\page.lib ..\..\dyn.lib ..\..\mtr.lib ..\..\log.lib ..\..\rem.lib ..\..\fil.lib ..\..\buf.lib ..\..\dict.lib ..\..\data.lib ..\..\mach.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tssrv.c $(LFL)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
/************************************************************************
|
||||
Database client test program
|
||||
|
||||
(c) 1995 Innobase Oy
|
||||
|
||||
Created 10/10/1995 Heikki Tuuri
|
||||
*************************************************************************/
|
||||
|
||||
#include "com0com.h"
|
||||
#include "com0shm.h"
|
||||
#include "ut0ut.h"
|
||||
#include "mem0mem.h"
|
||||
#include "os0thread.h"
|
||||
#include "sync0ipm.h"
|
||||
#include "sync0sync.h"
|
||||
|
||||
byte buf[10000];
|
||||
char addr[150];
|
||||
|
||||
void
|
||||
test1(void)
|
||||
/*=======*/
|
||||
{
|
||||
com_endpoint_t* ep;
|
||||
ulint ret;
|
||||
ulint size;
|
||||
ulint len;
|
||||
ulint addr_len;
|
||||
ulint i, j;
|
||||
ulint tm, oldtm;
|
||||
|
||||
|
||||
oldtm = ut_clock();
|
||||
|
||||
for (i = 0; i < 10000; i++) {
|
||||
|
||||
ut_delay(100);
|
||||
}
|
||||
|
||||
for (j = 0; j < i / 10; j++) {
|
||||
|
||||
ut_delay(200);
|
||||
}
|
||||
|
||||
tm = ut_clock();
|
||||
printf("Wall clock time for test without server %ld milliseconds\n",
|
||||
tm - oldtm);
|
||||
printf("%lu rounds\n", i);
|
||||
|
||||
ep = com_endpoint_create(COM_SHM);
|
||||
|
||||
ut_a(ep);
|
||||
|
||||
size = 8192;
|
||||
|
||||
ret = com_endpoint_set_option(ep, COM_OPT_MAX_DGRAM_SIZE,
|
||||
(byte*)&size, 0);
|
||||
|
||||
ut_a(ret == 0);
|
||||
|
||||
ret = com_bind(ep, "CLI", 3);
|
||||
|
||||
ut_a(ret == 0);
|
||||
|
||||
printf("Client endpoint created!\n");
|
||||
|
||||
oldtm = ut_clock();
|
||||
|
||||
for (i = 0; i < 50000; i++) {
|
||||
|
||||
ret = com_sendto(ep, (byte*)"Hello from client!\n", 18, "ibsrv", 5);
|
||||
|
||||
ut_a(ret == 0);
|
||||
|
||||
ret = com_recvfrom(ep, buf, 10000, &len, addr, 150, &addr_len);
|
||||
|
||||
ut_a(ret == 0);
|
||||
|
||||
buf[len] = '\0';
|
||||
addr[addr_len] = '\0';
|
||||
/*
|
||||
printf(
|
||||
"Message of len %lu\n%s \nreceived from address %s of len %lu\n",
|
||||
len, buf, addr, addr_len);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
tm = ut_clock();
|
||||
printf("Wall clock time for test %ld milliseconds\n", tm - oldtm);
|
||||
printf("%lu message pairs\n", i);
|
||||
|
||||
|
||||
printf("System calls in com_shm %lu ip_mutex %lu mutex %lu\n",
|
||||
com_shm_system_call_count,
|
||||
ip_mutex_system_call_count,
|
||||
mutex_system_call_count);
|
||||
|
||||
|
||||
ret = com_endpoint_free(ep);
|
||||
|
||||
ut_ad(ret == 0);
|
||||
}
|
||||
|
||||
void
|
||||
main(void)
|
||||
/*======*/
|
||||
{
|
||||
|
||||
|
||||
|
||||
sync_init();
|
||||
mem_init();
|
||||
|
||||
test1();
|
||||
|
||||
printf("TESTS COMPLETED SUCCESSFULLY!\n");
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/******************************************************
|
||||
Test for the database server
|
||||
|
||||
(c) 1995 Innobase Oy
|
||||
|
||||
Created 10/10/1995 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "srv0srv.h"
|
||||
#include "os0proc.h"
|
||||
#include "ut0mem.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
The main function of the server. */
|
||||
|
||||
void
|
||||
main(
|
||||
/*=*/
|
||||
#ifdef notdefined
|
||||
|
||||
ulint argc, /* in: number of string arguments given on
|
||||
the command line */
|
||||
char* argv[]
|
||||
#endif
|
||||
) /* in: array of character pointers giving
|
||||
the arguments */
|
||||
{
|
||||
/*
|
||||
if (argc != 2) {
|
||||
printf("Error! Wrong number of command line arguments!\n");
|
||||
printf("Usage: ib <init-file-name>\n");
|
||||
os_process_exit(1);
|
||||
}
|
||||
*/
|
||||
srv_boot("init.ib"/*argv[1]*/);
|
||||
|
||||
os_process_exit(0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue