db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r151650 - in incubator/derby/site/trunk: build/site/papers/recovery.html src/documentation/content/xdocs/papers/recovery.xml
Date Mon, 07 Feb 2005 01:08:56 GMT
Author: jta
Date: Sun Feb  6 17:08:55 2005
New Revision: 151650

URL: http://svn.apache.org/viewcvs?view=rev&rev=151650
Log:
Commited modification to recovery.xml by Dibyendu Majumdar <dibyendu@mazumdar.demon.co.uk>.

Modified:
    incubator/derby/site/trunk/build/site/papers/recovery.html
    incubator/derby/site/trunk/src/documentation/content/xdocs/papers/recovery.xml

Modified: incubator/derby/site/trunk/build/site/papers/recovery.html
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/build/site/papers/recovery.html?view=diff&r1=151649&r2=151650
==============================================================================
--- incubator/derby/site/trunk/build/site/papers/recovery.html (original)
+++ incubator/derby/site/trunk/build/site/papers/recovery.html Sun Feb  6 17:08:55 2005
@@ -223,6 +223,21 @@
 <li>
 <a href="#Checkpoints">Checkpoints</a>
 </li>
+<li>
+<a href="#Derby+Logging+Overview">Derby Logging Overview</a>
+</li>
+<li>
+<a href="#Loggable+Interface+Hierarchy">Loggable Interface Hierarchy</a>
+</li>
+<li>
+<a href="#Container+Log+Operations+Hierarchy">Container Log Operations Hierarchy</a>
+</li>
+<li>
+<a href="#Transaction+Management+Log+Operations+Hierarchy">Transaction Management Log
Operations Hierarchy</a>
+</li>
+<li>
+<a href="#Page+Level+Log+Operations+Hierarchy">Page Level Log Operations Hierarchy</a>
+</li>
 </ul>
 </div>
     
@@ -236,15 +251,23 @@
 <h2 class="boxed">ARIES - An Overview</h2>
 <div class="section">
 <p>Following is a brief description of the main principles behind ARIES.</p>
-<p>Firstly, in ARIES, changes always take the system forward. That is to 
-        say, even transaction rollbacks are treated as if they are updates to 
-        the system. For example, if a transaction changes A to B and then rolls 
-        back, ARIES treats the rollback as simply an update that changes B to 
-        A. The forward change from A to B (redo) and the reversal of B to A (undo) 
-        are both recorded as updates to the system.</p>
-<p>One can see that this simple principle ensures that all changes within 
-        the system are recorded as updates that forever take the system forward. 
-      </p>
+<p>Firstly, in ARIES, changes always take the system forward. That is to say,
+even transaction rollbacks are treated as if they are updates to the system.
+This is counter-inituitive to what the user thinks, because when a user asks for a
+transaction to be rolled back, they assume that the system is going back
+to a previous state of affairs. However, from the perspective of ARIES, there
+is no such thing as going back. For example, if a transaction changes A to B
+and then rolls back, ARIES treats the rollback as simply an update that
+changes B to A. The forward change from A to B (redo) and the reversal of B to
+A (undo) are both recorded as updates to the system. Changes during normal
+operations are recorded as Redo-Undo log records. As the name implies, these
+log records can be 'redone' in case of a system crash, or 'undone' in case a
+rollback is required. Changes made during rollbacks, however, are recorded as
+Redo-only log records. These log records are called Compensation Log Records
+(CLRs). The reason these are redo only is that by definition a rollback does
+not need to be undone, whereas normal updates need to be undone if the
+transaction decides to rollback.
+</p>
 <p>The second basic principle of ARIES is that during recovery, history 
         is repeated. This can be explained as follows.</p>
 <p>When a system crashes, there would be some transactions that have completed 
@@ -269,7 +292,7 @@
         system need to know about high level data structures. </p>
 </div>
     
-<a name="N10035"></a><a name="Features+of+ARIES"></a>
+<a name="N10032"></a><a name="Features+of+ARIES"></a>
 <h2 class="boxed">Features of ARIES</h2>
 <div class="section">
 <p>ARIES includes a number of optimisations to reduce the amount of work 
@@ -309,9 +332,12 @@
         UndoLsn pointer as described previously.</p>
 </div>
     
