Re: RFC: remove DB_PRIVATE flag

Wallet backups and other DB examination are easily possible in a safe, atomic, transactional fashion… if and only if DB_PRIVATE flag is removed.

--- a/db.cpp
+++ b/db.cpp
@@ -77,7 +77,6 @@ CDB::CDB(const char* pszFile, const char* pszMode) : pdb(NULL)

What, if any, problems arise from doing this? Obviously, this does not cover the non-db4 databases such as the block data file.

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.

12,160 total views, 5 views today