[sqlite] WAL mode and backup API

2010-11-30 Thread Marco Bambini
Hello,

if a running sqlite database is in WAL mode and a backup is performed on that 
db using the sqlite3_backup API, does that process is considered like a reader 
and can proceed concurrently with other readers and with the other writer?

Thanks a lot for your answer.
--
Marco Bambini
http://www.sqlabs.com






___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] WAL mode and backup API

2010-11-30 Thread Dan Kennedy
On 11/30/2010 05:03 PM, Marco Bambini wrote:
 Hello,

 if a running sqlite database is in WAL mode and a backup is performed on that 
 db using the sqlite3_backup API, does that process is considered like a 
 reader and can proceed concurrently with other readers and with the other 
 writer?


Yes. The connection to the backup source acts like any other reader.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] WAL mode and backup API

2010-11-30 Thread Marcus Grimm
On 30.11.2010 11:32, Dan Kennedy wrote:
 On 11/30/2010 05:03 PM, Marco Bambini wrote:
 Hello,

 if a running sqlite database is in WAL mode and a backup is performed on 
 that db using the sqlite3_backup API, does that process is considered like a 
 reader and can proceed concurrently with other readers and with the other 
 writer?


 Yes. The connection to the backup source acts like any other reader.

BTW:
Is there any chance that in the future the wal mode
will avoid that the backup API will restart on DB
changes during the backup loop ?
Currently, even in wal mode, it does restart when changes
are detected while the backup is ongoing.

Marcus

 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] WAL mode and backup API

2010-11-30 Thread Dan Kennedy

 BTW:
 Is there any chance that in the future the wal mode
 will avoid that the backup API will restart on DB
 changes during the backup loop ?
 Currently, even in wal mode, it does restart when changes
 are detected while the backup is ongoing.

What happens if you open a read transaction on the source database
before starting the backup? i.e.

   sqlite3_exec(pSource, BEGIN; SELECT * FROM sqlite_master, 0, 0, 0);

   ... do backup ...

   sqlite3_exec(pSource, COMMIT, 0, 0, 0);

Does that help things any?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] WAL mode and backup API

2010-11-30 Thread Marcus Grimm

On 30.11.2010 11:50, Dan Kennedy wrote:

 BTW:
 Is there any chance that in the future the wal mode
 will avoid that the backup API will restart on DB
 changes during the backup loop ?
 Currently, even in wal mode, it does restart when changes
 are detected while the backup is ongoing.

 What happens if you open a read transaction on the source database
 before starting the backup? i.e.

 sqlite3_exec(pSource, BEGIN; SELECT * FROM sqlite_master, 0, 0, 0);

 ... do backup ...

 sqlite3_exec(pSource, COMMIT, 0, 0, 0);

 Does that help things any?

wow... what a trick!
Using your hint I'm not able to reproduce any restarts!
I can imagine what your hint does in wal mode, but without your input
I would never came to that idea... :-)

Thanks Dan! This makes the wal mode and backup API even more sexy.

Marcus


 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users