MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Delayed_insert Class Reference
Inheritance diagram for Delayed_insert:
Collaboration diagram for Delayed_insert:

Public Member Functions

 Delayed_insert ()
void lock ()
void unlock ()
uint lock_count ()
TABLEget_local_table (THD *client_thd)
bool open_and_lock_table ()
bool handle_inserts (void)

Public Attributes

THD thd
TABLEtable
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_rowrows
ulong group_count
TABLE_LIST table_list
MDL_request grl_protection

Detailed Description

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.

Note
that custom operator new/delete are inherited from the ilink class.

Definition at line 2162 of file sql_insert.cc.

Constructor & Destructor Documentation

Delayed_insert::Delayed_insert ( )
inline

Creates a new delayed insert handler.

Definition at line 2198 of file sql_insert.cc.

Member Function Documentation

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.

Precondition
This function is called from the client thread. Delayed insert thread mutex must be acquired before invoking this function.
Returns
Not-NULL table object on success. NULL in case of an error, which is set in client_thd.

Definition at line 2510 of file sql_insert.cc.

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.

Return values
FALSE- Success.
TRUE- Failure.

Definition at line 2829 of file sql_insert.cc.

Here is the call graph for this function:

Member Data Documentation

MDL_request Delayed_insert::grl_protection

Request for IX metadata lock protecting against GRL which is passed from connection thread to the handler thread.

Definition at line 2195 of file sql_insert.cc.

bool Delayed_insert::handler_thread_initialized

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.

Definition at line 2183 of file sql_insert.cc.


The documentation for this class was generated from the following file: