make sqlite status cache the default

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-04-09 21:06:38 +02:00
parent 6fb5700f94
commit 41e275e9a2
3 changed files with 22 additions and 28 deletions

View File

@ -200,16 +200,20 @@ done this yet, do it :). See the folderfilter section in offlineimap.conf.
3. The cache. 3. The cache.
+ +
The default status cache is a plain text file that will write out the complete OfflineImap caches the state of the synchronisation to e.g. be able to determine
file for each single new message (or even changed flag) to a temporary file. if a mail has been added or deleted on either side.
If you have plenty of files in a folder, this is a few hundred kilo to +
megabytes for each mail and is bound to make things slower. I recommend to use The historical status cache is a plain text file that writes out the complete
the sqlite backend for that. See the status_backend = sqlite setting in the file for each single new message (or even changed flag) to a temporary file. If
offlineimap.conf. You will need to have python-sqlite installed in order to you have plenty of files in a folder, this is a few hundred kilo to megabytes
use this. This will save you plenty of disk activity. Do note that for each mail and is bound to make things slow. The default status cache uses
the sqlite backend is still considered experimental as it has only been sqlite. This saves plenty of disk activity. The sqlite engine and the Python
included recently (although a loss of your status cache should not be a sqlite module must installed. See the status_backend = plain setting in the
tragedy as that file can be rebuilt automatically) offlineimap.conf.
+
If you switch the backend from plain to sqlite, you may want to delete the old
cache directory in <metadata>/Account-<account>/LocalStatus manually once
you are sure that things work.
4. Use quick sync. 4. Use quick sync.
+ +

View File

@ -302,26 +302,16 @@ remoterepository = RemoteExample
# #
# This example plays a sound file of your chosing when new mail arrives. # This example plays a sound file of your chosing when new mail arrives.
# #
#newmail_hook = lambda: os.system("cvlc --play-and-stop --play-and-exit /path/to/sound/file.mp3" + #newmail_hook = lambda: os.system(
# " > /dev/null 2>&1") #"cvlc --play-and-stop --play-and-exit /path/to/sound/file.mp3 > /dev/null 2>&1")
# This option stands in the [Account Test] section. # This option stands in the [Account Test] section.
# #
# OfflineImap caches the state of the synchronisation to e.g. be able to # The historical backend is 'plain' which writes out the state in plain text
# determine if a mail has been added or deleted on either side. # files. See manual.
# #
# The default and historical backend is 'plain' which writes out the #status_backend = sqlite
# state in plain text files. On Repositories with large numbers of
# mails, the performance might not be optimal, as we write out the
# complete file for each change. Another new backend 'sqlite' is
# available which stores the status in sqlite databases.
#
# If you switch the backend, you may want to delete the old cache
# directory in ~/.offlineimap/Account-<account>/LocalStatus manually
# once you are sure that things work.
#
#status_backend = plain
# This option stands in the [Account Test] section. # This option stands in the [Account Test] section.

View File

@ -38,7 +38,7 @@ class LocalStatusRepository(BaseRepository):
} }
# Set class and root for the configured backend # Set class and root for the configured backend
self.setup_backend(self.account.getconf('status_backend', 'plain')) self.setup_backend(self.account.getconf('status_backend', 'sqlite'))
if not os.path.exists(self.root): if not os.path.exists(self.root):
os.mkdir(self.root, 0o700) os.mkdir(self.root, 0o700)
@ -71,8 +71,8 @@ class LocalStatusRepository(BaseRepository):
# if backend contains data, import it to folder. # if backend contains data, import it to folder.
if not folderbk.isnewfolder(): if not folderbk.isnewfolder():
self.ui._msg('Migrating LocalStatus cache from %s to %s " \ self.ui._msg("Migrating LocalStatus cache from %s to %s "
"status folder for %s:%s'% "status folder for %s:%s"%
(bk, self._backend, self.name, folder.name)) (bk, self._backend, self.name, folder.name))
folderbk.cachemessagelist() folderbk.cachemessagelist()