directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <>
Subject Re: svn commit: r1300690 - in /directory/apacheds/branches/apacheds-txns: core-api/src/main/java/org/apache/directory/server/core/api/log/ core-api/src/main/java/org/apache/directory/server/core/api/txn/ core-api/src/main/java/org/apache/directory/se
Date Wed, 14 Mar 2012 23:51:57 GMT
Some more clarifications about the changes :

when we write a LogEdit, we have two cases :
1) we write a ChangeDataContainer
2) we write a Transaction state

In the first case, we serialize the data in the log( LogEdit, sync) 
method using the current transaction logRecord, then we call the log( 
UserLogRecord, sync) method which will write the record in the WAL. In 
the second case, we simply call the log( UserLogRecord, sync) without 
having to grab the current transaction, as we already are dealing with a 
transaction. The places where this is done are :

I created a LogEdit.injectData( userLogRecord, type ) to have one single 
place to manage the serialization of a LogEdit instance 
(ChangeDataContainer ot TxnStateChange) instead of 4, and to be able to 
add some log.debug() in one single place instead of 4. This does not 
change the logic of this part of the code.

Regarding the added type, as I explained in another mail, I did that to 
be sure we can handle cases where we wil have something not expected 
like a sequence of TXN_BEGIN/TXN_COMMIT without any DATA_CONTAINER. Here 
is an exemple of the trace I get with a simple Add request :

Serializing : TxnStateChange[-9223372036854775808/TXN_BEGIN]
Serializing : TxnStateChange[-9223372036854775804/TXN_COMMIT]

Serializing : TxnStateChange[-9223372036854775808/TXN_BEGIN]
Serializing : DataChangeContainer(ou=system, 
866e5898-6aaa-4e84-96f2-c423bb6ef8b2, -9223372036854775808)
     IndexChange '': <ADD, 
ParentIdAndRdn<96512910-d92d-49c4-ac8a-20d28c4ff57c, 'cn=test'>>
     IndexChange '': <ADD, 866e5898-6aaa-4e84-96f2-c423bb6ef8b2, 
     IndexChange '': <ADD, 866e5898-6aaa-4e84-96f2-c423bb6ef8b2, top>
     IndexChange '': <ADD, 
866e5898-6aaa-4e84-96f2-c423bb6ef8b2, 96512910-d92d-49c4-ac8a-20d28c4ff57c>
     IndexChange '': <ADD, 
866e5898-6aaa-4e84-96f2-c423bb6ef8b2, 866e5898-6aaa-4e84-96f2-c423bb6ef8b2>
     IndexChange '': <ADD, 
     IndexChange '': <ADD, 
866e5898-6aaa-4e84-96f2-c423bb6ef8b2, 866e5898-6aaa-4e84-96f2-c423bb6ef8b2>
     EntryAddDelete : ADD
     dn[n]: cn=test,ou=system
     objectclass: person
     objectclass: top
     cn: test
     sn: TEST
     entryParentId: 96512910-d92d-49c4-ac8a-20d28c4ff57c
     entryUUID: 866e5898-6aaa-4e84-96f2-c423bb6ef8b2
     createTimestamp: 20120314234251Z
     creatorsName: 0.9.2342.19200300.100.1.1=admin,
     entryCSN: 20120314234251.077000Z#000000#000#000000

Serializing : TxnStateChange[-9223372036854775802/TXN_COMMIT]

I slightly modified some of the read/writeExternal methods too, 
especially the one that serailize the index. Call it premature 
optimization... At least, those changes are local to those methods.

Hope it helps to understand the changes

Emmanuel L├ęcharny

View raw message