> Le 14 mars 2019 à 09:27, Dan Kennedy <danielk1...@gmail.com> a écrit : > > On 13/3/62 22:51, Simon Slavin wrote: >> If the source database is changed while the Online Backup API is running, it >> returns to the beginning of the database and starts again. I have a couple >> of questions which might be useful, especially if the database is changed >> only by the same connection as it performing the backup. > > In that case - when the connection doing the backup is the same as the one > that modifies the database - the backup does not restart. Instead, when the > connection writes to the original database, any pages that have already been > copied into the backup are updated there as well. > > The backup only has to restart when the connection doing the backup and the > connection doing the db modification are different connections. > > From the docs for sqlite3_backup_step(): > > "If the source database is modified by an external process or via a database > connection other than the one being used by the backup operation, then the > backup will be automatically restarted by the next call to > sqlite3_backup_step(). If the source database is modified by the using the > same database connection as is used by the backup operation, then the backup > database is automatically updated at the same time." > > https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep
Dan, It has already been confirmed I think, but just for 100% clarity: if using WAL and a default (deferred) transaction has been started, the backup can run, step by step in the context of that reader transaction, without blocking writers and other (existing or new) readers. Is that right? Or could the detection of writes by other connections kicks in anyway and force the backup to needlessly restart? -- Best Regards, Meilleures salutations, Met vriendelijke groeten, Olivier Mascia _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users