On Wed, Feb 29, 2012 at 11:59 AM, Gregory Johnson <tkg.perso...@gmail.com>wrote:

> Hi,
> I have an application where one thread (A) is executing various statements
> and another thread (B) is performing an online backup. These two threads
> share the same source database connection; the SQLite threading mode is set
> to serialized.
>
> I wish to stop the online backup from another thread as quickly and safely
> as possible. In particular, I want to interrupt a potentially time
> consuming sqlite3_backup_step call. I thought calling sqlite3_interrupt on
> the online backup destination database would be ideal, since I do not want
> to potentially stop A's execution by calling interrupt on the source
> database. However the online backup documentation (
> http://www.sqlite.org/c3ref/backup_finish.html) states that an application
> "must guarantee that the destination database connection is not passed to
> any other API (by any thread) after sqlite3_backup_init() is called."
>
> So, my question is: is it safe to call sqlite3_interrupt on the destination
> database connection of an online backup?
>

I think it is safe.  But it will also be a no-op.  The sqlite3_interrupt()
interface only stops SQL statements, not sqlite3_backup_step() calls.

That seems wrong doesn't it?  It never occurred to us to want to interrupt
an sqlite3_backup_step() call.  Maybe we should fix this.

On the other hand, if you want sqlite3_backup_step() to be "interruptable"
then just do a single step at a time in a loop and check for your own
interrupt mechanism on each iteration of the loop.  You don't need SQLite's
help for this.

I'm not sure what the right solution for SQLite is:  Do we change
sqlite3_backup_step() to be interruptable or not?  We'll have to think
about that some before reaching a decision.


>
> Thank you!
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to