You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Stefan Seelmann (JIRA)" <ji...@apache.org> on 2009/08/05 16:19:14 UTC

[jira] Created: (DIRSERVER-1393) Modification with multiple items are not considered as atomic operation

Modification with multiple items are not considered as atomic operation
-----------------------------------------------------------------------

                 Key: DIRSERVER-1393
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1393
             Project: Directory ApacheDS
          Issue Type: Bug
          Components: ldap
    Affects Versions: 1.5.4, 1.5.5
            Reporter: Stefan Seelmann
            Priority: Critical


Having the following entry:
---------------------------------------------------------------------
dn: cn=test,ou=Users,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: top
cn: test
sn: test
---------------------------------------------------------------------

When trying to change the "sn" must attribute with following modification sequence fails with error " [15:48:05] ERROR [org.apache.directory.server.core.schema.SchemaInterceptor] - Trying to remove a required attribute: sn".
---------------------------------------------------------------------
dn: cn=test,ou=Users,dc=example,dc=com
changetype: modify
delete: sn
sn: test
-
add: sn
sn: test2
-
---------------------------------------------------------------------

Order of add/delete or delete/add doesn't matter. Using "replace" works.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1393) Modification with multiple items are not considered as atomic operation

Posted by "Stefan Seelmann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741584#action_12741584 ] 

Stefan Seelmann commented on DIRSERVER-1393:
--------------------------------------------

The value to delete exists, so an no_such_value error is not valid. The only problem is the schema violation.

Howerver IMO the schema check should only be done at the end of the modification, when all modification items are applied.

Two similar examples:

1st) I want to add an object class which contains must attributes that don't yet exist in the entry. The modifications can't be done one be one, only all together

--------------------------------------------------------------------- 
dn: cn=test,ou=Users,dc=example,dc=com
changetype: modify
add: objectClass
objectClass: posixAccount
-
add: gidNumber
gidNumber: 1000
-
add: homeDirectory
homeDirectory: /home/test
-
add: uid
uid: test
-
add: uidNumber
uidNumber: 1000
-
--------------------------------------------------------------------- 

2nd) The other way around: I want to delete the posixAccount objectClass, this could only be done by deleting all the attributes in the same modification


--> So my conclusion is that the schema check must be done after all modification items are applied to the entry.

> Modification with multiple items are not considered as atomic operation
> -----------------------------------------------------------------------
>
>                 Key: DIRSERVER-1393
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1393
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.4
>            Reporter: Stefan Seelmann
>            Assignee: Emmanuel Lecharny
>            Priority: Critical
>             Fix For: 1.5.5
>
>
> Having the following entry:
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> objectClass: inetOrgPerson
> objectClass: organizationalPerson
> objectClass: person
> objectClass: top
> cn: test
> sn: test
> ---------------------------------------------------------------------
> When trying to change the "sn" must attribute with following modification sequence fails with error " [15:48:05] ERROR [org.apache.directory.server.core.schema.SchemaInterceptor] - Trying to remove a required attribute: sn".
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> changetype: modify
> delete: sn
> sn: test
> -
> add: sn
> sn: test2
> -
> ---------------------------------------------------------------------
> Order of add/delete or delete/add doesn't matter. Using "replace" works.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1393) Modification with multiple items are not considered as atomic operation

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741577#action_12741577 ] 

Emmanuel Lecharny commented on DIRSERVER-1393:
----------------------------------------------

After having looked at the code, I'm not sure it's a bug.

The first removal will fail because sn is in must. As it's an atomic modification, it must be applied, and will fail because of that.

wdyt ?

> Modification with multiple items are not considered as atomic operation
> -----------------------------------------------------------------------
>
>                 Key: DIRSERVER-1393
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1393
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.4
>            Reporter: Stefan Seelmann
>            Assignee: Emmanuel Lecharny
>            Priority: Critical
>             Fix For: 1.5.5
>
>
> Having the following entry:
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> objectClass: inetOrgPerson
> objectClass: organizationalPerson
> objectClass: person
> objectClass: top
> cn: test
> sn: test
> ---------------------------------------------------------------------
> When trying to change the "sn" must attribute with following modification sequence fails with error " [15:48:05] ERROR [org.apache.directory.server.core.schema.SchemaInterceptor] - Trying to remove a required attribute: sn".
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> changetype: modify
> delete: sn
> sn: test
> -
> add: sn
> sn: test2
> -
> ---------------------------------------------------------------------
> Order of add/delete or delete/add doesn't matter. Using "replace" works.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRSERVER-1393) Modification with multiple items are not considered as atomic operation

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRSERVER-1393:
-----------------------------------------

    Fix Version/s:     (was: 1.5.5)
                   2.0.0-RC1

