~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/docs/ref/program/copy.html

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!--$Id$-->
2
 
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
 
<!--All rights reserved.-->
4
 
<!--See the file LICENSE for redistribution information.-->
5
 
<html>
6
 
<head>
7
 
<title>Berkeley DB Reference Guide: Copying databases</title>
8
 
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
 
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
10
 
</head>
11
 
<body bgcolor=white>
12
 
<table width="100%"><tr valign=top>
13
 
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Programmer Notes</dl></h3></td>
14
 
<td align=right><a href="../../ref/program/cache.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/program/compatible.html"><img src="../../images/next.gif" alt="Next"></a>
15
 
</td></tr></table>
16
 
<p>
17
 
<h1 align=center>Copying databases</h1>
18
 
<p>Because file identification cookies (for example, filenames, device and
19
 
inode numbers, volume and file IDs, and so on) are not necessarily
20
 
unique or maintained across system reboots, each Berkeley DB database file
21
 
contains a 20-byte file identification bytestring that is stored in the
22
 
first page of the database, starting with the 53rd byte on the page.
23
 
When multiple processes or threads open the same database file in Berkeley DB,
24
 
it is this bytestring that is used to ensure that the same underlying
25
 
pages are updated in the shared memory buffer pool, no matter which
26
 
Berkeley DB handle is used for the operation.
27
 
<p>It is usually a bad idea to physically copy a database to a new name.  In
28
 
the few cases in which copying is the best solution for your application,
29
 
you must guarantee that there are never two different databases with
30
 
the same file identification bytestring in the memory pool at the same
31
 
time.  Copying databases is further complicated by the fact that the
32
 
shared memory buffer pool does not discard all cached copies of pages
33
 
for a database when the database is logically closed; that is, when
34
 
<a href="../../api_c/db_close.html">DB-&gt;close</a> is called.  Nor is there a Berkeley DB interface to
35
 
explicitly discard pages from the shared memory buffer pool for any
36
 
particular database.
37
 
<p>Before copying a database, you must ensure that all modified pages have
38
 
been written from the memory pool cache to the backing database file.
39
 
This is done using the <a href="../../api_c/db_sync.html">DB-&gt;sync</a> or <a href="../../api_c/db_close.html">DB-&gt;close</a> interfaces.
40
 
<p>Before using a copy of a database from Berkeley DB, you must ensure that all
41
 
pages from any database with the same bytestring have been removed from
42
 
the memory pool cache.  If the environment in which you intend to open
43
 
the copy of the database potentially has pages from files with identical
44
 
bytestrings to the copied database (which is likely to be the case), there
45
 
are a few possible solutions:
46
 
<p><ol>
47
 
<p><li>Remove the environment, either explicitly or by calling <a href="../../api_c/env_remove.html">DB_ENV-&gt;remove</a>.
48
 
Note that this will not allow you to access both the original and copy
49
 
of the database at the same time.
50
 
<p><li>Create a new file that will have a new bytestring.  The simplest way to
51
 
create a new file that will have a new bytestring is to call the
52
 
<a href="../../utility/db_dump.html">db_dump</a> utility to dump out the contents of the database and
53
 
then use the <a href="../../utility/db_load.html">db_load</a> utility to load the dumped output into a
54
 
new file.  This allows you to access both the original and copy of
55
 
the database at the same time.
56
 
<p><li>If your database is too large to be copied, overwrite the bytestring in
57
 
the copied database with a new bytestring.  This allows you to access
58
 
both the original and copy of the database at the same time.
59
 
</ol>
60
 
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/program/cache.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/program/compatible.html"><img src="../../images/next.gif" alt="Next"></a>
61
 
</td></tr></table>
62
 
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
63
 
</body>
64
 
</html>