SN-10112 附来源、原文与上下文。
test 7:
test 7:
运行之前请备份数据目录,以防万一。
Backup your data directory before running this, just in case.
针对 Db::open/Db::close 的“Bad file descriptor”异常的临时解决办法。它也可能让初始区块下载更快。做法是打开数据库句柄,并在程序的整个运行期间保持打开,这其实本来就是更常见的做法。如果我们不再不停地关闭和打开,错误就应该没有机会发生。
Workaround for the Db::open/Db::close "Bad file descriptor" exception. Might also make the initial block download faster. The workaround is to open the database handles and keep them open for the duration of the program, which is actually the more common thing to do anyway. If we're not closing and opening all the time, the error shouldn't get a chance to happen.
唯一的例外是 wallet.dat,我仍会在写入完成后关闭它,以便将事务日志写入 dat 文件,让 dat 文件能够独立使用。这样,如果有人在 Bitcoin 运行时备份,得到的 wallet.dat 本身就是有效的,无需数据库事务日志。
The one exception is wallet.dat, which I still close after writing is finished so I can flush the transaction logs into the dat file, making the dat file standalone. That way if someone does a backup while Bitcoin is running, they'll get a wallet.dat that is valid by itself without the database transaction logs.
这是对数据库处理方式的重构,所以我们可能会发现一些新的死锁。通常如果出现死锁,要么界面停止重绘,要么虽然仍显示 Generating,却不再使用 CPU。
This is a restructuring of the database handling, so we might find some new deadlocks. Usually if it deadlocks, either the UI will stop repainting, or it'll stop using CPU even though it still says Generating.