Too big a modification to be applied on the current revision. Postponed

> Modification with multiple items are not considered as atomic operation
> -----------------------------------------------------------------------
>
>                 Key: DIRSERVER-1393
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1393
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.4
>            Reporter: Stefan Seelmann
>            Assignee: Emmanuel Lecharny
>            Priority: Critical
>             Fix For: 2.0.0-RC1
>
>
> Having the following entry:
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> objectClass: inetOrgPerson
> objectClass: organizationalPerson
> objectClass: person
> objectClass: top
> cn: test
> sn: test
> ---------------------------------------------------------------------
> When trying to change the "sn" must attribute with following modification sequence fails with error " [15:48:05] ERROR [org.apache.directory.server.core.schema.SchemaInterceptor] - Trying to remove a required attribute: sn".
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> changetype: modify
> delete: sn
> sn: test
> -
> add: sn
> sn: test2
> -
> ---------------------------------------------------------------------
> Order of add/delete or delete/add doesn't matter. Using "replace" works.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRSERVER-1393) Modification with multiple items are not considered as atomic operation

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRSERVER-1393:
-----------------------------------------

    Affects Version/s:     (was: 1.5.5)
        Fix Version/s: 1.5.5

> Modification with multiple items are not considered as atomic operation
> -----------------------------------------------------------------------
>
>                 Key: DIRSERVER-1393
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1393
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.4
>            Reporter: Stefan Seelmann
>            Priority: Critical
>             Fix For: 1.5.5
>
>
> Having the following entry:
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> objectClass: inetOrgPerson
> objectClass: organizationalPerson
> objectClass: person
> objectClass: top
> cn: test
> sn: test
> ---------------------------------------------------------------------
> When trying to change the "sn" must attribute with following modification sequence fails with error " [15:48:05] ERROR [org.apache.directory.server.core.schema.SchemaInterceptor] - Trying to remove a required attribute: sn".
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> changetype: modify
> delete: sn
> sn: test
> -
> add: sn
> sn: test2
> -
> ---------------------------------------------------------------------
> Order of add/delete or delete/add doesn't matter. Using "replace" works.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1393) Modification with multiple items are not considered as atomic operation

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741591#action_12741591 ] 

Emmanuel Lecharny commented on DIRSERVER-1393:
----------------------------------------------

You are right, Stefan :

RFC 4511, chap 4.6  : "...While individual
     modifications may violate certain aspects of the directory schema
     (such as the object class definition and Directory Information Tree
     (DIT) content rule), the resulting entry after the entire list of
     modifications is performed MUST conform to the requirements of the
     directory model and controlling schema [RFC4512]...
"

> Modification with multiple items are not considered as atomic operation
> -----------------------------------------------------------------------
>
>                 Key: DIRSERVER-1393
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1393
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.4
>            Reporter: Stefan Seelmann
>            Assignee: Emmanuel Lecharny
>            Priority: Critical
>             Fix For: 1.5.5
>
>
> Having the following entry:
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> objectClass: inetOrgPerson
> objectClass: organizationalPerson
> objectClass: person
> objectClass: top
> cn: test
> sn: test
> ---------------------------------------------------------------------
> When trying to change the "sn" must attribute with following modification sequence fails with error " [15:48:05] ERROR [org.apache.directory.server.core.schema.SchemaInterceptor] - Trying to remove a required attribute: sn".
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> changetype: modify
> delete: sn
> sn: test
> -
> add: sn
> sn: test2
> -
> ---------------------------------------------------------------------
> Order of add/delete or delete/add doesn't matter. Using "replace" works.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DIRSERVER-1393) Modification with multiple items are not considered as atomic operation

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny reassigned DIRSERVER-1393:
--------------------------------------------

    Assignee: Emmanuel Lecharny

