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

Mark Buechler mark.buechler at gmail.com
Fri Sep 8 14:50:56 UTC 2006

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
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.

- Mark.

On 9/8/06, Janne Grunau <janne-mythtv at grunau.be> wrote:
> On Friday 08 September 2006 11:04, MythTV wrote:
> > #2342: EIT Data update fials due to duplicate keys
> >
> >  2006-09-07 13:39:09.063 DB Error (change_program):
> >  Query was:
> >  UPDATE program SET starttime = '2006-09-10T01:32:00',     endtime
> > = '2006-09-10T02:00:00' WHERE chanid    = 1717 AND       starttime =
> > '2006- 09-10T01:00:00'
> >  Driver error was [2/1062]:
> >  QMYSQL3: Unable to execute query
> >  Database error was:
> >  Duplicate entry '1717-2006-09-10 01:32:00-0' for key 1
> >
> >  it appears that the database is ok - ran all the checks I could.
> >
> >  I think the issue is that there is a program already in the program
> > table for this time and channel, which will need deleting first else
> > the primary key constraint is broken on the DB.
> >
> >  Its an easy fix I think,
> It's a bug in the current implementation. We search and delete
> overlapping programs. I'm not sure if it's an error in the matching and
> delete code or if it is caused by multiple eitscanners listening for
> the same chanids. Even if it's the second locking the program table is
> a bad solution.
> The eitscanner changes in my queue will handle this situation in a
> better way.
> For the grabber-EIT-integration we have find a different solution.
> Janne
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-dev/attachments/20060908/f5e461df/attachment.htm 

More information about the mythtv-dev mailing list