1

Is there an example of using CDS mode for BerkeleyDB with perl on a Debian system? I am initializing with:

$db_env = new BerkeleyDB::Env
-Home => "/tmp",
-Flags => DB_CREATE | DB_INIT_CDB | DB_INIT_MPOOL
or die "cannot open environment $BerkeleyDB::Error";

And I am getting an "invalid argument" error for DB_INIT_MPOOL. If I omit it, I get complaints about "environment did not include a memory pool" (for either Hash or Btree databases).

adamo
  • 3,584
  • 1
  • 18
  • 23
  • Works fine for me, perhaps [upgrade libdb](http://sleepycat.com/) plus headers to 4.8 or 5.1? – daxim Jun 14 '11 at 11:00

2 Answers2

1

Simple answer to this is to remove the files __db.XXX, where XXX is three numbers. For example in my environment I had three files, __db.001, __db.002 and __db.003.

I know this is an old post and the previous answer essentially is the same thing but the example would have helped me when I stumbled over this post while googling yesterday.

Ash
  • 11
  • 1
0

And I am getting an "invalid argument" error for DB_INIT_MPOOL. If I omit it, I get complaints about "environment did not include a memory pool" (for either Hash or Btree databases).

You're typically getting this first kind of error ("Invalid argument") if you try to create an environment where an environment with a different configuration (different flags) already exists.

As for the second error (missing memory pool), it's because you're instructing BDB to do DB_INIT_CDB without DB_INIT_MPOOL - that's not possible, CDB has to go with a memory pool.

Take a look at this other BDB/CDB question, I've left some pointers to documentation there that might prove interesting to you.

Community
  • 1
  • 1
Lumi
  • 14,775
  • 8
  • 59
  • 92