Post
Topic
Board Development & Technical Discussion
Re: Reviving post: Where's the -walldir option in bitcoind?
by
kjj
on 30/08/2012, 22:54:17 UTC
So are you saying wallet.dat effectively comprises a table in the BDBE - does BDB not support linked tables?
If wallet.dat is linked in with these other database files, how come it can be renamed and replaced with a new wallet.dat without any discernible difference apart from I can now send BTC from my new wallet -what difference does the BDB see if this file is outside the data folder? If Access can manage linked tables... - I know, bad example ;-)

BDB doesn't work the way you are thinking.

BDB records extra data outside of the database files in an attempt to ensure consistency across (some types of) crashes.  For historic reasons, BDB expects database files all to be in the same place, and all of the files in that place share a single journal set.  The log.* files in database/ are the BDB journal, FYI.  As long as the files are closed properly and marked as clean ("detached"), you can swap them back and forth with no problems.  It simply doesn't support having files in multiple places, and there is nothing that bitcoin's developers can do about it.

The only option is to work around it by creating a whole second BDB instance, doubling the overhead, doubling the development effort needed, and bloating the code.  Oh, and then the client would have to rescan after even trivial "clean" crashes (maybe even on normal starts too, now that I think about it), because there would be no way to do transactions across both instances and so the code could never be sure that both databases were synchronized, even if both were marked clean.

I'm not even sure if Access does any journaling, it's been a long time since I used it, and google results weren't very helpful.  If it does do any, it does it inside the file, not externally like BDB.  Also, Microsoft has gigantic systems (OLE, DDE, etc) for data access abstraction hidden in the operating system so that their products can interact for "free".  The Bitcoin devs get no such help, they have to use the lowest common denominator between Windows, Macs and Unix, which is nothing.  Which means that they need to bring along their own third-party database library, and it needs to be freely distributable, plus work across all three platforms.  BDB fits that bill, not much else does.

gmaxwell - your holier than thou, coder superiority is not helpful, with you pull requests and shell histories. The -walletdir thread was posted over 18 months ago by Stephen and promptly died. We all appreciate the amazing work you guys are doing getting the bitcoind to it's current state, but most of us don't understand what's behind the system and that's only going to grow as adoption increases - embrace the eternal September dude, most people don't have the time to understand the ins and out of BDBE, we just see features that we would like or things we'd like to change. Bitcoind is still a terrifying prospect to install and use for most mortals, when it comes to storing actual wealth on your computer. Making it clear which files actually give you (or any thief) access to your cash, should be one-syllable-a-minute, crystal clear to the most sausage-fingered retard able to switch on a PC. If someone would like to point me to the pull request list, I'd happily hammer it up there.

Shit, September is right around the corner isn't it...  By the way, pull requests are for patches, not feature requests.