1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

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.
This commit is contained in:
Georg Richter
2023-02-27 10:13:57 +01:00
parent acb73df26c
commit ea74aa294f
2 changed files with 6 additions and 3 deletions

View File

@@ -321,7 +321,7 @@ typedef struct st_mariadb_rpl {
uint32_t filename_length;
uint32_t server_id;
unsigned long start_position;
uint32_t flags;
uint16_t flags;
uint8_t fd_header_len; /* header len from last format description event */
uint8_t use_checksum;
uint8_t artificial_checksun;

View File

@@ -792,13 +792,16 @@ int STDCALL mariadb_rpl_open(MARIADB_RPL *rpl)
if (rpl->mysql)
{
uint32_t replica_id= rpl->server_id;
ptr= buf= (unsigned char *)alloca(rpl->filename_length + 11);
int4store(ptr, (unsigned int)rpl->start_position);
ptr+= 4;
int2store(ptr, rpl->flags);
ptr+= 2;
int4store(ptr, rpl->server_id);
if ((rpl->flags & MARIADB_RPL_BINLOG_DUMP_NON_BLOCK) && !replica_id)
replica_id= 1;
int4store(ptr, replica_id);
ptr+= 4;
memcpy(ptr, rpl->filename, rpl->filename_length);
ptr+= rpl->filename_length;