-<a name="N1004B"></a><a name="References"></a>
+<a name="N10048"></a><a name="References"></a>
 <h2 class="boxed">References</h2>
 <div class="section">
+<ol>
+      
+<li>
 <p> For a full description of ARIES, please see 
         <em>Mohan, C., Haderle, D., Lindsay, B., Pirahesh, H., Schwarz, P. ARIES: 
           A Transaction Recovery Method Supporting Fine-Granularity Locking and 
@@ -319,11 +345,25 @@
           Systems, Vol. 17, No. 1, March 1992, pp94-162.</em>
         A version of this document is freely available as 
         <a class="external" href="http://www.almaden.ibm.com/u/mohan/RJ6649Rev.pdf">IBM
Research 
-          Report RJ6649</a>
-        .</p>
+          Report RJ6649</a>.</p>
+      
+</li>
+      
+<li>
+<p> A good description of Write Ahead Logging, and how a log is typically 
+          implemented, can be found in 
+          <em> 
+            <a class="external" href="http://portal.acm.org/citation.cfm?id=573304">Transaction

+              Processing: Concepts and Techniques</a>
+            , by Jim Gray and Andreas Reuter, 1993, Morgan Kaufmann Publishers</em>
+          .</p>
+      
+</li>
+      
+</ol>
 </div>
     
-<a name="N1005C"></a><a name="Derby+implementation+of+ARIES"></a>
+<a name="N1006A"></a><a name="Derby+implementation+of+ARIES"></a>
 <h2 class="boxed">Derby implementation of ARIES</h2>
 <div class="section">
 <p>I shall only describe how Derby differs from standard ARIES implementation. 
@@ -362,12 +402,18 @@
         8. I haven't seen this sanity check in many years, but was useful when 
         the product was first coded. </p>
 <p>Derby does not write the dirty pages list within a Checkpoint record. 
-        As a result, during checkpoint, Derby must flush all database pages to 
-        disk.</p>
+        Instead, during checkpoint, Derby flushes all database pages to 
+        disk. The redo Low Water Mark (redoLWM) is set to the current LSN when the
+        checkpoint starts. The undo Low Water Mark (undoLWM) is set to the 
+        starting LSN of the oldest active transaction. At restart, Derby replays
+        the log from redoLWM or undoLWM whichever is earlier. For a good description
+        of concepts behind the checkpoint method used by Derby, and the use of redo/undo
Low
+        Water Marks, please refer to TPCT book (Section 11.3).</p>
 <p>Derby uses 'internal' transactions instead of nested top-level actions 
         to separate structural changes from normal operations. Internal transactions 
         have the property that they are always page-oriented and do not require 
-        logical undo. Also, during recovery, incomplete internal transactions 
+        logical undo, ie, undo is always physical. Also, during recovery, incomplete 
+        internal transactions 
         are undone before any regular transactions. In ARIES, no special processing 
         is required to handle this, as nested top-level actions are automatically 
         handled as part of normal redo, and are skipped during undo unless they 
@@ -379,7 +425,7 @@
         done.</p>
 </div>
     
-<a name="N10080"></a><a name="Derby+recovery+process"></a>
+<a name="N1008E"></a><a name="Derby+recovery+process"></a>
 <h2 class="boxed">Derby recovery process</h2>
 <div class="section">
 <p>Implemented in <span class="codefrag">org.apache.derby.impl.store.raw.log.LogToFile.recover()</span>
@@ -402,7 +448,7 @@
 </dl>
 </div>
     
-<a name="N100A1"></a><a name="Recovery+Redo+pass"></a>
+<a name="N100AF"></a><a name="Recovery+Redo+pass"></a>
 <h2 class="boxed">Recovery Redo pass</h2>
 <div class="section">
 <p>Implemented in <span class="codefrag">org.apache.derby.impl.store.raw.log.FileLogger.redo()</span>
@@ -426,7 +472,7 @@
 </ol>
 </div>
     
-<a name="N100BC"></a><a name="Recovery+Undo+pass"></a>
+<a name="N100CA"></a><a name="Recovery+Undo+pass"></a>
 <h2 class="boxed">Recovery Undo pass</h2>
 <div class="section">
 <p>Implemented in <span class="codefrag">org.apache.derby.impl.store.raw.xact.XactFactory.rollbackAllTransactions()</span>
