MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dict0stats_bg.cc File Reference
#include "row0mysql.h"
#include "srv0start.h"
#include "dict0stats.h"
#include "dict0stats_bg.h"
#include <vector>
Include dependency graph for dict0stats_bg.cc:

Go to the source code of this file.

Macros

#define MIN_RECALC_INTERVAL   10 /* seconds */
#define SHUTTING_DOWN()   (srv_shutdown_state != SRV_SHUTDOWN_NONE)

Typedefs

typedef std::vector< table_id_t > recalc_pool_t
typedef recalc_pool_t::iterator recalc_pool_iterator_t

Functions

UNIV_INTERN void dict_stats_recalc_pool_add (const dict_table_t *table)
UNIV_INTERN void dict_stats_recalc_pool_del (const dict_table_t *table)
UNIV_INTERN void dict_stats_wait_bg_to_stop_using_table (dict_table_t *table, trx_t *trx)
UNIV_INTERN void dict_stats_thread_init ()
UNIV_INTERN void dict_stats_thread_deinit ()
UNIV_INTERN os_thread_ret_t
DECLARE_THREAD() 
dict_stats_thread (void *arg __attribute__((unused)))

Variables

UNIV_INTERN os_event_t dict_stats_event = NULL

Detailed Description

Code used for background table and index stats gathering.

Created Apr 25, 2012 Vasil Dimov

Definition in file dict0stats_bg.cc.

Macro Definition Documentation

#define MIN_RECALC_INTERVAL   10 /* seconds */

Minimum time interval between stats recalc for a given table

Definition at line 38 of file dict0stats_bg.cc.

Typedef Documentation

typedef std::vector<table_id_t> recalc_pool_t
The multitude of tables whose stats are to be automatically

recalculated - an STL vector

Definition at line 57 of file dict0stats_bg.cc.

Function Documentation

UNIV_INTERN void dict_stats_recalc_pool_add ( const dict_table_t table)

Add a table to the recalc pool, which is processed by the background stats gathering thread. Only the table id is added to the list, so the table can be closed after being enqueued and it will be opened when needed. If the table does not exist later (has been DROPped), then it will be removed from the pool and skipped.

Parameters
tablein: table to add

Definition at line 95 of file dict0stats_bg.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void dict_stats_recalc_pool_del ( const dict_table_t table)

Delete a given table from the auto recalc pool. dict_stats_recalc_pool_del()

Parameters
tablein: table to remove

Definition at line 155 of file dict0stats_bg.cc.

Here is the caller graph for this function:

UNIV_INTERN os_thread_ret_t DECLARE_THREAD() dict_stats_thread ( void *arg   __attribute__(unused))

This is the thread for background stats gathering. It pops tables, from the auto recalc list and proceeds them, eventually recalculating their statistics.

Returns
this function does not return, it calls os_thread_exit()
Parameters
__attribute__in: a dummy parameter required by os_thread_create

Definition at line 332 of file dict0stats_bg.cc.

Here is the call graph for this function:

UNIV_INTERN void dict_stats_thread_deinit ( )

Free resources allocated by dict_stats_thread_init(), must be called after dict_stats_thread() has exited.

Definition at line 238 of file dict0stats_bg.cc.

Here is the call graph for this function:

UNIV_INTERN void dict_stats_thread_init ( )

Initialize global variables needed for the operation of dict_stats_thread() Must be called before dict_stats_thread() is started.

Definition at line 207 of file dict0stats_bg.cc.

Here is the call graph for this function:

UNIV_INTERN void dict_stats_wait_bg_to_stop_using_table ( dict_table_t table,
trx_t trx 
)

Wait until background stats thread has stopped using the specified table. The caller must have locked the data dictionary using row_mysql_lock_data_dictionary() and this function may unlock it temporarily and restore the lock before it exits. The background stats thread is guaranteed not to start using the specified table after this function returns and before the caller unlocks the data dictionary because it sets the BG_STAT_IN_PROGRESS bit in table->stats_bg_flag under dict_sys->mutex.

Parameters
tablein/out: table
trxin/out: transaction to use for unlocking/locking the data dict

Definition at line 191 of file dict0stats_bg.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

UNIV_INTERN os_event_t dict_stats_event = NULL

Event to wake up the stats thread

Definition at line 43 of file dict0stats_bg.cc.