On 7/10/19 7:05 AM, Andy Bennett wrote:
>
> Thanks for the detailed explanation of how it works. What I meant to
> ask was "is there really a difference in the *semantics*?". i.e. from
> the user perspective, can databases in the two different modes end up
> in different states?

My understanding is NO, as long as the same transactions complete.

There is a significant difference in when a write transaction can start,
so code that doesn't wait properly might take different paths and thus
you end up in a different state.

In WAL mode, basically one write transaction can always be started, no
matter how many read transactions might be present, and once a write
transaction starts, no other existing read transaction can upgrade
itself to a write.

In non-WAL mode, the write transaction will need to wait for all (other)
read transactions to end before it can start, and if while it is waiting
another read transaction tries to upgrade it will be denied, but once it
starts, there can't be another read transaction to attempt an upgrade.

In both cases, if a read transaction attempting to upgrade to a write
transaction gets a busy, it needs to end the transaction and re-do its
reads before it can do its write. The differences is that in WAL mode,
one transaction doesn't need to wait for all the reads to finish before
it can start.

-- 
Richard Damon

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to