diff options
author | unknown <monty@mishka.local> | 2004-04-26 15:53:31 +0300 |
---|---|---|
committer | unknown <monty@mishka.local> | 2004-04-26 15:53:31 +0300 |
commit | 1065f2bbd66ac4b1161f5c188171a54cbad5b422 (patch) | |
tree | 25e3315af05fa92d20d2ad1d812882957c400337 /innobase/sync/sync0sync.c | |
parent | 0ba6cb48d84f1ff951d09871a96be6cdef3f2c3c (diff) | |
parent | 6366a9090c7fc24f0e13b5b9d73d6777dcda9d9e (diff) | |
download | mariadb-git-1065f2bbd66ac4b1161f5c188171a54cbad5b422.tar.gz |
Merge with 4.0
innobase/dict/dict0boot.c:
Auto merged
innobase/dict/dict0load.c:
Auto merged
innobase/dict/dict0mem.c:
Auto merged
innobase/fut/fut0lst.c:
Auto merged
innobase/include/buf0lru.h:
Auto merged
innobase/include/dict0mem.h:
Auto merged
innobase/include/fsp0fsp.h:
Auto merged
innobase/include/ha0ha.h:
Auto merged
innobase/include/ibuf0ibuf.h:
Auto merged
innobase/include/lock0lock.h:
Auto merged
innobase/include/log0log.h:
Auto merged
innobase/include/mem0pool.h:
Auto merged
innobase/include/mtr0mtr.h:
Auto merged
innobase/include/os0file.h:
Auto merged
innobase/include/rem0rec.h:
Auto merged
innobase/include/rem0rec.ic:
Auto merged
innobase/include/srv0srv.h:
Auto merged
innobase/include/sync0sync.h:
Auto merged
innobase/include/trx0sys.h:
Auto merged
innobase/include/ut0byte.h:
Auto merged
innobase/include/ut0ut.h:
Auto merged
innobase/mem/mem0pool.c:
Auto merged
innobase/mtr/mtr0mtr.c:
Auto merged
innobase/os/os0proc.c:
Auto merged
innobase/pars/lexyy.c:
Auto merged
innobase/pars/pars0opt.c:
Auto merged
innobase/row/row0ins.c:
Auto merged
innobase/row/row0purge.c:
Auto merged
innobase/row/row0uins.c:
Auto merged
innobase/row/row0umod.c:
Auto merged
innobase/row/row0undo.c:
Auto merged
innobase/row/row0upd.c:
Auto merged
innobase/trx/trx0purge.c:
Auto merged
innobase/trx/trx0roll.c:
Auto merged
innobase/trx/trx0sys.c:
Auto merged
innobase/trx/trx0undo.c:
Auto merged
innobase/ut/ut0byte.c:
Auto merged
pstack/bucomm.h:
Auto merged
pstack/budbg.h:
Auto merged
sql/item_sum.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_db.cc:
Auto merged
support-files/mysql.spec.sh:
Auto merged
tests/insert_test.c:
Auto merged
mysql-test/t/func_group.test:
Merge with 4.0
Put 4.1 tests lasts
sql/ha_innodb.cc:
Merge with 4.0
Added checking of results from my_malloc()
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'innobase/sync/sync0sync.c')
-rw-r--r-- | innobase/sync/sync0sync.c | 102 |
1 files changed, 59 insertions, 43 deletions
diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c index 64f76f5ee77..5c42876a7bb 100644 --- a/innobase/sync/sync0sync.c +++ b/innobase/sync/sync0sync.c @@ -168,6 +168,30 @@ struct sync_level_struct{ }; /********************************************************************** +A noninlined function that reserves a mutex. In ha_innodb.cc we have disabled +inlining of InnoDB functions, and no inlined functions should be called from +there. That is why we need to duplicate the inlined function here. */ + +void +mutex_enter_noninline( +/*==================*/ + mutex_t* mutex) /* in: mutex */ +{ + mutex_enter(mutex); +} + +/********************************************************************** +Releases a mutex. */ + +void +mutex_exit_noninline( +/*=================*/ + mutex_t* mutex) /* in: mutex */ +{ + mutex_exit(mutex); +} + +/********************************************************************** Creates, or rather, initializes a mutex object in a specified memory location (which must be appropriately aligned). The mutex is initialized in the reset state. Explicit freeing of the mutex with mutex_free is @@ -288,6 +312,7 @@ mutex_enter_nowait( return(1); } +#ifdef UNIV_DEBUG /********************************************************************** Checks that the mutex has been initialized. */ @@ -301,6 +326,7 @@ mutex_validate( return(TRUE); } +#endif /* UNIV_DEBUG */ /********************************************************************** Sets the waiters field in a mutex. */ @@ -365,9 +391,9 @@ spin_loop: } if (srv_print_latch_waits) { - printf( - "Thread %lu spin wait mutex at %lx cfile %s cline %lu rnds %lu\n", - (ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) mutex, + fprintf(stderr, + "Thread %lu spin wait mutex at %p cfile %s cline %lu rnds %lu\n", + (ulong) os_thread_pf(os_thread_get_curr_id()), mutex, mutex->cfile_name, (ulong) mutex->cline, (ulong) i); } @@ -425,10 +451,11 @@ spin_loop: #endif if (srv_print_latch_waits) { - printf( - "Thread %lu spin wait succeeds at 2: mutex at %lx\n", + fprintf(stderr, + "Thread %lu spin wait succeeds at 2:" + " mutex at %p\n", (ulong) os_thread_pf(os_thread_get_curr_id()), - (ulong) mutex); + mutex); } return; @@ -444,9 +471,9 @@ spin_loop: Now there is no risk of infinite wait on the event. */ if (srv_print_latch_waits) { - printf( - "Thread %lu OS wait mutex at %lx cfile %s cline %lu rnds %lu\n", - (ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) mutex, + fprintf(stderr, + "Thread %lu OS wait mutex at %p cfile %s cline %lu rnds %lu\n", + (ulong) os_thread_pf(os_thread_get_curr_id()), mutex, mutex->cfile_name, (ulong) mutex->cline, (ulong) i); } @@ -566,9 +593,9 @@ mutex_list_print_info(void) os_thread_id_t thread_id; ulint count = 0; - printf("----------\n"); - printf("MUTEX INFO\n"); - printf("----------\n"); + fputs("----------\n" + "MUTEX INFO\n" + "----------\n", stderr); mutex_enter(&mutex_list_mutex); @@ -580,16 +607,16 @@ mutex_list_print_info(void) if (mutex_get_lock_word(mutex) != 0) { mutex_get_debug_info(mutex, &file_name, &line, &thread_id); - printf( - "Locked mutex: addr %lx thread %ld file %s line %ld\n", - (ulint)mutex, os_thread_pf(thread_id), + fprintf(stderr, + "Locked mutex: addr %p thread %ld file %s line %ld\n", + mutex, os_thread_pf(thread_id), file_name, line); } mutex = UT_LIST_GET_NEXT(list, mutex); } - printf("Total number of mutexes %ld\n", count); + fprintf(stderr, "Total number of mutexes %ld\n", count); mutex_exit(&mutex_list_mutex); } @@ -747,12 +774,14 @@ sync_thread_levels_g( lock = slot->latch; mutex = slot->latch; - printf( + fprintf(stderr, "InnoDB error: sync levels should be > %lu but a level is %lu\n", (ulong) limit, (ulong) slot->level); if (mutex->magic_n == MUTEX_MAGIC_N) { - printf("Mutex created at %s %lu\n", mutex->cfile_name, + fprintf(stderr, + "Mutex created at %s %lu\n", + mutex->cfile_name, (ulong) mutex->cline); if (mutex_get_lock_word(mutex) != 0) { @@ -833,9 +862,6 @@ sync_thread_levels_empty_gen( sync_level_t* arr; sync_thread_t* thread_slot; sync_level_t* slot; - rw_lock_t* lock; - mutex_t* mutex; - char* buf; ulint i; if (!sync_order_checks_on) { @@ -864,13 +890,7 @@ sync_thread_levels_empty_gen( (slot->level != SYNC_DICT && slot->level != SYNC_DICT_OPERATION))) { - lock = slot->latch; - mutex = slot->latch; mutex_exit(&sync_thread_mutex); - - buf = mem_alloc(20000); - - sync_print(buf, buf + 18000); ut_error; return(FALSE); @@ -1054,8 +1074,12 @@ sync_thread_add_level( } else if (level == SYNC_DICT_HEADER) { ut_a(sync_thread_levels_g(array, SYNC_DICT_HEADER)); } else if (level == SYNC_DICT) { - ut_a(buf_debug_prints - || sync_thread_levels_g(array, SYNC_DICT)); +#ifdef UNIV_DEBUG + ut_a(buf_debug_prints || + sync_thread_levels_g(array, SYNC_DICT)); +#else /* UNIV_DEBUG */ + ut_a(sync_thread_levels_g(array, SYNC_DICT)); +#endif /* UNIV_DEBUG */ } else { ut_error; } @@ -1225,19 +1249,14 @@ Prints wait info of the sync system. */ void sync_print_wait_info( /*=================*/ - char* buf, /* in/out: buffer where to print */ - char* buf_end) /* in: buffer end */ + FILE* file) /* in: file where to print */ { #ifdef UNIV_SYNC_DEBUG - printf("Mutex exits %lu, rws exits %lu, rwx exits %lu\n", + fprintf(stderr, "Mutex exits %lu, rws exits %lu, rwx exits %lu\n", mutex_exit_count, rw_s_exit_count, rw_x_exit_count); #endif - if (buf_end - buf < 500) { - return; - } - - sprintf(buf, + fprintf(file, "Mutex spin waits %lu, rounds %lu, OS waits %lu\n" "RW-shared spins %lu, OS waits %lu; RW-excl spins %lu, OS waits %lu\n", (ulong) mutex_spin_wait_count, @@ -1255,8 +1274,7 @@ Prints info of the sync system. */ void sync_print( /*=======*/ - char* buf, /* in/out: buffer where to print */ - char* buf_end) /* in: buffer end */ + FILE* file) /* in: file where to print */ { #ifdef UNIV_SYNC_DEBUG mutex_list_print_info(); @@ -1264,9 +1282,7 @@ sync_print( rw_lock_list_print_info(); #endif /* UNIV_SYNC_DEBUG */ - sync_array_print_info(buf, buf_end, sync_primary_wait_array); - - buf = buf + strlen(buf); + sync_array_print_info(file, sync_primary_wait_array); - sync_print_wait_info(buf, buf_end); + sync_print_wait_info(file); } |