[mythtv-commits] Ticket #2342: EIT Data update fails due to duplicate keys
MythTV
noreply at mythtv.org
Sat Oct 29 13:49:55 UTC 2011
#2342: EIT Data update fails due to duplicate keys
-------------------------------+------------------------
Reporter: Karl | Owner: janne
Type: defect | Status: closed
Priority: minor | Milestone: 0.22
Component: eit | Version: head
Severity: low | Resolution: fixed
Keywords: eit duplicate key | Ticket locked: 0
-------------------------------+------------------------
Comment (by klaas.de.waal@…):
I have been getting messages like this:
{{{
2011-10-17 21:43:36.939617 E DB Error (change_program):
Query was:
UPDATE program SET starttime = ?, endtime = ? WHERE chanid = ?
AND starttime = ?
Bindings were:
:CHANID=1903, :NEWEND=2011-10-18T13:55:00, :NEWSTART=2011-10-18T12:10:00,
:OLDSTART=2011-10-18T12:00:00
Driver error was [2/1062]:
QMYSQL3: Unable to execute statement
Database error was:
Duplicate entry '1903-2011-10-18 12:10:00-0' for key 'PRIMARY'
}}}
in my backend log for years.
[[BR]]
In my case, with the EIT information from DVB-C provider Ziggo in the
Netherlands, most (but not all) of the database conflicts are caused by
dummy program entries "Zender verstrekt geen informatie" (in English:
"Broadcaster does not provide information"). For a number of TV channels,
the dummy entries are there already four days in the future while the real
program information appears three days in the future.[[BR]]
The result of the DB errors is that the dummy entries remain in the
database while the new entries, with real program information, are
discarded.
[[BR]][[BR]]
I have changed a bit of code in libs/libmythtv/programdata.cpp and that
solves this problem for me. The patch is attached.
[[BR]][[BR]]
What happens is the following.
[[BR]]
We start in function MoveOutOfTheWayDB in the section "starts during, but
ends after our program".
[[BR]]
There it calls change_program to move the start time of the overlapping
program to the end time of our new program, to make space in the EPG for
our new program. We have a problem if there is already a program that
starts at the end time of our new program; if we then try to change the
start time of the overlapping program to the end time of our new program
we get the duplicate primary key error.
[[BR]]
The result is that MoveOutOfTheWayDB returns false, the new EPG entry is
discarded and the old entry (the one that we could not move) remains in
the database.
[[BR]]
[[BR]]
I have now added a check to see if there is already a program in the
database that starts at the end time of our new program. If that is the
case, the overlapping program is deleted. If that is not the case then we
can safely change the start time of the overlapping program without
generating a database error.
[[BR]]
[[BR]]
Checked with MythTV version:
{{{
[klaas at modu log]$ mythbackend --version
Please attach all output as a file in bug reports.
MythTV Version : v0.25pre-3634-g98a0304-dirty
MythTV Branch : master
Network Protocol : 69
Library API : 0.25.20111023-1
QT Version : 4.7.3
Options compiled in:
linux debug use_hidesyms using_alsa using_oss using_pulse
using_pulseoutput using_backend using_bindings_perl using_bindings_python
using_bindings_php using_dvb using_frontend using_hdhomerun using_hdpvr
using_iptv using_ivtv using_joystick_menu using_libxml2 using_lirc
using_mheg using_opengl_video using_qtwebkit using_qtscript using_qtdbus
using_v4l2 using_v4l1 using_x11 using_xrandr using_xv using_bindings_perl
using_bindings_python using_bindings_php using_mythtranscode using_opengl
using_ffmpeg_threads using_live using_mheg using_libass using_libxml2
}}}
--
Ticket URL: <http://code.mythtv.org/trac/ticket/2342#comment:13>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
More information about the mythtv-commits
mailing list