log_get |
#include <db.h>int log_get(DB_ENV *env, DB_LSN *lsn, DBT *data, u_int32_t flags);
The log_get function implements a cursor inside of the log, retrieving records from the log according to the lsn and flags arguments.
The data field of the data structure is set to the record retrieved, and the size field indicates the number of bytes in the record. See DBT for a description of other fields in the data structure. When multiple threads are using the DB_ENV handle concurrently, one of the DB_DBT_MALLOC, DB_DBT_REALLOC, or DB_DBT_USERMEM flags must be specified for any DBT used for data retrieval.
The flags value must be set to one of the following values:
If the log is empty, the log_get function will return DB_NOTFOUND.
If the log is empty, the log_get function will return DB_NOTFOUND.
If the log is empty, the log_get function will return DB_NOTFOUND.
If the pointer has not been initialized via DB_FIRST, DB_LAST, DB_SET, DB_NEXT, or DB_PREV, log_get will return the first (last) record in the log. If the last (first) log record has already been returned or the log is empty, the log_get function will return DB_NOTFOUND.
If the log was opened with the DB_THREAD flag set, calls to log_get with the DB_NEXT (DB_PREV) flag set will return EINVAL.
If the log pointer has not been initialized via DB_FIRST, DB_LAST, DB_SET, DB_NEXT, or DB_PREV, or if the log was opened with the DB_THREAD flag set, log_get will return EINVAL.
Otherwise, the log_get function returns a non-zero error value on failure and 0 on success.
The log_get function may fail and return a non-zero error for the following conditions:
The DB_NEXT or DB_PREV flags were set and the log was opened with the DB_THREAD flag set.
The DB_CURRENT flag was set and the log pointer had not yet been initialized.
The DB_SET flag was set and the specified log sequence number does not exist.
The log_get function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the log_get function may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.