After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734916 - Slow startup with many DB QUERY messages
Slow startup with many DB QUERY messages
Status: RESOLVED DUPLICATE of bug 725929
Product: geary
Classification: Other
Component: engine
master
Other Linux
: Normal normal
: ---
Assigned To: Geary Maintainers
Geary Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-16 18:03 UTC by Robert Schroll
Modified: 2014-08-19 23:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Log from -d --log-network (1.18 MB, text/x-log)
2014-08-16 18:09 UTC, Robert Schroll
Details
log, part 2 (1.30 MB, text/x-log)
2014-08-16 18:10 UTC, Robert Schroll
Details

Description Robert Schroll 2014-08-16 18:03:20 UTC
I finally caught a slow start with full debugging.  See the attached file for the log.  There were only two new messages, I believe, but it took tens of seconds for Geary to display them.  The log ends when I closed Geary shortly after reading both.
Comment 1 Robert Schroll 2014-08-16 18:09:51 UTC
Created attachment 283611 [details]
Log from -d --log-network

Bugzilla doesn't like big files, apparently.  Here's the first part.
Comment 2 Robert Schroll 2014-08-16 18:10:44 UTC
Created attachment 283612 [details]
log, part 2
Comment 3 Jim Nelson 2014-08-19 23:18:53 UTC
You're seeing two problems, both known (bug #725929).  It's something I'm working on in the background, so to speak, attempting to isolate problem cases and fix them when I can.  The fact remains there are two large problems with the database:

(a) Geary used to use an INNER JOIN to find incomplete messages (needed for the ImapEngine.EmailPrefetcher).  This was horribly slow and I finally determined that it quicker to simply do the join manually with two separate transactions.  That commit is at https://git.gnome.org/browse/geary/commit/?id=28629ce6e2b149ea6b3ff94f27ab30237b7bcf2d

The manual transactions may seem annoyingly slow, but the INNER JOIN was actually much worse and tied up the db for a long period of time.  With the new strategy, the database is locked for less time and in smaller chunks of time, allowing for other operations to complete.

(b) At startup Geary checks to ensure all messages have been indexed in the FTS search table.  This also takes a horrible amount of time.  Testing showed that merely touching the FTS (with any query) causes SQLite to do a long load that seems to touch a rather large number of pages in the db.  We were unable to find a good way around this.

(b) is the worse one.  In your log the search load took 60s to complete, and experience shows all other db transactions are blocked until the transaction completes.  My nagging suspicion now is that we need to move the FTS into a separate database file, although that creates a host of cogency issues that would need to be addressed.

There might be a clever solution for (a) I'm overlooking.  (b) looks much more serious; unless there's some handy SQLite flag that turns off this behavior, I worry we need to restructure the entire db to get around the issue.

*** This bug has been marked as a duplicate of bug 725929 ***