@@ -442,7 +488,7 @@
 </ol>
 </div>
     
-<a name="N100D4"></a><a name="Checkpoints"></a>
+<a name="N100E2"></a><a name="Checkpoints"></a>
 <h2 class="boxed">Checkpoints</h2>
 <div class="section">
 <p>Implemented in <span class="codefrag">org.apache.derby.impl.store.raw.log.LogToFile.checkpoint()</span>
@@ -565,6 +611,189 @@
 	 Note that if any time elapse between taking the undoLWM and the redoLWM,
 	 then it will create a 4th period of interest.      
        </p>
+</div>
+    
+<a name="N1015D"></a><a name="Derby+Logging+Overview"></a>
+<h2 class="boxed">Derby Logging Overview</h2>
+<div class="section">
+<p>A loggable action in Derby is redoable. If the action implements Undoable interface,
then it is also
+	    undoable. When an undoable action is rolled back, it must generate a Compensation log
which represents 
+	    the action necessary to repeat the undo.
+		</p>
+<p>Normally a logged action is rolled back on the same page that it was originally
applied to. This is
+		called physical or physiological undo. If the undo needs to be applied to a different page
(such as due to
+		a page split in a BTree), then it is called
+    	a Logical Undo. In Derby, BTree inserts and deletes require logical undo.</p>
+<p>When performing a loggable action, Derby follows this sequence:</p>
+<ol>
+    		
+<li>Convert the action into a corresponding log operation. Most BTree and Heap operations
are
+   		    translated to Page level actions - ie - the action involves updating one or more
pages. For example,
+   		    a single Heap row insert may be translated to inserts on several pages. Each page
insert
+   		    will be a separate loggable action.</li>
+    		
+<li>Generate the log data that describes the page level action.</li>
+    		
+<li>Perform the action <em>after</em> it has been logged. Also, the action
is 
+    		performed using the logged data, in the same way as it would be performed during recovery.
+    		In other words, the logged data is used both for normal operations as well as for repeating
+    		history. This has the advantage that the recovery execution path is the same as the
execution
+    		path during normal execution.</li>    		  
+    		
+<li>If a transaction is being rolled back, first the loggable action is asked to generate
+    		the corresponding undo (Compensation) log data. This is then logged, and after that
it is performed.
+    		As described before, a Compensation action is only redoable, because by definition,
an undo
+    		action does not need to be undone.
+    		</li>
+    	
+</ol>
+</div>
+    
+<a name="N1017F"></a><a name="Loggable+Interface+Hierarchy"></a>
+<h2 class="boxed">Loggable Interface Hierarchy</h2>
+<div class="section">
+<div class="frame fixme">
+<div class="label">Fixme (DM)</div>
+<div class="content">Following links are broken.</div>
+</div>
+<ul>
+			
+<li>interface org.apache.derby.iapi.store.raw.<a href="../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw"><strong>Loggable</strong></a>
+				
+<ul>
+					
+<li>interface org.apache.derby.iapi.store.raw.<a href="../../../../../../org/apache/derby/iapi/store/raw/Compensation.html"
title="interface in org.apache.derby.iapi.store.raw"><strong>Compensation</strong></a>
+</li>
+					
+<li>interface org.apache.derby.iapi.store.raw.<a href="../../../../../../org/apache/derby/iapi/store/raw/Undoable.html"
title="interface in org.apache.derby.iapi.store.raw"><strong>Undoable</strong></a>
+						
+<ul>
+							
+<li>interface org.apache.derby.iapi.store.raw.<a href="../../../../../../org/apache/derby/iapi/store/raw/LogicalUndoable.html"
title="interface in org.apache.derby.iapi.store.raw"><strong>LogicalUndoable</strong></a>
+</li>
+						
+</ul>
+					
+</li>
+				
+</ul>
+			
+</li>
+		
+</ul>
+</div>
+    
+<a name="N101B5"></a><a name="Container+Log+Operations+Hierarchy"></a>
+<h2 class="boxed">Container Log Operations Hierarchy</h2>
+<div class="section">
+<div class="frame fixme">
+<div class="label">Fixme (DM)</div>
+<div class="content">Following links are broken.</div>
+</div>
+<ul>
+			
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/ContainerBasicOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>ContainerBasicOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw">Loggable</a>)
+				<ul>
+					
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/ContainerOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>ContainerOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Undoable.html"
title="interface in org.apache.derby.iapi.store.raw">Undoable</a>)</li>
+					
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/ContainerUndoOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>ContainerUndoOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Compensation.html"
title="interface in org.apache.derby.iapi.store.raw">Compensation</a>)</li>
+				
+</ul>
+			
+</li>
+			
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/RemoveFileOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>RemoveFileOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Undoable.html"
title="interface in org.apache.derby.iapi.store.raw">Undoable</a>)</li>
+		
+</ul>
+</div>
+    
+<a name="N101FE"></a><a name="Transaction+Management+Log+Operations+Hierarchy"></a>
+<h2 class="boxed">Transaction Management Log Operations Hierarchy</h2>
+<div class="section">
+<div class="frame fixme">
+<div class="label">Fixme (DM)</div>
+<div class="content">Following links are broken.</div>
+</div>
+<ul>
+			
+<li>class org.apache.derby.impl.store.raw.xact.<a href="../../../../../../../org/apache/derby/impl/store/raw/xact/BeginXact.html"
title="class in org.apache.derby.impl.store.raw.xact"><strong>BeginXact</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw">Loggable</a>)</li>
+			
+<li>class org.apache.derby.impl.store.raw.xact.<a href="../../../../../../../org/apache/derby/impl/store/raw/xact/EndXact.html"
title="class in org.apache.derby.impl.store.raw.xact"><strong>EndXact</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw">Loggable</a>)</li>
+			
+<li>class org.apache.derby.impl.store.raw.log.<a href="../../../../../../../org/apache/derby/impl/store/raw/log/CheckpointOperation.html"
title="class in org.apache.derby.impl.store.raw.log"><strong>CheckpointOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw">Loggable</a>)</li>
+		
+</ul>
+</div>
+    
+<a name="N10236"></a><a name="Page+Level+Log+Operations+Hierarchy"></a>
+<h2 class="boxed">Page Level Log Operations Hierarchy</h2>
+<div class="section">
+<div class="frame fixme">
+<div class="label">Fixme (DM)</div>
+<div class="content">Following links are broken.</div>
+</div>
+<ul>
+			
+<li>class org.apache.derby.impl.store.raw.data.<a href="/org/apache/derby/impl/store/raw/data/PageBasicOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>PageBasicOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw">Loggable</a>, org.apache.derby.iapi.store.raw.<a
href="/org/apache/derby/iapi/store/raw/RePreparable.html" title="interface in org.apache.derby.iapi.store.raw">RePreparable</a>)
+				<ul>
+					
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/LogicalPageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>LogicalPageOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/LogicalUndoable.html"
title="interface in org.apache.derby.iapi.store.raw">LogicalUndoable</a>)
+					<ul>
+						
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/DeleteOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>DeleteOperation</strong></a>
+</li>
+						
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/InsertOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>InsertOperation</strong></a>
+</li>
+						
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/UpdateFieldOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>UpdateFieldOperation</strong></a>
+</li>
+					
+</ul>
+					
+</li>
+					
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/LogicalUndoOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>LogicalUndoOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Compensation.html"
title="interface in org.apache.derby.iapi.store.raw">Compensation</a>)</li>
+					
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/PhysicalPageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>PhysicalPageOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Undoable.html"
title="interface in org.apache.derby.iapi.store.raw">Undoable</a>)
+						<ul>
+							
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/AllocPageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>AllocPageOperation</strong></a>
+</li>
+							
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/ChainAllocPageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>ChainAllocPageOperation</strong></a>
+</li>
+							
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/CopyRowsOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>CopyRowsOperation</strong></a>
+</li>
+							
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/InitPageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>InitPageOperation</strong></a>
+</li>
+							
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/InvalidatePageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>InvalidatePageOperation</strong></a>
+</li>
+							
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/PurgeOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>PurgeOperation</strong></a>
+</li>
+							
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/UpdateOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>UpdateOperation</strong></a>
+</li>
+						
+</ul>
+					
+</li>
+					
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/PhysicalUndoOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>PhysicalUndoOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Compensation.html"
title="interface in org.apache.derby.iapi.store.raw">Compensation</a>)</li>
+					
+<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/SetReservedSpaceOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>SetReservedSpaceOperation</strong></a>
+</li>
+				
+</ul>
+			
+</li>
+		
+</ul>
 </div>
     
 </div>

