Andrei Elkin wrote:
> Mats, hello.
>
> The patch looks good. I have couple of question though.
>
>
>
>> #At file:///home/bzr/bugs/b40004-5.1-5.1.29-rc/
>>
>> 2771 Mats Kindahl 2008-10-20
>> Bug #40004 Replication failure with no PK + no indexes
>>
>> In certain situations, a scan of the table will return the error
>> code HA_ERR_RECORD_DELETED, and this error code is not
>> correctly caught in the Rows_log_event::find_row() function, which
>> causes an error to be returned for this case.
>>
>
> I think we are able to specify situations more precise.
> The facts are: HA_ERR_RECORD_DELETED emits from in MyISAM only,
> and a table should not have neither PK nor indexes.
> If it sounds to you correct then should not we re-write about the situations?
It is true that is it just MyISAM that returns this code, but it can be returned
regardless of whether there is a primary key, and index, or neither.
>> This patch fixes the problem by adding code to either ignore the
>> record and continuing with the next one, the the event of a table
>> scan,
>
> that's ok
>
>> or change the error code to HA_ERR_KEY_NOT_FOUND, in the event
>> that a key lookup is attempted.
>
> It looks strange as the bug synopsis implies no key lookup at all.
> I see your conversion HA_ERR_RECORD_DELETED -> HA_ERR_KEY_NOT_FOUND
> which is principally fine with me but don't see a real case for doing
> it.
>
> Could you please explain?
HA_ERR_RECORD_DELETED can be returned from any of the search functions, even
index_next(), which implies that the table can contain indexes or primary keys.
The only reason that it is not in the bug report is because it hasn't been
tested thoroughly.
However, when doing a PK lookup, it is pointless to skip the record (since it
was deleted), and HA_ERR_KEY_NOT_FOUND should be returned.
Just my few cents,
Mats Kindahl
--
Mats Kindahl
Lead Software Developer
Replication Team
MySQL AB, www.mysql.com