26 #define LOCK_MODULE_IMPLEMENTATION
40 lock_wait_table_print(
void)
50 for (i = 0; i < OS_THREAD_MAX_N; i++, ++slot) {
53 "Slot %lu: thread type %lu,"
54 " in use %lu, susp %lu, timeout %lu, time %lu\n",
69 lock_wait_table_release_slot(
97 slot->
thr->slot = NULL;
130 lock_wait_table_reserve_slot(
144 for (i = OS_THREAD_MAX_N; i--; ++slot) {
148 slot->
thr->slot = slot;
150 if (slot->
event == NULL) {
174 " InnoDB: There appear to be %lu user"
175 " threads currently waiting\n"
176 "InnoDB: inside InnoDB, which is the"
177 " upper limit. Cannot continue operation.\n"
178 "InnoDB: As a last thing, we print"
179 " a list of waiting threads.\n", (ulong) OS_THREAD_MAX_N);
181 lock_wait_table_print();
204 ibool was_declared_inside_innodb;
205 ib_int64_t start_time = 0;
206 ib_int64_t finish_time;
209 ulong lock_wait_timeout;
214 DEBUG_SYNC_C(
"lock_wait_suspend_thread_enter");
229 if (thr->
state == QUE_THR_RUNNING) {
249 slot = lock_wait_table_reserve_slot(thr, lock_wait_timeout);
258 start_time = (ib_int64_t) sec * 1000000 + ms;
269 ulint lock_type = ULINT_UNDEFINED;
281 switch (had_dict_lock) {
288 DEBUG_SYNC_C(
"lock_wait_release_s_latch_before_sleep");
306 if (was_declared_inside_innodb) {
315 if (lock_type == ULINT_UNDEFINED || lock_type ==
LOCK_REC) {
322 os_event_wait(slot->
event);
329 if (was_declared_inside_innodb) {
338 row_mysql_freeze_data_dictionary(trx);
345 lock_wait_table_release_slot(slot);
353 finish_time = (ib_int64_t) sec * 1000000 + ms;
356 diff_time = (finish_time > start_time) ?
357 (ulint) (finish_time - start_time) : 0;
366 && finish_time != -1) {
376 if (lock_wait_timeout < 100000000
377 && wait_time > (
double) lock_wait_timeout) {
408 if (thr->slot != NULL && thr->slot->
in_use && thr->slot->
thr == thr) {
426 lock_wait_check_and_cancel(
448 || wait_time < 0))) {
478 extern "C" UNIV_INTERN
482 void* arg __attribute__((unused)))
486 ib_int64_t sig_count = 0;
491 #ifdef UNIV_PFS_THREAD
492 pfs_register_thread(srv_lock_timeout_thread_key);
516 slot < lock_sys->last_slot;
525 lock_wait_check_and_cancel(slot);
542 OS_THREAD_DUMMY_RETURN;