<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="2" MadCap:lastHeight="120" MadCap:lastWidth="624" MadCap:disableMasterStylesheet="true" MadCap:tocPath="Basics Operations & Concepts|ACID Properties And Transactions" MadCap:InPreviewMode="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" MadCap:PathToHelpSystem="../../../" MadCap:HelpSystemFileName="index.xml" MadCap:SearchType="Stem"> <head><title> db4o's Commit Process</title> <script type="text/javascript">/* <![CDATA[ */ window.onload = function(){ var pathToFlash = $('html').attr('MadCap:PathToHelpSystem') + 'Content/Resources/Code/ZeroClipboard.swf'; ZeroClipboard.setMoviePath(pathToFlash); function bindToClipBord(element,content){ var clip = new ZeroClipboard.Client(); clip.setText(content); clip.glue(element); }; if(location.protocol==='file:'){ $('.copylink-marker').remove(); } else{ $('.copylink-marker').each(function(){ var text = $(this).parent().parent().children('.prettyprint').html(); $(this).hover(function(){ bindToClipBord(this,text); }, function(){}); }); } prettyPrint(); }; /* ]]> */</script> <link href="../../SkinSupport/MadCap.css" rel="stylesheet" /> <link href="../../Resources/TableStyles/Basic.css" rel="stylesheet" /> <link href="../../Resources/Stylesheets/OnlineStyle.css" rel="stylesheet" /> <script src="../../Resources/Code/prettify.js"> </script> <script src="../../Resources/Code/lang-vb.js"> </script> <script src="../../Resources/Code/jquery.min.js"> </script> <script src="../../Resources/Code/ZeroClipboard.js"> </script> <script src="../../SkinSupport/MadCapAll.js" type="text/javascript"> </script> </head> <body> <p class="MCWebHelpFramesetLink" style="display: none;"><a href="../../../index_CSH.html#basics/acid_and_transactions/commit_process_db4o.htm" style="">Open topic with navigation</a> </p> <div class="MCBreadcrumbsBox"><span class="MCBreadcrumbsPrefix">You are here: </span><a class="MCBreadcrumbsLink" href="../../basics.htm">Basics Operations & Concepts</a><span class="MCBreadcrumbsDivider"> > </span><a class="MCBreadcrumbsLink" href="../acid_and_transactions.htm">ACID Properties And Transactions</a><span class="MCBreadcrumbsDivider"> > </span><span class="MCBreadcrumbs">db4o's Commit Process</span> </div> <p> <script type="text/javascript">/*<![CDATA[*/document.write('<a href="' + location.href +'">'); document.write("Direct Link"); document.write('</a>');/*]]>*/</script> </p> <p> </p> <h1> db4o's Commit Process</h1> <p>How does db4o make transactions safe, so that it can recover failures? Here's the short overview of the transaction-phases db4o uses.</p> <table style="width: 100%;mc-table-style: url('../../Resources/TableStyles/Basic.css');" class="TableStyle_Basic" cellspacing="0"> <col style="width: 50%;" /> <col style="width: 50%;" /> <tbody> <tr> <th style="text-align: left;" class="TableStyle_Basic_Body_0_0_RowSep_ColSep">Phase</th> <th style="text-align: left;" class="TableStyle_Basic_Body_0_0_RowSep_ColEnd">In Case Of A Crash</th> </tr> <tr> <td class="TableStyle_Basic_Body_0_0_RowSep_ColSep">1. During the transactions. New and updated objects are written to a new Slot in the database-file. The id-mapping and freespace changes are kept in the transaction.</td> <td class="TableStyle_Basic_Body_0_0_RowSep_ColEnd">The changes are lost, because the id-mapping and freespace changes weren't persisted. Therefore the changes are invisible to the database. The transaction is rolled back.</td> </tr> <tr> <td class="TableStyle_Basic_Body_0_0_RowSep_ColSep">2. Committing starts: The id-changes and free-space changes are written to a new slot, without damaging the old information.</td> <td class="TableStyle_Basic_Body_0_0_RowSep_ColEnd">The changes are lost, because the id-mapping and freespace changes haven't been completely stored. The transaction is rolled back.</td> </tr> <tr> <td class="TableStyle_Basic_Body_0_0_RowSep_ColSep">3. Write the location of latest id-records, and free-space changes to the first location with and additional checksum.</td> <td class="TableStyle_Basic_Body_0_0_RowSep_ColEnd">If the record write was completed, the transaction is resumed and completed. If not, the old information is used.</td> </tr> <tr> <td class="TableStyle_Basic_Body_0_0_RowEnd_ColSep">4. Write the of latest id-recods, and free-space changes to the backup location with and additional checksum.</td> <td class="TableStyle_Basic_Body_0_0_RowEnd_ColEnd">If the record wasn't completely written, the transaction is resumed. </td> </tr> </tbody> </table> <p>Of course you don't need to worry about this. db4o ensures that a transaction either completes or is rolled back. Whenever you call commit and the call succeeds, all changes are persisted. If your application or db4o crashes before a successfully commit-call, all changes are undone. </p> <script type="text/javascript" src="../../SkinSupport/MadCapBodyEnd.js"> </script> </body> </html>