> Modification with multiple items are not considered as atomic operation
> -----------------------------------------------------------------------
>
>                 Key: DIRSERVER-1393
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1393
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.4
>            Reporter: Stefan Seelmann
>            Assignee: Emmanuel Lecharny
>            Priority: Critical
>             Fix For: 1.5.5
>
>
> Having the following entry:
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> objectClass: inetOrgPerson
> objectClass: organizationalPerson
> objectClass: person
> objectClass: top
> cn: test
> sn: test
> ---------------------------------------------------------------------
> When trying to change the "sn" must attribute with following modification sequence fails with error " [15:48:05] ERROR [org.apache.directory.server.core.schema.SchemaInterceptor] - Trying to remove a required attribute: sn".
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> changetype: modify
> delete: sn
> sn: test
> -
> add: sn
> sn: test2
> -
> ---------------------------------------------------------------------
> Order of add/delete or delete/add doesn't matter. Using "replace" works.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DIRSERVER-1393) Modification with multiple items are not considered as atomic operation

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny resolved DIRSERVER-1393.
------------------------------------------

    Resolution: Fixed

This has been fixed a while back.

The following test shows that it's fixed :

ModifyMultipleChangesIT.testModifyMultipleChangeDeleteAddSnInMust()
    {
        LdapContext sysRoot = getSystemContext( service );
        createData( sysRoot );
        
        // Try to delete and add the SN which is in MUST
        ModificationItem[] mods = new ModificationItem[2];
        
        Attribute snOld = new BasicAttribute( "sn", "Amos" );
        mods[0] = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, snOld );
        Attribute snNew = new BasicAttribute( "sn", "TAmos" );
        mods[1] = new ModificationItem( DirContext.ADD_ATTRIBUTE, snNew );

        sysRoot.modifyAttributes( RDN_TORI_AMOS, mods );

        // Verify that the attribute value has been added
        Attributes attrs = sysRoot.getAttributes( RDN_TORI_AMOS );
        Attribute attr = attrs.get( "sn" );
        assertNotNull( attr );
        assertTrue( attr.contains( snNew.get() ) );
        assertEquals( 1, attr.size() );
    }

( in core-integ, operations/modify)

> Modification with multiple items are not considered as atomic operation
> -----------------------------------------------------------------------
>
>                 Key: DIRSERVER-1393
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1393
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.4
>            Reporter: Stefan Seelmann
>            Assignee: Emmanuel Lecharny
>            Priority: Critical
>             Fix For: 2.0.0-RC1
>
>
> Having the following entry:
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> objectClass: inetOrgPerson
> objectClass: organizationalPerson
> objectClass: person
> objectClass: top
> cn: test
> sn: test
> ---------------------------------------------------------------------
> When trying to change the "sn" must attribute with following modification sequence fails with error " [15:48:05] ERROR [org.apache.directory.server.core.schema.SchemaInterceptor] - Trying to remove a required attribute: sn".
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> changetype: modify
> delete: sn
> sn: test
> -
> add: sn
> sn: test2
> -
> ---------------------------------------------------------------------
> Order of add/delete or delete/add doesn't matter. Using "replace" works.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1393) Modification with multiple items are not considered as atomic operation

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12739808#action_12739808 ] 

Emmanuel Lecharny commented on DIRSERVER-1393:
----------------------------------------------

I have looked at the Modification operation code many times. All the ugly work is done in the schema interceptor : a new entry is created, and all the modification are applied there. 

I must say that the way we handle modification in this area is frankly not very clean, but I never had enough time (and probably I was reluctant to do so) to clean the code.

It may be time to do so.

The basic algorithm should be to create a copy of the entry, apply the modifications on it, and if it's still consistent wrt schema,  apply the change.

It's not very complicated, my estimation is that it's a matter of 2 days. I would suggest we fix it for 1.5.5

> Modification with multiple items are not considered as atomic operation
> -----------------------------------------------------------------------
>
>                 Key: DIRSERVER-1393
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1393
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>    Affects Versions: 1.5.4
>            Reporter: Stefan Seelmann
>            Priority: Critical
>             Fix For: 1.5.5
>
>
> Having the following entry:
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> objectClass: inetOrgPerson
> objectClass: organizationalPerson
> objectClass: person
> objectClass: top
> cn: test
> sn: test
> ---------------------------------------------------------------------
> When trying to change the "sn" must attribute with following modification sequence fails with error " [15:48:05] ERROR [org.apache.directory.server.core.schema.SchemaInterceptor] - Trying to remove a required attribute: sn".
> ---------------------------------------------------------------------
> dn: cn=test,ou=Users,dc=example,dc=com
> changetype: modify
> delete: sn
> sn: test
> -
> add: sn
> sn: test2
> -
> ---------------------------------------------------------------------
> Order of add/delete or delete/add doesn't matter. Using "replace" works.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.