can a berkeley database be opened and accessed from multiple programs at the same time?

不打扰是莪最后的温柔 提交于 2019-12-09 01:04:10

问题


according to the Berkeley documentation the Transactional (TS) and the Concurrent Datastore version of the Database, multiple threads may access (and change) the database.

Does this also mean that I can have 2 programs linked to the berkely 'client' and have them access the same database file without any problems?

(I ask, since for a separate database server this would be no problem of course, but in the case of Berkeley the database engine is linked long with your program)

thanks!

R


回答1:


Some documentation seems to think you can use the same database concurrently from multiple processes as well as from multiple threads. Specifically:

"Multiple processes, or multiple threads in a single process, can all use the database at the same time as each uses the Berkeley DB library. Low-level services like locking, transaction logging, shared buffer management, memory management, and so on are all handled transparently by the library."

A cursory read did not shed any light on what BDB uses to control access from multiple processes, but if filesystem locks are used, access from multiple processes on a network filesystems may well be problematic.




回答2:


Chapter 16: The Locking Subsystem from the reference guide looks promising.



来源:https://stackoverflow.com/questions/1749885/can-a-berkeley-database-be-opened-and-accessed-from-multiple-programs-at-the-sam

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