From commits-return-33831-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Thu Mar 15 16:24:24 2012 Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6BBF691A2 for ; Thu, 15 Mar 2012 16:24:24 +0000 (UTC) Received: (qmail 15213 invoked by uid 500); 15 Mar 2012 16:24:24 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 15174 invoked by uid 500); 15 Mar 2012 16:24:24 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 15167 invoked by uid 99); 15 Mar 2012 16:24:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2012 16:24:24 +0000 X-ASF-Spam-Status: No, hits=-1994.3 required=5.0 tests=ALL_TRUSTED,HTML_FONT_LOW_CONTRAST,HTML_MESSAGE,MIME_HTML_ONLY X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2012 16:24:21 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id q2FGO0WO001360 for ; Thu, 15 Mar 2012 16:24:00 GMT Date: Thu, 15 Mar 2012 12:24:00 -0400 (EDT) From: confluence@apache.org To: commits@directory.apache.org Message-ID: <23683335.50744.1331828640022.JavaMail.confluence@thor> Subject: [CONF] Apache Directory SandBox > TxnLogManager class MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Auto-Submitted: auto-generated X-Virus-Checked: Checked by ClamAV on apache.org

TxnLogManager class

Page edited by Emmanuel L=C3=A9charny


Changes (6)

=20 =20
=20 =20
This class is used to log th= e transactions in a file, the *WAL* (Write Ahead Log). We store LogEdit ins= tances, serialized into UserLogRecord. Here is the hierarchy for LogEdit : =
This class is used to manage the transaction, and to log them in a fi= le, the *WAL* (Write Ahead Log).

h2. add methods
We use two methods, _addRead_ and _addWrite_, to = store the set of *DN*s which will be affected by a read or a write, assumin= g we are inside a pending transaction.

It's just a matter of storing the couple of <Dn, scope> int= o the current transaction.

h2. merge methods

The merge me= thods (_mergeExistence_, _mergeForwardLookup_, _mergeReversLookup_ and _mer= geUpdates_) are just proxies on top of Transaction merge methods

h= 2. wrap methods
The wrap methods construct wrappers around the target o= bjects (_Index_, _IndexCursor_ and _MasterTable_).

h2. log methods=

We store LogEdit instances, serialized into UserLogRecord. Here i= s the hierarchy for LogEdit :

!LogEdit.png|border=3D1!
=
...
!UserLogRecord.png|border=3D1= !

Note that a _UserLogRecord_ always has a type, a data length, a buffe= r length and an _LogAnchor_ encapsulating the stored data.

All those structure will = be serialized using with the minimal s= ize, so we use Externizable classes and we use readExternal() and writeExte= rnal() directly, to save some bytes and time (this serialization is done in= a locked section).

Full Content

This class is used to manage the transaction, and to log them in= a file, the WAL (Write Ahead Log).

add methods

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.

It's just a matter of storing the couple of <Dn, scope> into the c= urrent transaction.

merge methods

The merge methods (mergeExistence, mergeForwardLookup,= mergeReversLookup and mergeUpdates) are just proxies on = top of Transaction merge methods

wrap methods

The wrap methods construct wrappers around the target objects (Index= , IndexCursor and MasterTable).

log methods

We store LogEdit instances, serialized into UserLogRecord. Here is the h= ierarchy for LogEdit :

When an operation is executed (a modification, we don't log anything for= searches), we will store two or three records :

    =09
  • a TXN_BEGIN record, to mark the beginning of a transaction
  • =09
  • an optional DataChangeContainer, which will contain all the modified= index and entries
  • =09
  • a TXN_COMMIT or TXN_ABORT, depending on the success or failure of th= e operation.

Those elements will be serialized into a UserLogRecord, following these = structures (the UserLogRecord will contains either a TxnStateChange or a Da= taChangeContainer) :

Note that a UserLogRecord always has a type, a data length, a b= uffer length and an LogAnchor encapsulating the stored data.

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 secti= on).