diff options
Diffstat (limited to 'docs/programmer_reference/transapp_env_open.html')
| -rw-r--r-- | docs/programmer_reference/transapp_env_open.html | 84 |
1 files changed, 43 insertions, 41 deletions
diff --git a/docs/programmer_reference/transapp_env_open.html b/docs/programmer_reference/transapp_env_open.html index 414a013d..6630d687 100644 --- a/docs/programmer_reference/transapp_env_open.html +++ b/docs/programmer_reference/transapp_env_open.html @@ -14,7 +14,7 @@ <body> <div xmlns="" class="navheader"> <div class="libver"> - <p>Library Version 11.2.5.3</p> + <p>Library Version 12.1.6.1</p> </div> <table width="100%" summary="Navigation header"> <tr> @@ -22,9 +22,7 @@ </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="transapp_app.html">Prev</a> </td> - <th width="60%" align="center">Chapter 11. - Berkeley DB Transactional Data Store Applications - </th> + <th width="60%" align="center">Chapter 11. Berkeley DB Transactional Data Store Applications </th> <td width="20%" align="right"> <a accesskey="n" href="transapp_data_open.html">Next</a></td> </tr> </table> @@ -38,39 +36,42 @@ </div> </div> </div> + <p> + Creating transaction-protected applications using the + Berkeley DB library is quite easy. Applications first use + <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a> to initialize the database environment. + Transaction-protected applications normally require all four + Berkeley DB subsystems, so the <a href="../api_reference/C/envopen.html#envopen_DB_INIT_MPOOL" class="olink">DB_INIT_MPOOL</a>, + <a href="../api_reference/C/envopen.html#envopen_DB_INIT_LOCK" class="olink">DB_INIT_LOCK</a>, <a href="../api_reference/C/envopen.html#envopen_DB_INIT_LOG" class="olink">DB_INIT_LOG</a>, and <a href="../api_reference/C/envopen.html#envopen_DB_INIT_TXN" class="olink">DB_INIT_TXN</a> flags should + be specified. + </p> + <p> + Once the application has called <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a>, it opens its + databases within the environment. Once the databases are + opened, the application makes changes to the databases inside + of transactions. Each set of changes that entails a unit of + work should be surrounded by the appropriate <a href="../api_reference/C/txnbegin.html" class="olink">DB_ENV->txn_begin()</a>, + <a href="../api_reference/C/txncommit.html" class="olink">DB_TXN->commit()</a> and <a href="../api_reference/C/txnabort.html" class="olink">DB_TXN->abort()</a> calls. The Berkeley DB access + methods will make the appropriate calls into the Lock, Log and + Memory Pool subsystems in order to guarantee transaction + semantics. When the application is ready to exit, all + outstanding transactions should have been committed or + aborted. + </p> <p> - Creating transaction-protected applications using the Berkeley DB - library is quite easy. Applications first use <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a> to initialize - the database environment. Transaction-protected applications normally - require all four Berkeley DB subsystems, so the <a href="../api_reference/C/envopen.html#envopen_DB_INIT_MPOOL" class="olink">DB_INIT_MPOOL</a>, - <a href="../api_reference/C/envopen.html#envopen_DB_INIT_LOCK" class="olink">DB_INIT_LOCK</a>, <a href="../api_reference/C/envopen.html#envopen_DB_INIT_LOG" class="olink">DB_INIT_LOG</a>, and <a href="../api_reference/C/envopen.html#envopen_DB_INIT_TXN" class="olink">DB_INIT_TXN</a> flags should be - specified. -</p> + Databases accessed by a transaction must not be closed + during the transaction. Once all outstanding transactions are + finished, all open Berkeley DB files should be closed. When + the Berkeley DB database files have been closed, the + environment should be closed by calling <a href="../api_reference/C/envclose.html" class="olink">DB_ENV->close()</a>. + </p> <p> - Once the application has called <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a>, it opens its databases - within the environment. Once the databases are opened, the application - makes changes to the databases inside of transactions. Each set of - changes that entails a unit of work should be surrounded by the - appropriate <a href="../api_reference/C/txnbegin.html" class="olink">DB_ENV->txn_begin()</a>, <a href="../api_reference/C/txncommit.html" class="olink">DB_TXN->commit()</a> and <a href="../api_reference/C/txnabort.html" class="olink">DB_TXN->abort()</a> calls. The Berkeley - DB access methods will make the appropriate calls into the Lock, Log - and Memory Pool subsystems in order to guarantee transaction semantics. - When the application is ready to exit, all outstanding transactions - should have been committed or aborted. -</p> - <p> - Databases accessed by a transaction must not be closed during the - transaction. Once all outstanding transactions are finished, all open - Berkeley DB files should be closed. When the Berkeley DB database - files have been closed, the environment should be closed by calling - <a href="../api_reference/C/envclose.html" class="olink">DB_ENV->close()</a>. -</p> - <p> - The following code fragment creates the database environment directory - then opens the environment, running recovery. Our <a href="../api_reference/C/env.html" class="olink">DB_ENV</a> database - environment handle is declared to be free-threaded using the - <a href="../api_reference/C/dbopen.html#open_DB_THREAD" class="olink">DB_THREAD</a> flag, and so may be used by any number of threads that we - may subsequently create. -</p> + The following code fragment creates the database + environment directory then opens the environment, running + recovery. Our <a href="../api_reference/C/env.html" class="olink">DB_ENV</a> database environment handle is declared to + be free-threaded using the <a href="../api_reference/C/dbopen.html#open_DB_THREAD" class="olink">DB_THREAD</a> flag, and so may be + used by any number of threads that we may subsequently create. + </p> <a id="prog_transapp1"></a> <pre class="programlisting">#include <sys/types.h> #include <sys/stat.h> @@ -172,9 +173,10 @@ env_open(DB_ENV **dbenvp) *dbenvp = dbenv; }</pre> <p> - After running this initial program, we can use the <a href="../api_reference/C/db_stat.html" class="olink">db_stat</a> utility to display - the contents of the environment directory: -</p> + After running this initial program, we can use the + <a href="../api_reference/C/db_stat.html" class="olink">db_stat</a> utility to display the contents of the environment + directory: + </p> <pre class="programlisting">prompt> db_stat -e -h TXNAPP 3.2.1 Environment version. 120897 Magic number. @@ -205,8 +207,7 @@ Txn Region: 5. 8KB Size (8192 bytes). -1 Segment ID. 1 Locks granted without waiting. -0 Locks granted after waiting. -</pre> +0 Locks granted after waiting.</pre> </div> <div class="navfooter"> <hr /> @@ -219,7 +220,8 @@ Txn Region: 5. <td width="40%" align="right"> <a accesskey="n" href="transapp_data_open.html">Next</a></td> </tr> <tr> - <td width="40%" align="left" valign="top">Architecting Transactional Data Store applications </td> + <td width="40%" align="left" valign="top">Architecting Transactional Data + Store applications </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> |
