[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#578157: and another!



On Fri, 7 Jan 2011 20:17:29 +0100, Jonas Smedegaard <dr@jones.dk> wrote:
> On Fri, Jan 07, 2011 at 12:06:37PM -0500, micah anderson wrote:
> >On Fri, 7 Jan 2011 17:02:20 +0100, Jonas Smedegaard <dr@jones.dk> 
> >wrote:
> >> On Fri, Jan 07, 2011 at 10:39:11AM -0500, micah anderson wrote:
> >> >I noticed that you are build-depending on libdb4.7++, I dont know 
> >> >that much about the bdb madness, but I do know that the bitcoin that 
> >> >I compiled from source was compiled against libdb4.8++ and when I 
> >> >try and install your packaged version, it can't read the wallet 
> >> >database.
> >> >
> >> >Is there any specific reason you went with 4.7 instead of 4.8,
> >>
> >> Yes.
> >>
> >> src/build-unix.txt includes this note:
> >>
> >> >You need Berkeley DB 4.7.  Don't use 4.8, the database/log0000* 
> >> >files are incompatible.
> >
> >This is interesting... I am using DB 4.8 just fine. I suspect that this 
> >build-unix.txt is out of date, or just wrong. The database/log0000 
> >files are just transaction logs, and while it is true that they are 
> >incompatible, this is normal for ABI differences between berkeley db 
> >versions.
> >
> >
> >>
> >> Helmuth Grohne, showing up on IRC just before I released the 
> >> packaging, claims this might actually be a reason to run away 
> >> screaming from Bitcoin, as it indicates a disastrous design flaw in 
> >> relying on the network API on the internal BDB format of 
> >> (little-endian!) v4.7.
> >
> >talking about irc gave me an idea. I stopped over to #bitcoin-dev, and 
> >asked them what the deal was:
> [IRC conversation snipped]
> >so it seems there is no particular reason to use 4.7, its just what 
> >their pre-compiled binary versions use, and the only reason that they 
> >dont move to 4.8 is because nobody has bothered to try it on mac and 
> >windows.
> >
> >As a test, I backed up my .bitcoin/ and then ran your version, with 
> >libdb4.7++ and start it up. It creates a wallet and I let it download 
> >all the current blocks. I then stop it, run a self-compiled bitcoin, 
> >linked against libdb4.8++, it converts the database to 4.8 format, and 
> >things continue to work as normal.
> 
> Thanks a lot for your investigation!
> 
> So what really is the issue here is that _at_ _each_ _runtime_ 
> _environment_ are the db files incompatible.

http://download.oracle.com/docs/cd/E17276_01/html/programmer_reference/changelog_4_8.html#id1655659

Database or Log File On-Disk Format Changes:

   1.  The log file format changed in 4.8.

So it seems that its just the db4.8 logs are not backward compatible
with 4.7. Transaction logs are great, if you want to do recovery, but I
wonder if they are really needed. If I recall, they simply grow, until
you rotate them, unless you set specific DB_CONFIG flags.

> @Micah: Could you please test if upgrading works like this:
> 
>    1) Move aside your precious .bitcoin folder
>    2) Start the current Debian Bitcoin (or upstream binary)
>    3) Let Bitcoin run until its db is fully init'ed (i.e. dir is ~150MB)
>    3) Quit Bitcoin
>    4) Install packages libdb4.8-util and db4.7-util

you mean db4.8-util and db4.7-util :)

>    5) run the following commands:

I think that the following commands should only be run after I've
stopped the running bitcoind:

>      db4.7_recover -h ~/.bitcoin
>      db4.8_upgrade -h ~/.bitcoin wallet.dat
> 
>    6) Start your locally compiled Bitcoin
>    7) Tell me if it worked out or not :-)

It seems like it works, here is the log:

micah@algae:~$ mv .bitcoin/ .bitcoin_bak
micah@algae:~$ /usr/bin/bitcoind 
bitcoin server starting
micah@algae:~$ Warning: To use bitcoind, you must set rpcpassword=<password>
in the configuration file: /home/micah/.bitcoin/bitcoin.conf
If the file does not exist, create it with owner-readable-only file permissions.
micah@algae:~$ cp .bitcoin_bak/bitcoin.conf .bitcoin
micah@algae:~$ /usr/bin/bitcoind 
bitcoin server starting
...
micah@algae:~$ du -sch .bitcoin
168M	.bitcoin
168M	total
micah@algae:~$ /usr/bin/bitcoind stop
micah@algae:~$ db4.7_recover -h ~/.bitcoin
micah@algae:~$ db4.8_upgrade -h ~/.bitcoin wallet.dat
micah@algae:~$ working/bitcoin-0.3.18/src/bitcoind 
bitcoin server starting
micah@algae:~$ working/bitcoin-0.3.18/src/bitcoind getinfo
{
    "version" : 31800,
    "balance" : 0.00000000,
    "blocks" : 75297,
    "connections" : 9,
    "proxy" : "",
    "generate" : false,
    "genproclimit" : -1,
    "difficulty" : 511.77353426,
    "hashespersec" : 0,
    "testnet" : false,
    "keypoololdest" : 1294638747,
    "paytxfee" : 0.00000000,
    "errors" : ""
}
micah@algae:~$

> I will now compile a new Bitcoin against Berkeley DB 4.8, with a README 
> mentioning essential parts of above - blindly hoping that it works.

I checked with the bitcoin community, and found there are quite a number
of people using bdb4.8 on gentoo, redhat, fedora and freebsd.

> Please be careful to test against current release, not the version I am 
> about to release :-)

Yep, I used 0.3.19~dfsg-3~0jones1 for this test.

micah

Attachment: pgpDbi6EWj_7S.pgp
Description: PGP signature


Reply to: