*I)Berkeley DB: DbMpool::sync[P

DbMpool::sync





#include <db_cxx.h>

intDbMpool::sync(LSN *lsn);





Description



HThe DbMpool::sync method ensures that all the modified pages in the pooljwith log sequence numbers (i.e., DbLsn objects) less than the(lsn argument are written to disk.

The DbMpool::sync>method either returns errno or throws an exception that:encapsulates an errno on failure, and 0 on success,Hand DB_INCOMPLETE if there were pages which need to be written but which.DbMpool::sync was unable to write immediately.;In addition, if DbMpool::sync returns success, the value ofGlsn will be overwritten with the largest LSN from any page which5was written by DbMpool::sync to satisfy this request.

8The purpose of the DbMpool::sync function is to enable aFtransaction manager to ensure, as part of a checkpoint, that all pages5modified by a certain time have been written to disk.IPages in the pool which cannot be written back to disk immediately (e.g.,Mare currently pinned) are written to disk as soon as it is possible to do so.?The expected behavior of the transaction manager is to call the=DbMpool::sync function and then, if the return indicates thatFsome pages could not be written immediately, to wait briefly and retry@again with the same LSN until the DbMpool::sync function returns!that all pages have been written.

DTo support the DbMpool::sync functionality, it is necessary that theKpool functions know the location of the LSN on the page for each file type.CThis location should be specified when the file is opened using theMDbMpoolFile::open function.J(Note, it is not required that the LSN be aligned on the page in any way.)



Errors

TIf a fatal error occurs in Berkeley DB, the DbMpool::sync method may fail and eitherIreturn DB_RUNRECOVERY or throw an exception encapsulating DB_RUNRECOVERY,Gat which point all subsequent database calls will also fail in the sameFway. Methods marked as returning errno will, by default, throwHan exception that encapsulates the error information. The default error\behavior can be changed, see DbException.

The DbMpool::sync&method may fail and throw an exceptionKfor any of the errors specified for the following Berkeley DB and C library functions:DBmemp->pgin(3),DBmemp->pgout(3), abort(3), close(3),dbenv->db_paniccall(3), fcntl(3), fflush(3), fprintf(3),free(3), fstat(3), fsync(3), getenv(3), getpid(3), getuid(3), isdigit(3),>DbLog::compare,:DbLog::flush, lseek(3), malloc(3), memcmp(3), memcpy(3), memset(3),mmap(3),open(3), pread(3),pstat_getdynamic(3), pwrite(3), qsort(3),read(3), realloc(3),sigfillset(3),sigprocmask(3),stat(3), strerror(3), strlen(3), sysconf(3),time(3), unlink(3), vfprintf(3), vsnprintf(3),and write(3).In addition, the DbMpool::sync&method may fail and throw an exceptionor return errnofor the following conditions:

B

EINVAL
An invalid flag value or parameter was specified.

AThe DbMpool::sync function was called without logging having beeninitialized in the environment.





Class

6DbMpool



See Also

>DbMpool::close,<DbMpool::open,JDbMpool::db_register,<DbMpool::stat,DbMpool::sync,ADbMpool::trickleand@DbMpool::unlink.
ÿÿ