Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: rupy on August 28, 2012, 08:50:36 AM



Title: database/log.00000XXX
Post by: rupy on August 28, 2012, 08:50:36 AM
How can I remove these without having to manually do it?


Title: Re: database/log.00000XXX
Post by: Stephen Gornick on August 28, 2012, 08:58:35 AM
How can I remove these without having to manually do it?

Well, you can write a script, but the client has no mechanism to remove them or to reinitialize.

They can't just be deleted willy nilly though.  They include data necessary to recover the database if it didn't happen to get shut down properly.

So at a minimum, make sure you have exited cleanly the app and make a backup of the wallet.dat before purging the .log files.


Title: Re: database/log.00000XXX
Post by: kjj on August 28, 2012, 01:53:00 PM
Bitcoin should automatically purge them either when it starts, or when it exits.  Just restart now and then and they'll be fine.


Title: Re: database/log.00000XXX
Post by: Pieter Wuille on August 28, 2012, 02:14:47 PM
If you run with -detachdb, and exit cleanly, they can be removed.

In every other case, the database files refers to indices in the log file, and the program will fail to open the database files in many cases.


Title: Re: database/log.00000XXX
Post by: rupy on August 28, 2012, 10:22:54 PM
But what's in the database? The block chain is in the blkXXXX.dat files...


Title: Re: database/log.00000XXX
Post by: Pieter Wuille on August 28, 2012, 10:36:21 PM
blkindex.dat, addr.dat (before 0.7.0) and wallet.dat are database files. They live in a database environment, consisting of several files, including transaction logs that are necessary in order to recover from (some) crashes.

When using -detachdb (or always for wallet.dat), BDB is asked to fully synchronize all changes to disk, and remove the references from the database files to the log files in the environment.

As to what blkindex.dat contains: where every transaction and every block can be found in the blk0000*.dat files, and where each transaction output was spent.