)I#Berkeley DB: log_put[P

log_put





#include <db.h>

intlog_put(DB_LOG *logp,3 DB_LSN *lsn, const DBT *data, u_int32_t flags);





Description



?The log_put function appends records to the log. The DB_LSN ofHthe put record is returned in the lsn argument. The flags3argument may be set to one of the following values:

[

DB_CHECKPOINT
The log should write a checkpoint record, recording any information?necessary to make the log structures recoverable after a crash.N

DB_CURLSN
The DB_LSN of the next record to be put is returned in thelsn argument.].W

DB_FLUSH
The log is forced to disk after this record is written, guaranteeing=that all records with DB_LSN values less than or equal to theEone being put are on disk before this function returns (this functionkis most often used for a transaction commit, see txn_commit formore information).

BThe caller is responsible for providing any necessary structure to data.E(For example, in a write-ahead logging protocol, the application mustCunderstand what part of data is an operation code, what part7is redo information, and what part is undo information.DIn addition, most transaction managers will store in data the>DB_LSN of the previous log record for the same transaction, toIsupport chaining back through the transaction's log records during undo.)



The log_putHfunction returns the value of errno on failure, and 0 on success.



Errors

PIf a fatal error occurs in Berkeley DB, the log_put function may fail and returnFDB_RUNRECOVERY, at which point all subsequent database calls will alsoreturn DB_RUNRECOVERY.

The log_put)function may fail and return errnoKfor any of the errors specified for the following Berkeley DB and C library functions: abort(3), close(3),dbenv->db_paniccall(3), fcntl(3), fflush(3), fprintf(3),free(3), fsync(3), getenv(3), getpid(3), getuid(3), isdigit(3), lseek(3), malloc(3), memcpy(3), memset(3),open(3),sigfillset(3),sigprocmask(3), snprintf(3),stat(3), strerror(3), strlen(3),time(3), unlink(3), vfprintf(3), vsnprintf(3),and write(3).

EIn addition, the log_flush)function may fail and return errnofor the following conditions:

B

EINVAL
An invalid flag value or parameter was specified.

>The record to be logged is larger than the maximum log record.





See Also

9log_archive,5log_close,9log_compare,3log_file,5log_flush,1log_get,3log_open,log_put,>log_register,3log_stat,6log_unlinkandBlog_unregister.
ÿÿ