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

#include <pfs_lock.h>

Public Member Functions

bool is_free (void)
bool is_populated (void)
bool free_to_dirty (void)
void allocated_to_dirty (void)
void dirty_to_allocated (void)
void set_allocated (void)
void dirty_to_free (void)
void allocated_to_free (void)
void begin_optimistic_lock (struct pfs_lock *copy)
bool end_optimistic_lock (struct pfs_lock *copy)
uint32 get_version ()

Public Attributes

volatile uint32 m_version_state

Detailed Description

A 'lock' protecting performance schema internal buffers. This lock is used to mark the state of a record. Access to the record is not enforced here, it's up to the readers and writers to look at the record state before making an actual read or write operation.

Definition at line 64 of file pfs_lock.h.

Member Function Documentation

void pfs_lock::allocated_to_dirty ( void  )
inline

Execute an allocated to dirty transition. This transition should be executed by the writer that owns the record, before the record is modified.

Definition at line 118 of file pfs_lock.h.

Here is the call graph for this function:

void pfs_lock::allocated_to_free ( void  )
inline

Execute an allocated to free transition. This transition should be executed by the writer that owns the record.

Definition at line 176 of file pfs_lock.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void pfs_lock::begin_optimistic_lock ( struct pfs_lock copy)
inline

Start an optimistic read operation.

See Also
end_optimist_lock.

Definition at line 208 of file pfs_lock.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void pfs_lock::dirty_to_allocated ( void  )
inline

Execute a dirty to allocated transition. This transition should be executed by the writer that owns the record, after the record is in a state ready to be read.

Definition at line 134 of file pfs_lock.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void pfs_lock::dirty_to_free ( void  )
inline

Execute a dirty to free transition. This transition should be executed by the writer that owns the record.

Definition at line 162 of file pfs_lock.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool pfs_lock::end_optimistic_lock ( struct pfs_lock copy)
inline

End an optimistic read operation.

See Also
begin_optimist_lock.
Returns
true if the data read is safe to use.

Definition at line 218 of file pfs_lock.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool pfs_lock::free_to_dirty ( void  )
inline

Execute a free to dirty transition. This transition is safe to execute concurrently by multiple writers. Only one writer will succeed to acquire the record.

Returns
true if the operation succeed

Definition at line 104 of file pfs_lock.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool pfs_lock::is_free ( void  )
inline

Returns true if the record is free.

Definition at line 85 of file pfs_lock.h.

Here is the caller graph for this function:

bool pfs_lock::is_populated ( void  )
inline

Returns true if the record contains values that can be read.

Definition at line 92 of file pfs_lock.h.

void pfs_lock::set_allocated ( void  )
inline

Initialize a lock to allocated. This transition should be executed by the writer that owns the record and the lock, after the record is in a state ready to be read.

Definition at line 149 of file pfs_lock.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

volatile uint32 pfs_lock::m_version_state

The record internal version and state

See Also
PFS_LOCK_FREE
PFS_LOCK_DIRTY
PFS_LOCK_ALLOCATED The version number is to transform the 'ABA' problem (see http://en.wikipedia.org/wiki/ABA_problem) into an 'A(n)BA(n + 1)' problem, where 'n' is the m_version number. When the performance schema instrumentation deletes a record, then create a different record reusing the same memory allocation, the version number is incremented, so that a reader can detect that the record was changed. Note that the version number is never reset to zero when a new record is created. The version number is stored in the high 30 bits. The state is stored in the low 2 bits.

Definition at line 82 of file pfs_lock.h.


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