Modified: incubator/derby/site/trunk/src/documentation/content/xdocs/papers/recovery.xml
URL: http://svn.apache.org/viewcvs/incubator/derby/site/trunk/src/documentation/content/xdocs/papers/recovery.xml?view=diff&r1=151649&r2=151650
==============================================================================
--- incubator/derby/site/trunk/src/documentation/content/xdocs/papers/recovery.xml (original)
+++ incubator/derby/site/trunk/src/documentation/content/xdocs/papers/recovery.xml Sun Feb
 6 17:08:55 2005
@@ -16,15 +16,23 @@
     <section> 
       <title>ARIES - An Overview</title>
       <p>Following is a brief description of the main principles behind ARIES.</p>
-      <p>Firstly, in ARIES, changes always take the system forward. That is to 
-        say, even transaction rollbacks are treated as if they are updates to 
-        the system. For example, if a transaction changes A to B and then rolls 
-        back, ARIES treats the rollback as simply an update that changes B to 
-        A. The forward change from A to B (redo) and the reversal of B to A (undo) 
-        are both recorded as updates to the system.</p>
-      <p>One can see that this simple principle ensures that all changes within 
-        the system are recorded as updates that forever take the system forward. 
-      </p>
+      <p>Firstly, in ARIES, changes always take the system forward. That is to say,
+even transaction rollbacks are treated as if they are updates to the system.
+This is counter-inituitive to what the user thinks, because when a user asks for a
+transaction to be rolled back, they assume that the system is going back
+to a previous state of affairs. However, from the perspective of ARIES, there
+is no such thing as going back. For example, if a transaction changes A to B
+and then rolls back, ARIES treats the rollback as simply an update that
+changes B to A. The forward change from A to B (redo) and the reversal of B to
+A (undo) are both recorded as updates to the system. Changes during normal
+operations are recorded as Redo-Undo log records. As the name implies, these
+log records can be 'redone' in case of a system crash, or 'undone' in case a
+rollback is required. Changes made during rollbacks, however, are recorded as
+Redo-only log records. These log records are called Compensation Log Records
+(CLRs). The reason these are redo only is that by definition a rollback does
+not need to be undone, whereas normal updates need to be undone if the
+transaction decides to rollback.
+</p>
       <p>The second basic principle of ARIES is that during recovery, history 
         is repeated. This can be explained as follows.</p>
       <p>When a system crashes, there would be some transactions that have completed

