MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rpl_info_table_access Class Reference

Public Member Functions

bool open_table (THD *thd, const LEX_STRING dbstr, const LEX_STRING tbstr, uint max_num_field, enum thr_lock_type lock_type, TABLE **table, Open_tables_backup *backup)
bool close_table (THD *thd, TABLE *table, Open_tables_backup *backup, bool error)
enum enum_return_id find_info (Rpl_info_values *field_values, TABLE *table)
enum enum_return_id scan_info (TABLE *table, uint instance)
bool count_info (TABLE *table, uint *counter)
bool load_info_values (uint max_num_field, Field **fields, Rpl_info_values *field_values)
bool store_info_values (uint max_num_field, Field **fields, Rpl_info_values *field_values)
THD * create_thd ()
bool drop_thd (THD *thd)

Detailed Description

Definition at line 28 of file rpl_info_table_access.h.

Member Function Documentation

bool Rpl_info_table_access::close_table ( THD *  thd,
TABLE table,
Open_tables_backup *  backup,
bool  error 
)

Commits the changes, unlocks the table and closes it. This method needs to be called even if the open_table fails, in order to ensure the lock info is properly restored.

Parameters
[in]thdThread requesting to close the table
[in]tableTable to be closed
[in]backupRestore the lock info from here
[in]errorIf there was an error while updating the table

If there is an error, rolls back the current statement. Otherwise, commits it. However, if a new thread was created and there is an error, the transaction must be rolled back. Otherwise, it must be committed. In this case, the changes were not done on behalf of any user transaction and if not finished, there would be pending changes.

Returns
Return values
FALSENo error
TRUEFailure

Definition at line 145 of file rpl_info_table_access.cc.

Here is the call graph for this function:

bool Rpl_info_table_access::count_info ( TABLE table,
uint *  counter 
)

Returns the number of entries in table.

The code built on top of this function needs to ensure there is no concurrent threads trying to update the table. So if an error different from HA_ERR_END_OF_FILE is returned, we abort with an error because this implies that someone has manualy and concurrently changed something.

Parameters
[in]tableTable
[out]counterRegisters the number of entries.
Returns
Return values
falseNo error
trueFailure

Definition at line 329 of file rpl_info_table_access.cc.

Here is the call graph for this function:

THD * Rpl_info_table_access::create_thd ( )

Creates a new thread if necessary. In the bootstrap process or in the mysqld startup, a thread is created in order to be able to access a table. Otherwise, the current thread is used.

Returns
Return values
THD*Pointer to thread structure

Definition at line 442 of file rpl_info_table_access.cc.

bool Rpl_info_table_access::drop_thd ( THD *  thd)

Destroys the created thread if necessary and restores the system_thread information.

Parameters
[in]thdThread requesting to be destroyed
Returns
Return values
FALSENo error
TRUEFailure

Definition at line 471 of file rpl_info_table_access.cc.

enum enum_return_id Rpl_info_table_access::find_info ( Rpl_info_values field_values,
TABLE table 
)

Positions the internal pointer of table according to the primary key.

If the search succeeds, the table cursor points to the found row.

Parameters
[in,out]field_valuesThe sequence of values
[in,out]tableTable
Returns
Return values
FOUNDThe row was found.
NOT_FOUNDThe row was not found.
ERRORThere was a failure.

Definition at line 206 of file rpl_info_table_access.cc.

Here is the call graph for this function:

bool Rpl_info_table_access::load_info_values ( uint  max_num_field,
Field **  fields,
Rpl_info_values field_values 
)

Reads information from a sequence of fields into a set of LEX_STRING structures, where the sequence of values is specified through the object Rpl_info_values.

Parameters
[in]max_num_fieldMaximum number of fields
[in]fieldsThe sequence of fields
[in]field_valuesThe sequence of values
Returns
Return values
FALSENo error
TRUEFailure

Definition at line 378 of file rpl_info_table_access.cc.

bool Rpl_info_table_access::open_table ( THD *  thd,
const LEX_STRING  dbstr,
const LEX_STRING  tbstr,
uint  max_num_field,
enum thr_lock_type  lock_type,
TABLE **  table,
Open_tables_backup *  backup 
)

Opens and locks a table.

It's assumed that the caller knows what they are doing:

  • whether it was necessary to reset-and-backup the open tables state
  • whether the requested lock does not lead to a deadlock
  • whether this open mode would work under LOCK TABLES, or inside a stored function or trigger.

Note that if the table can't be locked successfully this operation will close it. Therefore it provides guarantee that it either opens and locks table or fails without leaving any tables open.

Parameters
[in]thdThread requesting to open the table
[in]dbstrDatabase where the table resides
[in]tbstrTable to be openned
[in]max_num_fieldMaximum number of fields
[in]lock_typeHow to lock the table
[out]tableWe will store the open table here
[out]backupSave the lock info. here
Returns
Return values
TRUEopen and lock failed - an error message is pushed into the stack
FALSEsuccess

Definition at line 47 of file rpl_info_table_access.cc.

Here is the call graph for this function:

enum enum_return_id Rpl_info_table_access::scan_info ( TABLE table,
uint  instance 
)

Positions the internal pointer of table to the n-instance row.

Parameters
[in]tableReference to a table object.
[in]instancen-instance row.

The code built on top of this function needs to ensure there is no concurrent threads trying to update the table. So if an error different from HA_ERR_END_OF_FILE is returned, we abort with an error because this implies that someone has manualy and concurrently changed something.

Returns
Return values
FOUNDThe row was found.
NOT_FOUNDThe row was not found.
ERRORThere was a failure.

Definition at line 269 of file rpl_info_table_access.cc.

Here is the call graph for this function:

bool Rpl_info_table_access::store_info_values ( uint  max_num_field,
Field **  fields,
Rpl_info_values field_values 
)

Stores information from a sequence of fields into a set of LEX_STRING structures, where the sequence of values is specified through the object Rpl_info_values.

Parameters
[in]max_num_fieldMaximum number of fields
[in]fieldsThe sequence of fields
[in]field_valuesThe sequence of values
Returns
Return values
FALSENo error
TRUEFailure

Definition at line 410 of file rpl_info_table_access.cc.


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