MyBB Community Forums

Full Version: Database optimization fails with SQLite
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Have been using SQLite with this MyBB for quite some time, three upgrades; now at 1.8.6.  Every time I have tried to optimize the database, something very much like the below results.  Anyone have a thought as to what is wrong?  OS platform is currently CentOS 7, fully updated.  Performance in general is excellent, although 'database locked' errors do come up sometimes if I try to do operations on very long (~75) lists of users.


MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
0 -
Query:
SQLSTATE[HY000]: General error: 1 cannot VACUUM - SQL statements in progress
Please contact the MyBB Group for technical support.
That error means you have other open connections to the DB at that moment that query a table which is supposed to be optimised. You should temporarily block anyone but you in .htaccess and then retry.

Not sure if there's any possible code workaround, perhaps we should mention that on the optimize/backup pages (moving to bug reports).
Greetings, D666.  I tried that just now, did not change the behavior.  To be specific, I tried the following procedure:
  1. Set up .htaccess so that no one can log in except from my (home) IP
  2. Tested the .htaccess in terms of both permit and deny
  3. Ran 'apachectl restart' to reset anything currently open
  4. Attempted to optimize tables, one at a time, and then the whole
  5. Removed the .htaccess
Thoughts?
Well, given that the recommended fix did nothing and no further suggestions, I did this:

1.  Set up .htaccess to deny
2.  Ran 'apachectl restart' on the server to make sure nothing running, open, or locking
3.  Ran this on the server, against the database file, after making a backup:
sqlite3 *.db "VACUUM;"
4.  Checked sizes; was 11M, now 6.7M :-)
5.  Removed .htaccess denial
6.  Enjoyed the result!