@@ -88,15 +96,25 @@
     </section>
     <section> 
       <title>References</title>
-      <p> For a full description of ARIES, please see 
+      <ol>
+      <li><p> For a full description of ARIES, please see 
         <em>Mohan, C., Haderle, D., Lindsay, B., Pirahesh, H., Schwarz, P. ARIES: 
           A Transaction Recovery Method Supporting Fine-Granularity Locking and 
           Partial Rollbacks Using Write-Ahead Logging, ACM Transactions on Database 
           Systems, Vol. 17, No. 1, March 1992, pp94-162.</em>
         A version of this document is freely available as 
         <a href="http://www.almaden.ibm.com/u/mohan/RJ6649Rev.pdf">IBM Research 
-          Report RJ6649</a>
-        .</p>
+          Report RJ6649</a>.</p>
+      </li>
+      <li><p> A good description of Write Ahead Logging, and how a log is typically

+          implemented, can be found in 
+          <em> 
+            <a href="http://portal.acm.org/citation.cfm?id=573304">Transaction 
+              Processing: Concepts and Techniques</a>
+            , by Jim Gray and Andreas Reuter, 1993, Morgan Kaufmann Publishers</em>
+          .</p>
+      </li>
+      </ol>
     </section>
     <section> 
       <title>Derby implementation of ARIES</title>
@@ -134,12 +152,18 @@
         8. I haven't seen this sanity check in many years, but was useful when 
         the product was first coded. </p>
       <p>Derby does not write the dirty pages list within a Checkpoint record. 
