When checking for a semi sync indication header, we need also check if
the undocumented session variable @rpl_semi_sync_slave was set.
Otherwise the timestamp of the event could contain values which match
the 2 bytes of the semi sync header.
Since the variable rpl_semi_sync_slave and it's behavior is not documented,
a new option MARIADB_RPL_SEMI_SYNC was added.
Since extra_data (MySQL ROWSV2 event) is not part of row data,
we need to allocate memory for it's content.
Kudos to Sruli Ganor for reporting this issue and providing a fix.
- All (MariaDB and MySQL) events are now supported
- Added new api functions:
- mariadb_rpl_error: returns error message
- mariadb_rpl_errno: returns error number
- mariadb_rpl_extract_rows: extract values of
ROW_EVENTS
- Added decryption support
- Added uncompression
-
If timestamp is zero and flag LOG_EVEBNT_ARTIFICIAL_F was set the
event is a fake ROTATE_EVENT (https://mariadb.com/kb/en/fake-rotate_event/)
and needs different handling:
- a checksum might follow if @@binlog_checksum was set (CRC32)
- length calculation is different
Added new option MARIADB_OPT_RPL_REGISTER_REPLICA which expects
two parameters, host and port. When this option was set, rpl_open
will send a COM_REGISTER_SLAVE command with server_id, host and
port to the connected server. This information can be retrieved
by "SHOW SLAVE STATUS" command.
Example:
rc= mysql_optionsv(mysql, MARIADB_OPT_RPL_REGISTER_REPLICA,
"myhost", 123);
ZSTD compression is now supported for connections
to a MySQL Server 8.0.
Compression algorithms are supported via compression
plugins, which can be found in plugins/compress.
When receiving a ROTATE event, the offset of filename
was not computed correctly. Similiar to the
BINLOG_CHECK_POINT event filename will also be stored
in MARIADB_RPL handle
Beside already supported asynchronous replication
the replication/binlog API now supports semi
synchronous replication:
If an event contains a semi synchronous indicator (0xEF)
behind status byte and acknowledgement flag is set,
mariadb_rpl_fetch() automatically sends an acknowledge
message to the connected primary server.
QUERY_EVENT and ANNOTATE_ROWS_EVENT don't check if the crc32
checksum option is disabled and strip always 4 bytes from
protocol buffer.
Kudos to Ruslan Altynbaev for reporting and providing this small fix.
Various coverity scan fixes, including CONC-452 and CONC-453.
Special thanks to Lukas Javorsky for fixing numerous covscan
issues (This patch includes part of his pull request #126).
Coverity scan build was using the following cmake parameters:
-WITH_EXTERNAL_ZLIB=ON -DWITH_UNIT_TESTS=OFF.
CWE-416 (use after free) in dtoa.c (from netlib) is still open.
Binlog checksums are now detected and treated correctly. By subtracting
the checksum size from the event length, end-of-event strings are
calculated correctly. These are used at least in the ROTATE_EVENT which
were also fixed to use the event length stored in the event itself.
The table name is also null-terminated so the length plus one byte needs
to be skipped.
If the table map event is not used immediately after the event is read,
the column types would point to possibly freed memory. To avoid this,
memory should be allocated for it.