DbEnv::txn_checkpoint

APIRef

#include <db_cxx.h>

int DbEnv::txn_checkpoint(u_int32_t kbyte, u_int32_t min) const;

Description

The DbEnv::txn_checkpoint method flushes the underlying memory pool, writes a checkpoint record to the log and then flushes the log.

If either kbyte or min is non-zero, the checkpoint is only done if more than min minutes have passed since the last checkpoint, or if more than kbyte kilobytes of log data have been written since the last checkpoint.

The DbEnv::txn_checkpoint method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, 0 on success, and returns DB_INCOMPLETE if there were pages that needed to be written but that DbEnv::memp_sync was unable to write immediately. In this case, the DbEnv::txn_checkpoint call should be retried.

Errors

If a fatal error occurs in Berkeley DB, the DbEnv::txn_checkpoint method will fail and either return DB_RUNRECOVERY or throw an exception encapsulating DB_RUNRECOVERY, at which point all subsequent database calls will fail in the same way.

In addition, the DbEnv::txn_checkpoint method may fail and throw an exception or return a non-zero error for the following conditions:

EINVAL
An invalid flag value or parameter was specified.

In addition, the DbEnv::txn_checkpoint method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods.

Classes

DbEnv, DbTxn

See Also

DbEnv::set_tx_max, DbEnv::set_tx_recover, DbTxn::abort, DbEnv::txn_begin, DbEnv::txn_checkpoint, DbTxn::commit, DbTxn::id, DbTxn::prepare and DbEnv::txn_stat.

APIRef

Copyright Sleepycat Software