mirror of
https://github.com/MariaDB/server.git
synced 2026-05-10 00:54:30 +02:00
Bug#17377 Federated Engine returns wrong Data, always the rows with the highest ID
- Always make rnd_pos reposition the cursor in the fetched result set. mysql-test/r/federated.result: Update test result mysql-test/t/federated.test: Add test for bug#17377 sql/ha_federated.cc: Remove the "scan_flag" variable. rnd_pos should always move to a new position in the result set. The "scan" flag in rnd_init will protect from the old result set being closed and a new fecthed. I think the "scan_flag" was added before check of the "scan" argument in rnd_init was added. sql/ha_federated.h: Remove class variable "scan_flag"
This commit is contained in:
parent
85e54a08c4
commit
701b699144
4 changed files with 107 additions and 21 deletions
|
|
@ -740,7 +740,7 @@ error:
|
|||
|
||||
ha_federated::ha_federated(TABLE *table_arg)
|
||||
:handler(&federated_hton, table_arg),
|
||||
mysql(0), stored_result(0), scan_flag(0),
|
||||
mysql(0), stored_result(0),
|
||||
ref_length(sizeof(MYSQL_ROW_OFFSET)), current_position(0)
|
||||
{}
|
||||
|
||||
|
|
@ -2243,7 +2243,7 @@ int ha_federated::rnd_init(bool scan)
|
|||
containing the correct record, hence update the wrong row!
|
||||
|
||||
*/
|
||||
scan_flag= scan;
|
||||
|
||||
if (scan)
|
||||
{
|
||||
DBUG_PRINT("info", ("share->select_query %s", share->select_query));
|
||||
|
|
@ -2365,24 +2365,13 @@ void ha_federated::position(const byte *record)
|
|||
int ha_federated::rnd_pos(byte *buf, byte *pos)
|
||||
{
|
||||
DBUG_ENTER("ha_federated::rnd_pos");
|
||||
/*
|
||||
we do not need to do any of this if there has been a scan performed
|
||||
already, or if this is an update and index_read_idx already has a result
|
||||
set in which to build it's update query from
|
||||
*/
|
||||
if (scan_flag)
|
||||
{
|
||||
int retval;
|
||||
statistic_increment(table->in_use->status_var.ha_read_rnd_count,
|
||||
&LOCK_status);
|
||||
memcpy_fixed(¤t_position, pos, sizeof(MYSQL_ROW_OFFSET)); // pos
|
||||
/* is not aligned */
|
||||
stored_result->current_row= 0;
|
||||
stored_result->data_cursor= current_position;
|
||||
retval= rnd_next(buf);
|
||||
DBUG_RETURN(retval);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
||||
statistic_increment(table->in_use->status_var.ha_read_rnd_count,
|
||||
&LOCK_status);
|
||||
memcpy_fixed(¤t_position, pos, sizeof(MYSQL_ROW_OFFSET));
|
||||
stored_result->current_row= 0;
|
||||
stored_result->data_cursor= current_position;
|
||||
DBUG_RETURN(rnd_next(buf));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue