# DB_ENV->memp_sync

`

###

    #include <db.h>

    int
    DB_ENV->memp_sync(DB_ENV *env, DB_LSN *lsn);

# Description

The DB_ENV->memp_sync method ensures that any modified pages in the pool with a log sequence number (DB_LSN) less than the lsn argument are written to disk. The purpose of the lsn argument is to enable a transaction manager to ensure, as part of a checkpoint, that all pages modified by a certain time have been written to disk. Pages in the pool that cannot be immediately written back to disk (for example, pages that are currently in use by another thread of control) are waited for and written to disk as soon as it is possible to do so. If lsn is NULL, all modified pages in the pool are written to disk.

To support the DB_ENV->memp_sync functionality, it is necessary that the pool functions know the location of the log sequence number on the page for each file type. This location should be specified when the file is opened using the DB_MPOOLFILE->set_lsn_offset method. It is not required that the log sequence number be aligned on the page in any way.

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

# Errors

The DB_ENV->memp_sync method may fail and return a non-zero error for the following conditions:

EINVAL
  An invalid flag value or parameter was specified.

  The DB_ENV->memp_sync function was called without logging having been initialized in the environment.

The DB_ENV->memp_sync method 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 DB_ENV->memp_sync method may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

# Class

DB_ENV, DB_MPOOLFILE

# See Also

Memory Pools and Related Methods`

Copyright Sleepycat Software