1. 28 Feb, 2019 1 commit
    • Kristian Klausen's avatar
      Remove trailing whitespace · 48c93655
      Kristian Klausen authored
      find . -name '*.vala' -type f -exec sed -i 's/ *$//g' {} +
      The following files was ignored:
      test/client/composer/composer-web-view-test.vala
      test/engine/util-html-test.vala
      
      Fix #271
      48c93655
  2. 21 Jan, 2019 1 commit
  3. 21 May, 2018 3 commits
  4. 19 May, 2018 1 commit
  5. 08 May, 2018 2 commits
    • Michael Gratton's avatar
      Make database classes more amenable to asynchronous use. · 743b24dd
      Michael Gratton authored
      This makes both the open() and open_connection() methods on
      Geary.DB.Database asynchronous, which allows the VersionedDatabase
      open_background() and its hackery to be removed, and upgrades to be
      performed asynchronously as well. It also adds a
      exec_transaction_async() method to Connection, allowing an existing
      object to also be used to establish an async transaction.
      
      * src/engine/db/db-connection.vala (Connection): Add
        exec_transaction_async method, update doc comments.
      
      * src/engine/db/db-database.vala (Database): Make open and
        open_connection async by executing SQLite code in a background thread,
        update call sites. Move job management code out of
        exec_transaction_async into a new internal add_async_job() method so it
        can be used by Connection. Add unit tests.
      
      * src/engine/db/db-transaction-async-job.vala (TransactionAsyncJob): Add
        an optional internal connection method and make the job's cancellable
        an internal property so a Connection instance can specify itself for
        the transaction.
      
      * src/engine/db/db-versioned-database.vala (VersionedDatabase): Remove
        open_background() hack since open() is now async. Make version upgrade
        hooks for derived classes async and update call sites. Use a
        Nonblocking.Mutex rather than GLib mutex so upgrade exclusion works
        asynchronously. Add unit tests.
      
      * src/engine/imap-db/imap-db-database.vala (Database): Make database
        upgrade methods async and execute SQL in async instructions now that
        the bases classes support it. Add unit tests.
      743b24dd
    • Michael Gratton's avatar
      Support in-memory SQLite databases, as well as on-disk databases. · 4251596d
      Michael Gratton authored
      Give Db.Database two constructors, one for persistent and one for
      transient databases. Add a path property since SQLite's API lives in the
      last century still and that gets used to specify in-memory databases, and
      use that for debug messages everwhere.
      
      Having support for in-memory databases is also needed to make unit
      testing ImapDB possible.
      4251596d
  6. 15 Jan, 2018 1 commit
  7. 09 Jan, 2018 1 commit
  8. 09 Dec, 2016 1 commit
  9. 06 May, 2016 1 commit
  10. 12 Mar, 2015 1 commit
  11. 06 Feb, 2015 1 commit
  12. 05 Jan, 2015 1 commit
    • Jim Nelson's avatar
      Add free page requirement to trigger VACUUM · 2d0b53db
      Jim Nelson authored
      A follow-up to recent garbage collection commit.  Prior trigger for
      VACUUM required a large number of reaped messages, indicating disk
      fragmentation but not necessarily an indication of free space that
      could be returned to the operating system.  This patch adds trigger
      looking for 500MB of free space in database, large enough to justify
      a full rebuild.
      2d0b53db
  13. 03 Dec, 2014 1 commit
  14. 12 Jun, 2014 1 commit
    • Jim Nelson's avatar
      Improve database parallelization · 8dec339f
      Jim Nelson authored
      Prior attempts to use multiple threads to access the SQLite database
      failed due to locking reasons.  This re-attempt fixes this, alloc'ing
      four threads per database and slightly changing the locking strategy
      for read-write transactions.
      
      Part of the prior issues may have been an attempt to use a connection
      pool (this patch simply opens a new connection for each transaction,
      which for our purposes seems fine).  The read-write strategy of
      deferring locking until the write portion of the transaction was also
      too optimistic, causing transactions to stall in the middle of their
      operations.
      8dec339f
  15. 14 Mar, 2014 1 commit
  16. 12 Mar, 2014 1 commit
    • Charles Lindsay's avatar
      Fix a number of database hiccups · c3e52705
      Charles Lindsay authored
      1) Use docid instead of id in search table.
      
      We had previously included an 'id INTEGER PRIMARY KEY' column in the
      MessageSearchTable, assuming it would get the same rowid alias treatment
      as it does in non-FTS tables.  That assumption was wrong: it was being
      created as a FTS column.  This fixes it so we use docid everywhere.
      
      To fix the old incorrect docid values, we simply blow away the search
      table and let the natural search table population process, which now has
      the correct docid insertion code, fix the problem.
      
      This also removes the id column from the search table creation SQL, but
      this will only affect new users.  Upgraders will see an empty, vestigal
      id column in their search table.  Since SQLite doesn't easily let you
      remove columns, it's just easier to ignore the column than go through
      all the work to fix it.
      
      2) Do as many rowid lookups as possible in batches, instead of doing
      them individually in loops.  This speeds up working with large sets of
      email.
      
      3) Rejigger indices on the MessageLocationTable to make certain queries
      faster.  This creates a new covering index in particular for the email
      prefetcher, which previously had to sort using a temp table.  The new
      index should work in the general case too, as we should never be looking
      at ordering without folder_id (and since folder_id comes first, it works
      as an index on just folder_id, too).
      
      4) For bonus measure, log all slow queries (> 1s execution time) to
      debug output.
      
      Closes: bgo #725929
      c3e52705
  17. 04 Mar, 2014 1 commit
    • Charles Lindsay's avatar
      Don't multithread db upgrades · 85d1a971
      Charles Lindsay authored
      Turns out for long-running upgrades we were running them all in
      parallel, which thrashes the disk pretty hard.  This adds a simple mutex
      lock around each upgrade, so at least the computer is usable while it's
      going on.  A more robust solution would be to have a single-thread
      thread pool where we enqueue upgrades, but that's too much change this
      late in the release cycle.
      
      Also it turns out that the nullifying of the internaldate_time_t column
      before we repopulate it was very costly, and unnecessary.  So, this also
      should speed things up for upgrading users.
      
      Closes: bgo #724475
      85d1a971
  18. 05 Feb, 2014 1 commit
  19. 28 Sep, 2013 1 commit
  20. 26 Sep, 2013 1 commit
  21. 25 Sep, 2013 1 commit
  22. 09 Sep, 2013 2 commits
    • Jim Nelson's avatar
      Better schema version checking against newer schemas: Closes #7058 · 78977b3f
      Jim Nelson authored
      If the database's current schema version does not have a corresponding
      schema file in the schema directory, throw an Error and report it to
      the user.  Most likely this means the user is trying to run an older
      version of Geary against a newer database.
      78977b3f
    • Jim Nelson's avatar
      Warn when user data is corrupted: Closes #7345 · e09a056e
      Jim Nelson authored
      The database is now tested for corruption at startup.  If a problem
      is detected, one of three error messages are displayed in a dialog box
      (corruption, permission problems, and "general error").
      e09a056e
  23. 26 Aug, 2013 1 commit
  24. 19 Jul, 2013 1 commit
  25. 08 Jul, 2013 1 commit
  26. 24 Jun, 2013 1 commit
    • Jim Nelson's avatar
      Command continuation and synchronizing literals: Closes #3737 · a4ce7899
      Jim Nelson authored
      This introduces synchronized literals into the IMAP stack.  This
      work also includes a new Memory.Buffer interface (replacing the old
      Memory.AbstractBuffer classes) which is more flexible and has more
      potential for avoid buffer copies.  Some work in RFC822 and Db use
      these new unowned buffer capabilities.
      
      This opens the door for saving drafts (#6992).  It also fixes issues
      people have reported using UTF-8 usernames and passwords with IMAP.
      a4ce7899
  27. 27 Apr, 2013 1 commit
  28. 26 Apr, 2013 1 commit
    • Jim Nelson's avatar
      Produce Valadoc for the Engine: Closes #4346 · 15ed4042
      Jim Nelson authored
      "make valadoc" will now produce valadoc/ in the top-level directory.
      Still a lot of work to do to clean this up, as some names need to be
      fixed for better heirarchy and others should be made private to prevent
      leakage.  And, of course, more classes, namespaces, and methods need
      to be properly documented.
      15ed4042
  29. 12 Apr, 2013 1 commit
  30. 04 Apr, 2013 1 commit
    • Jim Nelson's avatar
      Updated two debug statements · baddc56c
      Jim Nelson authored
      One in GearyController is to assist when looking for reasons why
      for log messages, otherwise multiple accounts could be difficult to
      determine which database is causing the problem.
      baddc56c
  31. 27 Mar, 2013 1 commit
  32. 22 Mar, 2013 1 commit
  33. 16 Mar, 2013 1 commit
    • Jim Nelson's avatar
      Database locked errors part deux: Closes #6460 · 23b21349
      Jim Nelson authored
      This reverts the retry strategy back to SQLite's built-in handler,
      but with one difference: concurrency is turned off on async
      transactions by using only one thread.  Concurrency with SQLite
      will need to be readdressed later.
      23b21349
  34. 15 Mar, 2013 1 commit
  35. 12 Mar, 2013 1 commit
    • Jim Nelson's avatar
      Additional fixes discovered while researching memory leak · 9b9f0e9c
      Jim Nelson authored
      The .reconstitute ctor for RootParameter wasn't fully baked in how
      it handled ListParameter migrations.  Additionally, the name didn't
      convey that the operation was destructive to the source, so the name
      was changed to .migrate.
      
      Further tweaking of database BUSY timeout as well.  Couple of inner
      classes registered as BaseObjects to facilitate tracking.
      9b9f0e9c
  36. 08 Mar, 2013 1 commit
    • Jim Nelson's avatar
      Memory leak and lost reference tracking: Refs #5306 · 826e9d5f
      Jim Nelson authored
      This patch solves the following memory/resource leak problems:
      
      (a) Gee.TreeSet doesn't drop references when destroyed.  Fixed by
      using a subclass that clears the set when destroyed (exactly same
      as patch made to Gee, however that won't be in distribution for
      awhile.)
      
      (b) Imap.ClientSession was holding refs to CommandResponses after
      they'd been completed.  They're now dropped.
      
      (c) Imap.ClientSessionManager now has an open/close_async() (called
      by Imap.Account.open/close_async()) that drops all ClientSessions.
      
      (d) All classes in Engine (and some in the client) use Geary.BaseObject,
      which uses a static map to track outstanding held references to
      it.  The table is dumped when Geary exits.  Must be enabled with a
      ./configure flag.
      
      Two outstanding memory leaks persist (one for Imap.ResponseCodes and
      another when messages are selected/deselected), so this doesn't close
      the ticket, but testing and use has shown these changes to make a huge
      improvement on memory usage and reducing crashes.
      826e9d5f