xbianonpi / xbian

XBMC on Raspberry Pi, Bleeding Edge
https://xbian.org
GNU General Public License v3.0
294 stars 44 forks source link

Xbmc patch on xbian-package-xbmc broke video database clean #649

Closed bellini666 closed 9 years ago

bellini666 commented 9 years ago

I noticed this error on my xbmc.log:

11:01:34 T:3037876224   ERROR: SQL: SQL error or missing database
                                            Query: SELECT path.idPath, path.strPath, path.idParentPath FROM path WHERE NOT ((strContent IS NULL OR strContent = '') AND (strSettings IS NULL OR strSettings = '') AND (strHash IS NULL OR strHash = '') AND (exclude IS NULL OR exclude != 1))
11:01:34 T:3037876224   ERROR: CleanDatabase failed

I tried executing that command on the sqlite database, and found that path.idParentPath didn't exist.

Taking a look at the xbmc code, I saw that it should be created when migrating the database to the version 81, as you can see here: https://github.com/xbmc/xbmc/blob/master/xbmc/video/VideoDatabase.cpp#L4688

Since the database is on version 78 (the name of the file is MyVideos78.db), I greped the xbmc's Gotahm branch for 'idParentPath'. Nothing there.

But when I greped xbian-package-xbmc, I found this: https://github.com/xbianonpi/xbian-package-xbmc/blob/a9882adda7dab4a94b1035161abd58fd7702845c/patches/videoclean-keep-offline-tvshows.patch

As you can see, that patch is the culprit. It added path.idParentPath to the select in a branch where it doesn't exists.

anaconda commented 9 years ago

Thanks for reporting, and sorry for the inconvenience.

I've temporarily moved it to -nightly builds only because I don't have any MyVideos78.db available to test different queries with right now (technically, Helix/master have it already applied, so it'll silently "fail" to apply, but keeping it around ensures I won't forget).

It's even possible that in the meantime Helix gets released and we'll stop supporting Gotham.

CurlyMoo commented 9 years ago

As i said on IRC:

<curlymo> MyVideos78: "SELECT path.idPath, path.strPath, path.idParentPath FROM path".
<curlymo> Unknown column 'path.idParentPath' in 'field list'
<curlymo> MyVideos89: SELECT path.idPath, path.strPath, path.idParentPath FROM path
<curlymo> Table 'MyVideos89.path' doesn't exist
<curlymo> So better add some additional checks to see if the table / columns actually exists.
anaconda commented 9 years ago

Yep, but I have a couple ideas on how to get the same results on Gotham. However, given the different structure I'm not actually sure if that bug was also affecting Gotham (would need runtime testing, but nobody has reported that TV shows vanish after a clean on an offline source).

tl;dr I'll delete it, patch is merged upstream for Helix (where I'm sure the bug existed). (FYI, that MyVideos89 seems somewhat corrupted, the path table still exists in MyVideos90 and has existed for ages.)

bellini666 commented 9 years ago

@anaconda just updated to the latest xbian-package-xbmc and the problem is still there:

xbian@raspberry ~ $ apt-cache policy xbian-package-xbmc
xbian-package-xbmc:
  Installed: 13.2-RLS-1419024645
  Candidate: 13.2-RLS-1419024645
  Version table:
 *** 13.2-RLS-1419024645 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
        100 /var/lib/dpkg/status
     13.2-RLS-1418717053 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     13.2-RLS-1416698281 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     13.2-RLS-1416309594 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     13.2-RLS-1411559513 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     13.2-RLS-1410484857 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     13.2-RLS-1409264946 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     13.2-RC1-1408209931 0
        900 mirror://apt.xbian.org/mirror.txt/ staging/rpi-wheezy armhf Packages
     13.2-BETA3-1407283441 0
        900 mirror://apt.xbian.org/mirror.txt/ staging/rpi-wheezy armhf Packages
     13.2-BETA2-1405871107 0
        900 mirror://apt.xbian.org/mirror.txt/ staging/rpi-wheezy armhf Packages
     3.1.1-1 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     3.1.0-2 0
        900 mirror://apt.xbian.org/mirror.txt/ staging/rpi-wheezy armhf Packages
     3.0.1-1 0
        900 mirror://apt.xbian.org/mirror.txt/ staging/rpi-wheezy armhf Packages
     3.0.1 0
        900 mirror://apt.xbian.org/mirror.txt/ staging/rpi-wheezy armhf Packages
     3.0.0-1 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     2.9-10.20 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     2.9-10.19a 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     2.9-10.18 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     2.9-10.13 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
     2.9-10.10 0
        900 mirror://apt.xbian.org/mirror.txt/ stable/rpi-wheezy armhf Packages
anaconda commented 9 years ago

That package has been built the day before the patch got removed:

anepu:~ anaconda$ date -r 1419024645
Ven 19 Dic 2014 22:30:45 CET

A fix is likely to be pushed in the next couple days. // cc @mk01