2011-09-13 17:44:24 +00:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
|
<head>
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
|
|
|
<title>Chapter 1. Introduction</title>
|
|
|
|
|
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
|
|
|
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
|
|
|
|
|
<link rel="start" href="index.html" title="Getting Started with Berkeley DB Transaction Processing" />
|
|
|
|
|
<link rel="up" href="index.html" title="Getting Started with Berkeley DB Transaction Processing" />
|
|
|
|
|
<link rel="prev" href="moreinfo.html" title="For More Information" />
|
|
|
|
|
<link rel="next" href="sysfailure.html" title="A Note on System Failure" />
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div xmlns="" class="navheader">
|
|
|
|
|
<div class="libver">
|
2012-11-14 21:35:20 +00:00
|
|
|
|
<p>Library Version 11.2.5.3</p>
|
2011-09-13 17:44:24 +00:00
|
|
|
|
</div>
|
|
|
|
|
<table width="100%" summary="Navigation header">
|
|
|
|
|
<tr>
|
|
|
|
|
<th colspan="3" align="center">Chapter 1. Introduction</th>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="20%" align="left"><a accesskey="p" href="moreinfo.html">Prev</a> </td>
|
|
|
|
|
<th width="60%" align="center"> </th>
|
|
|
|
|
<td width="20%" align="right"> <a accesskey="n" href="sysfailure.html">Next</a></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
<hr />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="chapter" lang="en" xml:lang="en">
|
|
|
|
|
<div class="titlepage">
|
|
|
|
|
<div>
|
|
|
|
|
<div>
|
|
|
|
|
<h2 class="title"><a id="introduction"></a>Chapter 1. Introduction</h2>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="toc">
|
|
|
|
|
<p>
|
|
|
|
|
<b>Table of Contents</b>
|
|
|
|
|
</p>
|
|
|
|
|
<dl>
|
|
|
|
|
<dt>
|
|
|
|
|
<span class="sect1">
|
|
|
|
|
<a href="introduction.html#txnintro">Transaction Benefits</a>
|
|
|
|
|
</span>
|
|
|
|
|
</dt>
|
|
|
|
|
<dt>
|
|
|
|
|
<span class="sect1">
|
|
|
|
|
<a href="sysfailure.html">A Note on System Failure</a>
|
|
|
|
|
</span>
|
|
|
|
|
</dt>
|
|
|
|
|
<dt>
|
|
|
|
|
<span class="sect1">
|
|
|
|
|
<a href="apireq.html">Application Requirements</a>
|
|
|
|
|
</span>
|
|
|
|
|
</dt>
|
|
|
|
|
<dt>
|
|
|
|
|
<span class="sect1">
|
|
|
|
|
<a href="multithread-intro.html">Multi-threaded
|
|
|
|
|
<span>and Multi-process</span>
|
|
|
|
|
Applications</a>
|
|
|
|
|
</span>
|
|
|
|
|
</dt>
|
|
|
|
|
<dt>
|
|
|
|
|
<span class="sect1">
|
|
|
|
|
<a href="recovery-intro.html">Recoverability</a>
|
|
|
|
|
</span>
|
|
|
|
|
</dt>
|
|
|
|
|
<dt>
|
|
|
|
|
<span class="sect1">
|
|
|
|
|
<a href="perftune-intro.html">Performance Tuning</a>
|
|
|
|
|
</span>
|
|
|
|
|
</dt>
|
|
|
|
|
</dl>
|
|
|
|
|
</div>
|
|
|
|
|
<p>
|
|
|
|
|
This book provides a thorough introduction and discussion on transactions as
|
|
|
|
|
used with Berkeley DB (DB).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
It begins by offering a general overview to
|
|
|
|
|
transactions, the guarantees they provide, and the general application
|
|
|
|
|
infrastructure required to obtain full transactional protection for your
|
|
|
|
|
data.
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
This book also provides detailed examples on how to write a
|
|
|
|
|
transactional application. Both single threaded and multi-threaded <span>(as well as multi-process
|
|
|
|
|
applications)</span> are discussed. A detailed description of various
|
|
|
|
|
backup and recovery strategies is included in this manual, as is a
|
|
|
|
|
discussion on performance considerations for your transactional application.
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
You should understand the concepts from the
|
|
|
|
|
<span>
|
|
|
|
|
<em class="citetitle">Getting Started with Berkeley DB</em>
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
guide before reading this book.
|
|
|
|
|
</p>
|
|
|
|
|
<div class="sect1" lang="en" xml:lang="en">
|
|
|
|
|
<div class="titlepage">
|
|
|
|
|
<div>
|
|
|
|
|
<div>
|
|
|
|
|
<h2 class="title" style="clear: both"><a id="txnintro"></a>Transaction Benefits</h2>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>
|
|
|
|
|
Transactions offer your application's data protection from
|
|
|
|
|
application or system failures. That is, DB transactions offer
|
|
|
|
|
your application full ACID support:
|
|
|
|
|
</p>
|
|
|
|
|
<div class="itemizedlist">
|
|
|
|
|
<ul type="disc">
|
|
|
|
|
<li>
|
|
|
|
|
<p>
|
|
|
|
|
<span class="bold"><strong>A</strong></span>tomicity
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
Multiple database operations are treated as a single unit of
|
|
|
|
|
work. Once committed, all write operations performed under
|
|
|
|
|
the protection of the transaction are saved to your databases.
|
|
|
|
|
Further, in the event that you abort a transaction, all write
|
|
|
|
|
operations performed during the transaction are discarded.
|
|
|
|
|
In this event, your database is left in the state it was in
|
|
|
|
|
before the transaction began, regardless of the number or
|
|
|
|
|
type of write operations you may have performed during the
|
|
|
|
|
course of the transaction.
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
Note that DB transactions can span one or more
|
|
|
|
|
database handles.
|
|
|
|
|
</p>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<p>
|
|
|
|
|
<span class="bold"><strong>C</strong></span>onsistency
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
Your databases will never see a partially completed
|
|
|
|
|
transaction. This is true even if your application fails while there are
|
|
|
|
|
in-progress transactions. If the application or system fails,
|
|
|
|
|
then either all of the database changes appear when the
|
|
|
|
|
application next runs, or none of them appear.
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
In other words, whatever consistency requirements your application has will never be violated by DB.
|
|
|
|
|
If, for example, your application requires every record to include an employee ID, and your
|
|
|
|
|
code faithfully adds that ID to its database records, then DB will never
|
|
|
|
|
violate that consistency requirement. The ID will remain in the database records until such a time as your
|
|
|
|
|
application chooses to delete it.
|
|
|
|
|
</p>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<p>
|
|
|
|
|
<span class="bold"><strong>I</strong></span>solation
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
While a transaction is in progress, your databases will appear
|
|
|
|
|
to the transaction as if there are no other operations
|
|
|
|
|
occurring outside of the transaction. That is, operations
|
|
|
|
|
wrapped inside a transaction will always have a clean and
|
|
|
|
|
consistent view of your databases. They never have to see
|
|
|
|
|
updates currently in progress under the protection of another transaction.
|
|
|
|
|
Note, however, that isolation guarantees can be
|
|
|
|
|
|
|
|
|
|
relaxed from the default setting. See
|
|
|
|
|
<a class="xref" href="isolation.html" title="Isolation">Isolation</a>
|
|
|
|
|
for more information.
|
|
|
|
|
</p>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<p>
|
|
|
|
|
<span class="bold"><strong>D</strong></span>urability
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
Once committed to your databases, your modifications will
|
|
|
|
|
persist even in the event of an application or system failure.
|
|
|
|
|
Note that like isolation, your durability guarantee can be
|
|
|
|
|
relaxed. See <a class="xref" href="nodurabletxn.html" title="Non-Durable Transactions">Non-Durable Transactions</a>
|
|
|
|
|
for more information.
|
|
|
|
|
</p>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="navfooter">
|
|
|
|
|
<hr />
|
|
|
|
|
<table width="100%" summary="Navigation footer">
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="40%" align="left"><a accesskey="p" href="moreinfo.html">Prev</a> </td>
|
|
|
|
|
<td width="20%" align="center"> </td>
|
|
|
|
|
<td width="40%" align="right"> <a accesskey="n" href="sysfailure.html">Next</a></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="40%" align="left" valign="top">For More Information </td>
|
|
|
|
|
<td width="20%" align="center">
|
|
|
|
|
<a accesskey="h" href="index.html">Home</a>
|
|
|
|
|
</td>
|
|
|
|
|
<td width="40%" align="right" valign="top"> A Note on System Failure</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|