summaryrefslogtreecommitdiff
path: root/innobase/sync
diff options
context:
space:
mode:
authorunknown <monty@mishka.local>2004-04-26 15:53:31 +0300
committerunknown <monty@mishka.local>2004-04-26 15:53:31 +0300
commit1065f2bbd66ac4b1161f5c188171a54cbad5b422 (patch)
tree25e3315af05fa92d20d2ad1d812882957c400337 /innobase/sync
parent0ba6cb48d84f1ff951d09871a96be6cdef3f2c3c (diff)
parent6366a9090c7fc24f0e13b5b9d73d6777dcda9d9e (diff)
downloadmariadb-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')
-rw-r--r--innobase/sync/sync0arr.c128
-rw-r--r--innobase/sync/sync0rw.c67
-rw-r--r--innobase/sync/sync0sync.c102
3 files changed, 144 insertions, 153 deletions
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c
index 8082f598b0c..1268b22e2f8 100644
--- a/innobase/sync/sync0arr.c
+++ b/innobase/sync/sync0arr.c
@@ -425,7 +425,7 @@ sync_array_wait_event(
if (TRUE == sync_array_detect_deadlock(arr, cell, cell, 0)) {
- printf("########################################\n");
+ fputs("########################################\n", stderr);
ut_error;
}
@@ -444,8 +444,7 @@ static
void
sync_array_cell_print(
/*==================*/
- char* buf, /* in: buffer where to print, must be
- at least 400 characters */
+ FILE* file, /* in: file where to print */
sync_cell_t* cell) /* in: sync cell */
{
mutex_t* mutex;
@@ -455,7 +454,7 @@ sync_array_cell_print(
type = cell->request_type;
- buf += sprintf(buf,
+ fprintf(file,
"--Thread %lu has waited at %s line %lu for %.2f seconds the semaphore:\n",
(ulong) os_thread_pf(cell->thread), cell->file,
(ulong) cell->line,
@@ -466,7 +465,7 @@ sync_array_cell_print(
been freed meanwhile */
mutex = cell->old_wait_mutex;
- buf += sprintf(buf,
+ fprintf(file,
"Mutex at %p created file %s line %lu, lock var %lu\n"
#ifdef UNIV_SYNC_DEBUG
"Last time reserved in file %s line %lu, "
@@ -481,51 +480,43 @@ sync_array_cell_print(
} else if (type == RW_LOCK_EX || type == RW_LOCK_SHARED) {
- if (type == RW_LOCK_EX) {
- buf += sprintf(buf, "X-lock on");
- } else {
- buf += sprintf(buf, "S-lock on");
- }
+ fputs(type == RW_LOCK_EX ? "X-lock on" : "S-lock on", file);
rwlock = cell->old_wait_rw_lock;
- buf += sprintf(buf,
- " RW-latch at %lx created in file %s line %lu\n",
- (ulong) rwlock, rwlock->cfile_name,
+ fprintf(file,
+ " RW-latch at %p created in file %s line %lu\n",
+ rwlock, rwlock->cfile_name,
(ulong) rwlock->cline);
if (rwlock->writer != RW_LOCK_NOT_LOCKED) {
- buf += sprintf(buf,
- "a writer (thread id %lu) has reserved it in mode",
- (ulong) os_thread_pf(rwlock->writer_thread));
- if (rwlock->writer == RW_LOCK_EX) {
- buf += sprintf(buf, " exclusive\n");
- } else {
- buf += sprintf(buf, " wait exclusive\n");
- }
+ fprintf(file,
+ "a writer (thread id %lu) has reserved it in mode %s",
+ (ulong) os_thread_pf(rwlock->writer_thread),
+ rwlock->writer == RW_LOCK_EX
+ ? " exclusive\n"
+ : " wait exclusive\n");
}
- buf += sprintf(buf,
- "number of readers %lu, waiters flag %lu\n",
- (ulong) rwlock->reader_count,
- (ulong) rwlock->waiters);
-
- buf += sprintf(buf,
- "Last time read locked in file %s line %lu\n",
- rwlock->last_s_file_name,
- (ulong) rwlock->last_s_line);
- buf += sprintf(buf,
+ fprintf(file,
+ "number of readers %lu, waiters flag %lu\n"
+ "Last time read locked in file %s line %lu\n"
"Last time write locked in file %s line %lu\n",
- rwlock->last_x_file_name, (ulong) rwlock->last_x_line);
+ (ulong) rwlock->reader_count,
+ (ulong) rwlock->waiters,
+ rwlock->last_s_file_name,
+ (ulong) rwlock->last_s_line,
+ rwlock->last_x_file_name,
+ (ulong) rwlock->last_x_line);
} else {
ut_error;
}
if (!cell->waiting) {
- buf += sprintf(buf, "wait has ended\n");
+ fputs("wait has ended\n", file);
}
if (cell->event_set) {
- buf += sprintf(buf, "wait is ending\n");
+ fputs("wait is ending\n", file);
}
}
@@ -594,8 +585,8 @@ sync_array_deadlock_step(
ut_dbg_stop_threads = TRUE;
/* Deadlock */
- printf("########################################\n");
- printf("DEADLOCK of threads detected!\n");
+ fputs("########################################\n"
+ "DEADLOCK of threads detected!\n", stderr);
return(TRUE);
@@ -627,8 +618,8 @@ sync_array_detect_deadlock(
rw_lock_t* lock;
os_thread_id_t thread;
ibool ret;
- rw_lock_debug_t* debug;
- char buf[500];
+ rw_lock_t* lock;
+ rw_lock_debug_t*debug;
ut_a(arr && start && cell);
ut_ad(cell->wait_object);
@@ -661,11 +652,11 @@ sync_array_detect_deadlock(
ret = sync_array_deadlock_step(arr, start, thread, 0,
depth);
if (ret) {
- sync_array_cell_print(buf, cell);
- printf(
- "Mutex %lx owned by thread %lu file %s line %lu\n%s",
- (ulong) mutex, (ulong) os_thread_pf(mutex->thread_id),
- mutex->file_name, (ulong) mutex->line, buf);
+ fprintf(stderr,
+ "Mutex %p owned by thread %lu file %s line %lu\n",
+ mutex, (ulong) os_thread_pf(mutex->thread_id),
+ mutex->file_name, (ulong) mutex->line);
+ sync_array_cell_print(stderr, cell);
return(TRUE);
}
@@ -698,8 +689,9 @@ sync_array_detect_deadlock(
debug->pass,
depth);
if (ret) {
- sync_array_cell_print(buf, cell);
- printf("rw-lock %lx %s ", (ulong) lock, buf);
+ print:
+ fprintf(stderr, "rw-lock %p ", lock);
+ sync_array_cell_print(stderr, cell);
rw_lock_debug_print(debug);
return(TRUE);
}
@@ -730,11 +722,7 @@ sync_array_detect_deadlock(
debug->pass,
depth);
if (ret) {
- sync_array_cell_print(buf, cell);
- printf("rw-lock %lx %s ", (ulong) lock, buf);
- rw_lock_debug_print(debug);
-
- return(TRUE);
+ goto print;
}
}
@@ -918,7 +906,6 @@ sync_array_print_long_waits(void)
sync_cell_t* cell;
ibool old_val;
ibool noticed = FALSE;
- char buf[500];
ulint i;
for (i = 0; i < sync_primary_wait_array->n_cells; i++) {
@@ -927,22 +914,19 @@ sync_array_print_long_waits(void)
if (cell->wait_object != NULL
&& difftime(time(NULL), cell->reservation_time) > 240) {
-
- sync_array_cell_print(buf, cell);
-
- fprintf(stderr,
- "InnoDB: Warning: a long semaphore wait:\n%s", buf);
-
+ fputs("InnoDB: Warning: a long semaphore wait:\n",
+ stderr);
+ sync_array_cell_print(stderr, cell);
noticed = TRUE;
}
if (cell->wait_object != NULL
&& difftime(time(NULL), cell->reservation_time) > 600) {
- fprintf(stderr,
+ fputs(
"InnoDB: Error: semaphore wait has lasted > 600 seconds\n"
-"InnoDB: We intentionally crash the server, because it appears to be hung.\n"
- );
+"InnoDB: We intentionally crash the server, because it appears to be hung.\n",
+ stderr);
ut_error;
}
@@ -970,7 +954,7 @@ sync_array_print_long_waits(void)
srv_print_innodb_monitor = old_val;
fprintf(stderr,
-"InnoDB: ###### Diagnostic info printed to the standard output\n");
+"InnoDB: ###### Diagnostic info printed to the standard error stream\n");
}
}
@@ -980,8 +964,7 @@ static
void
sync_array_output_info(
/*===================*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end,/* in: buffer end */
+ FILE* file, /* in: file where to print */
sync_array_t* arr) /* in: wait array; NOTE! caller must own the
mutex */
{
@@ -989,11 +972,7 @@ sync_array_output_info(
ulint count;
ulint i;
- if (buf_end - buf < 500) {
- return;
- }
-
- buf += sprintf(buf,
+ fprintf(file,
"OS WAIT ARRAY INFO: reservation count %ld, signal count %ld\n",
(long) arr->res_count, (long) arr->sg_count);
i = 0;
@@ -1001,17 +980,11 @@ sync_array_output_info(
while (count < arr->n_reserved) {
- if (buf_end - buf < 500) {
- return;
- }
-
cell = sync_array_get_nth_cell(arr, i);
if (cell->wait_object != NULL) {
count++;
- sync_array_cell_print(buf, cell);
-
- buf = buf + strlen(buf);
+ sync_array_cell_print(file, cell);
}
i++;
@@ -1024,13 +997,12 @@ Prints info of the wait array. */
void
sync_array_print_info(
/*==================*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end,/* in: buffer end */
+ FILE* file, /* in: file where to print */
sync_array_t* arr) /* in: wait array */
{
sync_array_enter(arr);
- sync_array_output_info(buf, buf_end, arr);
+ sync_array_output_info(file, arr);
sync_array_exit(arr);
}
diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c
index 93fd9f14575..3d219f27fb6 100644
--- a/innobase/sync/sync0rw.c
+++ b/innobase/sync/sync0rw.c
@@ -169,6 +169,7 @@ rw_lock_free(
mutex_exit(&rw_lock_list_mutex);
}
+#ifdef UNIV_DEBUG
/**********************************************************************
Checks that the rw-lock has been initialized and that there are no
simultaneous shared and exclusive locks. */
@@ -196,6 +197,7 @@ rw_lock_validate(
return(TRUE);
}
+#endif /* UNIV_DEBUG */
/**********************************************************************
Lock an rw-lock in shared mode for the current thread. If the rw-lock is
@@ -237,9 +239,9 @@ lock_loop:
}
if (srv_print_latch_waits) {
- printf(
- "Thread %lu spin wait rw-s-lock at %lx cfile %s cline %lu rnds %lu\n",
- (ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) lock,
+ fprintf(stderr,
+ "Thread %lu spin wait rw-s-lock at %p cfile %s cline %lu rnds %lu\n",
+ (ulong) os_thread_pf(os_thread_get_curr_id()), lock,
lock->cfile_name, (ulong) lock->cline, (ulong) i);
}
@@ -267,10 +269,10 @@ lock_loop:
mutex_exit(rw_lock_get_mutex(lock));
if (srv_print_latch_waits) {
- printf(
- "Thread %lu OS wait rw-s-lock at %lx cfile %s cline %lu\n",
- (ulong) os_thread_pf(os_thread_get_curr_id()),
- (ulong) lock, lock->cfile_name, (ulong) lock->cline);
+ fprintf(stderr,
+ "Thread %lu OS wait rw-s-lock at %p cfile %s cline %lu\n",
+ os_thread_pf(os_thread_get_curr_id()),
+ lock, lock->cfile_name, (ulong) lock->cline);
}
rw_s_system_call_count++;
@@ -486,9 +488,9 @@ lock_loop:
}
if (srv_print_latch_waits) {
- printf(
- "Thread %lu spin wait rw-x-lock at %lx cfile %s cline %lu rnds %lu\n",
- (ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) lock,
+ fprintf(stderr,
+ "Thread %lu spin wait rw-x-lock at %p cfile %s cline %lu rnds %lu\n",
+ os_thread_pf(os_thread_get_curr_id()), lock,
lock->cfile_name, (ulong) lock->cline, (ulong) i);
}
@@ -519,9 +521,9 @@ lock_loop:
mutex_exit(rw_lock_get_mutex(lock));
if (srv_print_latch_waits) {
- printf(
- "Thread %lu OS wait for rw-x-lock at %lx cfile %s cline %lu\n",
- (ulong) os_thread_pf(os_thread_get_curr_id()), (ulong) lock,
+ fprintf(stderr,
+ "Thread %lu OS wait for rw-x-lock at %p cfile %s cline %lu\n",
+ os_thread_pf(os_thread_get_curr_id()), lock,
lock->cfile_name, (ulong) lock->cline);
}
@@ -764,9 +766,9 @@ rw_lock_list_print_info(void)
mutex_enter(&rw_lock_list_mutex);
- printf("-------------\n");
- printf("RW-LATCH INFO\n");
- printf("-------------\n");
+ fputs("-------------\n"
+ "RW-LATCH INFO\n"
+ "-------------\n", stderr);
lock = UT_LIST_GET_FIRST(rw_lock_list);
@@ -780,12 +782,12 @@ rw_lock_list_print_info(void)
|| (rw_lock_get_reader_count(lock) != 0)
|| (rw_lock_get_waiters(lock) != 0)) {
- printf("RW-LOCK: %lx ", (ulint)lock);
+ fprintf(stderr, "RW-LOCK: %p ", lock);
if (rw_lock_get_waiters(lock)) {
- printf(" Waiters for the lock exist\n");
+ fputs(" Waiters for the lock exist\n", stderr);
} else {
- printf("\n");
+ putc('\n', stderr);
}
info = UT_LIST_GET_FIRST(lock->debug_list);
@@ -799,7 +801,7 @@ rw_lock_list_print_info(void)
lock = UT_LIST_GET_NEXT(list, lock);
}
- printf("Total number of rw-locks %ld\n", count);
+ fprintf(stderr, "Total number of rw-locks %ld\n", count);
mutex_exit(&rw_lock_list_mutex);
}
@@ -809,22 +811,23 @@ Prints debug info of an rw-lock. */
void
rw_lock_print(
/*==========*/
- rw_lock_t* lock __attribute__((unused))) /* in: rw-lock */
+ rw_lock_t* lock) /* in: rw-lock */
{
rw_lock_debug_t* info;
- printf("-------------\n");
- printf("RW-LATCH INFO\n");
- printf("RW-LATCH: %lx ", (ulint)lock);
+ fprintf(stderr,
+ "-------------\n"
+ "RW-LATCH INFO\n"
+ "RW-LATCH: %p ", lock);
if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED)
|| (rw_lock_get_reader_count(lock) != 0)
|| (rw_lock_get_waiters(lock) != 0)) {
if (rw_lock_get_waiters(lock)) {
- printf(" Waiters for the lock exist\n");
+ fputs(" Waiters for the lock exist\n", stderr);
} else {
- printf("\n");
+ putc('\n', stderr);
}
info = UT_LIST_GET_FIRST(lock->debug_list);
@@ -847,22 +850,22 @@ rw_lock_debug_print(
rwt = info->lock_type;
- printf("Locked: thread %ld file %s line %ld ",
+ fprintf(stderr, "Locked: thread %ld file %s line %ld ",
(ulong) os_thread_pf(info->thread_id), info->file_name,
(ulong) info->line);
if (rwt == RW_LOCK_SHARED) {
- printf("S-LOCK");
+ fputs("S-LOCK", stderr);
} else if (rwt == RW_LOCK_EX) {
- printf("X-LOCK");
+ fputs("X-LOCK", stderr);
} else if (rwt == RW_LOCK_WAIT_EX) {
- printf("WAIT X-LOCK");
+ fputs("WAIT X-LOCK", stderr);
} else {
ut_error;
}
if (info->pass != 0) {
- printf(" pass value %lu", (ulong) info->pass);
+ fprintf(stderr, " pass value %lu", (ulong) info->pass);
}
- printf("\n");
+ putc('\n', stderr);
}
/*******************************************************************
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);
}