Simon Slavin-3 wrote
> On 27 Aug 2014, at 4:21pm, Jan Slodicka <

> jano@

> > wrote:
> 
>> - There is one potentionally risky operation that our app performs: The
>> data
>> exchange with a remote WebService. This can take long (10+ min). Users
>> often
>> switch to email reading or similar activity, the app then runs on the
>> background and can be eventually killed by OS. This might happen during
>> an
>> unfinished transaction. 
> 
> Does this happen while the database is open and in use by the app ?

Yes


> When you exchange data, do you exchange data accessed as records (e.g.
> accessed using the SQLite API) or do you exchange files ?

DB tables are being synchronized. The server sends xml data over http. This
data is parsed and converted into a collection of high level data records.
These records are then stored in the DB. At the same time some of the local
DB records are sent to the server.

The details are complex. Main point is that during a single transaction
(which may take a long time) new records are added (deleted, updated) for a
single table. If this succeeds, the transaction is commited and the whole
process is repeated with a new table. In case of any failure, the whole
syncronization process is aborted.

What is strange - the corruption may affect tables that were accessed
through different transactions. However, this may be explained by this
scenario:
- App is killed => synchronization is killed in the middle => DB gets first
corruption.
- App is restarted, DB corruption unnoticed and the user starts
synchronization again. Synchronization resumes with the table where it
stopped the last time. (I would expect that the DB corruption is discovered
now, but it does not happen for some reason.) Synchronization updates a few
tables, when the app is killed again causing another DB corruption etc.


> If you exchange files do you exchange just the database file or also
> journal files ?

Should be answered above.



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/Integrity-check-tp77519p77556.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to