1
<!--$Id: memp_sync.so,v 10.27 2001/04/02 20:10:08 bostic Exp $-->
2
<!--Copyright 1997-2001 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
6
<title>Berkeley DB: memp_sync</title>
7
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
11
<a name="2"><!--meow--></a>
12
<table width="100%"><tr valign=top>
17
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
25
memp_sync(DB_ENV *env, DB_LSN *lsn);
28
<p>The memp_sync function ensures that any modified pages in the pool with
29
log sequence numbers less than the <b>lsn</b> argument are written to
30
disk. If <b>lsn</b> is NULL, all modified pages in the pool are
32
<p>The primary purpose of the memp_sync function is to enable a
33
transaction manager to ensure, as part of a checkpoint, that all pages
34
modified by a certain time have been written to disk. Pages in the pool
35
that cannot be written back to disk immediately (for example, pages that
36
are currently pinned) are written to disk as soon as it is possible to
37
do so. The expected behavior of the Berkeley DB or other Transaction
38
subsystem is to call the memp_sync function and then, if the
39
return indicates that some pages could not be written immediately, to
40
wait briefly and retry again with the same log sequence number until
41
the memp_sync function returns that all pages have been
43
<p>To support the memp_sync functionality, it is necessary that the
44
pool functions know the location of the log sequence number on the page
45
for each file type. This location should be specified when the file is
46
opened using the <a href="../api_c/memp_fopen.html">memp_fopen</a> function. It is not required that
47
the log sequence number be aligned on the page in any way.
48
<p>The memp_sync function returns a non-zero error value on failure, 0 on success, and returns <a href="../api_c/memp_fsync.html#DB_INCOMPLETE">DB_INCOMPLETE</a> if there were pages which need to be
49
written but that memp_sync was unable to write immediately.
50
In addition, if memp_sync returns success, the value of
51
<b>lsn</b> will be overwritten with the largest log sequence number
52
from any page that was written by memp_sync to satisfy this
55
<p>The memp_sync function may fail and return a non-zero error for the following conditions:
57
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
58
<p>The memp_sync function was called without logging having been
59
initialized in the environment.
61
<p>The memp_sync function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions.
62
If a catastrophic error has occurred, the memp_sync function may fail and return
63
<a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, in which case all subsequent Berkeley DB calls will fail
66
<a href="../api_c/env_set_cachesize.html">DB_ENV->set_cachesize</a>,
67
<a href="../api_c/env_set_mp_mmapsize.html">DB_ENV->set_mp_mmapsize</a>,
68
<a href="../api_c/memp_fclose.html">memp_fclose</a>,
69
<a href="../api_c/memp_fget.html">memp_fget</a>,
70
<a href="../api_c/memp_fopen.html">memp_fopen</a>,
71
<a href="../api_c/memp_fput.html">memp_fput</a>,
72
<a href="../api_c/memp_fset.html">memp_fset</a>,
73
<a href="../api_c/memp_fsync.html">memp_fsync</a>,
74
<a href="../api_c/memp_register.html">memp_register</a>,
75
<a href="../api_c/memp_stat.html">memp_stat</a>,
76
<a href="../api_c/memp_sync.html">memp_sync</a>,
78
<a href="../api_c/memp_trickle.html">memp_trickle</a>.
80
<table width="100%"><tr><td><br></td><td align=right>
81
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
83
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>