$db = Paranoid::BerkeleyDB::Env->new(-Home => './dbdir'); $home = $dbe->home; %params = $dbe->params; $count = $dbe->refc; $env = $dbe->env; @dbs = $dbe->dbs;
If you're using the Paranoid::BerkeleyDB(3) API this object is created for you automatically. There is probably no value in using this module directly unless you need to tune BerkeleyDB::Btree's defaults.
While this class places no restrictions on the use of any available BerkeleyDB::Env(3) options it does automatically deploy some defaults options oriented towards CDS access. These can be overridden, but if you're focused on CDS this will simplify their use.
$db = Paranoid::BerkeleyDB::Env->new(-Home => './dbdir');
The only required argument is -Home. For a complete list of all available options please see the BerkeleyDB(3) man page.
By default the following settings are applied unless overridden:
Parameter Value --------------------------------------------------- -Flags DB_CREATE | DB_INIT_CDB | DB_INIT_MPOOL -ErrFile {-Home}/db_err.log -Verbose 1
$home = $dbe->home;
This method returns the canonical path to the environment's home directory.
%params = $dbe->params;
This method returns the assembled parameters hash used to open the BerkeleyDB::Env object.
$count = $dbe->refc;
This method returns the current number of references to the underlying environment object. That count is essentially the number of objects all using the same environment.
$env = $dbe->env;
This returns a handle to the current BerkeleyDB::Env(3) object.
While CDS allows for safe concurrent use of database files, it makes no allowances for recovery from stale locks. If a process exits badly and fails to release a write lock (which causes all other process operations to block indefinitely) you have to intervene manually. The brute force intervention would mean killing all accessing processes and deleting the environment files (files in the same directory call __db.*). Those will be recreated by the next process to access them.
Berkeley DB provides a handy CLI utility called db_stat(1). It can provide some statistics on your shared database environment via invocation like so:
db_stat -m -h .
The last argument, of course, is the directory in which the environment was created. The example above would work fine if your working directory was that directory.
You can also show all existing locks via:
db_stat -N -Co -h .
L<BerkeleyDB(3)>
(c) 2005 - 2022, Arthur Corliss (corliss@digitalmages.com)
Copyright © 1997 - 2019, Arthur Corliss, all rights reserved.