| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <title>Using Recovery on Journaling Filesystems</title> |
| 7 | <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> |
| 10 | <link rel="up" href="transapp.html" title="Chapter 11. Berkeley DB Transactional Data Store Applications" /> |
| 11 | <link rel="prev" href="transapp_hotfail.html" title="Hot failover" /> |
| 12 | <link rel="next" href="transapp_filesys.html" title="Recovery and filesystem operations" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">Using Recovery on Journaling Filesystems</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="transapp_hotfail.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 11. |
| 26 | Berkeley DB Transactional Data Store Applications |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="transapp_filesys.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="transapp_journal"></a>Using Recovery on Journaling Filesystems</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <p> |
| 42 | In some cases, the use of meta-data only journaling file systems can |
| 43 | lead to log file corruption. The window of vulnerability is quite |
| 44 | small, but if the operating system experiences an unclean shutdown |
| 45 | while Berkeley DB is creating a new log file, it is possible that upon |
| 46 | file system recovery, the system will be in a state where the log file |
| 47 | has been created, but its own meta-data has not. |
| 48 | </p> |
| 49 | <p> |
| 50 | When a log file is corrupted to this degree, normal recovery can fail |
| 51 | and your application may be unable to open your environment. Instead, |
| 52 | an error something like this is issued when you attempt to run normal |
| 53 | recovery on environment open: |
| 54 | </p> |
| 55 | <pre class="programlisting"> Ignoring log file: /var/dblog/log.0000000074: magic number |
| 56 | 6c73732f, not 40988 |
| 57 | Invalid log file: log.0000000074: Invalid argument |
| 58 | PANIC: Invalid argument |
| 59 | process-private: unable to find environment |
| 60 | txn_checkpoint interface requires an environment configured for |
| 61 | the transaction subsystem </pre> |
| 62 | <p> |
| 63 | In this case, it may be possible to successfully recover the |
| 64 | environment by ignoring the log file that was being created — to |
| 65 | do this, rename the log file with the highest number to a temporary |
| 66 | name: |
| 67 | </p> |
| 68 | <pre class="programlisting"> mv DBHOME/log.000000XXX my-temporary-log-file </pre> |
| 69 | <p> |
| 70 | and try running normal environment recovery again. If recovery is |
| 71 | successful, and your application is able to open the environment, then |
| 72 | you can delete the log file that you renamed. |
| 73 | </p> |
| 74 | <p> |
| 75 | If recovery is not successful, then you must perform a catastrophic |
| 76 | recovery from a previous backup. |
| 77 | </p> |
| 78 | <p> |
| 79 | This situation has been shown to occur when using ext3 in writeback |
| 80 | mode, but other journaling filesystems could exhibit similar behavior. |
| 81 | </p> |
| 82 | <p> |
| 83 | To be absolutely certain of your application's ability to recover your |
| 84 | environment in the event of a system crash, either use non-journaling |
| 85 | filesystems, or use a journaling filesystem in a safe (albeit slower) |
| 86 | configuration, such as ext3 in ordered mode. |
| 87 | </p> |
| 88 | </div> |
| 89 | <div class="navfooter"> |
| 90 | <hr /> |
| 91 | <table width="100%" summary="Navigation footer"> |
| 92 | <tr> |
| 93 | <td width="40%" align="left"><a accesskey="p" href="transapp_hotfail.html">Prev</a> </td> |
| 94 | <td width="20%" align="center"> |
| 95 | <a accesskey="u" href="transapp.html">Up</a> |
| 96 | </td> |
| 97 | <td width="40%" align="right"> <a accesskey="n" href="transapp_filesys.html">Next</a></td> |
| 98 | </tr> |
| 99 | <tr> |
| 100 | <td width="40%" align="left" valign="top">Hot failover </td> |
| 101 | <td width="20%" align="center"> |
| 102 | <a accesskey="h" href="index.html">Home</a> |
| 103 | </td> |
| 104 | <td width="40%" align="right" valign="top"> Recovery and filesystem operations</td> |
| 105 | </tr> |
| 106 | </table> |
| 107 | </div> |
| 108 | </body> |
| 109 | </html> |