Berkeley DB Reference Guide:
Upgrading Berkeley DB Applications

PrevRefNext

Release 3.0: the DB_ENV structure

The DB_ENV structure is now opaque for applications in the Berkeley DB 3.0 release. Accesses to any fields within that structure by the application should be replaced with method calls. The following example illustrates this using the historic errpfx structure field. In the Berkeley DB 2.X releases, applications set error prefixes using code similar to the following:

DB_ENV *dbenv;

dbenv->errpfx = "my prefix";

in the Berkeley DB 3.X releases, this should be done using the DBENV->set_errpfx method, as follows:

DB_ENV *dbenv;

dbenv->set_errpfx(dbenv, "my prefix");

The following table lists the DB_ENV fields previously used by applications and the methods that should now be used to set them.

DB_ENV fieldBerkeley DB 3.X method
db_errcallDBENV->set_errcall
db_errfileDBENV->set_errfile
db_errpfxDBENV->set_errpfx
db_lorderThis field was removed from the DB_ENV structure in the Berkeley DB 3.0 release as no application should have ever used it. Any code using it should be evaluated for potential bugs.
db_paniccallDBENV->set_paniccall
db_verboseDBENV->set_verbose

Note: the db_verbose field was a simple boolean toggle, the DBENV->set_verbose method takes arguments that specify exactly which verbose messages are desired.

lg_maxDBENV->set_lg_max
lk_conflicess method,access methods,java,C,C++">

Berkeley DB Reference Guide:
Upgrading Berkeley DB Applications

PrevRefNext

Release 3.0: DB->sync and DB->close

In previous Berkeley DB releases, the DB->close and DB->sync functions discarded any return of DB_INCOMPLETE from the underlying buffer pool interfaces, and returned success to its caller. (The DB_INCOMPLETE error will be returned if the buffer pool functions are unable to flush all of the database's dirty blocks from the pool. This often happens if another thread is reading or writing the database's pages in the pool.)

In the 3.X release, DB->sync and DB->close will return DB_INCOMPLETE to the application. The best solution is to not call DB->sync and specify the DB_NOSYNC flag to the DB->close function when multiple threads are expected to be accessing the database. Alternatively, the caller can ignore any error return of DB_INCOMPLETE.