-        As a result, during checkpoint, Derby must flush all database pages to 
-        disk.</p>
+        Instead, during checkpoint, Derby flushes all database pages to 
+        disk. The redo Low Water Mark (redoLWM) is set to the current LSN when the
+        checkpoint starts. The undo Low Water Mark (undoLWM) is set to the 
+        starting LSN of the oldest active transaction. At restart, Derby replays
+        the log from redoLWM or undoLWM whichever is earlier. For a good description
+        of concepts behind the checkpoint method used by Derby, and the use of redo/undo
Low
+        Water Marks, please refer to TPCT book (Section 11.3).</p>
       <p>Derby uses 'internal' transactions instead of nested top-level actions 
         to separate structural changes from normal operations. Internal transactions 
         have the property that they are always page-oriented and do not require 
-        logical undo. Also, during recovery, incomplete internal transactions 
+        logical undo, ie, undo is always physical. Also, during recovery, incomplete 
+        internal transactions 
         are undone before any regular transactions. In ARIES, no special processing 
         is required to handle this, as nested top-level actions are automatically 
         handled as part of normal redo, and are skipped during undo unless they 
@@ -290,6 +314,104 @@
 	 then it will create a 4th period of interest.      
        </p>
     </section>
+    <section>
+		<title>Derby Logging Overview</title>
+		<p>A loggable action in Derby is redoable. If the action implements Undoable interface,
then it is also
+	    undoable. When an undoable action is rolled back, it must generate a Compensation log
which represents 
+	    the action necessary to repeat the undo.
+		</p>
+		<p>Normally a logged action is rolled back on the same page that it was originally
applied to. This is
+		called physical or physiological undo. If the undo needs to be applied to a different page
(such as due to
+		a page split in a BTree), then it is called
+    	a Logical Undo. In Derby, BTree inserts and deletes require logical undo.</p>
+    	<p>When performing a loggable action, Derby follows this sequence:</p>
+    	<ol>
+    		<li>Convert the action into a corresponding log operation. Most BTree and Heap
operations are
+   		    translated to Page level actions - ie - the action involves updating one or more
pages. For example,
+   		    a single Heap row insert may be translated to inserts on several pages. Each page
insert
+   		    will be a separate loggable action.</li>
+    		<li>Generate the log data that describes the page level action.</li>
+    		<li>Perform the action <em>after</em> it has been logged. Also, the
action is 
+    		performed using the logged data, in the same way as it would be performed during recovery.
+    		In other words, the logged data is used both for normal operations as well as for repeating
+    		history. This has the advantage that the recovery execution path is the same as the
execution
+    		path during normal execution.</li>    		  
+    		<li>If a transaction is being rolled back, first the loggable action is asked
to generate
+    		the corresponding undo (Compensation) log data. This is then logged, and after that
it is performed.
+    		As described before, a Compensation action is only redoable, because by definition,
an undo
+    		action does not need to be undone.
+    		</li>
+    	</ol>
+    </section>
+    <section>
+		<title>Loggable Interface Hierarchy</title>
+		<fixme author="DM">Following links are broken.</fixme>
+		<ul>
+			<li>interface org.apache.derby.iapi.store.raw.<a href="../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw"><strong>Loggable</strong></a>
+				<ul>
+					<li>interface org.apache.derby.iapi.store.raw.<a href="../../../../../../org/apache/derby/iapi/store/raw/Compensation.html"
title="interface in org.apache.derby.iapi.store.raw"><strong>Compensation</strong></a></li>
+					<li>interface org.apache.derby.iapi.store.raw.<a href="../../../../../../org/apache/derby/iapi/store/raw/Undoable.html"
title="interface in org.apache.derby.iapi.store.raw"><strong>Undoable</strong></a>
+						<ul>
+							<li>interface org.apache.derby.iapi.store.raw.<a href="../../../../../../org/apache/derby/iapi/store/raw/LogicalUndoable.html"
title="interface in org.apache.derby.iapi.store.raw"><strong>LogicalUndoable</strong></a></li>
+						</ul>
+					</li>
+				</ul>
+			</li>
+		</ul>
+    </section>
+    <section>
+		<title>Container Log Operations Hierarchy</title>
+		<fixme author="DM">Following links are broken.</fixme>
+		<ul>
+			<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/ContainerBasicOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>ContainerBasicOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw">Loggable</a>)
+				<ul>
+					<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/ContainerOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>ContainerOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Undoable.html"
title="interface in org.apache.derby.iapi.store.raw">Undoable</a>)</li>
+					<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/ContainerUndoOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>ContainerUndoOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Compensation.html"
title="interface in org.apache.derby.iapi.store.raw">Compensation</a>)</li>
+				</ul>
+			</li>
+			<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/RemoveFileOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>RemoveFileOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Undoable.html"
title="interface in org.apache.derby.iapi.store.raw">Undoable</a>)</li>
+		</ul>
+    </section>
+    <section>
+		<title>Transaction Management Log Operations Hierarchy</title>
+		<fixme author="DM">Following links are broken.</fixme>
+		<ul>
+			<li>class org.apache.derby.impl.store.raw.xact.<a href="../../../../../../../org/apache/derby/impl/store/raw/xact/BeginXact.html"
title="class in org.apache.derby.impl.store.raw.xact"><strong>BeginXact</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw">Loggable</a>)</li>
+			<li>class org.apache.derby.impl.store.raw.xact.<a href="../../../../../../../org/apache/derby/impl/store/raw/xact/EndXact.html"
title="class in org.apache.derby.impl.store.raw.xact"><strong>EndXact</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw">Loggable</a>)</li>
+			<li>class org.apache.derby.impl.store.raw.log.<a href="../../../../../../../org/apache/derby/impl/store/raw/log/CheckpointOperation.html"
title="class in org.apache.derby.impl.store.raw.log"><strong>CheckpointOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw">Loggable</a>)</li>
+		</ul>
+    </section>
+    <section>
+		<title>Page Level Log Operations Hierarchy</title>
+		<fixme author="DM">Following links are broken.</fixme>
+		<ul>
+			<li>class org.apache.derby.impl.store.raw.data.<a href="/org/apache/derby/impl/store/raw/data/PageBasicOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>PageBasicOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Loggable.html"
title="interface in org.apache.derby.iapi.store.raw">Loggable</a>, org.apache.derby.iapi.store.raw.<a
href="/org/apache/derby/iapi/store/raw/RePreparable.html" title="interface in org.apache.derby.iapi.store.raw">RePreparable</a>)
+				<ul>
+					<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/LogicalPageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>LogicalPageOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/LogicalUndoable.html"
title="interface in org.apache.derby.iapi.store.raw">LogicalUndoable</a>)
+					<ul>
+						<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/DeleteOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>DeleteOperation</strong></a></li>
+						<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/InsertOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>InsertOperation</strong></a></li>
+						<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/UpdateFieldOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>UpdateFieldOperation</strong></a></li>
+					</ul>
+					</li>
+					<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/LogicalUndoOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>LogicalUndoOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Compensation.html"
title="interface in org.apache.derby.iapi.store.raw">Compensation</a>)</li>
+					<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/PhysicalPageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>PhysicalPageOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Undoable.html"
title="interface in org.apache.derby.iapi.store.raw">Undoable</a>)
+						<ul>
+							<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/AllocPageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>AllocPageOperation</strong></a></li>
+							<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/ChainAllocPageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>ChainAllocPageOperation</strong></a></li>
+							<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/CopyRowsOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>CopyRowsOperation</strong></a></li>
+							<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/InitPageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>InitPageOperation</strong></a></li>
+							<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/InvalidatePageOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>InvalidatePageOperation</strong></a></li>
+							<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/PurgeOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>PurgeOperation</strong></a></li>
+							<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/UpdateOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>UpdateOperation</strong></a></li>
+						</ul>
+					</li>
+					<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/PhysicalUndoOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>PhysicalUndoOperation</strong></a>
(implements org.apache.derby.iapi.store.raw.<a href="../../../../../../../org/apache/derby/iapi/store/raw/Compensation.html"
title="interface in org.apache.derby.iapi.store.raw">Compensation</a>)</li>
+					<li>class org.apache.derby.impl.store.raw.data.<a href="../../../../../../../org/apache/derby/impl/store/raw/data/SetReservedSpaceOperation.html"
title="class in org.apache.derby.impl.store.raw.data"><strong>SetReservedSpaceOperation</strong></a></li>
+				</ul>
+			</li>
+		</ul> 
+		</section>
     </body>
     <footer> 
       <legal></legal>



Mime
View raw message