Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 35807 invoked from network); 2 Mar 2009 19:07:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Mar 2009 19:07:52 -0000 Received: (qmail 27624 invoked by uid 500); 2 Mar 2009 19:07:51 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 27590 invoked by uid 500); 2 Mar 2009 19:07:51 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 27581 invoked by uid 99); 2 Mar 2009 19:07:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Mar 2009 11:07:51 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of akarasulu@gmail.com designates 74.125.46.29 as permitted sender) Received: from [74.125.46.29] (HELO yw-out-2324.google.com) (74.125.46.29) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Mar 2009 19:07:44 +0000 Received: by yw-out-2324.google.com with SMTP id 5so1585107ywh.55 for ; Mon, 02 Mar 2009 11:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=s6ICfjXLgVxZryPREeM4PW+Iu5zgRwFiqE4E7TNZmMc=; b=Fxt4ZetIaIRTspX1anOjQiZ/wztNyR3nFWPYzRWqVbFtEMWiVbcLGlEffipANqAUxd 45zcTaI5oBpNwsobVHGrB6Iw2KSy3isCuOtBa9sRpIZ6dgbu/il7YMTmX65EJ/tYwUDo 9eR0bMwDq+tPqAJ/5IoAxdl4Knn3/aepG878k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=cmJZxEbv01FCRlRGGT3BdGRANJIM7K8IiwKaqOIK3GsjUbYnV0zfPN9gO/CCxEfS02 WMriBy2oz0ufJKyb8Z+Ajb1AeHcqVCiK41oS8DYjYNIbkUEnPaLMdT8ZkVilacKYE1H3 35CKq0G9R6Sp7OrNh9HaYb+7WpqQouPvqoPD0= MIME-Version: 1.0 Received: by 10.150.149.19 with SMTP id w19mr10891472ybd.159.1236020840763; Mon, 02 Mar 2009 11:07:20 -0800 (PST) In-Reply-To: <49A9C767.5030101@nextury.com> References: <49A9C767.5030101@nextury.com> Date: Mon, 2 Mar 2009 14:07:20 -0500 Message-ID: Subject: Re: Journal first draft From: Alex Karasulu To: Apache Directory Developers List Content-Type: multipart/alternative; boundary=000e0cd487ba2611160464278740 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd487ba2611160464278740 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi Emm, On Sat, Feb 28, 2009 at 6:23 PM, Emmanuel Lecharny wrote: > Hi guys, > > I'm currently working on a very preliminary implementation of the journal. > It is an interceptor added at the very end of the chain, just before the > partition. the way it works is very simple : > - it logs the LDIF for every modification in the journal, plus some extra > informations (Ldapprincipal, a timestamp and a revision number). This is > done before calling the partition Add method > - when the entry has been added into the partition, an ACK is logged into > the journal, as a comment, containing the revision of the ACKed operation. > - if the addition failed, a NACK is logged in the same way > - the written information are immediately flushed on disk, and the write > operation is synchronized in order to avoid a mixup of operations in the > file. > > Here is an exemple of what we get : > > # 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system > # ts: 1235862542574 > # rev: 1235862541942 > dn: 2.5.4.3=kate#bush,2.5.4.11=system > changeType: Add > createtimestamp: 20090228230902Z > sn: Bush > entryuuid:: OWM5MDU5YjYtNmJkNC00ZmQzLTgwODMtMzE4MGJhOGQyMGY0 > cn: Kate#Bush > entrycsn:: MjAwOTAzMDEwMDA5MDIuMDAwNTM0WiMwIzAjMDAwMDAw > objectclass: person > objectclass: top > creatorsname: 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system > > # ack-rev: 1235862541942 > > # 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system > # ts: 1235862542618 > # rev: 1235862541943 > dn: 2.5.4.3=kate#bush,2.5.4.11=system > changeType: Delete > > # ack-rev: 1235862541943 > ... > > The revision number is used to associate a ack/nack to an operation : if > the server crashes in the middle of a partition update, we won't have a > ack/nack for the pending operation. > > As you can see, this is a very basic implementation atm. I didn't dealt > with all the intricacy of journal rotation, journal cleanup, and such. It's > a growing file, and it can grow fast. Some immediate improvement could be to > use more than one file to store the changes, with an executor to deal with > the write, allowing parallel update of the journal (it would be a bit more > complicated to restore the journal, but at least, we would avoid a > contention problem). > > So wdyt about this first version ? What's missing ? > (1) Why not make these comment attribute actual attributes in the LDIF even though they are special? (2) Why is rev not a regular attribute? (3) What exactly is the difference between ACK and NACK and why do we need a NACK? Thanks, Alex --000e0cd487ba2611160464278740 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Emm,

On Sat, Feb 28, 2009 at 6:23 PM, = Emmanuel Lecharny <elecharny@apache.org> wrote:
Hi guys,

I'm currently working on a very preliminary implementation of the journ= al. It is an interceptor added at the very end of the chain, just before th= e partition. the way it works is very simple :
- it logs the LDIF for every modification in the journal, plus some extra i= nformations (Ldapprincipal, a timestamp and a revision number). This is don= e before calling the partition Add method
- when the entry has been added into the partition, an ACK is logged into t= he journal, as a comment, containing the revision of the ACKed operation. - if the addition failed, a NACK is logged in the same way
- the written information are immediately flushed on disk, and the write op= eration is synchronized in order to avoid a mixup of operations in the file= .

Here is an exemple of what we get :

# 0.9.2342.19200300.100.1.1=3Dadmin,2.5.4.11=3Dsystem
# ts: 1235862542574
# rev: 1235862541942
dn: 2.5.4.3=3Dkate#bush,2.5.4.11=3Dsystem
changeType: Add
createtimestamp: 20090228230902Z
sn: Bush
entryuuid:: OWM5MDU5YjYtNmJkNC00ZmQzLTgwODMtMzE4MGJhOGQyMGY0
cn: Kate#Bush
entrycsn:: MjAwOTAzMDEwMDA5MDIuMDAwNTM0WiMwIzAjMDAwMDAw
objectclass: person
objectclass: top
creatorsname: 0.9.2342.19200300.100.1.1=3Dadmin,2.5.4.11=3Dsystem

# ack-rev: 1235862541942

# 0.9.2342.19200300.100.1.1=3Dadmin,2.5.4.11=3Dsystem
# ts: 1235862542618
# rev: 1235862541943
dn: 2.5.4.3=3Dkate#bush,2.5.4.11=3Dsystem
changeType: Delete

# ack-rev: 1235862541943
...

The revision number is used to associate a ack/nack to an operation : if th= e server crashes in the middle of a partition update, we won't have a a= ck/nack for the pending operation.

As you can see, this is a very basic implementation atm. I didn't dealt= with all the intricacy of journal rotation, journal cleanup, and such. It&= #39;s a growing file, and it can grow fast. Some immediate improvement coul= d be to use more than one file to store the changes, with an executor to de= al with the write, allowing parallel update of the journal (it would be a b= it more complicated to restore the journal, but at least, we would avoid a = contention problem).

So wdyt about this first version ? What's missing ?

(1) Why not make these comment attribute actual attr= ibutes in the LDIF even though they are special?

(2) Why is rev not= a regular attribute?

(3) What exactly is the difference between ACK= and NACK and why do we need a NACK?

Thanks,
Alex
--000e0cd487ba2611160464278740--