1

I have a coupled main and a (temporary and auxiliary) database in a BerkeleyDB JE environment. The problem is as follows:

  • I am using transactions, and atomicity must span both the main and the aux DB
  • therefore, as I understand the docs, I have to use a single environment (transactions cannot span several environments)
  • So the two databases share one directory. But do they also share the same files?
  • Because the aux DB can grow very big, and I want to wipe it at the start of the application.
  • I have used e.truncateDatabase(txn, name, false) to do so
  • But it appears the database directory never shrinks, so if in every application run the aux DB uses e.g. 500 MB, then after four runs, the directory is already 2 GB, irrespective of the truncation. Also I cannot see distinct files for main and aux DB

How can I really wipe the aux database, so that the disk space is freed? This is also a performance problem, because with those several GB large directories, BDB has serious trouble starting up and winding down. Can I force BDB to use separate files, so I can just delete a particular file?


Somehow this single environment seems at the root of the problem. For example, I would love to increase performance by giving the aux DB setTxnNoSync() but then this will also affect the main DB.


If I use setTemporary on the aux DB, I get a runtime exception, apparently it is disallowed to use transactions with a temporary database!?

java.lang.IllegalArgumentException: Attempted to open Database aux and two ore more of the following exclusive properties are true: deferredWrite, temporary, transactional

0__
  • 66,707
  • 21
  • 171
  • 266

1 Answers1

0

I improved the situation a bit with the following setting:

envCfg.setConfigParam(EnvironmentConfig.CLEANER_MIN_FILE_UTILIZATION, "33")

and using removeDatabase instead of truncateDatabase upon application start. At least I don't seem to get infinite growth any longer.

I'm still interested in hearing whether I can make BDB use dedicated log files for either database.

0__
  • 66,707
  • 21
  • 171
  • 266