summaryrefslogtreecommitdiff
path: root/innobase/srv
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/srv')
-rw-r--r--innobase/srv/srv0srv.c97
-rw-r--r--innobase/srv/srv0start.c22
2 files changed, 102 insertions, 17 deletions
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index cbc22b9b28a..c3d3ed53058 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -20,7 +20,7 @@ Windows 2000 will have something called thread pooling
Another possibility could be to use some very fast user space
thread library. This might confuse NT though.
-(c) 1995 InnoDB Oy
+(c) 1995 Innobase Oy
Created 10/8/1995 Heikki Tuuri
*******************************************************/
@@ -49,6 +49,7 @@ Created 10/8/1995 Heikki Tuuri
#include "btr0sea.h"
#include "dict0load.h"
#include "srv0start.h"
+#include "row0mysql.h"
/* Buffer which can be used in printing fatal error messages */
char srv_fatal_errbuf[5000];
@@ -91,8 +92,43 @@ ibool srv_log_archive_on = TRUE;
ulint srv_log_buffer_size = ULINT_MAX; /* size in database pages */
ibool srv_flush_log_at_trx_commit = TRUE;
-byte srv_latin1_ordering[256]; /* The sort order table of the latin1
- character set */
+byte srv_latin1_ordering[256] /* The sort order table of the latin1
+ character set. The following table is
+ the MySQL order as of Feb 10th, 2002 */
+= {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
+, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
+, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17
+, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
+, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27
+, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F
+, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37
+, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F
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4F, 0x4F, 0x4F, 0x4F, 0x5D, 0xF7
+, 0xD8, 0x55, 0x55, 0x55, 0x59, 0x59, 0xDE, 0xFF
+};
ibool srv_use_native_aio = FALSE;
@@ -1920,17 +1956,12 @@ srv_boot(void)
srv_init();
- /* Reserve the first slot for the current thread, i.e., the master
- thread */
-
- srv_table_reserve_slot(SRV_MASTER);
-
return(DB_SUCCESS);
}
/*************************************************************************
Reserves a slot in the thread table for the current MySQL OS thread.
-NOTE! The server mutex has to be reserved by the caller! */
+NOTE! The kernel mutex has to be reserved by the caller! */
static
srv_slot_t*
srv_table_reserve_slot_for_mysql(void)
@@ -1940,6 +1971,8 @@ srv_table_reserve_slot_for_mysql(void)
srv_slot_t* slot;
ulint i;
+ ut_ad(mutex_own(&kernel_mutex));
+
i = 0;
slot = srv_mysql_table + i;
@@ -2361,6 +2394,22 @@ srv_active_wake_master_thread(void)
}
}
+/***********************************************************************
+Wakes up the master thread if it is suspended or being suspended. */
+
+void
+srv_wake_master_thread(void)
+/*========================*/
+{
+ srv_activity_count++;
+
+ mutex_enter(&kernel_mutex);
+
+ srv_release_threads(SRV_MASTER, 1);
+
+ mutex_exit(&kernel_mutex);
+}
+
/*************************************************************************
The master thread controlling the server. */
@@ -2383,6 +2432,7 @@ srv_master_thread(
ulint n_bytes_merged;
ulint n_pages_flushed;
ulint n_bytes_archived;
+ ulint n_tables_to_drop;
ulint n_ios;
ulint n_ios_old;
ulint n_ios_very_old;
@@ -2424,7 +2474,11 @@ loop:
can drop tables lazily after there no longer are SELECT
queries to them. */
-/* row_drop_tables_for_mysql_in_background(); */
+ srv_main_thread_op_info = "doing background drop tables";
+
+ row_drop_tables_for_mysql_in_background();
+
+ srv_main_thread_op_info = "";
if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) {
@@ -2475,6 +2529,11 @@ loop:
printf("Master thread wakes up!\n");
}
+#ifdef MEM_PERIODIC_CHECK
+ /* Check magic numbers of every allocated mem block once in 10
+ seconds */
+ mem_validate_all_blocks();
+#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. */
@@ -2531,6 +2590,12 @@ 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 = "doing background drop tables";
+
+ n_tables_to_drop = row_drop_tables_for_mysql_in_background();
+
+ srv_main_thread_op_info = "";
+
srv_main_thread_op_info = "flushing buffer pool pages";
/* Flush a few oldest pages to make the checkpoint younger */
@@ -2616,11 +2681,13 @@ background_loop:
log_archive_do(FALSE, &n_bytes_archived);
if (srv_fast_shutdown && srv_shutdown_state > 0) {
- if (n_pages_flushed + n_bytes_archived != 0) {
+ if (n_tables_to_drop + n_pages_flushed
+ + n_bytes_archived != 0) {
goto background_loop;
}
- } else if (n_pages_purged + n_bytes_merged + n_pages_flushed
+ } else if (n_tables_to_drop +
+ n_pages_purged + n_bytes_merged + n_pages_flushed
+ n_bytes_archived != 0) {
goto background_loop;
}
@@ -2639,6 +2706,12 @@ suspend_thread:
mutex_enter(&kernel_mutex);
+ if (row_get_background_drop_list_len_low() > 0) {
+ mutex_exit(&kernel_mutex);
+
+ goto loop;
+ }
+
event = srv_suspend_thread();
mutex_exit(&kernel_mutex);
diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c
index 70c85d7fbeb..bbb48331811 100644
--- a/innobase/srv/srv0start.c
+++ b/innobase/srv/srv0start.c
@@ -271,13 +271,18 @@ open_or_create_log_file(
} else {
*log_file_created = TRUE;
+ ut_print_timestamp(stderr);
+
fprintf(stderr,
- "InnoDB: Log file %s did not exist: new to be created\n",
+ " InnoDB: Log file %s did not exist: new to be created\n",
name);
fprintf(stderr, "InnoDB: Setting log file %s size to %lu MB\n",
name, srv_log_file_size
>> (20 - UNIV_PAGE_SIZE_SHIFT));
+ fprintf(stderr,
+ "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));
@@ -456,8 +461,9 @@ open_or_create_data_files(
one_created = TRUE;
if (i > 0) {
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Data file %s did not exist: new to be created\n",
+ " InnoDB: Data file %s did not exist: new to be created\n",
name);
} else {
fprintf(stderr,
@@ -466,8 +472,9 @@ open_or_create_data_files(
*create_new_db = TRUE;
}
+ ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Setting file %s size to %lu MB\n",
+ " InnoDB: Setting file %s size to %lu MB\n",
name, (srv_data_file_sizes[i]
>> (20 - UNIV_PAGE_SIZE_SHIFT)));
@@ -911,6 +918,12 @@ innobase_start_or_create_for_mysql(void)
mtr_commit(&mtr);
}
+ if (recv_needed_recovery) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Flushing modified pages from the buffer pool...\n");
+ }
+
log_make_checkpoint_at(ut_dulint_max, TRUE);
if (!srv_log_archive_on) {
@@ -991,9 +1004,8 @@ innobase_shutdown_for_mysql(void)
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: shutting down a not properly started\n");
- ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: or created database!\n");
+ " InnoDB: or created database!\n");
}
return(DB_SUCCESS);