MySQL  8.0.17
Source Code Documentation
control_events.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 /**
24  @addtogroup Replication
25  @{
26 
27  @file control_events.h
28 
29  @brief Contains the classes representing events operating in the replication
30  stream properties. Each event is represented as a byte sequence with logical
31  divisions as event header, event specific data and event footer. The header
32  and footer are common to all the events and are represented as two different
33  subclasses.
34 */
35 
36 #ifndef CONTROL_EVENT_INCLUDED
37 #define CONTROL_EVENT_INCLUDED
38 
39 #include <sys/types.h>
40 #include <time.h>
41 #include <list>
42 #include <map>
43 #include <vector>
44 
45 #include "binlog_event.h"
46 #include "template_utils.h"
47 #include "uuid.h"
48 
49 namespace binary_log {
50 /**
51  @class Rotate_event
52 
53  When a binary log file exceeds a size limit, a ROTATE_EVENT is written
54  at the end of the file that points to the next file in the squence.
55  This event is information for the slave to know the name of the next
56  binary log it is going to receive.
57 
58  ROTATE_EVENT is generated locally and written to the binary log
59  on the master. It is written to the relay log on the slave when FLUSH LOGS
60  occurs, and when receiving a ROTATE_EVENT from the master.
61  In the latter case, there will be two rotate events in total originating
62  on different servers.
63 
64  @section Rotate_event_binary_format Binary Format
65 
66  <table>
67  <caption>Post-Header for Rotate_event</caption>
68 
69  <tr>
70  <th>Name</th>
71  <th>Format</th>
72  <th>Description</th>
73  </tr>
74 
75  <tr>
76  <td>position</td>
77  <td>8 byte integer</td>
78  <td>The position within the binary log to rotate to.</td>
79  </tr>
80 
81  </table>
82 
83  The Body has one component:
84 
85  <table>
86  <caption>Body for Rotate_event</caption>
87 
88  <tr>
89  <th>Name</th>
90  <th>Format</th>
91  <th>Description</th>
92  </tr>
93 
94  <tr>
95  <td>new_log_ident</td>
96  <td>variable length string without trailing zero, extending to the
97  end of the event (determined by the length field of the
98  Common-Header)
99  </td>
100  <td>Name of the binlog to rotate to.</td>
101  </tr>
102 
103  </table>
104 */
106  public:
107  const char *new_log_ident;
108  size_t ident_len;
109  unsigned int flags;
110  uint64_t pos;
111 
112  enum {
113  /* Values taken by the flag member variable */
114  DUP_NAME = 2, // if constructor should dup the string argument
115  RELAY_LOG = 4 // rotate event for the relay log
116  };
117 
118  enum {
119  /* Rotate event post_header */
122  };
123 
124  /**
125  This is the minimal constructor, it will set the type code as ROTATE_EVENT.
126  */
127  Rotate_event(const char *new_log_ident_arg, size_t ident_len_arg,
128  unsigned int flags_arg, uint64_t pos_arg)
130  new_log_ident(new_log_ident_arg),
131  ident_len(ident_len_arg ? ident_len_arg : strlen(new_log_ident_arg)),
132  flags(flags_arg),
133  pos(pos_arg) {}
134 
135  /**
136  The layout of Rotate_event data part is as follows:
137 
138  <pre>
139  +-----------------------------------------------------------------------+
140  | common_header | post_header | position of the first event | file name |
141  +-----------------------------------------------------------------------+
142  </pre>
143 
144  @param buf Contains the serialized event.
145  @param fde An FDE event, used to get the following information:
146  -binlog_version
147  -server_version
148  -post_header_len
149  -common_header_len
150  The content of this object depends on the binlog-version
151  currently in use.
152  */
153  Rotate_event(const char *buf, const Format_description_event *fde);
154 
155 #ifndef HAVE_MYSYS
156  void print_event_info(std::ostream &);
157  void print_long_info(std::ostream &);
158 #endif
159 
161  if (flags & DUP_NAME) bapi_free(const_cast<char *>(new_log_ident));
162  }
163 };
164 
165 /**
166  @class Format_description_event
167  For binlog version 4.
168  This event is saved by threads which read it, as they need it for future
169  use (to decode the ordinary events).
170 
171  @section Format_description_event_binary_format Binary Format
172 
173  The Post-Header has six components:
174 
175  <table>
176  <caption>Post-Header for Format_description_event</caption>
177 
178  <tr>
179  <th>Name</th>
180  <th>Format</th>
181  <th>Description</th>
182  </tr>
183 
184  <tr>
185  <td>created</td>
186  <td>4 byte unsigned integer</td>
187  <td>The creation timestamp, if non-zero,
188  is the time in seconds when this event was created</td>
189  </tr>
190  <tr>
191  <td>binlog_version</td>
192  <td>2 byte unsigned integer</td>
193  <td>This is 1 in MySQL 3.23 and 3 in MySQL 4.0 and 4.1
194  (In MySQL 5.0 and up, FORMAT_DESCRIPTION_EVENT is
195  used instead of START_EVENT_V3 and for them its 4).</td>
196  </tr>
197  <tr>
198  <td>server_version</td>
199  <td>char array of 50 bytes</td>
200  <td>The MySQL server's version (example: 4.0.14-debug-log),
201  padded with 0x00 bytes on the right</td>
202  </tr>
203  <tr>
204  <td>common_header_len</td>
205  <td>1 byte unsigned integer</td>
206  <td>The length of the event header. This value includes the extra_headers
207  field, so this header length - 19 yields the size
208  of the extra_headers field.</td>
209  </tr>
210  <tr>
211  <td>post_header_len</td>
212  <td>array of type 1 byte unsigned integer</td>
213  <td>The lengths for the fixed data part of each event</td>
214  </tr>
215  <tr>
216  <td>server_version_split</td>
217  <td>unsigned char array</td>
218  <td>Stores the server version of the server
219  and splits them in three parts</td>
220  </tr>
221  <tr>
222  <td>number_of_event_types</td>
223  <td>1 byte unsigned integer</td>
224  <td>number of event types present in the server</td>
225  </tr>
226  </table>
227 */
229  public:
230  /**
231  If this event is at the start of the first binary log since server
232  startup 'created' should be the timestamp when the event (and the
233  binary log) was created. In the other case (i.e. this event is at
234  the start of a binary log created by FLUSH LOGS or automatic
235  rotation), 'created' should be 0. This "trick" is used by MySQL
236  >=4.0.14 slaves to know whether they must drop stale temporary
237  tables and whether they should abort unfinished transaction.
238 
239  Note that when 'created'!=0, it is always equal to the event's
240  timestamp; indeed Format_description_event is written only in binlog.cc
241  where the first constructor below is called, in which 'created' is set to
242  'when'. So in fact 'created' is a useless variable. When it is 0 we can
243  read the actual value from timestamp ('when') and when it is non-zero we
244  can read the same value from timestamp
245  ('when'). Conclusion:
246  - we use timestamp to print when the binlog was created.
247  - we use 'created' only to know if this is a first binlog or not.
248  */
249  time_t created;
250  uint16_t binlog_version;
252  /*
253  We set this to 1 if we don't want to have the created time in the log,
254  which is the case when we rollover to a new log.
255  */
257 
258  /**
259  The size of the fixed header which _all_ events have
260  (for binlogs written by this version, this is equal to
261  LOG_EVENT_HEADER_LEN), except FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT
262  (those have a header of size LOG_EVENT_MINIMAL_HEADER_LEN).
263  */
265  /*
266  The list of post-headers' lengths followed
267  by the checksum alg decription byte
268  */
269  std::vector<uint8_t> post_header_len;
271 
272  /**
273  Format_description_event 1st constructor.
274 
275  This constructor can be used to create the event to write to the binary log
276  (when the server starts or when FLUSH LOGS)
277 
278  @param binlog_ver the binlog version for which we want to build
279  an event. It should only be 4, old versions are not compatible anymore
280  since 8.0.2.
281  @param server_ver The MySQL server's version.
282  */
283  Format_description_event(uint8_t binlog_ver, const char *server_ver);
284  /**
285  The layout of Format_description_event data part is as follows:
286 
287  <pre>
288  +=====================================+
289  | event | binlog_version 19 : 2 | = 4
290  | data +----------------------------+
291  | | server_version 21 : 50 |
292  | +----------------------------+
293  | | create_timestamp 71 : 4 |
294  | +----------------------------+
295  | | header_length 75 : 1 |
296  | +----------------------------+
297  | | post-header 76 : n | = array of n bytes, one byte
298  | | lengths for all | per event type that the
299  | | event types | server knows about
300  +=====================================+
301  </pre>
302  @param buf Contains the serialized event.
303  @param fde An FDE event (see Rotate_event constructor for more info).
304 
305  @note The fde passed to this constructor was created through another
306  constructor of FDE class.
307  */
308  Format_description_event(const char *buf,
309  const Format_description_event *fde);
310 
313  default;
315  /**
316  This method is used to find out the version of server that originated
317  the current FD instance.
318 
319  @return the version of server.
320  */
321  unsigned long get_product_version() const;
322  /**
323  This method checks the MySQL version to determine whether checksums may be
324  present in the events contained in the binary log.
325 
326  @retval true if the event's version is earlier than one that introduced
327  the replication event checksum.
328  @retval false otherwise.
329  */
330  bool is_version_before_checksum() const;
331  /**
332  This method populates the array server_version_split which is then used for
333  lookups to find if the server which created this event has some known bug.
334  */
336 #ifndef HAVE_MYSYS
337  void print_event_info(std::ostream &info);
338  void print_long_info(std::ostream &info);
339 #endif
341 
342  bool header_is_valid() const {
344  (!post_header_len.empty()));
345  }
346 
347  bool version_is_valid() const {
348  /* It is invalid only when all version numbers are 0 */
349  return server_version_split[0] != 0 || server_version_split[1] != 0 ||
350  server_version_split[2] != 0;
351  }
352 };
353 
354 /**
355  @class Stop_event
356 
357  A stop event is written to the log files under these circumstances:
358  - A master writes the event to the binary log when it shuts down.
359  - A slave writes the event to the relay log when it shuts down or
360  when a RESET SLAVE statement is executed.
361 
362  @section Stop_event_binary_format Binary Format
363 
364  The Post-Header and Body for this event type are empty; it only has
365  the Common-Header.
366 */
367 
368 class Stop_event : public Binary_log_event {
369  public:
370  /**
371  It is the minimal constructor, and all it will do is set the type_code as
372  STOP_EVENT in the header object in Binary_log_event.
373  */
375 
376  /**
377  A Stop_event is occurs under these circumstances:
378  - A master writes the event to the binary log when it shuts down
379  - A slave writes the event to the relay log when it shuts down or when a
380  RESET SLAVE statement is executed
381  @param buf Contains the serialized event.
382  @param fde An FDE event (see Rotate_event constructor for more info).
383  */
384  Stop_event(const char *buf, const Format_description_event *fde);
385 
386 #ifndef HAVE_MYSYS
387  void print_event_info(std::ostream &) {}
388  void print_long_info(std::ostream &info);
389 #endif
390 };
391 
392 /**
393  @class Incident_event
394 
395  Class representing an incident, an occurance out of the ordinary,
396  that happened on the master.
397 
398  The event is used to inform the slave that something out of the
399  ordinary happened on the master that might cause the database to be
400  in an inconsistent state.
401 
402  @section Incident_event_binary_format Binary Format
403 
404  <table id="IncidentFormat">
405  <caption>Incident event format</caption>
406  <tr>
407  <th>Symbol</th>
408  <th>Format</th>
409  <th>Description</th>
410  </tr>
411  <tr>
412  <td>INCIDENT</td>
413  <td align="right">2</td>
414  <td>Incident number as an unsigned integer</td>
415  </tr>
416  <tr>
417  <td>MSGLEN</td>
418  <td align="right">1</td>
419  <td>Message length as an unsigned integer</td>
420  </tr>
421  <tr>
422  <td>MESSAGE</td>
423  <td align="right">MSGLEN</td>
424  <td>The message, if present. Not null terminated.</td>
425  </tr>
426  </table>
427 
428 */
430  public:
431  /**
432  Enumeration of the incidents that can occur for the server.
433  */
435  /** No incident */
437  /** There are possibly lost events in the replication stream */
439  /** Shall be last event of the enumeration */
441  };
442 
444  char *get_message() { return message; }
445 
446  /**
447  This will create an Incident_event with an empty message and set the
448  type_code as INCIDENT_EVENT in the header object in Binary_log_event.
449  */
450  explicit Incident_event(enum_incident incident_arg)
452  incident(incident_arg),
453  message(nullptr),
454  message_length(0) {}
455 
456  /**
457  Constructor of Incident_event
458  The buffer layout is as follows:
459  <pre>
460  +-----------------------------------------------------+
461  | Incident_number | message_length | Incident_message |
462  +-----------------------------------------------------+
463  </pre>
464 
465  Incident number codes are listed in binlog_evnet.h.
466  The only code currently used is INCIDENT_LOST_EVENTS, which indicates that
467  there may be lost events (a "gap") in the replication stream that requires
468  databases to be resynchronized.
469 
470  @param buf Contains the serialized event.
471  @param fde An FDE event (see Rotate_event constructor for more info).
472  */
473  Incident_event(const char *buf, const Format_description_event *fde);
474 #ifndef HAVE_MYSYS
475  void print_event_info(std::ostream &info);
476  void print_long_info(std::ostream &info);
477 #endif
478  protected:
480  char *message;
482 };
483 
484 /**
485  @class Xid_event
486 
487  An XID event is generated for a commit of a transaction that modifies one or
488  more tables of an XA-capable storage engine.
489 
490  @section Xid_event_binary_format Binary Format
491 
492 The Body has the following component:
493 
494  <table>
495  <caption>Body for Xid_event</caption>
496 
497  <tr>
498  <th>Name</th>
499  <th>Format</th>
500  <th>Description</th>
501  </tr>
502 
503  <tr>
504  <td>xid</td>
505  <td>8 byte unsigned integer</td>
506  <td>The XID transaction number.</td>
507  </tr>
508  </table>
509  The Post-Header and Body for this event type are empty; it only has
510  the common header.
511 */
512 class Xid_event : public Binary_log_event {
513  public:
514  /**
515  The minimal constructor of Xid_event, it initializes the instance variable
516  xid and set the type_code as XID_EVENT in the header object in
517  Binary_log_event
518  */
519  explicit Xid_event(uint64_t xid_arg)
520  : Binary_log_event(XID_EVENT), xid(xid_arg) {}
521 
522  /**
523  An XID event is generated for a commit of a transaction that modifies one or
524  more tables of an XA-capable storage engine
525  @param buf Contains the serialized event.
526  @param fde An FDE event (see Rotate_event constructor for more info).
527  */
528  Xid_event(const char *buf, const Format_description_event *fde);
529  uint64_t xid;
530 #ifndef HAVE_MYSYS
531  void print_event_info(std::ostream &info);
532  void print_long_info(std::ostream &info);
533 #endif
534 };
535 
536 /**
537  @class XA_prepare_event
538 
539  An XA_prepare event is generated for a XA prepared transaction.
540  Like Xid_event it contans XID of the *prepared* transaction.
541 
542  @section XA_prepare_event_binary_format Binary Format
543 
544 The Body has the following component:
545 
546  <table>
547  <caption>Body for XA_prepare_event</caption>
548 
549  <tr>
550  <th>Name</th>
551  <th>Format</th>
552  <th>Description</th>
553  </tr>
554 
555  <tr>
556  <td>my_xid</td>
557  <td>a struct similar to mysql/plugin.h containing three members.</td>
558  <td>serialized XID representation of XA transaction.</td>
559  </tr>
560 
561  <tr>
562  <td>xid</td>
563  <td>a pointer to XID object.</td>
564  <td>a reference to an object for mysql logger.</td>
565  </tr>
566 
567  <tr>
568  <td>one_phase</td>
569  <td>a bool</td>
570  <td>the value specifies the current XA transaction commit method.</td>
571  </tr>
572  </table>
573  The Post-Header and Body for this event type are empty; it only has
574  the common header.
575 */
576 
578  /*
579  Struct def is copied from $MYSQL/include/mysql/plugin.h,
580  consult there about fine details.
581  */
582  static const int MY_XIDDATASIZE = 128;
583 
584  struct MY_XID {
585  long formatID;
588  char data[MY_XIDDATASIZE]; /* Not \0-terminated */
589  };
590 
591  protected:
592  /* size of serialization buffer is explained in $MYSQL/sql/xa.h. */
593  static const uint16_t ser_buf_size =
594  8 + 2 * MY_XIDDATASIZE + 4 * sizeof(long) + 1;
596  void *xid; /* Master side only */
597  bool one_phase;
598 
599  public:
600  /**
601  The minimal constructor of XA_prepare_event, it initializes the
602  instance variable xid and set the type_code as XID_EVENT in the
603  header object in Binary_log_event
604  */
605  XA_prepare_event(void *xid_arg, bool oph_arg)
607  xid(xid_arg),
608  one_phase(oph_arg) {}
609 
610  /**
611  An XID event is generated for a commit of a transaction that modifies one or
612  more tables of an XA-capable storage engine
613  @param buf Contains the serialized event.
614  @param fde An FDE event (see Rotate_event constructor for more info).
615  */
616  XA_prepare_event(const char *buf, const Format_description_event *fde);
617 #ifndef HAVE_MYSYS
618  /*
619  todo: we need to find way how to exploit server's code of
620  serialize_xid()
621  */
622  void print_event_info(std::ostream &) {}
623  void print_long_info(std::ostream &) {}
624 #endif
625 };
626 
627 /**
628  @class Ignorable_event
629 
630  Base class for ignorable log events. Events deriving from
631  this class can be safely ignored by slaves that cannot
632  recognize them. Newer slaves, will be able to read and
633  handle them. This has been designed to be an open-ended
634  architecture, so adding new derived events shall not harm
635  the old slaves that support ignorable log event mechanism
636  (they will just ignore unrecognized ignorable events).
637 
638  @note The only thing that makes an event ignorable is that it has
639  the LOG_EVENT_IGNORABLE_F flag set. It is not strictly necessary
640  that ignorable event types derive from Ignorable_event; they may
641  just as well derive from Binary_log_event and Log_event and pass
642  LOG_EVENT_IGNORABLE_F as argument to the Log_event constructor.
643 
644  @section Ignoarble_event_binary_format Binary format
645 
646  The Post-Header and Body for this event type are empty; it only has
647  the Common-Header.
648 */
650  public:
651  // buf is advanced in Binary_log_event constructor to point to beginning of
652  // post-header
653 
654  /**
655  The minimal constructor and all it will do is set the type_code as
656  IGNORABLE_LOG_EVENT in the header object in Binary_log_event.
657  */
659  : Binary_log_event(type_arg) {}
660  /**
661  @param buf Contains the serialized event.
662  @param fde An FDE event (see Rotate_event constructor for more info).
663  */
664  Ignorable_event(const char *buf, const Format_description_event *fde);
665 #ifndef HAVE_MYSYS
666  void print_event_info(std::ostream &) {}
667  void print_long_info(std::ostream &) {}
668 #endif
669 };
670 
671 /**
672  @struct gtid_info
673  Structure to hold the members declared in the class Gtid_log_event those
674  member are objects of classes defined in server(rpl_gtid.h). As we can not
675  move all the classes defined there(in rpl_gtid.h) in libbinlogevents so this
676  structure was created, to provide a way to map the decoded value in Gtid_event
677  ctor and the class members defined in rpl_gtid.h, these classes are also the
678  members of Gtid_log_event(subclass of this in server code)
679 
680  The structure contains the following components.
681  <table>
682  <caption>Structure gtid_info</caption>
683 
684  <tr>
685  <th>Name</th>
686  <th>Format</th>
687  <th>Description</th>
688  </tr>
689  <tr>
690  <td>rpl_gtid_sidno</td>
691  <td>4 bytes integer</td>
692  <td>SIDNO (source ID number, first component of GTID)</td>
693  </tr>
694  <tr>
695  <td>rpl_gtid_gno</td>
696  <td>8 bytes integer</td>
697  <td>GNO (group number, second component of GTID)</td>
698  </tr>
699  </table>
700 */
701 struct gtid_info {
702  int32_t rpl_gtid_sidno;
703  int64_t rpl_gtid_gno;
704 };
705 
706 /**
707  @class Gtid_event
708  GTID stands for Global Transaction IDentifier
709  It is composed of two parts:
710  - SID for Source Identifier, and
711  - GNO for Group Number.
712  The basic idea is to
713  - Associate an identifier, the Global Transaction IDentifier or GTID,
714  to every transaction.
715  - When a transaction is copied to a slave, re-executed on the slave,
716  and written to the slave's binary log, the GTID is preserved.
717  - When a slave connects to a master, the slave uses GTIDs instead of
718  (file, offset)
719 
720  @section Gtid_event_binary_format Binary Format
721 
722  The Body can have up to nine components:
723 
724  <table>
725  <caption>Body for Gtid_event</caption>
726 
727  <tr>
728  <th>Name</th>
729  <th>Format</th>
730  <th>Description</th>
731  </tr>
732 
733  <tr>
734  <td>GTID_FLAGS</td>
735  <td>1 byte</td>
736  <td>00000001 = Transaction may have changes logged with SBR.
737  In 5.6, 5.7.0-5.7.18, and 8.0.0-8.0.1, this flag is always set.
738  Starting in 5.7.19 and 8.0.2, this flag is cleared if the transaction
739  only contains row events. It is set if any part of the transaction is
740  written in statement format.</td>
741  </tr>
742  <tr>
743  <td>SID</td>
744  <td>16 byte sequence</td>
745  <td>UUID representing the SID</td>
746  </tr>
747  <tr>
748  <td>GNO</td>
749  <td>8 byte integer</td>
750  <td>Group number, second component of GTID.</td>
751  </tr>
752  <tr>
753  <td>logical clock timestamp typecode</td>
754  <td>1 byte integer</td>
755  <td>The type of logical timestamp used in the logical clock fields.</td>
756  </tr>
757  <tr>
758  <td>last_committed</td>
759  <td>8 byte integer</td>
760  <td>Store the transaction's commit parent sequence_number</td>
761  </tr>
762  <tr>
763  <td>sequence_number</td>
764  <td>8 byte integer</td>
765  <td>The transaction's logical timestamp assigned at prepare phase</td>
766  </tr>
767  <tr>
768  <td>immediate_commit_timestamp</td>
769  <td>7 byte integer</td>
770  <td>Timestamp of commit on the immediate master</td>
771  </tr>
772  <tr>
773  <td>original_commit_timestamp</td>
774  <td>7 byte integer</td>
775  <td>Timestamp of commit on the originating master</td>
776  </tr>
777  <tr>
778  <td>transaction_length</td>
779  <td>1 to 9 byte integer // See net_length_size(ulonglong num)</td>
780  <td>The packed transaction's length in bytes, including the Gtid</td>
781  </tr>
782  <tr>
783  <td>immediate_server_version</td>
784  <td>4 byte integer</td>
785  <td>Server version of the immediate server</td>
786  </tr>
787  <tr>
788  <td>original_server_version</td>
789  <td>4 byte integer</td>
790  <td>Version of the server where the transaction was originally executed</td>
791  </tr>
792  </table>
793 
794 */
795 class Gtid_event : public Binary_log_event {
796  public:
797  /*
798  The transaction's logical timestamps used for MTS: see
799  Transaction_ctx::last_committed and
800  Transaction_ctx::sequence_number for details.
801  Note: Transaction_ctx is in the MySQL server code.
802  */
803  long long int last_committed;
804  long long int sequence_number;
805  /** GTID flags constants */
806  unsigned const char FLAG_MAY_HAVE_SBR = 1;
807  /** Transaction might have changes logged with SBR */
809  /** Timestamp when the transaction was committed on the originating master. */
810  unsigned long long int original_commit_timestamp;
811  /** Timestamp when the transaction was committed on the nearest master. */
812  unsigned long long int immediate_commit_timestamp;
814  /** The length of the transaction in bytes. */
815  unsigned long long int transaction_length;
816 
817  public:
818  /**
819  Ctor of Gtid_event
820 
821  The layout of the buffer is as follows
822  <pre>
823  +----------+---+---+-------+--------------+---------+----------+
824  |gtid flags|SID|GNO|TS_TYPE|logical ts(:s)|commit ts|trx length|
825  +----------+---+---+-------+------------------------+----------+
826  </pre>
827  TS_TYPE is from {G_COMMIT_TS2} singleton set of values
828  Details on commit timestamps in Gtid_event(const char*...)
829 
830  @param buf Contains the serialized event.
831  @param fde An FDE event (see Rotate_event constructor for more info).
832  */
833 
834  Gtid_event(const char *buf, const Format_description_event *fde);
835  /**
836  Constructor.
837  */
838  explicit Gtid_event(long long int last_committed_arg,
839  long long int sequence_number_arg,
840  bool may_have_sbr_stmts_arg,
841  unsigned long long int original_commit_timestamp_arg,
842  unsigned long long int immediate_commit_timestamp_arg,
843  uint32_t original_server_version_arg,
844  uint32_t immediate_server_version_arg)
846  last_committed(last_committed_arg),
847  sequence_number(sequence_number_arg),
848  may_have_sbr_stmts(may_have_sbr_stmts_arg),
849  original_commit_timestamp(original_commit_timestamp_arg),
850  immediate_commit_timestamp(immediate_commit_timestamp_arg),
852  original_server_version(original_server_version_arg),
853  immediate_server_version(immediate_server_version_arg) {}
854 #ifndef HAVE_MYSYS
855  // TODO(WL#7684): Implement the method print_event_info and print_long_info
856  // for all the events supported in MySQL Binlog
857  void print_event_info(std::ostream &) {}
858  void print_long_info(std::ostream &) {}
859 #endif
860  protected:
861  static const int ENCODED_FLAG_LENGTH = 1;
862  static const int ENCODED_SID_LENGTH = 16; // Uuid::BYTE_LENGTH;
863  static const int ENCODED_GNO_LENGTH = 8;
864  /// Length of typecode for logical timestamps.
865  static const int LOGICAL_TIMESTAMP_TYPECODE_LENGTH = 1;
866  /// Length of two logical timestamps.
867  static const int LOGICAL_TIMESTAMP_LENGTH = 16;
868  // Type code used before the logical timestamps.
869  static const int LOGICAL_TIMESTAMP_TYPECODE = 2;
870 
871  static const int IMMEDIATE_COMMIT_TIMESTAMP_LENGTH = 7;
872  static const int ORIGINAL_COMMIT_TIMESTAMP_LENGTH = 7;
873  // Length of two timestamps (from original/immediate masters)
874  static const int FULL_COMMIT_TIMESTAMP_LENGTH =
876  // We use 7 bytes out of which 1 bit is used as a flag.
877  static const int ENCODED_COMMIT_TIMESTAMP_LENGTH = 55;
878  // Minimum and maximum lengths of transaction length field.
879  static const int TRANSACTION_LENGTH_MIN_LENGTH = 1;
880  static const int TRANSACTION_LENGTH_MAX_LENGTH = 9;
881  /// Length of original_server_version
882  static const int ORIGINAL_SERVER_VERSION_LENGTH = 4;
883  /// Length of immediate_server_version
884  static const int IMMEDIATE_SERVER_VERSION_LENGTH = 4;
885  /// Length of original and immediate server version
886  static const int FULL_SERVER_VERSION_LENGTH =
888  // We use 4 bytes out of which 1 bit is used as a flag.
889  static const int ENCODED_SERVER_VERSION_LENGTH = 31;
890 
891  /* We have only original commit timestamp if both timestamps are equal. */
896  }
897 
898  /**
899  We only store the immediate_server_version if both server versions are the
900  same.
901  */
906  }
907 
910 
911  /* Minimum GNO expected in a serialized GTID event */
912  static const int64_t MIN_GNO = 1;
913  /* Maximum GNO expected in a serialized GTID event */
914  static const int64_t MAX_GNO = LLONG_MAX;
915 
916  public:
917  /// Total length of post header
918  static const int POST_HEADER_LENGTH =
919  ENCODED_FLAG_LENGTH + /* flags */
920  ENCODED_SID_LENGTH + /* SID length */
921  ENCODED_GNO_LENGTH + /* GNO length */
922  LOGICAL_TIMESTAMP_TYPECODE_LENGTH + /* length of typecode */
923  LOGICAL_TIMESTAMP_LENGTH; /* length of two logical timestamps */
924 
925  /*
926  We keep the commit timestamps in the body section because they can be of
927  variable length.
928  On the originating master, the event has only one timestamp as the two
929  timestamps are equal. On every other server we have two timestamps.
930  */
934  static const int MAX_EVENT_LENGTH =
936  /**
937  Set the transaction length information.
938 
939  This function should be used when the full transaction length (including
940  the Gtid event length) is known.
941 
942  @param transaction_length_arg The transaction length.
943  */
944  void set_trx_length(unsigned long long int transaction_length_arg) {
945  transaction_length = transaction_length_arg;
946  }
947 
948  /** The version of the server where the transaction was originally executed */
950  /** The version of the immediate server */
952 };
953 
954 /**
955  @class Previous_gtids_event
956 
957  @section Previous_gtids_event_binary_format Binary Format
958 
959  The Post-Header for this event type is empty. The Body has two
960  components:
961 
962  <table>
963  <caption>Body for Previous_gtids_event</caption>
964 
965  <tr>
966  <th>Name</th>
967  <th>Format</th>
968  <th>Description</th>
969  </tr>
970 
971  <tr>
972  <td>buf</td>
973  <td>unsigned char array</td>
974  <td>It contains the Gtids executed in the
975  last binary log file.</td>
976  </tr>
977 
978  <tr>
979  <td>buf_size</td>
980  <td>4 byte integer</td>
981  <td>Size of the above buffer</td>
982  </tr>
983  </table>
984 */
986  public:
987  /**
988  Decodes the gtid_executed in the last binlog file
989 
990  <pre>
991  The buffer layout is as follows
992  +--------------------------------------------+
993  | Gtids executed in the last binary log file |
994  +--------------------------------------------+
995  </pre>
996  @param buf Contains the serialized event.
997  @param fde An FDE event (see Rotate_event constructor for more info).
998  */
999  Previous_gtids_event(const char *buf, const Format_description_event *fde);
1000  /**
1001  This is the minimal constructor, and set the
1002  type_code as PREVIOUS_GTIDS_LOG_EVENT in the header object in
1003  Binary_log_event
1004  */
1006 #ifndef HAVE_MYSYS
1007  // TODO(WL#7684): Implement the method print_event_info and print_long_info
1008  // for all the events supported in MySQL Binlog
1009  void print_event_info(std::ostream &) {}
1010  void print_long_info(std::ostream &) {}
1011 #endif
1012  protected:
1013  size_t buf_size;
1014  const unsigned char *buf;
1015 };
1016 
1017 /**
1018  @class Transaction_context_event
1019 
1020  This class is used to combine the information of the ongoing transaction
1021  including the write set and other information of the thread executing the
1022  transaction.
1023 
1024  <tr>
1025  <th>Name</th>
1026  <th>Format</th>
1027  <th>Description</th>
1028  </tr>
1029 
1030  <tr>
1031  <td>thread_id</td>
1032  <td>4 byte integer</td>
1033  <td>The identifier for the thread executing the transaction.</td>
1034  </tr>
1035 
1036  <tr>
1037  <td>gtid_specified</td>
1038  <td>bool type variable</td>
1039  <td>Variable to identify whether the Gtid have been specified for the
1040  ongoing transaction or not.
1041  </td>
1042  </tr>
1043 
1044  <tr>
1045  <td>encoded_snapshot_version</td>
1046  <td>unsigned char array</td>
1047  <td>A gtid_set which is used to store the transaction set used for
1048  conflict detection.</td>
1049  </tr>
1050 
1051  <tr>
1052  <td>encoded_snapshot_version_length</td>
1053  <td>4 byte integer</td>
1054  <td>Length of the above char array.</td>
1055  </tr>
1056 
1057  <tr>
1058  <td>write_set</td>
1059  <td>variable length list to store the hash values. </td>
1060  <td>Used to store the hash values of the rows identifier for the rows
1061  which have changed in the ongoing transaction.
1062  </td>
1063  </tr>
1064 
1065  <tr>
1066  <td>read_set</td>
1067  <td>variable length list to store the read set values. Currently empty.
1068  </td> <td>Will be used to store the read set values of the current
1069  transaction.</td>
1070  </tr>
1071 
1072 */
1074  public:
1075  /**
1076  Decodes the transaction_context_log_event of the ongoing transaction.
1077 
1078  <pre>
1079  The buffer layout is as follows
1080  </pre>
1081 
1082  @param buf Contains the serialized event.
1083  @param fde An FDE event (see Rotate_event constructor for more info).
1084  */
1085  Transaction_context_event(const char *buf,
1086  const Format_description_event *fde);
1087 
1088  Transaction_context_event(unsigned int thread_id_arg,
1089  bool is_gtid_specified_arg)
1091  thread_id(thread_id_arg),
1092  gtid_specified(is_gtid_specified_arg) {}
1093 
1094  virtual ~Transaction_context_event();
1095 
1096  static const char *read_data_set(const char *pos, uint32_t set_len,
1097  std::list<const char *> *set,
1098  uint32_t remaining_buffer);
1099 
1100  static void clear_set(std::list<const char *> *set);
1101 
1102 #ifndef HAVE_MYSYS
1103  void print_event_info(std::ostream &) {}
1104  void print_long_info(std::ostream &) {}
1105 #endif
1106 
1107  protected:
1108  const char *server_uuid;
1109  uint32_t thread_id;
1111  const unsigned char *encoded_snapshot_version;
1113  std::list<const char *> write_set;
1114  std::list<const char *> read_set;
1115 
1116  // The values mentioned on the next class constants is the offset where the
1117  // data that will be copied in the buffer.
1118 
1119  // 1 byte length.
1120  static const int ENCODED_SERVER_UUID_LEN_OFFSET = 0;
1121  // 4 bytes length.
1122  static const int ENCODED_THREAD_ID_OFFSET = 1;
1123  // 1 byte length.
1124  static const int ENCODED_GTID_SPECIFIED_OFFSET = 5;
1125  // 4 bytes length
1127  // 4 bytes length.
1128  static const int ENCODED_WRITE_SET_ITEMS_OFFSET = 10;
1129  // 4 bytes length.
1130  static const int ENCODED_READ_SET_ITEMS_OFFSET = 14;
1131 
1132  // The values mentioned on the next class's constants is the length of the
1133  // data that will be copied in the buffer.
1134  static const int ENCODED_READ_WRITE_SET_ITEM_LEN = 2;
1135  static const int ENCODED_SNAPSHOT_VERSION_LEN = 2;
1136 };
1137 
1138 /**
1139  @class View_change_event
1140 
1141  This class is used to add view change markers in the binary log when a
1142  member of the group enters or leaves the group.
1143 
1144  <tr>
1145  <th>Name</th>
1146  <th>Format</th>
1147  <th>Description</th>
1148  </tr>
1149 
1150  <tr>
1151  <td>view_id</td>
1152  <td>40 length character array</td>
1153  <td>This is used to store the view id value of the new view change when a
1154  node add or leaves the group.
1155  </td>
1156  </tr>
1157 
1158  <tr>
1159  <td>seq_number</td>
1160  <td>8 bytes integer</td>
1161  <td>Variable to identify the next sequence number to be alloted to the
1162  certified transaction.</td>
1163  </tr>
1164 
1165  <tr>
1166  <td>certification_info</td>
1167  <td>variable length map to store the certification data.</td>
1168  <td>Map to store the certification info ie. the hash of write_set and the
1169  snapshot sequence value.
1170  </td>
1171  </tr>
1172 
1173 */
1175  public:
1176  /**
1177  Decodes the view_change_log_event generated incase a server enters or
1178  leaves the group.
1179 
1180  <pre>
1181  The buffer layout is as follows
1182  </pre>
1183 
1184  @param buf Contains the serialized event.
1185  @param fde An FDE event (see Rotate_event constructor for more info).
1186  */
1187  View_change_event(const char *buf, const Format_description_event *fde);
1188 
1189  explicit View_change_event(const char *raw_view_id);
1190 
1191  virtual ~View_change_event();
1192 
1193 #ifndef HAVE_MYSYS
1194  void print_event_info(std::ostream &) {}
1195  void print_long_info(std::ostream &) {}
1196 #endif
1197 
1198  protected:
1199  // The values mentioned on the next class constants is the offset where the
1200  // data that will be copied in the buffer.
1201 
1202  // 40 bytes length.
1203  static const int ENCODED_VIEW_ID_OFFSET = 0;
1204  // 8 bytes length.
1205  static const int ENCODED_SEQ_NUMBER_OFFSET = 40;
1206  // 4 bytes length.
1207  static const int ENCODED_CERT_INFO_SIZE_OFFSET = 48;
1208 
1209  /*
1210  The layout of the buffer is as follows
1211  +--------------------- -+-------------+----------+
1212  | View Id | seq number | map size |
1213  +-----------------------+-------------+----------+
1214  view id (40 bytes) + seq number (8 bytes) + map size (4 bytes)
1215  Sum of the length of the values at the above OFFSETS.
1216  */
1217 
1218  // The values mentioned on the next class constants is the length of the data
1219  // that will be copied in the buffer.
1220 
1221  // Field sizes on serialization
1222  static const int ENCODED_VIEW_ID_MAX_LEN = 40;
1223  static const int ENCODED_CERT_INFO_KEY_SIZE_LEN = 2;
1224  static const int ENCODED_CERT_INFO_VALUE_LEN = 4;
1225 
1227 
1228  long long int seq_number;
1229 
1230  std::map<std::string, std::string> certification_info;
1231 };
1232 
1233 /**
1234  @class Heartbeat_event
1235 
1236  Replication event to ensure to slave that master is alive.
1237  The event is originated by master's dump thread and sent straight to
1238  slave without being logged. Slave itself does not store it in relay log
1239  but rather uses a data for immediate checks and throws away the event.
1240 
1241  Two members of the class log_ident and Binary_log_event::log_pos comprise
1242  @see the rpl_event_coordinates instance. The coordinates that a heartbeat
1243  instance carries correspond to the last event master has sent from
1244  its binlog.
1245 
1246  @section Heartbeat_event_binary_format Binary Format
1247 
1248  The Body has one component:
1249 
1250  <table>
1251  <caption>Body for Heartbeat_event</caption>
1252 
1253  <tr>
1254  <th>Name</th>
1255  <th>Format</th>
1256  <th>Description</th>
1257  </tr>
1258 
1259  <tr>
1260  <td>log_ident</td>
1261  <td>variable length string without trailing zero, extending to the
1262  end of the event</td>
1263  <td>Name of the current binlog being written to.</td>
1264  </tr>
1265  </table>
1266 */
1268  public:
1269  /**
1270  Sent by a master to a slave to let the slave know that the master is
1271  still alive. Events of this type do not appear in the binary or relay logs.
1272  They are generated on a master server by the thread that dumps events and
1273  sent straight to the slave without ever being written to the binary log.
1274 
1275  @param buf Contains the serialized event.
1276  @param fde An FDE event (see Rotate_event constructor for more info).
1277  */
1278  Heartbeat_event(const char *buf, const Format_description_event *fde);
1279 
1280  const char *get_log_ident() { return log_ident; }
1281  unsigned int get_ident_len() { return ident_len; }
1282 
1283  protected:
1284  const char *log_ident;
1285  unsigned int ident_len; /** filename length */
1286 };
1287 
1288 } // end namespace binary_log
1289 /**
1290  @} (end of group Replication)
1291 */
1292 #endif /* CONTROL_EVENTS_INCLUDED */
uint8_t number_of_event_types
Definition: control_events.h:314
This class is used to combine the information of the ongoing transaction including the write set and ...
Definition: control_events.h:1073
No incident.
Definition: control_events.h:436
static const int ENCODED_CERT_INFO_VALUE_LEN
Definition: control_events.h:1224
Base class for ignorable log events.
Definition: control_events.h:649
static const int ENCODED_READ_WRITE_SET_ITEM_LEN
Definition: control_events.h:1134
Rotate_event(const char *new_log_ident_arg, size_t ident_len_arg, unsigned int flags_arg, uint64_t pos_arg)
This is the minimal constructor, it will set the type code as ROTATE_EVENT.
Definition: control_events.h:127
static const int MAX_DATA_LENGTH
Definition: control_events.h:931
XA_prepare_event(void *xid_arg, bool oph_arg)
The minimal constructor of XA_prepare_event, it initializes the instance variable xid and set the typ...
Definition: control_events.h:605
Structure to hold the members declared in the class Gtid_log_event those member are objects of classe...
Definition: control_events.h:701
bool header_is_valid() const
Definition: control_events.h:342
t pos
Definition: dbug_analyze.cc:148
Definition: binlog_event.h:340
static const int FULL_SERVER_VERSION_LENGTH
Length of original and immediate server version.
Definition: control_events.h:886
Stop_event()
It is the minimal constructor, and all it will do is set the type_code as STOP_EVENT in the header ob...
Definition: control_events.h:374
static const int TRANSACTION_LENGTH_MAX_LENGTH
Definition: control_events.h:880
static const int POST_HEADER_LENGTH
Total length of post header.
Definition: control_events.h:918
static const int ENCODED_GTID_SPECIFIED_OFFSET
Definition: control_events.h:1124
uint8_t common_header_len
The size of the fixed header which all events have (for binlogs written by this version, this is equal to LOG_EVENT_HEADER_LEN), except FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT (those have a header of size LOG_EVENT_MINIMAL_HEADER_LEN).
Definition: control_events.h:264
enum_incident
Enumeration of the incidents that can occur for the server.
Definition: control_events.h:434
size_t message_length
Definition: control_events.h:481
static void clear_set(std::list< const char *> *set)
Function to clear the memory of the write_set and the read_set.
Definition: control_events.cpp:575
Definition: control_events.h:985
static const int FULL_COMMIT_TIMESTAMP_LENGTH
Definition: control_events.h:874
bool version_is_valid() const
Definition: control_events.h:347
char server_version[ST_SERVER_VER_LEN]
Definition: control_events.h:251
enum_incident get_incident_type()
Definition: control_events.h:443
long long int seq_number
Definition: control_events.h:1228
In some situations, it is necessary to send over ignorable data to the slave: data that a slave can h...
Definition: binlog_event.h:322
Contains the classes representing events occurring in the replication stream.
Replication event to ensure to slave that master is alive.
Definition: control_events.h:1267
static const int MY_XIDDATASIZE
Definition: control_events.h:582
static const uint16_t ser_buf_size
Definition: control_events.h:593
static const int LOGICAL_TIMESTAMP_TYPECODE
Definition: control_events.h:869
This is the abstract base class for binary log events.
Definition: binlog_event.h:785
unsigned char server_version_split[ST_SERVER_VER_SPLIT_LEN]
Definition: control_events.h:270
const char * server_uuid
Definition: control_events.h:1108
int get_commit_timestamp_length() const
Definition: control_events.h:892
static const int ENCODED_GNO_LENGTH
Definition: control_events.h:863
Definition: control_events.h:115
Definition: control_events.h:120
Transaction_context_event(const char *buf, const Format_description_event *fde)
Decodes the transaction_context_log_event of the ongoing transaction.
Definition: control_events.cpp:537
long bqual_length
Definition: control_events.h:587
~Rotate_event()
Definition: control_events.h:160
const char * get_log_ident()
Definition: control_events.h:1280
unsigned long long int transaction_length
The length of the transaction in bytes.
Definition: control_events.h:815
Log_event_type
Enumeration type for the different types of log events.
Definition: binlog_event.h:265
static const int ENCODED_CERT_INFO_SIZE_OFFSET
Definition: control_events.h:1207
static const int64_t MAX_GNO
Definition: control_events.h:914
char data[MY_XIDDATASIZE]
Definition: control_events.h:588
bool has_commit_timestamps
Definition: control_events.h:813
Something out of the ordinary happened on the master.
Definition: binlog_event.h:308
static const int ENCODED_WRITE_SET_ITEMS_OFFSET
Definition: control_events.h:1128
Gtid_event(const char *buf, const Format_description_event *fde)
Ctor of Gtid_event.
Definition: control_events.cpp:370
static const int ENCODED_SERVER_UUID_LEN_OFFSET
Definition: control_events.h:1120
unsigned const char FLAG_MAY_HAVE_SBR
GTID flags constants.
Definition: control_events.h:806
static const int ORIGINAL_SERVER_VERSION_LENGTH
Length of original_server_version.
Definition: control_events.h:882
uint32_t thread_id
Definition: control_events.h:1109
static const int MAX_EVENT_LENGTH
Definition: control_events.h:934
void calc_server_version_split()
This method populates the array server_version_split which is then used for lookups to find if the se...
Definition: control_events.cpp:167
Definition: control_events.h:121
gtid_info gtid_info_struct
Definition: control_events.h:908
An XA_prepare event is generated for a XA prepared transaction.
Definition: control_events.h:577
unsigned long get_product_version() const
This method is used to find out the version of server that originated the current FD instance...
Definition: control_events.cpp:176
const char * log_ident
Definition: control_events.h:1284
enum_incident incident
Definition: control_events.h:479
static const int64_t MIN_GNO
Definition: control_events.h:912
size_t ident_len
Definition: control_events.h:108
long long int sequence_number
Definition: control_events.h:804
static const int IMMEDIATE_SERVER_VERSION_LENGTH
Length of immediate_server_version.
Definition: control_events.h:884
static const int ENCODED_SNAPSHOT_VERSION_LEN_OFFSET
Definition: control_events.h:1126
static const int ENCODED_SNAPSHOT_VERSION_LEN
Definition: control_events.h:1135
uint16_t binlog_version
Definition: control_events.h:250
static const int ENCODED_SEQ_NUMBER_OFFSET
Definition: control_events.h:1205
bool may_have_sbr_stmts
Transaction might have changes logged with SBR.
Definition: control_events.h:808
bool is_version_before_checksum() const
This method checks the MySQL version to determine whether checksums may be present in the events cont...
Definition: control_events.cpp:188
When a binary log file exceeds a size limit, a ROTATE_EVENT is written at the end of the file that po...
Definition: control_events.h:105
Format_description_event & operator=(const Format_description_event &)=default
View_change_event(const char *buf, const Format_description_event *fde)
Decodes the view_change_log_event generated incase a server enters or leaves the group.
Definition: control_events.cpp:603
std::map< std::string, std::string > certification_info
Definition: control_events.h:1230
uint32_t original_server_version
The version of the server where the transaction was originally executed.
Definition: control_events.h:949
unsigned int flags
Definition: control_events.h:109
char * get_message()
Definition: control_events.h:444
static const int ENCODED_CERT_INFO_KEY_SIZE_LEN
Definition: control_events.h:1223
void * xid
Definition: control_events.h:596
Definition: binlog_event.h:292
char * message
Definition: control_events.h:480
Definition: binlog_event.h:281
std::list< const char * > write_set
Definition: control_events.h:1113
Class representing an incident, an occurance out of the ordinary, that happened on the master...
Definition: control_events.h:429
An XID event is generated for a commit of a transaction that modifies one or more tables of an XA-ca...
Definition: control_events.h:512
static const char * read_data_set(const char *pos, uint32_t set_len, std::list< const char *> *set, uint32_t remaining_buffer)
virtual ~View_change_event()
Destructor of the View_change_event class.
Definition: control_events.cpp:628
GTID stands for Global Transaction IDentifier It is composed of two parts:
Definition: control_events.h:795
const char * new_log_ident
Definition: control_events.h:107
const unsigned char * encoded_snapshot_version
Definition: control_events.h:1111
Definition: binlog_event.h:333
long gtrid_length
Definition: control_events.h:586
For binlog version 4.
Definition: control_events.h:228
unsigned long long int original_commit_timestamp
Timestamp when the transaction was committed on the originating master.
Definition: control_events.h:810
static const int LOGICAL_TIMESTAMP_LENGTH
Length of two logical timestamps.
Definition: control_events.h:867
void set_trx_length(unsigned long long int transaction_length_arg)
Set the transaction length information.
Definition: control_events.h:944
Definition: control_events.h:584
Definition: control_events.h:114
Incident_event(enum_incident incident_arg)
This will create an Incident_event with an empty message and set the type_code as INCIDENT_EVENT in t...
Definition: control_events.h:450
const unsigned char * buf
Definition: control_events.h:1014
MY_XID my_xid
Definition: control_events.h:595
Format_description_event(uint8_t binlog_ver, const char *server_ver)
Format_description_event 1st constructor.
Definition: control_events.cpp:67
static const int ENCODED_FLAG_LENGTH
Definition: control_events.h:861
virtual ~Transaction_context_event()
Destructor of the Transaction_context_event class.
Definition: control_events.cpp:585
unsigned int get_ident_len()
Definition: control_events.h:1281
#define ST_SERVER_VER_LEN
The length of the array server_version, which is used to store the version of MySQL server...
Definition: binlog_event.h:366
static const int LOGICAL_TIMESTAMP_TYPECODE_LENGTH
Length of typecode for logical timestamps.
Definition: control_events.h:865
static const int ENCODED_READ_SET_ITEMS_OFFSET
Definition: control_events.h:1130
Gtid_event(long long int last_committed_arg, long long int sequence_number_arg, bool may_have_sbr_stmts_arg, unsigned long long int original_commit_timestamp_arg, unsigned long long int immediate_commit_timestamp_arg, uint32_t original_server_version_arg, uint32_t immediate_server_version_arg)
Constructor.
Definition: control_events.h:838
time_t created
If this event is at the start of the first binary log since server startup &#39;created&#39; should be the ti...
Definition: control_events.h:249
size_t buf_size
Definition: control_events.h:1013
A stop event is written to the log files under these circumstances:
Definition: control_events.h:368
void bapi_free(void *ptr)
This is a wrapper function in order to free the memory allocated from the heap in the binlogevent lib...
Definition: wrapper_functions.h:186
Definition: binlog_event.h:335
static const int ENCODED_VIEW_ID_OFFSET
Definition: control_events.h:1203
~Format_description_event()
Definition: control_events.cpp:279
uint64_t xid
Definition: control_events.h:529
Ignorable_event(Log_event_type type_arg=IGNORABLE_LOG_EVENT)
The minimal constructor and all it will do is set the type_code as IGNORABLE_LOG_EVENT in the header ...
Definition: control_events.h:658
long long int last_committed
Definition: control_events.h:803
uint32_t encoded_snapshot_version_length
Definition: control_events.h:1112
static const int ENCODED_SID_LENGTH
Definition: control_events.h:862
long formatID
Definition: control_events.h:585
bool dont_set_created
Definition: control_events.h:256
static const int ENCODED_THREAD_ID_OFFSET
Definition: control_events.h:1122
Heartbeat_event(const char *buf, const Format_description_event *fde)
Sent by a master to a slave to let the slave know that the master is still alive. ...
Definition: control_events.cpp:630
#define LOG_EVENT_MINIMAL_HEADER_LEN
Fixed header length, where 4.x and 5.0 agree.
Definition: binlog_event.h:393
bool gtid_specified
Definition: control_events.h:1110
The namespace contains classes representing events that can occur in a replication stream...
There are possibly lost events in the replication stream.
Definition: control_events.h:438
Definition: binlog_event.h:280
unsigned int ident_len
Definition: control_events.h:1285
This is a POD.
Definition: uuid.h:60
int get_server_version_length() const
We only store the immediate_server_version if both server versions are the same.
Definition: control_events.h:902
Shall be last event of the enumeration.
Definition: control_events.h:440
Definition: binlog_event.h:330
char view_id[ENCODED_VIEW_ID_MAX_LEN]
Definition: control_events.h:1226
Log info(cout, "NOTE")
static const int ORIGINAL_COMMIT_TIMESTAMP_LENGTH
Definition: control_events.h:872
static const int ENCODED_VIEW_ID_MAX_LEN
Definition: control_events.h:1222
#define ST_SERVER_VER_SPLIT_LEN
Definition: binlog_event.h:75
Previous_gtids_event()
This is the minimal constructor, and set the type_code as PREVIOUS_GTIDS_LOG_EVENT in the header obje...
Definition: control_events.h:1005
Uuid Uuid_parent_struct
Definition: control_events.h:909
uint32_t immediate_server_version
The version of the immediate server.
Definition: control_events.h:951
Xid_event(uint64_t xid_arg)
The minimal constructor of Xid_event, it initializes the instance variable xid and set the type_code ...
Definition: control_events.h:519
int64_t rpl_gtid_gno
Definition: control_events.h:703
std::vector< uint8_t > post_header_len
Definition: control_events.h:269
bool one_phase
Definition: control_events.h:597
int32_t rpl_gtid_sidno
Definition: control_events.h:702
uint64_t pos
Definition: control_events.h:110
static const int ENCODED_COMMIT_TIMESTAMP_LENGTH
Definition: control_events.h:877
std::list< const char * > read_set
Definition: control_events.h:1114
static const int TRANSACTION_LENGTH_MIN_LENGTH
Definition: control_events.h:879
Transaction_context_event(unsigned int thread_id_arg, bool is_gtid_specified_arg)
Definition: control_events.h:1088
unsigned long long int immediate_commit_timestamp
Timestamp when the transaction was committed on the nearest master.
Definition: control_events.h:812
#define LOG_EVENT_HEADER_LEN
Definition: binlog_event.h:384
This class is used to add view change markers in the binary log when a member of the group enters or ...
Definition: control_events.h:1174
static const int IMMEDIATE_COMMIT_TIMESTAMP_LENGTH
Definition: control_events.h:871
static const int ENCODED_SERVER_VERSION_LENGTH
Definition: control_events.h:889