My Project
|
Public Member Functions | |
Delayed_insert () | |
void | lock () |
void | unlock () |
uint | lock_count () |
TABLE * | get_local_table (THD *client_thd) |
bool | open_and_lock_table () |
bool | handle_inserts (void) |
Public Attributes | |
THD | thd |
TABLE * | table |
mysql_mutex_t | mutex |
mysql_cond_t | cond |
mysql_cond_t | cond_client |
volatile uint | tables_in_use |
volatile uint | stacked_inserts |
volatile bool | status |
bool | handler_thread_initialized |
Delayable_insert_operation | d_info |
An INSERT operation reused for all delayed rows of this thread. | |
I_List< delayed_row > | rows |
ulong | group_count |
TABLE_LIST | table_list |
MDL_request | grl_protection |
Delayed_insert - context of a thread responsible for delayed insert into one table. When processing delayed inserts, we create an own thread for every distinct table. Later on all delayed inserts directed into that table are handled by a dedicated thread.
Delayed_insert::Delayed_insert | ( | ) | [inline] |
Creates a new delayed insert handler.
TABLE * Delayed_insert::get_local_table | ( | THD * | client_thd | ) |
As we can't let many client threads modify the same TABLE structure of the dedicated delayed insert thread, we create an own structure for each client thread. This includes a row buffer to save the column values and new fields that point to the new row buffer. The memory is allocated in the client thread and is freed automatically.
bool Delayed_insert::open_and_lock_table | ( | ) |
Open and lock table for use by delayed thread and check that this table is suitable for delayed inserts.
FALSE | - Success. |
TRUE | - Failure. |
Request for IX metadata lock protecting against GRL which is passed from connection thread to the handler thread.
When the handler thread starts, it clones a metadata lock ticket which protects against GRL and ticket for the table to be inserted. This is done to allow the deadlock detector to detect deadlocks resulting from these locks. Before this is done, the connection thread cannot safely exit without causing problems for clone_ticket(). Once handler_thread_initialized has been set, it is safe for the connection thread to exit. Access to handler_thread_initialized is protected by di->mutex.