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

rpl/binlog api fixes:

- Store artifical checksum in event->checksum instead of raw.
- Fixed build when builing with external zlib library.
This commit is contained in:
Georg Richter
2023-03-07 09:58:51 +01:00
parent 93e9d091f7
commit 4de47e64a5
3 changed files with 6 additions and 6 deletions

View File

@@ -227,6 +227,7 @@ IF(WITH_EXTERNAL_ZLIB)
IF(NOT ZLIB_FOUND) IF(NOT ZLIB_FOUND)
FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(ZLIB REQUIRED)
ENDIF() ENDIF()
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${ZLIB_LIBRARIES})
ELSE() ELSE()
SET(ZLIB_INCLUDE_DIR "${CC_SOURCE_DIR}/external/zlib") SET(ZLIB_INCLUDE_DIR "${CC_SOURCE_DIR}/external/zlib")
ADD_SUBDIRECTORY("${CC_SOURCE_DIR}/external/zlib") ADD_SUBDIRECTORY("${CC_SOURCE_DIR}/external/zlib")

View File

@@ -328,7 +328,7 @@ typedef struct st_mariadb_rpl {
uint16_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_checksum;
uint8_t verify_checksum; uint8_t verify_checksum;
uint8_t post_header_len[ENUM_END_EVENT]; uint8_t post_header_len[ENUM_END_EVENT];
MA_FILE *fp; MA_FILE *fp;

View File

@@ -698,7 +698,7 @@ MARIADB_RPL * STDCALL mariadb_rpl_init_ex(MYSQL *mysql, unsigned int version)
MYSQL_ROW row= mysql_fetch_row(result); MYSQL_ROW row= mysql_fetch_row(result);
if (!strcmp(row[0], "CRC32")) if (!strcmp(row[0], "CRC32"))
{ {
rpl->artificial_checksun= 1; rpl->artificial_checksum= 1;
} }
mysql_free_result(result); mysql_free_result(result);
} }
@@ -1476,11 +1476,10 @@ MARIADB_RPL_EVENT * STDCALL mariadb_rpl_fetch(MARIADB_RPL *rpl, MARIADB_RPL_EVEN
if (rpl_event->timestamp == 0 && if (rpl_event->timestamp == 0 &&
rpl_event->flags & LOG_EVENT_ARTIFICIAL_F) rpl_event->flags & LOG_EVENT_ARTIFICIAL_F)
{ {
if (rpl->artificial_checksun) if (rpl->artificial_checksum)
{ {
int4store(ev_end - 4, rpl_event->checksum); unsigned long crc= crc32_z(0L, Z_NULL, 0);
if (mariadb_connection(rpl->mysql)) rpl_event->checksum= (uint32_t) crc32_z(crc, checksum_start, ev_end - checksum_start);
rpl->artificial_checksun= 0;
} }
} }
RPL_CHECK_POS(ev, ev_end, len); RPL_CHECK_POS(ev, ev_end, len);