On Thu, Aug 1, 2019 at 5:02 PM Olivier Mascia <o...@integral.be> wrote:
> > Le 1 août 2019 à 14:49, Tammisalo Toni <toni.tammis...@aalto.fi> a > écrit : > > I have an application which is using sqlite database in WAL mode. There > is a need for > > periodic backups to a remote site without obstructing the normal > operation. Both read > > and write access is required during the backup. At the moment I have > system which > > first blocks checkpoints as otherwise backup was restarted too often. > Backup is done > > to remote database implemented with sqlite vfs layer. > > ... > > Also, I'm open to other suggestions. > > You are using WAL mode. > Have you tried coding your backup as a single step (passing -1 for the > number of pages to step)? > > int status = sqlite3_backup_step(bck, -1); > > Or if you really want to call sqlite3_backup_step() incrementally (X pages > at a time), then do BEGIN [DEFERRED] [TRANSACTION] first. > > Your backup copy should then be allowed to proceed from start to finish > without impacting readers and writers, nor being impacted by them. You shouldn't see any restart. Your backup will be a representation of the > database as it was when the single (or first) sqlite3_backup_step() call > started. > I've little practical experience here on this, but unless I'm mistaken, it does mean the WAL file cannot be check-pointed, while readers (including the backup) are still operating (AFAIK). Not a problem per-se, just something to be aware of. --DD _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users