My Project
Public Member Functions | Public Attributes
Delayed_insert Class Reference
Inheritance diagram for Delayed_insert:
ilink< Delayed_insert >

List of all members.

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.

Constructor & Destructor Documentation

Creates a new delayed insert handler.


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.

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.

Member Data Documentation

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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines