Merge with 4.0.13

BitKeeper/etc/ignore:
  auto-union
BitKeeper/etc/logging_ok:
  auto-union
BUILD/SETUP.sh:
  Auto merged
BitKeeper/deleted/.del-libmysql.def~29fc6d70335f1c4c:
  Auto merged
Makefile.am:
  Auto merged
acinclude.m4:
  Auto merged
BitKeeper/triggers/post-commit:
  Auto merged
Build-tools/Do-compile:
  Auto merged
VC++Files/libmysql/libmysql.dsp:
  Auto merged
VC++Files/mysql.dsw:
  Auto merged
client/mysql.cc:
  Auto merged
client/mysqlbinlog.cc:
  Auto merged
client/mysqldump.c:
  Auto merged
include/config-win.h:
  Auto merged
include/my_base.h:
  Auto merged
include/my_global.h:
  Auto merged
include/my_pthread.h:
  Auto merged
include/my_sys.h:
  Auto merged
include/violite.h:
  Auto merged
innobase/buf/buf0flu.c:
  Auto merged
innobase/buf/buf0lru.c:
  Auto merged
innobase/include/buf0buf.h:
  Auto merged
innobase/include/buf0lru.h:
  Auto merged
innobase/include/row0mysql.h:
  Auto merged
innobase/include/srv0srv.h:
  Auto merged
innobase/lock/lock0lock.c:
  Auto merged
innobase/log/log0log.c:
  Auto merged
innobase/log/log0recv.c:
  Auto merged
innobase/os/os0file.c:
  Auto merged
innobase/row/row0mysql.c:
  Auto merged
innobase/row/row0sel.c:
  Auto merged
innobase/srv/srv0srv.c:
  Auto merged
innobase/srv/srv0start.c:
  Auto merged
innobase/trx/trx0sys.c:
  Auto merged
innobase/trx/trx0trx.c:
  Auto merged
innobase/ut/ut0ut.c:
  Auto merged
myisam/ft_boolean_search.c:
  Auto merged
myisam/mi_check.c:
  Auto merged
myisam/mi_key.c:
  Auto merged
myisam/mi_open.c:
  Auto merged
myisam/mi_range.c:
  Auto merged
myisam/mi_search.c:
  Auto merged
myisam/sort.c:
  Auto merged
mysql-test/r/delete.result:
  Auto merged
mysql-test/r/fulltext.result:
  Auto merged
mysql-test/r/innodb_handler.result:
  Auto merged
mysql-test/r/join.result:
  Auto merged
mysql-test/r/join_outer.result:
  Auto merged
mysql-test/r/key.result:
  Auto merged
mysql-test/r/multi_update.result:
  Auto merged
mysql-test/r/myisam.result:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/r/variables.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
mysql-test/t/ctype_latin1_de.test:
  Auto merged
mysql-test/t/delete.test:
  Auto merged
mysql-test/t/fulltext.test:
  Auto merged
mysql-test/t/innodb_handler.test:
  Auto merged
mysql-test/t/join.test:
  Auto merged
mysql-test/t/join_outer.test:
  Auto merged
mysql-test/t/key.test:
  Auto merged
mysql-test/t/multi_update.test:
  Auto merged
mysql-test/t/myisam.test:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
mysql-test/t/repair.test:
  Auto merged
mysql-test/t/select_safe.test:
  Auto merged
mysql-test/t/type_decimal.test:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
mysys/default.c:
  Auto merged
mysys/my_pthread.c:
  Auto merged
scripts/mysql_fix_privilege_tables.sh:
  Auto merged
scripts/mysqld_safe.sh:
  Auto merged
sql/ha_heap.h:
  Auto merged
sql/ha_innodb.h:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/init.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_create.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/mini_client.cc:
  Auto merged
sql/net_serv.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/records.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_acl.h:
  Auto merged
sql/sql_analyse.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_list.h:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/share/czech/errmsg.txt:
  Auto merged
sql/share/danish/errmsg.txt:
  Auto merged
sql/share/dutch/errmsg.txt:
  Auto merged
sql/share/english/errmsg.txt:
  Auto merged
sql/share/estonian/errmsg.txt:
  Auto merged
