Bitcointalk · RFC: remove DB_PRIVATE flag

中本聪,2010 年 8 月 26 日

SN-2603 已核对来源,附原文与上下文。

阅读语言
中文译文

你能更详细说说移除 DB_PRIVATE 会带来什么吗?

我不记得当初用 DB_PRIVATE 是不是有特定理由,还是只是从示例代码里抄的标志。移除 DB_PRIVATE 能让其他进程安全地同时打开数据库吗?倘若是副作用可接受,那可能是个改进。它会不会因为必须立刻写出每次改动或做其他协调而大幅降低性能?那时会有额外的锁定或协调文件吗?还有什么会变?你可以通过给初始区块下载计时来测试有无 DB_PRIVATE 的差别,最好用 -connect 连本机,排除网络因素。

显然,DB_PRIVATE 并没有做到你期望它做的事,也就是阻止其他进程打开数据库。它照样放行,只是别人真打开时会把事情搞砸。另一个选项,倘若有什么办法的话,是让它锁定数据库文件,让其他进程无法访问。

ORIGINAL · 英文原文
Can you provide more details about what removing DB_PRIVATE does?

I can't remember if I had a specific reason for DB_PRIVATE, or if I just copied the flags from some example code.  Does removing DB_PRIVATE make it safe for other processes to open the database simultaneously?  That may be an improvement, depending what the side effects are.  Does it substantially reduce performance by making it have to write out every change immediately or do other coordination?  Are there additional locking or coordination files then?  What else changes?  You could test by timing an initial block download with and without DB_PRIVATE, preferably -connect-ing to a local machine so network isn't a factor.

Apparently, DB_PRIVATE doesn't do what you would hope it would do, which is prevent other processes from being able to open the database.  It still lets them, it just screws up if they do.  Another option, if there's a way, would be to make it lock the database files so they can't be accessed by other processes.
来源
Bitcointalk 原始链接 ↗ 记录编号 SN-2603