You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +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:
@@ -321,7 +321,7 @@ typedef struct st_mariadb_rpl {
|
|||||||
uint32_t filename_length;
|
uint32_t filename_length;
|
||||||
uint32_t server_id;
|
uint32_t server_id;
|
||||||
unsigned long start_position;
|
unsigned long start_position;
|
||||||
uint32_t flags;
|
uint16_t flags;
|
||||||
uint8_t fd_header_len; /* header len from last format description event */
|
uint8_t fd_header_len; /* header len from last format description event */
|
||||||
uint8_t use_checksum;
|
uint8_t use_checksum;
|
||||||
uint8_t artificial_checksun;
|
uint8_t artificial_checksun;
|
||||||
|
@@ -792,13 +792,16 @@ int STDCALL mariadb_rpl_open(MARIADB_RPL *rpl)
|
|||||||
|
|
||||||
if (rpl->mysql)
|
if (rpl->mysql)
|
||||||
{
|
{
|
||||||
|
uint32_t replica_id= rpl->server_id;
|
||||||
ptr= buf= (unsigned char *)alloca(rpl->filename_length + 11);
|
ptr= buf= (unsigned char *)alloca(rpl->filename_length + 11);
|
||||||
|
|
||||||
int4store(ptr, (unsigned int)rpl->start_position);
|
int4store(ptr, (unsigned int)rpl->start_position);
|
||||||
ptr+= 4;
|
ptr+= 4;
|
||||||
int2store(ptr, rpl->flags);
|
int2store(ptr, rpl->flags);
|
||||||
ptr+= 2;
|
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;
|
ptr+= 4;
|
||||||
memcpy(ptr, rpl->filename, rpl->filename_length);
|
memcpy(ptr, rpl->filename, rpl->filename_length);
|
||||||
ptr+= rpl->filename_length;
|
ptr+= rpl->filename_length;
|
||||||
|
Reference in New Issue
Block a user