sql/share/french/errmsg.txt:
  Auto merged
sql/share/greek/errmsg.txt:
  Auto merged
sql/share/hungarian/errmsg.txt:
  Auto merged
sql/share/italian/errmsg.txt:
  Auto merged
sql/share/japanese/errmsg.txt:
  Auto merged
sql/share/korean/errmsg.txt:
  Auto merged
sql/share/norwegian-ny/errmsg.txt:
  Auto merged
sql/share/norwegian/errmsg.txt:
  Auto merged
sql/share/portuguese/errmsg.txt:
  Auto merged
sql/share/romanian/errmsg.txt:
  Auto merged
sql/share/russian/errmsg.txt:
  Auto merged
sql/share/slovak/errmsg.txt:
  Auto merged
sql/share/spanish/errmsg.txt:
  Auto merged
sql/share/swedish/errmsg.txt:
  Auto merged
sql/share/ukrainian/errmsg.txt:
  Auto merged
sql/unireg.h:
  Auto merged
sql-bench/crash-me.sh:
  Auto merged
sql-bench/test-transactions.sh:
  Auto merged
strings/ctype-tis620.c:
  Auto merged
tests/grant.res:
  Auto merged
sql/log_event.cc:
  Merge with 4.0.13
  Cleaned up comment syntax
This commit is contained in:
unknown 2003-05-19 16:35:49 +03:00
commit daac922bc3
317 changed files with 6691 additions and 3495 deletions

View file

@ -17,7 +17,7 @@
include ../include/Makefile.i
libs_LIBRARIES = libsrv.a
noinst_LIBRARIES = libsrv.a
libsrv_a_SOURCES = srv0srv.c srv0que.c srv0start.c

View file

