You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sa...@apache.org on 2012/04/08 20:16:29 UTC
svn commit: r1311064 - in /directory/apacheds/branches/apacheds-txns:
core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/
core-api/src/test/java/org/apache/directory/server/core/api/
core-integ/src/test/java/org/apache/dire...
Author: saya
Date: Sun Apr 8 18:16:28 2012
New Revision: 1311064
URL: http://svn.apache.org/viewvc?rev=1311064&view=rev
Log:
Compeleted the tests and changes for txn conflict handling
Modified:
directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractChangeOperationContext.java
directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AddOperationContext.java
directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/BindOperationContext.java
directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/DeleteOperationContext.java
directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ModifyOperationContext.java
directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/MoveOperationContext.java
directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/RenameOperationContext.java
directory/apacheds/branches/apacheds-txns/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnConflictIT.java
directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
directory/apacheds/branches/apacheds-txns/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractChangeOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractChangeOperationContext.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractChangeOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractChangeOperationContext.java Sun Apr 8 18:16:28 2012
@@ -61,9 +61,9 @@ public abstract class AbstractChangeOper
/**
* {@inheritDoc}
*/
- public void reset()
+ public void resetContext()
{
- super.reset();
+ super.resetContext();
modifiedEntry = null;
logChange = LogChange.FALSE;
changeLogEvent = null;
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java Sun Apr 8 18:16:28 2012
@@ -55,6 +55,9 @@ public abstract class AbstractOperationC
/** The associated request's controls */
protected Map<String, Control> requestControls = new HashMap<String, Control>(4);
+
+ /** Original request controls used in case of a reset */
+ protected Map<String, Control> originalRequestControls = new HashMap<String, Control>(4);
/** The associated response's controls */
protected Map<String, Control> responseControls = new HashMap<String, Control>(4);
@@ -89,15 +92,6 @@ public abstract class AbstractOperationC
this.session = session;
currentInterceptor = 0;
}
-
-
- /**
- * {@inheritDoc}
- */
- public void reset()
- {
- currentInterceptor = 0;
- }
/**
@@ -114,6 +108,32 @@ public abstract class AbstractOperationC
// the entries, even if they are referrals.
ignoreReferral();
}
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void saveOriginalContext()
+ {
+ originalRequestControls.putAll( requestControls );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void resetContext()
+ {
+ currentInterceptor = 0;
+ originalEntry = null;
+ authorizedPrincipal = null;
+ next = null;
+ previous = null;
+ entry = null;
+ responseControls.clear();
+ requestControls = originalRequestControls;
+ originalRequestControls = new HashMap<String, Control>(4);
+ }
/**
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AddOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AddOperationContext.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AddOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AddOperationContext.java Sun Apr 8 18:16:28 2012
@@ -42,6 +42,9 @@ import org.apache.directory.shared.ldap.
*/
public class AddOperationContext extends AbstractChangeOperationContext
{
+ /** Original version of the entry to be added */
+ private Entry originalAddedEntry;
+
/**
* Creates a new instance of AddOperationContext.
*
@@ -141,6 +144,38 @@ public class AddOperationContext extends
throwReferral();
}
}
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void saveOriginalContext()
+ {
+ super.saveOriginalContext();
+
+ if ( entry instanceof ClonedServerEntry )
+ {
+ originalAddedEntry = (( ClonedServerEntry )entry).getOriginalEntry();
+ }
+ else
+ {
+ originalAddedEntry = entry;
+ entry = new ClonedServerEntry( session.getDirectoryService().getSchemaManager(),
+ originalAddedEntry);
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void resetContext()
+ {
+ super.resetContext();
+
+ entry = new ClonedServerEntry( session.getDirectoryService().getSchemaManager(),
+ originalAddedEntry);
+ }
/**
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/BindOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/BindOperationContext.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/BindOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/BindOperationContext.java Sun Apr 8 18:16:28 2012
@@ -26,6 +26,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.api.ReferralHandlingMode;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.model.entry.Modification;
import org.apache.directory.shared.ldap.model.exception.LdapAuthenticationException;
import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
import org.apache.directory.shared.util.Strings;
@@ -47,6 +48,9 @@ public class BindOperationContext extend
/** The password */
private byte[] credentials;
+
+ /** Original credentials */
+ private byte[] originalCredentials;
/** The SASL mechanism */
private String saslMechanism;
@@ -121,6 +125,27 @@ public class BindOperationContext extend
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void saveOriginalContext()
+ {
+ super.saveOriginalContext();
+
+ originalCredentials = credentials;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void resetContext()
+ {
+ super.resetContext();
+
+ credentials = originalCredentials;
+ }
/**
* @return the SASL mechanisms
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/DeleteOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/DeleteOperationContext.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/DeleteOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/DeleteOperationContext.java Sun Apr 8 18:16:28 2012
@@ -90,6 +90,16 @@ public class DeleteOperationContext exte
/**
+ * {@inheritDoc}
+ */
+ public void resetContext()
+ {
+ super.resetContext();
+ entry = null;
+ }
+
+
+ /**
* @return the operation name
*/
public String getName()
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ModifyOperationContext.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ModifyOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ModifyOperationContext.java Sun Apr 8 18:16:28 2012
@@ -51,6 +51,9 @@ public class ModifyOperationContext exte
{
/** The modification items */
private List<Modification> modItems;
+
+ /** Orignal list of modification items */
+ private List<Modification> originalModItems = new ArrayList<Modification>();
/** The entry after being renamed and altered for rdn attributes */
private Entry alteredEntry;
@@ -68,16 +71,6 @@ public class ModifyOperationContext exte
setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.MODIFY ) );
}
}
-
-
- /**
- * {@inheritDoc}
- */
- public void reset()
- {
- super.reset();
- alteredEntry = null;
- }
/**
@@ -123,6 +116,33 @@ public class ModifyOperationContext exte
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void saveOriginalContext()
+ {
+ super.saveOriginalContext();
+
+ for ( Modification mod : getModItems() )
+ {
+ originalModItems.add( mod.clone() );
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void resetContext()
+ {
+ super.resetContext();
+ alteredEntry = null;
+ modItems.clear();
+ modItems.addAll( originalModItems );
+ originalModItems.clear();
+ }
+
/**
* Set the modified attributes
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/MoveOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/MoveOperationContext.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/MoveOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/MoveOperationContext.java Sun Apr 8 18:16:28 2012
@@ -135,7 +135,7 @@ public class MoveOperationContext extend
throw new IllegalArgumentException( lide.getMessage(), lide );
}
}
-
+
/**
* @return The oldSuperior Dn
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java Sun Apr 8 18:16:28 2012
@@ -41,10 +41,18 @@ import org.apache.directory.shared.ldap.
public interface OperationContext
{
/**
+ * Called Before the operation enters the interceptor chain to save information
+ * that might be modified by the interceptor chain. What is save might later on
+ * used by resetContext
+ */
+ void saveOriginalContext();
+
+
+ /**
* Called when operation is to be re-executed.Operation context willr reset its state
* related to the execution of the operation
*/
- void reset();
+ void resetContext();
/**
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/RenameOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/RenameOperationContext.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/RenameOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/RenameOperationContext.java Sun Apr 8 18:16:28 2012
@@ -22,6 +22,7 @@ package org.apache.directory.server.core
import org.apache.directory.server.core.api.CoreSession;
import org.apache.directory.server.core.api.OperationEnum;
+import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
@@ -110,8 +111,8 @@ public class RenameOperationContext exte
throwReferral();
}
}
-
-
+
+
/**
* @return The delete old Rdn flag
*/
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java Sun Apr 8 18:16:28 2012
@@ -50,7 +50,13 @@ public class MockOperation implements Op
}
- public void reset()
+ public void saveOriginalContext()
+ {
+
+ }
+
+
+ public void resetContext()
{
}
Modified: directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnConflictIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnConflictIT.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnConflictIT.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnConflictIT.java Sun Apr 8 18:16:28 2012
@@ -3,12 +3,14 @@ package org.apache.directory.server.core
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
+import javax.naming.NameNotFoundException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
import javax.naming.ldap.LdapContext;
+import org.apache.directory.ldap.client.api.LdapConnection;
import org.apache.directory.server.core.annotations.ApplyLdifs;
import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
@@ -17,12 +19,17 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.directory.server.core.integ.IntegrationUtils;
+import org.apache.directory.shared.ldap.model.name.Dn;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.exception.LdapException;
+
@RunWith ( FrameworkRunner.class )
@CreateDS(name = "TxnConflictIT")
@@ -42,7 +49,10 @@ public class TxnConflictIT extends Abstr
{
enum ConflictType
{
- MODIFY_MODIFY_CONLICT
+ MODIFY_MODIFY_CONLICT,
+ DELETE_MODIFY_CONFLICT,
+ ADD_ADD_CONFLICT,
+ RENAME_MODIFY_CONFLICT
}
@@ -53,10 +63,10 @@ public class TxnConflictIT extends Abstr
{
ConflictingThread cThread = new ConflictingThread( ConflictType.MODIFY_MODIFY_CONLICT );
- cThread.start();
-
LdapContext sysRoot = getSystemContext( getService() );
+ cThread.start();
+
// The added value
Attributes attrs = new BasicAttributes( "telephoneNumber", "1 650 300 6089", true );
@@ -84,6 +94,118 @@ public class TxnConflictIT extends Abstr
}
+
+ @Test
+ public void testDeleteModifyConflict() throws Exception
+ {
+ try
+ {
+ Dn dn = new Dn("cn=test1, ou=system");
+ ConflictingThread cThread = new ConflictingThread( ConflictType.DELETE_MODIFY_CONFLICT );
+
+ LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
+
+ cThread.start();
+
+ // Delete the entry, this should succeed
+ connection.delete( dn );
+
+ cThread.join();
+
+ Entry entry = connection.lookup( dn );
+ assertTrue( entry == null );
+
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+
+ fail();
+ }
+
+
+ }
+
+
+ @Test
+ public void testAddAddConflict()
+ {
+ try
+ {
+ Dn dn = new Dn( "cn=test2,ou=system" );
+ Entry entry = new DefaultEntry( dn,
+ "ObjectClass: top",
+ "ObjectClass: person",
+ "sn: TEST",
+ "cn: test2" );
+
+ LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
+
+ ConflictingThread cThread = new ConflictingThread( ConflictType.ADD_ADD_CONFLICT );
+
+ cThread.start();
+
+ try
+ {
+ connection.add( entry );
+ }
+ catch ( LdapException e )
+ {
+ //e.printStackTrace();
+ }
+
+ cThread.join();
+
+ // Entry should be there
+ entry = connection.lookup( dn );
+ assertTrue( entry != null );
+
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+
+ @Test
+ public void testRenameModifyConflict()
+ {
+ try
+ {
+ Dn dn = new Dn( "cn=test3,ou=users,ou=system" );
+ Entry entry = new DefaultEntry( dn,
+ "ObjectClass: top",
+ "ObjectClass: person",
+ "sn: TEST",
+ "cn: test3" );
+
+ LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
+
+ connection.add( entry );
+
+ ConflictingThread cThread = new ConflictingThread( ConflictType.RENAME_MODIFY_CONFLICT );
+
+ cThread.start();
+
+ connection.rename( "ou=users,ou=system", "ou=people" );
+
+ cThread.join();
+
+ // test3 should be there with the new dn
+ entry = connection.lookup( new Dn("cn=test3,ou=people,ou=system") );
+ assertTrue( entry != null );
+
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+
class ConflictingThread extends Thread
{
ConflictType type;
@@ -93,6 +215,7 @@ public class TxnConflictIT extends Abstr
this.type = type;
}
+
private void doConflictingModify() throws Exception
{
LdapContext sysRoot = getSystemContext( getService() );
@@ -104,14 +227,79 @@ public class TxnConflictIT extends Abstr
sysRoot.modifyAttributes( "cn=test1", DirContext.ADD_ATTRIBUTE, attrs );
}
+
+ private void doConflictingAdd() throws Exception
+ {
+ Dn dn = new Dn( "cn=test2,ou=system" );
+ Entry entry = new DefaultEntry( dn,
+ "ObjectClass: top",
+ "ObjectClass: person",
+ "sn: TES2",
+ "cn: test2" );
+
+ LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
+
+ connection.add( entry );
+ }
+
+
+ private void doModifyConfclictingWithRename() throws Exception
+ {
+ LdapContext sysRoot = getSystemContext( getService() );
+
+ // The added value
+ Attributes attrs = new BasicAttributes( "telephoneNumber", "1 650 300 6088", true );
+
+ // Add the Ava
+ sysRoot.modifyAttributes( "cn=test3,ou=users", DirContext.ADD_ATTRIBUTE, attrs );
+ }
+
+
public void run()
{
- System.out.println("here1");
try
{
if (type == ConflictType.MODIFY_MODIFY_CONLICT )
{
- this.doConflictingModify();
+ doConflictingModify();
+ }
+ else if ( type == ConflictType.DELETE_MODIFY_CONFLICT )
+ {
+ try
+ {
+ doConflictingModify();
+ }
+ catch ( NameNotFoundException e )
+ {
+ // Entry might have been already deleted,
+ // hence this is OK.
+ //e.printStackTrace();
+ }
+ }
+ else if ( type == ConflictType.ADD_ADD_CONFLICT )
+ {
+ try
+ {
+ doConflictingAdd();
+ }
+ catch ( LdapException e )
+ {
+ //Entry with the same dn might have been alrady added
+ // so this is ok.
+ //e.printStackTrace();
+ }
+ }
+ else if ( type == ConflictType.RENAME_MODIFY_CONFLICT )
+ {
+ try
+ {
+ doModifyConfclictingWithRename();
+ }
+ catch ( NameNotFoundException e )
+ {
+ // Entry might have been moved.
+ //e.printStackTrace();
+ }
}
}
catch( Exception e )
@@ -122,7 +310,5 @@ public class TxnConflictIT extends Abstr
}
}
}
-
-
}
Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Sun Apr 8 18:16:28 2012
@@ -1261,6 +1261,10 @@ public class DefaultDirectoryService imp
}
}
}
+ catch ( LdapException e )
+ {
+ //e.printStackTrace();
+ }
catch ( Exception e )
{
throw e;
Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java Sun Apr 8 18:16:28 2012
@@ -427,6 +427,7 @@ public class DefaultOperationManager imp
{
if ( startedTxn )
{
+ addContext.resetContext();
retryTransactionRW( txnManager );
}
else if ( curTxn == null )
@@ -435,6 +436,8 @@ public class DefaultOperationManager imp
startedTxn = true;
}
+ addContext.saveOriginalContext();
+
try
{
head.add( addContext );
@@ -487,12 +490,23 @@ public class DefaultOperationManager imp
Interceptor head = directoryService.getInterceptor( bindContext.getNextInterceptor() );
boolean done = false;
+ boolean startedTxn = false;
TxnManager txnManager = directoryService.getTxnManager();
do
{
+ if ( startedTxn )
+ {
+ bindContext.resetContext();
+ retryTransactionRW( txnManager );
+ }
+
beginTransactionRW( txnManager );
-
+ startedTxn = true;
+
+
+ bindContext.saveOriginalContext();
+
try
{
head.bind( bindContext );
@@ -721,6 +735,7 @@ public class DefaultOperationManager imp
{
if ( startedTxn )
{
+ deleteContext.resetContext();
retryTransactionRW( txnManager );
}
else if ( curTxn == null )
@@ -729,6 +744,8 @@ public class DefaultOperationManager imp
startedTxn = true;
}
+ deleteContext.saveOriginalContext();
+
try
{
// populate the context with the old entry
@@ -998,7 +1015,7 @@ public class DefaultOperationManager imp
{
if ( startedTxn )
{
- modifyContext.reset();
+ modifyContext.resetContext();
retryTransactionRW( txnManager );
}
else if ( curTxn == null )
@@ -1007,6 +1024,8 @@ public class DefaultOperationManager imp
startedTxn = true;
}
+ modifyContext.saveOriginalContext();
+
try
{
// populate the context with the old entry
@@ -1144,6 +1163,7 @@ public class DefaultOperationManager imp
{
if ( startedTxn )
{
+ moveContext.resetContext();
retryTransactionRW( txnManager );
}
else if ( curTxn == null )
@@ -1152,6 +1172,8 @@ public class DefaultOperationManager imp
startedTxn = true;
}
+ moveContext.saveOriginalContext();
+
try
{
Entry originalEntry = getOriginalEntry( moveContext );
@@ -1292,6 +1314,7 @@ public class DefaultOperationManager imp
{
if ( startedTxn )
{
+ moveAndRenameContext.resetContext();
retryTransactionRW( txnManager );
}
else if ( curTxn == null )
@@ -1300,6 +1323,8 @@ public class DefaultOperationManager imp
startedTxn = true;
}
+ moveAndRenameContext.saveOriginalContext();
+
try
{
moveAndRenameContext.setOriginalEntry( getOriginalEntry( moveAndRenameContext ) );
@@ -1427,6 +1452,7 @@ public class DefaultOperationManager imp
{
if ( startedTxn )
{
+ renameContext.resetContext();
retryTransactionRW( txnManager );
}
else if ( curTxn == null )
@@ -1435,6 +1461,8 @@ public class DefaultOperationManager imp
startedTxn = true;
}
+ renameContext.saveOriginalContext();
+
try
{
// Call the rename method
Modified: directory/apacheds/branches/apacheds-txns/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=1311064&r1=1311063&r2=1311064&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Sun Apr 8 18:16:28 2012
@@ -221,7 +221,7 @@ public class ChangeLogInterceptor extend
// Call the next interceptor
next( modifyContext );
- // If op doesnt want to be logged, skipped
+ // If op doesnt want to be logged, skip
if ( !modifyContext.isLogChange() )
{
return;