http://bugzilla.moblin.org/show_bug.cgi?id=7708
--- Comment #10 from pohly <patrick.ohly(a)intel.com> 2010-02-16 13:04:08 PST ---
Code all in "pohly" branch.
(In reply to comment #7)
Open at this point:
- call SyncSourceRevisions/TrackingSyncSource::listAllItems() only once,
not twice (once in database dump, once in change tracking)
commit 33f6e2064c7fc7c376336e86fd9460df3cdbf14c
Author: Patrick Ohly <patrick.ohly(a)intel.com>
Date: Tue Feb 16 17:43:41 2010 +0100
SyncSourceRevisions: cache result of listAllItems() (MB #7708)
When automatic backups are enabled (the default), SyncSourceRevisions
and derived classes like TrackingSyncSource called listAllItems()
twice, once during backup and once while checking for changes.
This patch introduces caching of the result returned by the first
call. During a normal session, that will be during backup, with
change detection reusing the information. If backups are off, the
call will happen during change detection, as before.
The advantages of this change are:
- more efficient, in particular for sources where listAllItems() is slow
- avoids a race condition (backup stores one set of items, changes
are made, change detection works with another set)
That race condition is both fairly theoretical (short time window) and
had no impact on the correctness of the sync, only on the output (data
comparison would not show all changes synced later).
Now the race condition still exists if changes are made while a sync
runs, which is the bigger problem that still needs to be solved (for EDS,
see MB #3479).
Restoring data also calls listAllItems(). It does not use the cached
information, just in case that it is to be called more than once per
instance, and because there is no benefit.
- detect empty sources via source callback, instead of depending on a
previous
database dump (needed for slow sync detection, search for
m_backupBefore.getNumItems())
commit 5f18644fbfc944db1759dbb726f2ea8b7892e0cf
Author: Patrick Ohly <patrick.ohly(a)intel.com>
Date: Tue Feb 16 20:11:16 2010 +0100
SyncSource API: added m_isEmpty operation (MB #7708)
The current solution of checking for empty sources by looking at the
"before" database dump is a hack which fails if creating that backup
was disabled. It also prevents delaying the dump until after the
start of the session, because the information must be available
before starting the session, so that the XML config can be created
with slow sync check enabled if needed.
This patch adds a new operation which backends must implement if they
want to provide the "is empty" information for the slow sync
detection. This is optional. If the information is not available, slow
sync detection is always on, even when not strictly needed.
commit fc059f7017f32b9184b5781a875a3ab22ca0c0c5
Author: Patrick Ohly <patrick.ohly(a)intel.com>
Date: Tue Feb 16 20:15:50 2010 +0100
SQLite backend: implement m_isEmpty operation (MB #7708)
This patch demonstrates how the operation can be implemented
by sources implementing the operations themselves. The implementation
of SQLiteContactSource::isEmpty() might not be perfect, but it
should get the job done.
commit 9e45cb0c56e9975637214f0f03add823171b314c
Author: Patrick Ohly <patrick.ohly(a)intel.com>
Date: Tue Feb 16 20:17:36 2010 +0100
TrackingSyncSource: added isEmpty() pure virtual method (MB #7708)
This implements the new m_isEmpty operation with a pure virtual
TrackingSyncSource::isEmpty() callback. It follows the philosophy
that TrackingSyncSource should
a) hide the underlying operation mechanism and
b) prevent derived classes from compiling unless they do
everything that is expected of them.
All of the in-tree backends were adapted so that they provide at least
a dummy implementation of the call, to keep them in a usable state.
The file backend implementation is okay. The Evolution backends get the
job done correctly, but not efficiently. Maemo and XMLRPC backends always
return false, which is acceptable but should be changed (disables the
"allow slow sync for empty databases" heuristic).
With this change in place, it was possible to delay dumping of databases also
when running as client:
commit 4713aa435afa8e51b18780f94595e81eead6008c
Author: Patrick Ohly <patrick.ohly(a)intel.com>
Date: Tue Feb 16 17:15:46 2010 +0100
database comparison: also delay it in clients (MB #7708)
Delaying the database comparison was done initially for servers to
limit it to the sources really used by the client. In a client the
same delay makes sense for syncs which fail because the peer cannot be
reached. It is possible to delay the dump because starting the session
no longer depends on it thanks to the m_isEmpty() operation.
- for automatic sync: when doing many syncs which do not change
anything,
these sessions will replace the old ones fairly quickly, thus removing
a potentially sane backup with many identical broken ones => if nothing
changed during a session and no error occurred, then remove the session dir
Not done yet.
--
Configure bugmail:
http://bugzilla.moblin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching someone on the CC list of the bug.