Berkeley DB Reference Version 2026.09.11

DB_ENV->cdsgroup_begin()

#include <db.h>

int
DB_ENV->cdsgroup_begin(DB_ENV *dbenv, DB_TXN **tid);  

The DB_ENV->cdsgroup_begin() method allocates a locker ID in an environment configured for Berkeley DB Concurrent Data Store applications. It copies a pointer to a DB_TXN that uniquely identifies the locker ID into the memory to which tid refers. Calling the DB_TXN->commit() method will discard the allocated locker ID.

See Berkeley DB Concurrent Data Store applications for more information about when this is required.

The DB_TXN handle returned by DB_ENV->cdsgroup_begin() is not a transaction handle: it names a CDS locker group, and a CDS environment has no transaction subsystem. Only DB_TXN->abort(), DB_TXN->commit(), DB_TXN->discard() and DB_TXN->id() are meaningful on it. Every other DB_TXN method — DB_TXN->prepare(), DB_TXN->get_name(), DB_TXN->set_name(), DB_TXN->set_timeout(), DB_TXN->get_priority(), DB_TXN->set_priority() and DB_TXN->set_commit_token() — returns DB_OPNOTSUP when called on a CDS group handle. (In releases before 5.3.35 the last three of these were unimplemented slots and calling one crashed the application rather than returning an error.)

The DB_ENV->cdsgroup_begin() method may be called at any time during the life of the application.

The DB_ENV->cdsgroup_begin() method returns a non-zero error value on failure and 0 on success.

Errors

The DB_ENV->cdsgroup_begin() method may fail and return one of the following non-zero errors:

EINVAL

The environment was not configured for Berkeley DB Concurrent Data Store, that is, it was opened without the DB_INIT_CDB flag.

ENOMEM

The maximum number of lockers has been reached.

Class

DB_ENV, DB_TXN

See Also

Transaction Subsystem and Related Methods