| 492 | */ |
| 493 | |
| 494 | static void tdc_delete_share_from_hash(TDC_element *element) |
| 495 | { |
| 496 | THD *thd= current_thd; |
| 497 | LF_PINS *pins; |
| 498 | TABLE_SHARE *share; |
| 499 | DBUG_ENTER("tdc_delete_share_from_hash"); |
| 500 | |
| 501 | mysql_mutex_assert_owner(&element->LOCK_table_share); |
| 502 | share= element->share; |
| 503 | DBUG_ASSERT(share); |
| 504 | element->share= 0; |
| 505 | PSI_CALL_release_table_share(share->m_psi); |
| 506 | share->m_psi= 0; |
| 507 | |
| 508 | if (!element->m_flush_tickets.is_empty()) |
| 509 | { |
| 510 | Wait_for_flush_list::Iterator it(element->m_flush_tickets); |
| 511 | Wait_for_flush *ticket; |
| 512 | while ((ticket= it++)) |
| 513 | (void) ticket->get_ctx()->m_wait.set_status(MDL_wait::GRANTED); |
| 514 | |
| 515 | do |
| 516 | { |
| 517 | mysql_cond_wait(&element->COND_release, &element->LOCK_table_share); |
| 518 | } while (!element->m_flush_tickets.is_empty()); |
| 519 | } |
| 520 | |
| 521 | mysql_mutex_unlock(&element->LOCK_table_share); |
| 522 | |
| 523 | if (thd) |
| 524 | { |
| 525 | fix_thd_pins(thd); |
| 526 | pins= thd->tdc_hash_pins; |
| 527 | } |
| 528 | else |
| 529 | pins= lf_hash_get_pins(&tdc_hash); |
| 530 | |
| 531 | DBUG_ASSERT(pins); // What can we do about it? |
| 532 | tdc_assert_clean_share(element); |
| 533 | lf_hash_delete(&tdc_hash, pins, element->m_key, element->m_key_length); |
| 534 | if (!thd) |
| 535 | lf_hash_put_pins(pins); |
| 536 | free_table_share(share); |
| 537 | DBUG_VOID_RETURN; |
| 538 | } |
| 539 | |
| 540 | |
| 541 | /** |
no test coverage detected