head 1.2; access; symbols RPM_4_2_1:1.1.1.5 RPM_4_2:1.1.1.5 RPM_4_1_1:1.1.1.5 RPM_4_1:1.1.1.4 RPM_4_0_5:1.1.1.3 RPM_4_0_4:1.1.1.2 RPM_4_0_3:1.1.1.1 RPM:1.1.1; locks; strict; comment @# @; 1.2 date 2008.01.02.09.55.21; author rse; state dead; branches; next 1.1; commitid z4cpSiAhOCXk5PLs; 1.1 date 2001.07.23.20.45.38; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2001.07.23.20.45.38; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 2002.01.08.00.30.12; author rse; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2003.01.18.13.49.02; author rse; state Exp; branches; next 1.1.1.4; 1.1.1.4 date 2001.10.15.03.47.34; author rse; state Exp; branches; next 1.1.1.5; 1.1.1.5 date 2003.01.18.14.05.00; author rse; state Exp; branches; next ; desc @@ 1.2 log @remove the ancient RPM 4.2.1 source tree copy @ text @ Berkeley DB Reference Guide: Berkeley DB and the memory pool

Berkeley DB Reference Guide:
Memory Pool Subsystem

PrevRefNext

Berkeley DB and the memory pool

The Memory Pool subsystem is the general-purpose shared memory buffer pool used by Berkeley DB. This module is useful outside of the Berkeley DB package for processes that require page-oriented, cached, shared file access.

A memory pool is a memory cache shared among any number of threads of control. The DB_INIT_MPOOL flag to the DB_ENV->open interface opens, optionally creating a memory pool. When that pool is no longer in use, it should be closed using the DB_ENV->close interface.

The memp_fopen interface returns a DB_MPOOLFILE handle on an underlying file within the memory pool. When that handle is no longer in use, it should be closed using the memp_fclose interface. The memp_fget interface is used to retrieve pages from files in the pool. All retrieved pages must be subsequently returned using the memp_fput interface. At the time pages are returned, they may be marked dirty, which causes them to be written to the underlying file before being discarded from the pool. If there is insufficient room to bring a new page in the pool, a page is selected to be discarded from the pool using a least-recently-used algorithm. Pages in files may also be explicitly marked clean or dirty using the memp_fset interface. All dirty pages in the pool may be flushed using the memp_sync interface. All dirty pages in the pool from a single underlying file may be flushed using the memp_fsync interface.

There are additional interfaces related to the memory pool:


PrevRefNext

Copyright Sleepycat Software @ 1.1 log @Initial revision @ text @d1 1 a1 1 @ 1.1.1.1 log @Import: RPM 4.0.3 @ text @@ 1.1.1.2 log @Import: RPM 4.0.4 @ text @d1 1 a1 1 a10 1 d19 1 a19 1 for processes that require page-oriented, shared and cached file access. d22 19 a40 31 DB_ENV->open function opens and optionally creates a memory pool. When that pool is no longer in use, it should be closed using the DB_ENV->close function.

The DB_ENV->memp_fcreate function returns a DB_MPOOLFILE handle on an underlying file within the memory pool. The file may be opened using the DB_MPOOLFILE->open function. The DB_MPOOLFILE->get function is used to retrieve pages from files in the pool. All retrieved pages must be subsequently returned using the DB_MPOOLFILE->put function. At the time pages are returned, they may be marked dirty, which causes them to be written to the underlying file before being discarded from the pool. If there is insufficient room to bring a new page in the pool, a page is selected to be discarded from the pool using a least-recently-used algorithm. Pages in files may also be explicitly marked clean or dirty using the DB_MPOOLFILE->set function. All dirty pages in the pool from the file may be flushed using the DB_MPOOLFILE->sync function. When the file handle is no longer in use, it should be closed using the DB_MPOOLFILE->close function.

There are additional configuration interfaces that apply when opening a new file in the memory pool:

