Using SQLite 3.20.1 I notice a flood of log events sometimes when I call PRAGMA 
optimize;

Warning 0x5: statement aborts at 1: [PRAGMA optimize;] database is locked
And a few times
Warning 0x5: statement aborts at 2: [PRAGMA optimize;] database is locked
And even once
Warning 0x5: statement aborts at 35: [PRAGMA optimize;] database is locked

We use the default busy-handler w/timeout=250ms and call sqlite_exec("PRAGMA 
optimize;") in a loop until success or non-busy/locked error or some ungodly 
amount of time elapses (~5min). The logs indicate PRAGMA optimize; fails due to 
SQLITE_BUSY w/o ever going through the busy-handler, and then we spin trying a 
few thousand times.

Docs for PRAGMA optimize; says nothing about busy|locked scenarios, nor any 
need to call this in a transaction (nor even if that's legal). Ditto ANALYZE 
docs say nothing about busy|locked scenarios

What's expected if PRAGMA optimize hits a busy|locked scenario?
What am I the caller expected to do?


  *   Howard
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to