DobyTang / LazyLibrarian

This project isn't finished yet. Goal is to create a SickBeard, CouchPotato, Headphones-like application for ebooks. Headphones is used as a base, so there are still a lot of references to it.
729 stars 72 forks source link

Database Integrity Error - foreign key constraint failed #1663

Closed anotb closed 5 years ago

anotb commented 5 years ago

Multiple database integrity errors on trying to add past issues of magazines to wanted list, as well as any new magazine searches

Version - 59b5b79fe5b069ab8d74677f8cd9799dba611354

philborman commented 5 years ago

That's a tricky one. Missed that. The foreign key restraint deletes orphans, but the magazine doesn't have an entry in the same table as books. Sounds like there are a couple of locations with the error, found one on line 3267, in markPastIssues but haven't found the other yet, do you have the location in your browser "internal server error"?

anotb commented 5 years ago

I actually recreated the docker container and the issue seems to have resolved itself.

Restarting the container / or the application had not fixed the issue.

I initially encountered the issue on on https://xyz.com/lazylibrarian/markPastIssues?redirect=manageissues&book_table_length=10&http=on&action=Wanted and then noticed a few more errors on the log similar to that. On Fri, Nov 9, 2018 at 10:17 AM philborman notifications@github.com wrote:

That's a tricky one. Missed that. The foreign key restraint deletes orphans, but the magazine doesn't have an entry in the same table as books. Sounds like there are a couple of locations with the error, found one on line 3267, in markPastIssues but haven't found the other yet, do you have the location in your browser "internal server error"?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DobyTang/LazyLibrarian/issues/1663#issuecomment-437390405, or mute the thread https://github.com/notifications/unsubscribe-auth/AbVv_5gvHpa8b4LhUhOivyKWfkRQSmdkks5utZxtgaJpZM4YWtVI .

airix1 commented 5 years ago

I have this error as well

09-Nov-2018 10:12:18 - ERROR :: SEARCHMAG : searchmag.py:search_magazines:507 : Unhandled exception in search_magazines: Traceback (most recent call last): File "/opt/LazyLibrarian/lazylibrarian/searchmag.py", line 458, in search_magazines myDB.upsert(insert_table, newValueDict, controlValueDict) File "/opt/LazyLibrarian/lazylibrarian/database.py", line 143, in upsert self._action(query, list(valueDict.values()) + list(keyDict.values()), suppress="UNIQUE") File "/opt/LazyLibrarian/lazylibrarian/database.py", line 58, in _action sqlResult = self.connection.execute(query, args) IntegrityError: FOREIGN KEY constraint failed

philborman commented 5 years ago

Should be fixed tomorrow. It's a little complicated...

philborman commented 5 years ago

Tomorrows upgrade will include a fix for this, the fix seems to work fine in testing, but have to delay the upgrade until tomorrow as we are moving provider. Sorry for the inconvenience.

philborman commented 5 years ago

Should be fixed now, Development has moved to GitLab All open issues have been moved over to LazyLibrarian Issues Please open any new issues or comments on the new repo as the old one is no longer maintained, thanks