Skip to content

Commit 4c41cef

Browse files
BUG#32803050 REPLICA WITH FEDERATED TABLE CRASHES IN HA_FEDERATED::RND_POS WHEN APPLYING ROW EVENTS
Description: When executing Update/Delete with indexes on a table with Row based replication setup and the federated table on slave, The Slave crashes. Analysis: Slave crashes when trying to get the reference to the row to be update or deleted on federated table using position() method. The crash occurs due to assert(stored_result) in position method, since the stored_result is still empty. Server should do index_scan and update the stored_result and then call for position() and ha_rnd_pos() methods to get the ref to the row stored. But in this scenario the server calls for position() method without scanning the table resulting in crash at assert. Fix: The fix is added to fetch the position or reference of the row only when stored_result is not empty. RB: 26755
1 parent 8d86a6b commit 4c41cef

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

storage/federated/ha_federated.cc

+17
Original file line numberDiff line numberDiff line change
@@ -3455,6 +3455,23 @@ int ha_federated::execute_simple_query(const char *query, int len)
34553455
DBUG_RETURN(0);
34563456
}
34573457

3458+
3459+
int ha_federated::rnd_pos_by_record(uchar *record) {
3460+
int error;
3461+
assert(table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION);
3462+
3463+
error = ha_rnd_init(false);
3464+
if (error != 0) return error;
3465+
3466+
if (stored_result) {
3467+
position(record);
3468+
error = ha_rnd_pos(record, ref);
3469+
}
3470+
3471+
ha_rnd_end();
3472+
return error;
3473+
}
3474+
34583475
struct st_mysql_storage_engine federated_storage_engine=
34593476
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
34603477

storage/federated/ha_federated.h

+1
Original file line numberDiff line numberDiff line change
@@ -278,5 +278,6 @@ class ha_federated: public handler
278278
int connection_autocommit(bool state);
279279
int execute_simple_query(const char *query, int len);
280280
int reset(void);
281+
int rnd_pos_by_record(uchar *record);
281282
};
282283

0 commit comments

Comments
 (0)