There are additional interfaces for the memory pool as a whole: d43 14 a56 13 maintain a consistent percentage of clean buffers in the pool using the DB_ENV->memp_trickle function.

  • Because special-purpose processing may be necessary when pages are read or written (for example, compression or endian conversion), the DB_ENV->memp_register function allows applications to specify automatic input and output processing in these cases.
  • The db_stat utility uses the DB_ENV->memp_stat function to display statistics about the efficiency of the pool.
  • All dirty pages in the pool may be flushed using the DB_ENV->memp_sync function. In addition, DB_ENV->memp_sync takes an argument that is specific to database systems, and which allows the memory pool to be flushed up to a specified log sequence number (DB_LSN).
  • The entire pool may be discarded using the DB_ENV->remove function. @ 1.1.1.3 log @Import: RPM 4.0.5 @ text @d1 2 a2 2 a3 1 d23 1 a23 1 DB_ENV->open method opens and optionally creates a memory pool. When d25 2 a26 2 DB_ENV->close method.

    The DB_ENV->memp_fcreate method returns a DB_MPOOLFILE handle on an d28 1 a28 1 the DB_MPOOLFILE->open method. The DB_MPOOLFILE->get method is used to retrieve d30 1 a30 1 returned using the DB_MPOOLFILE->put method. At the time pages are returned, d36 3 a38 3 DB_MPOOLFILE->set method. All dirty pages in the pool from the file may be flushed using the DB_MPOOLFILE->sync method. When the file handle is no longer in use, it should be closed using the DB_MPOOLFILE->close method. d42 1 a42 1

  • The DB_MPOOLFILE->set_clear_len method specifies the number of bytes to clear d44 2 a45 2
  • The DB_MPOOLFILE->set_fileid method specifies a unique ID associated with the file.
  • The DB_MPOOLFILE->set_ftype method specifies the type of file for the purposes of d47 2 a48 2
  • The DB_MPOOLFILE->set_lsn_offset method specifies the byte offset of each page's log sequence number (DB_LSN) for the purposes of transaction d50 1 a50 1
  • The DB_MPOOLFILE->set_pgcookie method specifies an application provided argument d57 1 a57 1 the DB_ENV->memp_trickle method. d62 1 a62 1
  • The db_stat utility uses the DB_ENV->memp_stat method to display d64 1 a64 1
  • All dirty pages in the pool may be flushed using the DB_ENV->memp_sync method. d67 2 a68 2 a specified log sequence number (DB_LSN).
  • The entire pool may be discarded using the DB_ENV->remove method. a69 22

    Memory Pools and Related MethodsDescription
    DB_ENV->set_cachesizeSet the environment cache size
    DB_ENV->set_mp_mmapsizeSet maximum mapped-in database file size
    DB_ENV->memp_registerRegister input/output functions for a file in a memory pool
    DB_ENV->memp_statReturn memory pool statistics
    DB_ENV->memp_syncFlush pages from a memory pool
    DB_ENV->memp_trickleTrickle flush pages from a memory pool
    DB_ENV->memp_fcreateOpen a file in a memory pool
    DB_MPOOLFILE->closeClose a file in a memory pool
    DB_MPOOLFILE->getGet page from a file in a memory pool
    DB_MPOOLFILE->openOpen a file in a memory pool
    DB_MPOOLFILE->putReturn a page to a memory pool
    DB_MPOOLFILE->setSet memory pool page status
    DB_MPOOLFILE->syncFlush pages from a file in a memory pool
    DB_MPOOLFILE->set_clear_lenSet file page bytes to be cleared
    DB_MPOOLFILE->set_fileidSet file unique identifier
    DB_MPOOLFILE->set_ftypeSet file type
    DB_MPOOLFILE->set_lsn_offsetSet file log-sequence-number offset
    DB_MPOOLFILE->set_pgcookieSet file cookie for pgin/pgout
    @ 1.1.1.4 log @Import: RPM 4.1 @ text @d1 2 a2 2 d4 1 d24 1 a24 1 DB_ENV->open function opens and optionally creates a memory pool. When d26 2 a27 2 DB_ENV->close function.

    The DB_ENV->memp_fcreate function returns a DB_MPOOLFILE handle on an d29 1 a29 1 the DB_MPOOLFILE->open function. The DB_MPOOLFILE->get function is used to retrieve d31 1 a31 1 returned using the DB_MPOOLFILE->put function. At the time pages are returned, d37 3 a39 3 DB_MPOOLFILE->set function. All dirty pages in the pool from the file may be flushed using the DB_MPOOLFILE->sync function. When the file handle is no longer in use, it should be closed using the DB_MPOOLFILE->close function. d43 1 a43 1

  • The DB_MPOOLFILE->set_clear_len function specifies the number of bytes to clear d45 2 a46 2
  • The DB_MPOOLFILE->set_fileid function specifies a unique ID associated with the file.
  • The DB_MPOOLFILE->set_ftype function specifies the type of file for the purposes of d48 2 a49 2
  • The DB_MPOOLFILE->set_lsn_offset function specifies the byte offset of each page's log sequence number (DB_LSN) for the purposes of transaction d51 1 a51 1
  • The DB_MPOOLFILE->set_pgcookie function specifies an application provided argument d58 1 a58 1 the DB_ENV->memp_trickle function. d63 1 a63 1
  • The db_stat utility uses the DB_ENV->memp_stat function to display d65 1 a65 1
  • All dirty pages in the pool may be flushed using the DB_ENV->memp_sync function. d68 2 a69 2 a specified log sequence number (DB_LSN).
  • The entire pool may be discarded using the DB_ENV->remove function. d71 22 @ 1.1.1.5 log @Import: RPM 4.1.1 @ text @d1 2 a2 2 a3 1 d23 1 a23 1 DB_ENV->open method opens and optionally creates a memory pool. When d25 2 a26 2 DB_ENV->close method.

    The DB_ENV->memp_fcreate method returns a DB_MPOOLFILE handle on an d28 1 a28 1 the DB_MPOOLFILE->open method. The DB_MPOOLFILE->get method is used to retrieve d30 1 a30 1 returned using the DB_MPOOLFILE->put method. At the time pages are returned, d36 3 a38 3 DB_MPOOLFILE->set method. All dirty pages in the pool from the file may be flushed using the DB_MPOOLFILE->sync method. When the file handle is no longer in use, it should be closed using the DB_MPOOLFILE->close method. d42 1 a42 1

  • The DB_MPOOLFILE->set_clear_len method specifies the number of bytes to clear d44 2 a45 2
  • The DB_MPOOLFILE->set_fileid method specifies a unique ID associated with the file.
  • The DB_MPOOLFILE->set_ftype method specifies the type of file for the purposes of d47 2 a48 2
  • The DB_MPOOLFILE->set_lsn_offset method specifies the byte offset of each page's log sequence number (DB_LSN) for the purposes of transaction d50 1 a50 1
  • The DB_MPOOLFILE->set_pgcookie method specifies an application provided argument d57 1 a57 1 the DB_ENV->memp_trickle method. d62 1 a62 1
  • The db_stat utility uses the DB_ENV->memp_stat method to display d64 1 a64 1
  • All dirty pages in the pool may be flushed using the DB_ENV->memp_sync method. d67 2 a68 2 a specified log sequence number (DB_LSN).
  • The entire pool may be discarded using the DB_ENV->remove method. a69 22

    Memory Pools and Related MethodsDescription
    DB_ENV->set_cachesizeSet the environment cache size
    DB_ENV->set_mp_mmapsizeSet maximum mapped-in database file size
    DB_ENV->memp_registerRegister input/output functions for a file in a memory pool
    DB_ENV->memp_statReturn memory pool statistics
    DB_ENV->memp_syncFlush pages from a memory pool
    DB_ENV->memp_trickleTrickle flush pages from a memory pool
    DB_ENV->memp_fcreateOpen a file in a memory pool
    DB_MPOOLFILE->closeClose a file in a memory pool
    DB_MPOOLFILE->getGet page from a file in a memory pool
    DB_MPOOLFILE->openOpen a file in a memory pool
    DB_MPOOLFILE->putReturn a page to a memory pool
    DB_MPOOLFILE->setSet memory pool page status
    DB_MPOOLFILE->syncFlush pages from a file in a memory pool
    DB_MPOOLFILE->set_clear_lenSet file page bytes to be cleared
    DB_MPOOLFILE->set_fileidSet file unique identifier
    DB_MPOOLFILE->set_ftypeSet file type
    DB_MPOOLFILE->set_lsn_offsetSet file log-sequence-number offset
    DB_MPOOLFILE->set_pgcookieSet file cookie for pgin/pgout
    @