You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
CONC-689: Fix parsing of HEARTBEAT_LOG_EVENT:
The heartbeat log event now contains the filename, instead of wrong header information (which was already processed when reading event header).
This commit is contained in:
@@ -72,6 +72,7 @@ static int test_rpl_async(MYSQL *my __attribute__((unused)))
|
||||
mysql_query(mysql, "SET @mariadb_slave_capability=4");
|
||||
mysql_query(mysql, "SET NAMES latin1");
|
||||
mysql_query(mysql, "SET @slave_gtid_strict_mode=1");
|
||||
mysql_query(mysql, "SET @master_heartbeat_period=10");
|
||||
mysql_query(mysql, "SET @slave_gtid_ignore_duplicates=1");
|
||||
mysql_query(mysql, "SET NAMES utf8");
|
||||
mysql_query(mysql, "SET @master_binlog_checksum= @@global.binlog_checksum");
|
||||
@@ -85,7 +86,7 @@ static int test_rpl_async(MYSQL *my __attribute__((unused)))
|
||||
/* We run rpl_api as very last test, too make sure
|
||||
binary log contains > 10000 events.
|
||||
*/
|
||||
while((event= mariadb_rpl_fetch(rpl, event)) && events < 10000)
|
||||
while((event= mariadb_rpl_fetch(rpl, event)) && event->event_type != HEARTBEAT_LOG_EVENT)
|
||||
{
|
||||
events++;
|
||||
}
|
||||
@@ -142,6 +143,7 @@ static int test_rpl_semisync(MYSQL *my __attribute__((unused)))
|
||||
mysql_query(mysql, "SET NAMES latin1");
|
||||
mysql_query(mysql, "SET @slave_gtid_strict_mode=1");
|
||||
mysql_query(mysql, "SET @slave_gtid_ignore_duplicates=1");
|
||||
mysql_query(mysql, "SET @master_heartbeat_period=10");
|
||||
mysql_query(mysql, "SET NAMES utf8");
|
||||
mysql_query(mysql, "SET @master_binlog_checksum= @@global.binlog_checksum");
|
||||
rpl->server_id= 12;
|
||||
@@ -161,10 +163,7 @@ static int test_rpl_semisync(MYSQL *my __attribute__((unused)))
|
||||
if (mariadb_rpl_open(rpl))
|
||||
return FAIL;
|
||||
|
||||
/* We run rpl_api as very last test, too make sure
|
||||
binary log contains > 10000 events.
|
||||
*/
|
||||
while((event= mariadb_rpl_fetch(rpl, event)) && events < 10000)
|
||||
while((event= mariadb_rpl_fetch(rpl, event)) && event->event_type != HEARTBEAT_LOG_EVENT)
|
||||
{
|
||||
events++;
|
||||
}
|
||||
@@ -341,7 +340,80 @@ static int test_conc592(MYSQL *my __attribute__((unused)))
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int test_conc689(MYSQL *my __attribute__((unused)))
|
||||
{
|
||||
MYSQL *mysql= mysql_init(NULL);
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
MARIADB_RPL_EVENT *event= NULL;
|
||||
MARIADB_RPL *rpl;
|
||||
int events= 0, rc;
|
||||
|
||||
SKIP_SKYSQL;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
if (!is_mariadb)
|
||||
return SKIP;
|
||||
|
||||
if (!my_test_connect(mysql, hostname, username,
|
||||
password, schema, port, socketname, 0))
|
||||
{
|
||||
diag("Error: %s", mysql_error(mysql));
|
||||
mysql_close(mysql);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
rc= mysql_query(mysql, "SELECT @@log_bin");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
result= mysql_store_result(mysql);
|
||||
row= mysql_fetch_row(result);
|
||||
if (!atoi(row[0]))
|
||||
rc= SKIP;
|
||||
mysql_free_result(result);
|
||||
|
||||
if (rc == SKIP)
|
||||
{
|
||||
diag("binary log disabled -> skip");
|
||||
mysql_close(mysql);
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
rpl = mariadb_rpl_init(mysql);
|
||||
|
||||
mysql_query(mysql, "SET @mariadb_slave_capability=4");
|
||||
mysql_query(mysql, "SET NAMES latin1");
|
||||
mysql_query(mysql, "SET @slave_gtid_strict_mode=1");
|
||||
mysql_query(mysql, "SET @master_heartbeat_period=10");
|
||||
mysql_query(mysql, "SET @slave_gtid_ignore_duplicates=1");
|
||||
mysql_query(mysql, "SET NAMES utf8");
|
||||
mysql_query(mysql, "SET @master_binlog_checksum= @@global.binlog_checksum");
|
||||
rpl->server_id= 12;
|
||||
rpl->start_position= 4;
|
||||
rpl->flags= MARIADB_RPL_BINLOG_SEND_ANNOTATE_ROWS;
|
||||
|
||||
if (mariadb_rpl_open(rpl))
|
||||
return FAIL;
|
||||
|
||||
/* We run rpl_api as very last test, too make sure
|
||||
binary log contains > 10000 events.
|
||||
*/
|
||||
while((event= mariadb_rpl_fetch(rpl, event)) && event->event_type != HEARTBEAT_LOG_EVENT)
|
||||
{
|
||||
events++;
|
||||
}
|
||||
FAIL_IF(event->event.heartbeat.filename.length == 0, "Invalid filename");
|
||||
diag("Filename: %.*s", event->event.heartbeat.filename.length,
|
||||
event->event.heartbeat.filename.str);
|
||||
mariadb_free_rpl_event(event);
|
||||
mariadb_rpl_close(rpl);
|
||||
mysql_close(mysql);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
struct my_tests_st my_tests[] = {
|
||||
{"test_conc689", test_conc689, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_conc592", test_conc592, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_rpl_async", test_rpl_async, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_rpl_semisync", test_rpl_semisync, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
|
Reference in New Issue
Block a user