[mythtv] [mythtv-commits] Ticket #2342: EIT Data update fials due to duplicate keys

Stuart Auchterlonie stuarta at squashedfrog.net
Fri Sep 8 16:19:00 UTC 2006

On Fri, Sep 08, 2006 at 10:50:56AM -0400, Mark Buechler wrote:
> The second case could only happen if the following events took place:
> Two cards scanning same transport at nearly the same time:
> 1. Card A finds a mismatch on starttime and calls
> DBEvent::MoveOutOfTheWayDB() which then calls change_program(), third case I
> believe.
> 2. Card A immediately inserts an event for the the original starttime.
> 3. Card B also finds a mismatch on starttime for the same event and also
> calls DBEvent::MoveOutOfTheWayDB() then calling change_program().
> Since Card B is attempting to change the event starttime AFTER card A has
> already inserted a new event for the original starttime we break the key
> constraint. However, if card A hadn't inserted a new entry for the original
> starttime the db update would return back 0 rows effected since the WHERE
> clause would have nothing to match.

aka classic race condition.

when we centralize control of the scanning to a single thread
post 0.20 the inserting of events into the database will become
serialized, thus avoiding the problem.


More information about the mythtv-dev mailing list