Запутывается при разборе mysqlbinlog - PullRequest
0 голосов
/ 10 июля 2020

Я пытаюсь написать синтаксический анализ бинлога MySQL, при синтаксическом анализе анонимных событий gtid внутреннее руководство MySQL не содержит описания структуры анонимных событий gtid. Я обнаружил следующее do c в MySQL исходном коде сервера

  @section Gtid_event_binary_format Binary Format

  The Body has seven components:

  <table>
  <caption>Body for Gtid_event</caption>

  <tr>
    <th>Name</th>
    <th>Format</th>
    <th>Description</th>
  </tr>

  </tr>
  <tr>
    <td>GTID_FLAGS</td>
    <td>1 byte</td>
    <td>00000001 = Transaction may have changes logged with SBR.
        In 5.6, 5.7.0-5.7.18, and 8.0.0-8.0.1, this flag is always set.
        Starting in 5.7.19 and 8.0.2, this flag is cleared if the transaction
        only contains row events. It is set if any part of the transaction is
        written in statement format.</td>
  </tr>
  <tr>
    <td>ENCODED_SID_LENGTH</td>
    <td>4 bytes static const integer</td>
    <td>Length of SID in event encoding</td>
  </tr>
  <tr>
    <td>ENCODED_GNO_LENGTH</td>
    <td>4 bytes static const integer</td>
    <td>Length of GNO in event encoding.</td>
  </tr>
  <tr>
    <td>last_committed</td>
    <td>8 byte integer</td>
    <td>Store the transaction's commit parent sequence_number</td>
  </tr>
  <tr>
    <td>sequence_number</td>
    <td>8 byte integer</td>
    <td>The transaction's logical timestamp assigned at prepare phase</td>
  </tr>
  </table>

*/

Но он не соответствует результату работы mysqlbinlog -v <binlog.log>

#200709 15:41:10 server id 1  end_log_pos 219 CRC32 0x4f99babc 
# Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
#       9a 96 3a 07 5f   22   01 00 00 00   41 00 00 00   db 00 00 00   00 00
#       ad 01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
#       bd 00 00 00 00 00 00 00 00  00 02 00 00 00 00 00 00 |................|
#       cd 00 00 01 00 00 00 00 00  00 00 bc ba 99 4f       |.............O|
#   Anonymous_GTID  last_committed=0    sequence_number=1   rbr_only=no
SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/;

mysql версии 5.7. 30

Я считаю неправильным делать c и какова реальная структура анонимов?

...