From 9b848d9e7a8ea42694a2b1169902b5caaf0911e8 Mon Sep 17 00:00:00 2001 From: Mikael Ronstrom Date: Fri, 17 Oct 2008 12:01:14 +0200 Subject: [PATCH] Fixed a number of compiler issues and attempted a fix for Windows compilation error. --- storage/innobase/handler/ha_innodb.cc | 3 +-- storage/innobase/include/srv0srv.h | 6 +----- storage/innobase/include/sync0rw.h | 14 ++++++++++++++ storage/innobase/include/sync0rw.ic | 12 +++++++----- storage/innobase/os/os0file.c | 4 +--- storage/innobase/srv/srv0srv.c | 13 +++---------- storage/innobase/srv/srv0start.c | 4 ++-- storage/innobase/sync/sync0rw.c | 2 +- 8 files changed, 30 insertions(+), 28 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 2781ca2851a..6197b44795e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6833,8 +6833,7 @@ innodb_show_status( mutex_enter_noninline(&srv_monitor_file_mutex); rewind(srv_monitor_file); - srv_printf_innodb_monitor(srv_monitor_file, - &trx_list_start, &trx_list_end); + srv_printf_innodb_monitor(srv_monitor_file); flen = ftell(srv_monitor_file); os_file_set_eof(srv_monitor_file); diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 6654b0b672b..c8a84ca390a 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -463,11 +463,7 @@ Outputs to a file the output of the InnoDB Monitor. */ void srv_printf_innodb_monitor( /*======================*/ - FILE* file, /* in: output stream */ - ulint* trx_start, /* out: file position of the start of - the list of active transactions */ - ulint* trx_end); /* out: file position of the end of - the list of active transactions */ + FILE* file); /* in: output stream */ /********************************************************************** Function to pass InnoDB status variables to MySQL */ diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h index a4145cdd666..f329e7d161c 100644 --- a/storage/innobase/include/sync0rw.h +++ b/storage/innobase/include/sync0rw.h @@ -117,6 +117,20 @@ rw_lock_validate( /*=============*/ rw_lock_t* lock); #endif /* UNIV_DEBUG */ +/********************************************************************** +Low-level function which tries to lock an rw-lock in s-mode. Performs no +spinning. */ +UNIV_INLINE +ibool +rw_lock_s_lock_low( +/*===============*/ + /* out: TRUE if success */ + rw_lock_t* lock, /* in: pointer to rw-lock */ + ulint pass, + /* in: pass value; != 0, if the lock will be + passed to another thread to unlock */ + const char* file_name, /* in: file name where lock requested */ + ulint line); /* in: line where requested */ /****************************************************************** NOTE! The following macros should be used in rw s-locking, not the corresponding function. */ diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index 8cbde2ee758..bcadff0bd67 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -474,13 +474,15 @@ rw_lock_x_unlock_func( #endif ) { + os_thread_id_t local_writer_thread; ut_ad((lock->lock_word % X_LOCK_DECR) == 0); - /* Must reset writer_thread while we still have the lock. - If we are not the last unlocker, we correct it later in the function, - which is harmless since we still hold the lock. */ - /* TODO: are there any risks of a thread id == -1 on any platform? */ - os_thread_id_t local_writer_thread; + /* + Must reset writer_thread while we still have the lock. + If we are not the last unlocker, we correct it later in the function, + which is harmless since we still hold the lock. + TODO: are there any risks of a thread id == -1 on any platform? + */ local_writer_thread = lock->writer_thread; lock->writer_thread = -1; diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 44f6afee25e..88884dcb2fd 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -3432,8 +3432,6 @@ void os_aio_simulated_wake_handler_threads(void) /*=======================================*/ { - ulint i; - if (os_aio_use_native_aio) { /* We do not use simulated aio: do nothing */ @@ -4405,7 +4403,7 @@ loop: putc('\n', file); fprintf(file, "Summary of background IO slot status: %lu issued, " - "%lu done, %lu claimed, sleep set %d\n", + "%lu done, %lu claimed, sleep set %u\n", num_issued, num_done, num_claimed, os_aio_recommend_sleep_for_read_threads); diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index ef5044302e1..44d59d060d7 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -664,8 +664,6 @@ are indexed by the type of the thread. */ ulint srv_n_threads_active[SRV_MASTER + 1]; ulint srv_n_threads[SRV_MASTER + 1]; -static void srv_reset_free_tickets(trx_t* trx); - static void time_spin_delay() { ulint start_sec, end_sec; @@ -1697,11 +1695,7 @@ Outputs to a file the output of the InnoDB Monitor. */ void srv_printf_innodb_monitor( /*======================*/ - FILE* file, /* in: output stream */ - ulint* trx_start, /* out: file position of the start of - the list of active transactions */ - ulint* trx_end) /* out: file position of the end of - the list of active transactions */ + FILE* file) /* in: output stream */ { double time_elapsed; time_t current_time; @@ -1994,14 +1988,13 @@ loop: last_monitor_time = time(NULL); if (srv_print_innodb_monitor) { - srv_printf_innodb_monitor(stderr, NULL, NULL); + srv_printf_innodb_monitor(stderr); } if (srv_innodb_status) { mutex_enter(&srv_monitor_file_mutex); rewind(srv_monitor_file); - srv_printf_innodb_monitor(srv_monitor_file, NULL, - NULL); + srv_printf_innodb_monitor(srv_monitor_file); os_file_set_eof(srv_monitor_file); mutex_exit(&srv_monitor_file_mutex); } diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index aa6fd1b9e9a..86cbf15a5df 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -1251,7 +1251,7 @@ innobase_start_or_create_for_mysql(void) /* Restrict the maximum number of file i/o threads */ if ((srv_n_read_io_threads + srv_n_write_io_threads) > SRV_MAX_N_IO_THREADS) { fprintf(stderr, - "InnoDB: requested too many read(%d) or write(%d) IO threads, max is %d\n", + "InnoDB: requested too many read(%u) or write(%u) IO threads, max is %d\n", srv_n_read_io_threads, srv_n_write_io_threads, SRV_MAX_N_IO_THREADS); return(DB_ERROR); } @@ -1272,7 +1272,7 @@ innobase_start_or_create_for_mysql(void) if (n_threads > SRV_MAX_N_IO_THREADS) { fprintf(stderr, - "InnoDB: requested too many IO threads(%d), max is %d\n", + "InnoDB: requested too many IO threads(%u), max is %d\n", n_threads, SRV_MAX_N_IO_THREADS); return(DB_ERROR); } diff --git a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c index 6c9cb076cbe..0d6cb025260 100644 --- a/storage/innobase/sync/sync0rw.c +++ b/storage/innobase/sync/sync0rw.c @@ -417,7 +417,7 @@ rw_lock_x_lock_move_ownership( os_thread_id_t local_writer_thread = lock->writer_thread; os_thread_id_t new_writer_thread = os_thread_get_curr_id(); while (TRUE) { - if (local_writer_thread != -1) { + if ((int)local_writer_thread != -1) { if(os_compare_and_swap( &(lock->writer_thread), local_writer_thread,