1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-05 15:55:58 +03:00
Commit Graph

46 Commits

Author SHA1 Message Date
Georg Richter
03195a2f30 Fix for CENTOS7:
Since CentOS7 builder still uses gcc4.8, we need to move c99
declarations out of the loop.
2023-08-16 20:11:45 +02:00
Georg Richter
1acb81e11c Build fixes:
- Fixed build error, which was previously introduced by commit
c8ca89112e

- Treat warnings as errors
2023-08-16 14:09:34 +02:00
Georg Richter
c8ca89112e Fix for CONC-659:
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.
2023-08-11 10:14:26 +02:00
Georg Richter
681fbd98ee Fix for CONC-657:
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.
2023-07-21 13:42:19 +02:00
Georg Richter
56b515648b Fix for CONC-650:
Added support for XID in GTID_EVENT (but also updated
documentation on https://mariadb.com/kb/en/gtid_event/).
2023-06-19 12:17:27 +02:00
Georg Richter
ec3852338f Removed unnecessary RPL_CHECK_POS checks. 2023-06-09 14:37:29 +02:00
Georg Richter
374f0eedc2 Build fix: replace crc32_z by crc32
To make internal builders with zlib < 1.2.8 happy,
we use crc32() instead of crc32_z now.
2023-04-27 09:24:16 +02:00
Georg Richter
4de47e64a5 rpl/binlog api fixes:
- Store artifical checksum in event->checksum instead of raw.
- Fixed build when builing with external zlib library.
2023-03-07 09:58:51 +01:00
Georg Richter
fe405c4fc4 Fixed conversion warning (windows). 2023-02-28 07:41:56 +01:00
Georg Richter
86b903a5e6 Windows build fixes 2023-02-27 17:19:35 +01:00
Georg Richter
bdf6fbb4f6 Replication/Binlog API fix:
When sending filename in SEMI_SYNC_REQUEST to the server, we don't
need to send additional terminating zero in filename.
See https://mariadb.com/kb/en/4-semi-sync-replication/
2023-02-27 10:23:39 +01:00
Georg Richter
ea74aa294f fix for replication/binlog api:
If flag BINLOG_DUMP_NON_BLOCK was set, we need to check the replica_id.
If it was not specified, a default value of 1 will be used.
2023-02-27 10:13:57 +01:00
Georg Richter
acb73df26c Check result of COM_REGISTER_SLAVE and set error message
if it fails.
2023-02-22 15:08:24 +01:00
Georg Richter
49ecb8bd2c Fix for semisync replication:
clear network buffer before sending the
reply packet to the server.
2023-02-22 13:55:41 +01:00
Georg Richter
dbb4d8d93b Fixed segfault:
Use rpl->host and port instead of mysql->options.
2023-02-22 11:32:21 +01:00
Georg Richter
9890d34612 Remove ma_global.h (which is not included in package)
from mariadb_rpl include file.
2023-02-22 09:14:43 +01:00
Georg Richter
ece593f571 Merge branch '3.3-rpl' into 3.3 2023-02-21 17:11:56 +01:00
Georg Richter
87bd5bfc34 Removed decryption stuff from rpl api 2023-02-12 14:26:02 +01:00
Georg Richter
4dca917b7e Added support for all (?) events
- 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
  -
2022-09-26 09:20:07 +02:00
Georg Richter
9c2e470825 PL fixes 2022-08-30 17:39:36 +02:00
Georg Richter
3f7719c74d Typo fixes (from PR #200) 2022-06-27 13:23:35 +02:00
Georg Richter
abddf0b0af Fixed ROTATE_EVENT
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
2022-06-22 16:25:37 +02:00
Georg Richter
1e2f6d5a12 Fix for CONC-600:
If mariadb_fetch_event() detects an unknown event, the event will be
returned instead of releasing it.

Kudos to '007gzs' for providing this patch!
2022-06-21 10:51:59 +02:00
Georg Richter
7523c27e66 Windows build fix 2022-06-15 11:42:27 +02:00
Georg Richter
fcce4a8c76 CONC-592: Register replica with host and port
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);
2022-05-23 14:05:06 +02:00
Georg Richter
770cf2286a CONC-575: Support for MySQL zstd compression
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.
2022-01-25 05:02:33 +01:00
Georg Richter
dae2d119a2 Windows build fixes 2022-01-03 06:34:59 +01:00
Georg Richter
bc7bbd4752 Merge branch '3.2' into 3.3 2021-12-31 17:20:46 +01:00
Georg Richter
0670c38c2b Merge pull request #188 from kou/rows-events-v2
Add support for ROWS_EVENT V2
2021-12-31 17:19:49 +01:00
Georg Richter
0489f34b48 Merge branch '3.2' into 3.3 2021-12-22 07:18:27 +01:00
Georg Richter
7bd53326b4 Merge pull request #186 from kou/fix-indent
Fix indent
2021-12-15 06:32:36 +01:00
Georg Richter
7c29edf8a4 Follow up of merge from Sutou Kouhei:
use mariadb_rpl_free_event in case of network error.
2021-11-21 15:18:17 +01:00
Georg Richter
a4f40a3714 Merge branch '3.2' into 3.3 2021-11-21 15:17:41 +01:00
Sutou Kouhei
3d0cc1afd3 Add support for ROWS_EVENT V2
ROWS_EVENT V2 has the extra-data field after the flags field in
header.

See also: https://dev.mysql.com/doc/internals/en/rows-event.html
2021-11-20 06:15:10 +09:00
Sutou Kouhei
6ce6dabefa Use mariadb_free_rpl_event() for freeing MARIADB_RPL_EVENT 2021-11-19 15:31:07 +09:00
Sutou Kouhei
bb60d1d676 Fix indent 2021-11-19 10:07:59 +09:00
Georg Richter
e8fc259320 CONC-467: Rotate event doesn't handle filename correctly
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
2021-10-09 10:44:04 +02:00
Georg Richter
004f9d4217 CONC-470: Support for semi synchronous replication
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.
2021-10-09 08:26:15 +02:00
Georg Richter
d272377f89 Fix for CONC-535: disabled checksum ignored in events
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.
2021-03-22 09:28:46 +01:00
Vladislav Vaintroub
5390a7780f Fix clang-cl 32bit warning.
STDCALL is not compatible with vararg functions.
2020-04-24 13:31:28 +02:00
Georg Richter
1218ffac1a Fix for CONC-452 and CONC-453:
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.
2020-02-14 09:52:21 +01:00
Sergei Golubchik
62e79baa5a compilation on windows
typecasting warnings/errors
2019-02-04 16:05:32 +01:00
Markus Mäkelä
4fd787d597 Fix ROWS_EVENT size
The event didn't ignore the binlog checksum.
2019-01-24 15:52:15 +02:00
Markus Mäkelä
be021582ff Add binlog checksum support
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.
2019-01-24 13:32:40 +02:00
Markus Mäkelä
cb013c2c3d Fix table map event processing
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.
2019-01-18 09:19:09 +02:00
Georg Richter
1888c141f7 Manual merge from CONC-325 branch: Initial implementation for binlog/replication API 2018-12-02 18:28:38 +01:00