My Project
|
#include <rpl_gtid.h>
Classes | |
class | Gtid_iterator |
struct | Node |
Represents one owned group. | |
Public Member Functions | |
Owned_gtids (Checkable_rwlock *sid_lock) | |
~Owned_gtids () | |
Destroys this Owned_gtids. | |
enum_return_status | add_gtid_owner (const Gtid >id, my_thread_id owner) |
my_thread_id | get_owner (const Gtid >id) const |
void | remove_gtid (const Gtid >id) |
enum_return_status | ensure_sidno (rpl_sidno sidno) |
bool | is_intersection_nonempty (const Gtid_set *other) const |
bool | is_empty () const |
Returns true if this Owned_gtids is empty. | |
rpl_sidno | get_max_sidno () const |
Returns the maximal sidno that this Owned_gtids currently has space for. | |
int | to_string (char *out) const |
size_t | get_max_string_length () const |
bool | thread_owns_anything (my_thread_id thd_id) const |
char * | to_string () const |
void | print () const |
Debug only: print this Owned_gtids to stdout. | |
void | dbug_print (const char *text="") const |
Represents the set of GTIDs that are owned by some thread.
This data structure has 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. Access methods assert that the caller already holds the read (or write) lock. If 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.
The internal representation is a DYNAMIC_ARRAY that maps SIDNO to HASH, where each HASH maps GNO to my_thread_id.
Owned_gtids::Owned_gtids | ( | Checkable_rwlock * | sid_lock | ) |
Constructs a new, empty Owned_gtids object.
sid_lock | Read-write lock that protects updates to the number of SIDs. |
enum_return_status Owned_gtids::add_gtid_owner | ( | const Gtid & | gtid, |
my_thread_id | owner | ||
) |
Add a GTID to this Owned_gtids.
gtid | The Gtid to add. |
owner | The my_thread_id of the group to add. |
void Owned_gtids::dbug_print | ( | const char * | text = "" | ) | const [inline] |
Print this Owned_gtids to the trace file if debug is enabled; no-op otherwise.
enum_return_status Owned_gtids::ensure_sidno | ( | rpl_sidno | sidno | ) |
Ensures that this Owned_gtids object can accomodate SIDNOs up to the given SIDNO.
If this Owned_gtids object needs to be resized, then the lock will be temporarily upgraded to a write lock and then degraded to a read lock again; there will be a short period when the lock is not held at all.
sidno | The SIDNO. |
size_t Owned_gtids::get_max_string_length | ( | ) | const [inline] |
Return an upper bound on the length of the string representation of this Owned_groups. The actual length may be smaller. This includes the trailing '\0'.
my_thread_id Owned_gtids::get_owner | ( | const Gtid & | gtid | ) | const |
bool Owned_gtids::is_intersection_nonempty | ( | const Gtid_set * | other | ) | const |
Returns true if there is a least one element of this Owned_gtids set in the other Gtid_set.
void Owned_gtids::remove_gtid | ( | const Gtid & | gtid | ) |
Removes the given GTID.
If the group does not exist in this Owned_gtids object, does nothing.
gtid | The Gtid. |
bool Owned_gtids::thread_owns_anything | ( | my_thread_id | thd_id | ) | const [inline] |
Return true if the given thread is the owner of any groups.
int Owned_gtids::to_string | ( | char * | out | ) | const [inline] |
Write a string representation of this Owned_groups to the given buffer.
out | Buffer to write to. |
char* Owned_gtids::to_string | ( | ) | const [inline] |
Debug only: return a newly allocated string representation of this Owned_gtids.