My Project
Public Types | Public Member Functions
Group_cache Class Reference

#include <rpl_gtid.h>

List of all members.

Public Types

enum  enum_add_group_status { EXTEND_EXISTING_GROUP, APPEND_NEW_GROUP, ERROR }

Public Member Functions

 Group_cache ()
 Constructs a new Group_cache.
 ~Group_cache ()
 Deletes a Group_cache.
void clear ()
 Removes all groups from this cache.
int get_n_groups () const
 Return the number of groups in this group cache.
bool is_empty () const
 Return true iff the group cache contains zero groups.
enum_add_group_status add_logged_group (const THD *thd, my_off_t binlog_offset)
enum_return_status write_to_gtid_state () const
enum_return_status generate_automatic_gno (THD *thd)
bool contains_gtid (const Gtid &gtid) const
enum_return_status get_gtids (Gtid_set *gs) const
size_t to_string (const Sid_map *sm, char *buf) const
size_t get_max_string_length () const
char * to_string (const Sid_map *sm) const
void print (const Sid_map *sm) const
 Debug only: print this Group_cache to stdout.
void dbug_print (const Sid_map *sid_map, const char *text="") const
Cached_groupget_unsafe_pointer (int index) const

Detailed Description

Represents a group cache: either the statement group cache or the transaction group cache.


Member Enumeration Documentation

Adds a group to this Group_cache. The group should already have been written to the stmt or trx cache. The SIDNO and GNO fields are taken from @SESSION.GTID_NEXT.

Parameters:
thdThe THD object from which we read session variables.
binlog_lengthLength of group in binary log.
Return values:
EXTEND_EXISTING_GROUPThe last existing group had the same GTID and has been extended to include this group too.
APPEND_NEW_GROUPThe group has been appended to this cache.
ERRORAn error (out of memory) occurred. The error has been reported.

Member Function Documentation

bool Group_cache::contains_gtid ( const Gtid gtid) const

Return true if this Group_cache contains the given GTID.

Parameters:
gtidThe Gtid to check.
Return values:
trueThe group exists in this cache.
falseThe group does not exist in this cache.
void Group_cache::dbug_print ( const Sid_map sid_map,
const char *  text = "" 
) const [inline]

Print this Gtid_cache to the trace file if debug is enabled; no-op otherwise.

enum_return_status Group_cache::generate_automatic_gno ( THD *  thd)

Generates GNO for all groups that are committed for the first time in this Group_cache.

This acquires ownership of all groups. After this call, this Group_cache does not contain any Cached_groups that have type==GTID_GROUP and gno<=0.

Parameters:
thdThe THD that this Gtid_state belongs to.
Returns:
RETURN_STATUS_OK or RETURN_STATUS_REPORTED_ERROR
enum_return_status Group_cache::get_gtids ( Gtid_set gs) const

Add all GTIDs that exist in this Group_cache to the given Gtid_set.

Parameters:
gsThe Gtid_set to which groups are added.
Returns:
RETURN_STATUS_OK or RETURN_STATUS_REPORTED_ERROR.
size_t Group_cache::get_max_string_length ( ) const [inline]

Debug only: return an upper bound on the length of the string generated by to_string(). The actual length may be shorter.

Cached_group* Group_cache::get_unsafe_pointer ( int  index) const [inline]

Returns a pointer to the given group. The pointer is only valid until the next time a group is added or removed.

Parameters:
indexIndex of the element: 0 <= index < get_n_groups().
size_t Group_cache::to_string ( const Sid_map sm,
char *  buf 
) const [inline]

Debug only: store a textual representation of this Group_cache in the given buffer and return the length.

char* Group_cache::to_string ( const Sid_map sm) const [inline]

Debug only: generate a textual representation of this Group_cache and store in a newly allocated string. Return the string, or NULL on out of memory.

enum_return_status Group_cache::write_to_gtid_state ( ) const

Write all gtids in this cache to the global Gtid_state.

Returns:
RETURN_STATUS_OK or RETURN_STATUS_REPORTED_ERROR.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines