Can I use WAL mode in SQLite3 if I use an additional mutex for multiple writers?

288 views Asked by At

http://sqlite.org/wal.html

WAL mode is specified for N readers and one writer. It the writer's identity interchangible? For example, I have N writers and an additional mutex. Each writer has to obtain this mutex to be able to write, so there are never two writers writing at the same time. Is this possible? And if so, why is this not part of SQLite since to me, it appears to be a natural extension of the WAL mode.

1

There are 1 answers

2
CL. On BEST ANSWER

In WAL mode, it is not possible to have multiple active writers. However, it is possible for multiple writers to attempt to write. This conflict is handled in exactly the same way as in rollback journal mode, i.e., the first writer locks the database, and the others have to wait.