MySQL 5.6.14 Source Code Document
|
#include <rpl_gtid.h>
Classes | |
struct | Node |
Node pointed to by both the hash and the array. |
Public Member Functions | |
Sid_map (Checkable_rwlock *sid_lock) | |
~Sid_map () | |
Destroy this Sid_map. | |
rpl_sidno | add_sid (const rpl_sid &sid) |
rpl_sidno | sid_to_sidno (const rpl_sid &sid) const |
const rpl_sid & | sidno_to_sid (rpl_sidno sidno) const |
rpl_sidno | get_sorted_sidno (rpl_sidno n) const |
rpl_sidno | get_max_sidno () const |
Represents a bidirectional map between SID and SIDNO.
SIDNOs are always numbers greater or equal to 1.
This data structure OPTIONALLY knows of a read-write lock that protects the number of SIDNOs. The lock is provided by the invoker of the constructor and it is generally the caller's responsibility to acquire the read lock. If the lock is not NULL, access methods assert that the caller already holds the read (or write) lock. If the lock is not NULL and a method of this class grows the number of SIDNOs, then the method temporarily upgrades this lock to a write lock and then degrades it to a read lock again; there will be a short period when the lock is not held at all.
Definition at line 467 of file rpl_gtid.h.
Sid_map::Sid_map | ( | Checkable_rwlock * | sid_lock | ) |
Create this Sid_map.
sid_lock | Read-write lock that protects updates to the number of SIDNOs. |
Definition at line 24 of file rpl_gtid_sid_map.cc.
rpl_sidno Sid_map::add_sid | ( | const rpl_sid & | sid | ) |
Add the given SID to this map if it does not already exist.
The caller must hold the read lock or write lock on sid_lock before invoking this function. If the SID does not exist in this map, it will release the read lock, take a write lock, update the map, release the write lock, and take the read lock again.
sid | The SID. |
SIDNO | The SIDNO for the SID (a new SIDNO if the SID did not exist, an existing if it did exist). |
negative | Error. This function calls my_error. |
Definition at line 68 of file rpl_gtid_sid_map.cc.
|
inline |
Return the biggest sidno in this Sid_map.
The caller must hold the read or write lock on sid_lock before invoking this function.
Definition at line 562 of file rpl_gtid.h.
|
inline |
Return the n'th smallest sidno, in the order of the SID's UUID.
The caller must hold the read or write lock on sid_lock before invoking this function.
n | A number in the interval [0, get_max_sidno()-1], inclusively. |
Definition at line 549 of file rpl_gtid.h.
|
inline |
Get the SIDNO for a given SID
The caller must hold the read lock on sid_lock before invoking this function.
sid | The SID. |
SIDNO | if the given SID exists in this map. |
0 | if the given SID does not exist in this map. |
Definition at line 511 of file rpl_gtid.h.
|
inline |
Get the SID for a given SIDNO.
An assertion is raised if the caller does not hold a lock on sid_lock, or if the SIDNO is not valid.
sidno | The SIDNO. |
NULL | The SIDNO does not exist in this map. |
pointer | Pointer to the SID. The data is shared with this Sid_map, so should not be modified. It is safe to read the data even after this Sid_map is modified, but not if this Sid_map is destroyed. |
Definition at line 534 of file rpl_gtid.h.