@ -162,6 +162,13 @@ char* srv_file_flush_method_str = NULL;
ulint srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
ulint srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
/* The InnoDB main thread tries to keep the ratio of modified pages
in the buffer pool to all database pages in the buffer pool smaller than
the following number. But it is not guaranteed that the value stays below
that during a time of heavy update/insert activity. */
ulint srv_max_buf_pool_modified_pct = 90;
/* If the following is != 0 we do not allow inserts etc. This protects
the user from forgetting the innodb_force_recovery keyword to my.cnf */
@ -1881,11 +1888,11 @@ retry:
/* Go to wait for the event; when a thread leaves InnoDB it will
release this thread */
trx->op_info = "waiting in InnoDB queue";
trx->op_info = (char*)"waiting in InnoDB queue";
os_event_wait(slot->event);
trx->op_info = "";
trx->op_info = (char*)"";
os_fast_mutex_lock(&srv_conc_mutex);
@ -2368,12 +2375,35 @@ srv_sprintf_innodb_monitor(
buf = buf + strlen(buf);
ut_a(buf < buf_end + 1500);
buf += sprintf(buf, "------------\n"
"TRANSACTIONS\n"
"------------\n");
if (*dict_foreign_err_buf != '\0') {
buf += sprintf(buf,
"------------------------\n"
"LATEST FOREIGN KEY ERROR\n"
"------------------------\n");
if (buf_end - buf > 6000) {
buf+= sprintf(buf, "%.4000s", dict_foreign_err_buf);
}
}
ut_a(buf < buf_end + 1500);
if (*dict_unique_err_buf != '\0') {
buf += sprintf(buf,
"---------------------------------------------------------------\n"
"LATEST UNIQUE KEY ERROR (is masked in REPLACE or INSERT IGNORE)\n"
"---------------------------------------------------------------\n");
if (buf_end - buf > 6000) {
buf+= sprintf(buf, "%.4000s", dict_unique_err_buf);
}
}
ut_a(buf < buf_end + 1500);
lock_print_info(buf, buf_end);
buf = buf + strlen(buf);
buf += sprintf(buf, "--------\n"
"FILE I/O\n"
"--------\n");
@ -2777,6 +2807,7 @@ srv_master_thread(
ulint n_ios_old;
ulint n_ios_very_old;
ulint n_pend_ios;
ibool skip_sleep = FALSE;
ulint i;
UT_NOT_USED(arg);
@ -2794,24 +2825,42 @@ srv_master_thread(
os_event_set(srv_sys->operational);
loop:
/*****************************************************************/
/* ---- When there is database activity by users, we cycle in this
loop */
srv_main_thread_op_info = (char*) "reserving kernel mutex";
n_ios_very_old = log_sys->n_log_ios + buf_pool->n_pages_read
+ buf_pool->n_pages_written;
mutex_enter(&kernel_mutex);
/* Store the user activity counter at the start of this loop */
old_activity_count = srv_activity_count;
mutex_exit(&kernel_mutex);
/* We run purge and a batch of ibuf_contract every 10 seconds, even
if the server were active: */
if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) {
goto suspend_thread;
}
/* ---- We run the following loop approximately once per second
when there is database activity */
skip_sleep = FALSE;
for (i = 0; i < 10; i++) {
n_ios_old = log_sys->n_log_ios + buf_pool->n_pages_read
+ buf_pool->n_pages_written;
srv_main_thread_op_info = (char*)"sleeping";
os_thread_sleep(1000000);
if (!skip_sleep) {
os_thread_sleep(1000000);
}
skip_sleep = FALSE;
/* ALTER TABLE in MySQL requires on Unix that the table handler
can drop tables lazily after there no longer are SELECT
@ -2824,9 +2873,9 @@ loop:
srv_main_thread_op_info = (char*)"";
if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) {
if (srv_fast_shutdown && srv_shutdown_state > 0) {
goto suspend_thread;
goto background_loop;
}
/* We flush the log once in a second even if no commit
@ -2834,10 +2883,9 @@ loop:
at transaction commit */
srv_main_thread_op_info = (char*)"flushing log";
log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP);
log_flush_to_disk();
log_write_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP, TRUE);
/* If there were less than 10 i/os during the
/* If there were less than 5 i/os during the
one second sleep, we assume that there is free
disk i/o capacity available, and it makes sense to
do an insert buffer merge. */
@ -2846,35 +2894,45 @@ loop:
+ log_sys->n_pending_writes;
n_ios = log_sys->n_log_ios + buf_pool->n_pages_read
+ buf_pool->n_pages_written;
if (n_pend_ios < 3 && (n_ios - n_ios_old < 10)) {
if (n_pend_ios < 3 && (n_ios - n_ios_old < 5)) {
srv_main_thread_op_info =
(char*)"doing insert buffer merge";
ibuf_contract_for_n_pages(TRUE, 5);
srv_main_thread_op_info =
(char*)"flushing log";
log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP);
log_flush_to_disk();
log_write_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP,
TRUE);
}
if (srv_fast_shutdown && srv_shutdown_state > 0) {
goto background_loop;
if (buf_get_modified_ratio_pct() >
srv_max_buf_pool_modified_pct) {
/* Try to keep the number of modified pages in the
buffer pool under the limit wished by the user */
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100,
ut_dulint_max);
/* If we had to do the flush, it may have taken
even more than 1 second, and also, there may be more
to flush. Do not sleep 1 second during the next
iteration of this loop. */
skip_sleep = TRUE;
}
if (srv_activity_count == old_activity_count) {
if (srv_print_thread_releases) {
printf("Master thread wakes up!\n");
}
/* There is no user activity at the moment, go to
the background loop */
goto background_loop;
}
}
if (srv_print_thread_releases) {
printf("Master thread wakes up!\n");
}
/* ---- We perform the following code approximately once per
10 seconds when there is database activity */
#ifdef MEM_PERIODIC_CHECK
/* Check magic numbers of every allocated mem block once in 10
@ -2883,7 +2941,7 @@ loop:
#endif
/* If there were less than 200 i/os during the 10 second period,
we assume that there is free disk i/o capacity available, and it
makes sense to do a buffer pool flush. */
makes sense to flush 100 pages. */
n_pend_ios = buf_get_n_pending_ios() + log_sys->n_pending_writes;
n_ios = log_sys->n_log_ios + buf_pool->n_pages_read
@ -2891,11 +2949,10 @@ loop:
if (n_pend_ios < 3 && (n_ios - n_ios_very_old < 200)) {
srv_main_thread_op_info = (char*) "flushing buffer pool pages";
buf_flush_batch(BUF_FLUSH_LIST, 50, ut_dulint_max);
buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
srv_main_thread_op_info = (char*) "flushing log";
log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP);
log_flush_to_disk();
log_write_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP, TRUE);
}
/* We run a batch of insert buffer merge every 10 seconds,
@ -2905,8 +2962,7 @@ loop:
ibuf_contract_for_n_pages(TRUE, 5);
srv_main_thread_op_info = (char*)"flushing log";
log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP);
log_flush_to_disk();
log_write_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP, TRUE);
/* We run a full purge every 10 seconds, even if the server
were active */
@ -2930,27 +2986,32 @@ loop:
if (difftime(current_time, last_flush_time) > 1) {
srv_main_thread_op_info = (char*) "flushing log";
log_flush_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP);
log_flush_to_disk();
log_write_up_to(ut_dulint_max, LOG_WAIT_ONE_GROUP,
TRUE);
last_flush_time = current_time;
}
}
background_loop:
/* In this loop we run background operations when the server
is quiet and we also come here about once in 10 seconds */
srv_main_thread_op_info = (char*)"doing background drop tables";
n_tables_to_drop = row_drop_tables_for_mysql_in_background();
srv_main_thread_op_info = (char*)"";
srv_main_thread_op_info = (char*)"flushing buffer pool pages";
/* Flush a few oldest pages to make the checkpoint younger */
/* Flush a few oldest pages to make a new checkpoint younger */
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10, ut_dulint_max);
if (buf_get_modified_ratio_pct() > 70) {
/* If there are lots of modified pages in the buffer pool
(> 70 %), we assume we can afford reserving the disk(s) for
the time it requires to flush 100 pages */
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100,
ut_dulint_max);
} else {
/* Otherwise, we only flush a small number of pages so that
we do not unnecessarily use much disk i/o capacity from
other work */
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10,
ut_dulint_max);
}
srv_main_thread_op_info = (char*)"making checkpoint";
@ -2961,16 +3022,31 @@ background_loop:
srv_main_thread_op_info = (char*)"reserving kernel mutex";
mutex_enter(&kernel_mutex);
/* ---- When there is database activity, we jump from here back to
the start of loop */
if (srv_activity_count != old_activity_count) {
mutex_exit(&kernel_mutex);
goto loop;
}
old_activity_count = srv_activity_count;
mutex_exit(&kernel_mutex);
/* If the database is quiet, we enter the background loop */
/*****************************************************************/
background_loop:
/* ---- In this loop we run background operations when the server
is quiet from user activity */
/* The server has been quiet for a while: start running background
operations */
srv_main_thread_op_info = (char*)"doing background drop tables";
n_tables_to_drop = row_drop_tables_for_mysql_in_background();
srv_main_thread_op_info = (char*)"purging";
if (srv_fast_shutdown && srv_shutdown_state > 0) {
@ -3005,6 +3081,7 @@ background_loop:
}
mutex_exit(&kernel_mutex);
flush_loop:
srv_main_thread_op_info = (char*)"flushing buffer pool pages";
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
@ -3017,13 +3094,22 @@ background_loop:
}
mutex_exit(&kernel_mutex);
srv_main_thread_op_info = (char*) "waiting for buffer pool flush to end";
srv_main_thread_op_info =
(char*) "waiting for buffer pool flush to end";
buf_flush_wait_batch_end(BUF_FLUSH_LIST);
srv_main_thread_op_info = (char*)"making checkpoint";
log_checkpoint(TRUE, FALSE);
if (buf_get_modified_ratio_pct() > srv_max_buf_pool_modified_pct) {
/* Try to keep the number of modified pages in the
buffer pool under the limit wished by the user */
goto flush_loop;
}
srv_main_thread_op_info = (char*)"reserving kernel mutex";
mutex_enter(&kernel_mutex);
@ -3038,15 +3124,24 @@ background_loop:
log_archive_do(FALSE, &n_bytes_archived);
/* Keep looping in the background loop if still work to do */
if (srv_fast_shutdown && srv_shutdown_state > 0) {
if (n_tables_to_drop + n_pages_flushed
+ n_bytes_archived != 0) {
/* If we are doing a fast shutdown (= the default)
we do not do purge or insert buffer merge. But we
flush the buffer pool completely to disk. */
goto background_loop;
}
} else if (n_tables_to_drop +
n_pages_purged + n_bytes_merged + n_pages_flushed
n_pages_purged + n_bytes_merged + n_pages_flushed
+ n_bytes_archived != 0) {
/* In a 'slow' shutdown we run purge and the insert buffer
merge to completion */
goto background_loop;
}
@ -3078,6 +3173,9 @@ suspend_thread:
os_event_wait(event);
/* When there is user activity, InnoDB will set the event and the main
thread goes back to loop: */
goto loop;
#ifndef __WIN__

