libs/mysql/gtids/readme.md
\page PageLibsMysqlGtids Library: Gtids
<!--- Copyright (c) 2025, Oracle and/or its affiliates. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the Free Software Foundation. // This program is designed to work with certain software (including but not limited to OpenSSL) that is licensed under separate terms, as designated in a particular file or component or in included license documentation. The authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the separately licensed software that they have either included with the program or referenced in the documentation. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, for more details. // You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --> <!-- MySQL Library: Gtids ==================== -->Code documentation: @ref GroupLibsMysqlGtids.
This library provides data structures for handling GTIDs:
Tag: The tag component of a GTID: an identifier of length 0...32 alphanumeric ascii characters.
Tsid: The transaction source identifier, consisting of the pair (uuid, tag).
(The UUID component is defined in the uuids library).
Sequence_number: the number component of a GTID.
Gtid: The pair (Tsid, Sequence_number).
Gtid_interval: an interval of sequence numbers, specified by the endpoints,
represented as a specialization of mysql::sets::Interval.
Gtid_interval_set: a set of Gtid_intervals, represented as a specialization of
mysql::sets::Map_interval_container.
Gtid_set: A set of GTIDs, represented as a specialization of
mysql::sets::Nested_set. This supports all operations provided by nested
sets in the sets library. See the unittest gtids_example-t.cc for example
usage.
The types in this class can be encoded into strings using four formats: Text, Binary v0, Binary v1, and Binary v2.
The text format should be used when these objects are presented to users. The binary formats should be preferred otherwise.
If the decoder is given a buffer in any of the Binary formats, it detects which of the formats is used by inspecting the buffer. The encoder will automatically choose Binary v0 for sets that do not have tags and Binary v1 for sets that have tags; it will never use Binary v2. We introduced the decoder for Binary v2 before we enabled the encoder for Binary v2, so that we can later switch to Binary v2 without breaking cross-version compatibility.
The text format represents each object type as follows:
The Binary v0 format can not represent tags, and is only used for backward compatibility. It represents each object type as follows:
The Binary v1 format can represent all object types. It represents each object type as follows:
The Binary v2 format can represent all object types, and is more space-effective than the other formats. It represents each object type as follows:
mysql_serialization
library).