directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Directory SandBox > TxnLogManager class
Date Thu, 15 Mar 2012 16:24:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/5/_/styles/combined.css?spaceKey=DIRxSBOX&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/DIRxSBOX/TxnLogManager+class">TxnLogManager
class</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~elecharny">Emmanuel
L├ęcharny</a>
    </h4>
        <br/>
                         <h4>Changes (6)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">This
class is used to log the transactions in a file, the *WAL* (Write Ahead Log). We store LogEdit
instances, serialized into UserLogRecord. Here is the hierarchy for LogEdit : <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">This
class is used to manage the transaction, and to log them in a file, the *WAL* (Write Ahead
Log).  <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h2.
add methods <br>We use two methods, _addRead_ and _addWrite_, to store the set of *DN*s
which will be affected by a read or a write, assuming we are inside a pending transaction.
 <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">It&#39;s
just a matter of storing the couple of &lt;Dn, scope&gt; into the current transaction.
<br> <br>h2. merge methods <br> <br>The merge methods (_mergeExistence_,
_mergeForwardLookup_, _mergeReversLookup_ and _mergeUpdates_) are just proxies on top of Transaction
merge methods <br> <br>h2. wrap methods <br>The wrap methods construct wrappers
around the target objects (_Index_, _IndexCursor_ and _MasterTable_). <br> <br>h2.
log methods <br> <br>We store LogEdit instances, serialized into UserLogRecord.
Here is the hierarchy for LogEdit : <br> <br></td></tr>
            <tr><td class="diff-unchanged" >!LogEdit.png|border=1! <br>
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >!UserLogRecord.png|border=1! <br>
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Note
that a _UserLogRecord_ always has a type, a data length, a buffer length and an _LogAnchor_
encapsulating the stored data. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >All those structure will be serialized
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">using</span>
<span class="diff-added-words"style="background-color: #dfd;">with</span> the
minimal size, so we use Externizable classes and we use readExternal() and writeExternal()
directly, to save some bytes and time (this serialization is done in a locked section). <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>This class is used to manage the transaction, and to log them in a file,
the <b>WAL</b> (Write Ahead Log). </p>

<h2><a name="TxnLogManagerclass-addmethods"></a>add methods</h2>
<p>We use two methods, <em>addRead</em> and <em>addWrite</em>,
to store the set of *DN*s which will be affected by a read or a write, assuming we are inside
a pending transaction. </p>

<p>It's just a matter of storing the couple of &lt;Dn, scope&gt; into the current
transaction.</p>

<h2><a name="TxnLogManagerclass-mergemethods"></a>merge methods</h2>

<p>The merge methods (<em>mergeExistence</em>, <em>mergeForwardLookup</em>,
<em>mergeReversLookup</em> and <em>mergeUpdates</em>) are just proxies
on top of Transaction merge methods</p>

<h2><a name="TxnLogManagerclass-wrapmethods"></a>wrap methods</h2>
<p>The wrap methods construct wrappers around the target objects (<em>Index</em>,
<em>IndexCursor</em> and <em>MasterTable</em>).</p>

<h2><a name="TxnLogManagerclass-logmethods"></a>log methods</h2>

<p>We store LogEdit instances, serialized into UserLogRecord. Here is the hierarchy
for LogEdit :</p>

<p><span class="image-wrap" style=""><img src="/confluence/download/attachments/27841171/LogEdit.png?version=1&amp;modificationDate=1331826367000"
style="border: 1px solid black" /></span></p>


<p>When an operation is executed (a modification, we don't log anything for searches),
we will store two or three records :</p>
<ul class="alternate" type="square">
	<li>a TXN_BEGIN record, to mark the beginning of a transaction</li>
	<li>an optional DataChangeContainer, which will contain all the modified index and
entries</li>
	<li>a TXN_COMMIT or TXN_ABORT, depending on the success or failure of the operation.</li>
</ul>


<p>Those elements will be serialized into a UserLogRecord, following these structures
(the UserLogRecord will contains either a TxnStateChange or a DataChangeContainer) :</p>


<p><span class="image-wrap" style=""><img src="/confluence/download/attachments/27841171/UserLogRecord.png?version=3&amp;modificationDate=1331828524252"
style="border: 1px solid black" /></span></p>

<p>Note that a <em>UserLogRecord</em> always has a type, a data length,
a buffer length and an <em>LogAnchor</em> encapsulating the stored data.</p>

<p>All those structure will be serialized with the minimal size, so we use Externizable
classes and we use readExternal() and writeExternal() directly, to save some bytes and time
(this serialization is done in a locked section).</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/DIRxSBOX/TxnLogManager+class">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=27841171&revisedVersion=4&originalVersion=3">View
Changes</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message