On Thu, Nov 29, 2012 at 02:39:49PM +0000, Black, Michael (IS) scratched on the 
wall:
> I thought a backup was using a snapshot and locking the database?

  No... the source DB remains available.  That's largely the point of
  the API.  In fact, the full name is the "Online Backup API." The fact
  that it can also be used to copy in-memory DBs is more of a side
  benefit, even if it was a much needed benefit.

  http://www.sqlite.org/c3ref/backup_finish.html

    SQLite holds a write transaction open on the destination database
    file for the duration of the backup operation. The source database
    is read-locked only while it is being read; it is not locked
    continuously for the entire backup operation. Thus, the backup may
    be performed on a live source database without preventing other
    database connections from reading or writing to the source database
    while the backup is underway.

  If the source database is modified by the same connection doing the
  backup, the page updates are written to both DBs.  If the source DB
  is modified by any other connection, the backup automatically restarts.

  Because it is easy to imagine a case when the backup gets caught in a
  restart loop, some people choose to make the backup a more atomic
  operation by having the backup "step" function copy all the pages in
  one go.  In that case it is likely that the majority of pages are
  written out in-order, but I wouldn't want to bank on that.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to