> Le 1 août 2019 à 14:49, Tammisalo Toni <toni.tammis...@aalto.fi> a écrit : > > Hi! > > 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. Background: https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep "Every call to sqlite3_backup_step() obtains a shared lock on the source database that lasts for the duration of the sqlite3_backup_step() call." I can't comment on buffering issues, flushing things and so on when outputting through a custom VFS. — Best Regards, Meilleures salutations, Met vriendelijke groeten, Mit besten Grüßen, Olivier Mascia _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users