View file

@ -161,13 +161,13 @@ srv_parse_data_file_paths_and_sizes(
}
if (strlen(str) >= ut_strlen(":autoextend")
&& 0 == ut_memcmp(str, ":autoextend",
&& 0 == ut_memcmp(str, (char*)":autoextend",
ut_strlen(":autoextend"))) {
str += ut_strlen(":autoextend");
if (strlen(str) >= ut_strlen(":max:")
&& 0 == ut_memcmp(str, ":max:",
&& 0 == ut_memcmp(str, (char*)":max:",
ut_strlen(":max:"))) {
str += ut_strlen(":max:");
@ -265,7 +265,7 @@ srv_parse_data_file_paths_and_sizes(
(*data_file_sizes)[i] = size;
if (strlen(str) >= ut_strlen(":autoextend")
&& 0 == ut_memcmp(str, ":autoextend",
&& 0 == ut_memcmp(str, (char*)":autoextend",
ut_strlen(":autoextend"))) {
*is_auto_extending = TRUE;
@ -273,7 +273,7 @@ srv_parse_data_file_paths_and_sizes(
str += ut_strlen(":autoextend");
if (strlen(str) >= ut_strlen(":max:")
&& 0 == ut_memcmp(str, ":max:",
&& 0 == ut_memcmp(str, (char*)":max:",
ut_strlen(":max:"))) {
str += ut_strlen(":max:");
@ -864,6 +864,7 @@ open_or_create_data_files(
return(DB_SUCCESS);
}
#ifdef notdefined
/*********************************************************************
This thread is used to measure contention of latches. */
static
@ -935,6 +936,7 @@ test_measure_cont(
return(0);
}
#endif
/********************************************************************
Starts InnoDB and creates a new database if database files
@ -1053,20 +1055,24 @@ innobase_start_or_create_for_mysql(void)
srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
#ifndef __WIN__
} else if (0 == ut_strcmp(srv_file_flush_method_str, "fdatasync")) {
} else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"fdatasync")) {
srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DSYNC")) {
} else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"O_DSYNC")) {
srv_unix_file_flush_method = SRV_UNIX_O_DSYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str,
"littlesync")) {
(char*)"littlesync")) {
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "nosync")) {
} else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"nosync")) {
srv_unix_file_flush_method = SRV_UNIX_NOSYNC;
#else
} else if (0 == ut_strcmp(srv_file_flush_method_str, "normal")) {
} else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"normal")) {
srv_win_file_flush_method = SRV_WIN_IO_NORMAL;
os_aio_use_native_aio = FALSE;
@ -1196,7 +1202,14 @@ innobase_start_or_create_for_mysql(void)
&max_flushed_lsn, &max_arch_log_no,
&sum_of_new_sizes);
if (err != DB_SUCCESS) {
fprintf(stderr, "InnoDB: Could not open data files\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);
}
@ -1207,7 +1220,10 @@ innobase_start_or_create_for_mysql(void)
and restore them from the doublewrite buffer if
possible */
trx_sys_doublewrite_restore_corrupt_pages();
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
trx_sys_doublewrite_restore_corrupt_pages();
}
}
srv_normalize_path_for_win(srv_arch_dir);
@ -1478,7 +1494,9 @@ innobase_start_or_create_for_mysql(void)
fprintf(stderr,
"InnoDB: !!! innodb_force_recovery is set to %lu !!!\n",
srv_force_recovery);
}
}
fflush(stderr);
return((int) DB_SUCCESS);
}