SQLite: Is there any way for use of WAL without mmap() function?

為{幸葍}努か 提交于 2019-12-11 01:49:40

问题


I want to use WAL mode for the reason of performance and reliability. However my environment doesn't have mmap() function, so I can't compile SQLite with WAL (WAL needs mmap().). Although setting PRAGMA locking_mode=EXCLUSIVE allow use of WAL without mmap() (In this case, WAL-index is created on heap memory not shared file), it is not good solution for the applications that manage multiple database connections.

I use SQLite with multiple database connections (for inter-thread concurrency) in one process, and mmap() seems to be only used for inter-process memory sharing. Since I expect there is a way to use WAL without mmap() in single-process environment. But I can't find the good solution. Are there any ideas to solve this problem?

Thanks.


回答1:


The code in the SQLibrary always creates a memory-mapped file for the wal-index.

If you want to use WAL without mmap, you have to change that code to use a plain block of shared memory instead.



来源:https://stackoverflow.com/questions/23540013/sqlite-is-there-any-way-for-use-of-wal-without-mmap-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!