SQLite:有没有任何方法使用WAL没有mmap()函数? [英] SQLite: Is there any way for use of WAL without mmap() function?

查看:243
本文介绍了SQLite:有没有任何方法使用WAL没有mmap()函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于性能和可靠性的原因,我想使用WAL模式。但是我的环境没有mmap()函数,所以我不能用WAL编译SQLite(WAL需要mmap()。)。虽然设置 PRAGMA locking_mode = EXCLUSIVE 允许使用WAL而不使用mmap()(在这种情况下,WAL-index是在堆内存上创建的,而不是共享文件),这不是好的解决方案对于管理多个数据库连接的应用程序。

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.

我在一个进程中使用SQLite与多个数据库连接(用于线程间并发),而mmap()似乎只有用于进程间内存共享。因为我期望有一种方法在单进程环境中使用WAL而不使用mmap()。但我找不到好的解决方案。是否有任何想法来解决这个问题?

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?

谢谢。

推荐答案

SQLibrary中的代码总是为wal-index创建一个内存映射文件。

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

如果要使用WAL而不使用mmap,则必须将该代码更改为请改用一个简单的共享内存块。

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

这篇关于SQLite:有没有任何方法使用WAL没有mmap()函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