Page 1 of 1

[Trunk] History DB - Database fails to create [rev 2490]

Posted: May 5th, 2009, 2:31 am
by FrankSpierings
I think there might be something wrong with the threading in revision 2490 (trunk).

(Note: I've configured the ini file to store admin somewhere outside the program dir)

I see that the initialisation of the history database is done twice. When it tries to setup the tables it fails because its locked.

You can spot this when logging the constructor of database.py.

The following is a log of the unmodified rev 2490

Code: Select all

2009-05-05 08:57:33,285::DEBUG::[misc:503] Unsupported release number (trunk), will not check
2009-05-05 08:57:59,238::ERROR::[database:79] SQL Command Failed, see log
2009-05-05 08:57:59,239::DEBUG::[database:80] SQL: SELECT sum(bytes) FROM history
2009-05-05 08:57:59,239::DEBUG::[database:81] Traceback: 
Traceback (most recent call last):
  File "/usr/local/share/SABnzbd-trunk/sabnzbd/database.py", line 74, in execute
    self.c.execute(command)
OperationalError: no such table: history
2009-05-05 08:57:59,448::ERROR::[database:79] SQL Command Failed, see log
2009-05-05 08:57:59,449::DEBUG::[database:80] SQL: SELECT sum(bytes) FROM history WHERE "completed">?
2009-05-05 08:57:59,449::DEBUG::[database:81] Traceback: 
Traceback (most recent call last):
  File "/usr/local/share/SABnzbd-trunk/sabnzbd/database.py", line 72, in execute
    self.c.execute(command, args)
OperationalError: no such table: history
2009-05-05 08:57:59,658::ERROR::[database:79] SQL Command Failed, see log
2009-05-05 08:57:59,659::DEBUG::[database:80] SQL: SELECT sum(bytes) FROM history WHERE "completed">?
2009-05-05 08:57:59,659::DEBUG::[database:81] Traceback: 
Traceback (most recent call last):
  File "/usr/local/share/SABnzbd-trunk/sabnzbd/database.py", line 72, in execute
    self.c.execute(command, args)
OperationalError: no such table: history
2009-05-05 08:57:59,868::ERROR::[database:79] SQL Command Failed, see log
2009-05-05 08:57:59,869::DEBUG::[database:80] SQL: select count(*) from History WHERE name LIKE ?
2009-05-05 08:57:59,869::DEBUG::[database:81] Traceback: 
Traceback (most recent call last):
  File "/usr/local/share/SABnzbd-trunk/sabnzbd/database.py", line 72, in execute
    self.c.execute(command, args)
OperationalError: no such table: History
2009-05-05 08:58:00,078::ERROR::[database:79] SQL Command Failed, see log
2009-05-05 08:58:00,079::DEBUG::[database:80] SQL: SELECT * FROM history WHERE name LIKE ? ORDER BY completed desc LIMIT ?, ?
2009-05-05 08:58:00,081::DEBUG::[database:81] Traceback: 
Traceback (most recent call last):
  File "/usr/local/share/SABnzbd-trunk/sabnzbd/database.py", line 72, in execute
    self.c.execute(command, args)
OperationalError: no such table: history
2009-05-05 08:58:17,490::ERROR::[database:79] SQL Command Failed, see log
2009-05-05 08:58:17,491::DEBUG::[database:80] SQL: 
        CREATE TABLE "history" (
            "id" INTEGER PRIMARY KEY,
            "completed" INTEGER NOT NULL,
            "name" TEXT NOT NULL,
            "nzb_name" TEXT NOT NULL,
            "category" TEXT,
            "pp" TEXT,
            "script" TEXT,
            "report" TEXT,
            "url" TEXT,
            "status" TEXT,
            "nzo_id" TEXT,
            "storage" TEXT,
            "path" TEXT,
            "script_log" BLOB,
            "script_line" TEXT,
            "download_time" INTEGER,
            "postproc_time" INTEGER,
            "stage_log" TEXT,
            "downloaded" INTEGER,
            "completeness" INTEGER,
            "fail_message" TEXT,
            "url_info" TEXT,
            "bytes" INTEGER,
            "meta" TEXT
        )
        
2009-05-05 08:58:17,492::DEBUG::[database:81] Traceback: 
Traceback (most recent call last):
  File "/usr/local/share/SABnzbd-trunk/sabnzbd/database.py", line 74, in execute
    self.c.execute(command)
OperationalError: database is locked
2009-05-05 08:58:29,033::ERROR::[database:79] SQL Command Failed, see log
2009-05-05 08:58:29,037::DEBUG::[database:80] SQL: SELECT sum(bytes) FROM history
2009-05-05 08:58:29,037::DEBUG::[database:81] Traceback: 
Traceback (most recent call last):
  File "/usr/local/share/SABnzbd-trunk/sabnzbd/database.py", line 74, in execute
    self.c.execute(command)
OperationalError: no such table: history
2009-05-05 08:58:29,039::ERROR::[database:79] SQL Command Failed, see log
2009-05-05 08:58:29,039::DEBUG::[database:80] SQL: SELECT sum(bytes) FROM history WHERE "completed">?
2009-05-05 08:58:29,040::DEBUG::[database:81] Traceback: 
Traceback (most recent call last):
  File "/usr/local/share/SABnzbd-trunk/sabnzbd/database.py", line 72, in execute
    self.c.execute(command, args)
OperationalError: no such table: history

Re: [Trunk] History DB - Database fails to create [rev 2490]

Posted: May 5th, 2009, 7:39 am
by switch
I take it this happened right after changing the admin directory to another location. I will look into ways to make this better.

For now, simply delete the database file inside the admin folder and it will be created again.

Thanks for reporting the issue.

Re: [Trunk] History DB - Database fails to create [rev 2490]

Posted: May 6th, 2009, 1:43 am
by FrankSpierings
In this situation the admin database won't be rercreated. I'll give it a try when the admin folder is in the normal installation dir.

Cheers