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 <se...@apache.org> on 2009/05/06 00:15:13 UTC

Alias issues

Hi guys,

When trying to add an alias entry which aliasedObjectName points to an
non-existing entry, this is refused by the server. That's OK to avoid an
inconsistent state.

However it is possible to
- add a real entry, say "ou=people,dc=example,dc=com"
- add an alias to it, say "ou=users,dc=example,dc=com"
- delete the real entry "ou=people,dc=example,dc=com"
After that the alias "ou=users,dc=example,dc=com" still exists and its
aliasedObjectName still contains "ou=people,dc=example,dc=com", but that
doesn't exist. Now when deleting this alias I get an NPE when dropping
the subAliasIdx.

I'd like to discuss the possible solutions:

1. Reject deletion of an entry, when an alias points to this entry. This
is easy to check in the JdbmStore using the aliasIdx.

2. Automatically delete all alias entries that point to the entry that
should be deleted (cool, some kind of cascade delete). This is also easy
to implement in JdmbStore.

3. Keep the current sitation, but then we need to add some error
handling for the aliasIdx, oneAliasIdx and subAliasIdx, what is painful
IMHO.

Thoughts?

Please note that this is JDBM-specific and all handled within the
JdbmStore. Other partition implementations need to re-implement this
logic or may work different. Otherwise we must move this checks to a
higher level, i.e. to the interceptor chain.

Kind Regards,
Stefan

Re: Alias issues

Posted by Stefan Seelmann <se...@apache.org>.
Emmanuel Lecharny schrieb:
> Stefan Seelmann wrote:
>> Hi guys,
>>
>> When trying to add an alias entry which aliasedObjectName points to an
>> non-existing entry, this is refused by the server. That's OK to avoid an
>> inconsistent state.
>>
>> However it is possible to
>> - add a real entry, say "ou=people,dc=example,dc=com"
>> - add an alias to it, say "ou=users,dc=example,dc=com"
>> - delete the real entry "ou=people,dc=example,dc=com"
>> After that the alias "ou=users,dc=example,dc=com" still exists and its
>> aliasedObjectName still contains "ou=people,dc=example,dc=com", but that
>> doesn't exist. Now when deleting this alias I get an NPE when dropping
>> the subAliasIdx.
>>   
> That should not be the case. It should be fixed.

I created a Jira: https://issues.apache.org/jira/browse/DIRSERVER-1357

>> I'd like to discuss the possible solutions:
>>
>> 1. Reject deletion of an entry, when an alias points to this entry. This
>> is easy to check in the JdbmStore using the aliasIdx.
>>   
> No. We can have an alias pointing to nothing, we just have to return an
> AliasProbkel error :
> 
> aliasProblem (33)
>         Indicates that an alias problem has occurred.  For example,
>         the code may used to indicate an alias has been dereferenced
>         that names no object.
> 
Yes, makes sense.
> 
>> 2. Automatically delete all alias entries that point to the entry that
>> should be deleted (cool, some kind of cascade delete). This is also easy
>> to implement in JdmbStore.
>>   
> Same as previously : we should keep the alias, just in case.
>> 3. Keep the current sitation, but then we need to add some error
>> handling for the aliasIdx, oneAliasIdx and subAliasIdx, what is painful
>> IMHO.
>>   
> +1. Painful, but necessary, IMHO... Don't we have a cache will all the
> aliases taht is built when we start the server ? (I don't remember from
> the top of my head ...)

in the JdbmStore we have three indexes for the aliases, see [1]. They
are updated when adding/deleting an alias entry, but not when deleting
the target of an alias. I checked the code and I think we need to update
the oneAliasIdx and subAliasIdx when deleting an alias target.

Kind Regards,
Stefan

[1]
http://cwiki.apache.org/confluence/display/DIRxSRVx11/Structure+and+Organization



Re: Alias issues

Posted by Emmanuel Lecharny <el...@apache.org>.
Stefan Seelmann wrote:
> Hi guys,
>
> When trying to add an alias entry which aliasedObjectName points to an
> non-existing entry, this is refused by the server. That's OK to avoid an
> inconsistent state.
>
> However it is possible to
> - add a real entry, say "ou=people,dc=example,dc=com"
> - add an alias to it, say "ou=users,dc=example,dc=com"
> - delete the real entry "ou=people,dc=example,dc=com"
> After that the alias "ou=users,dc=example,dc=com" still exists and its
> aliasedObjectName still contains "ou=people,dc=example,dc=com", but that
> doesn't exist. Now when deleting this alias I get an NPE when dropping
> the subAliasIdx.
>   
That should not be the case. It should be fixed.
> I'd like to discuss the possible solutions:
>
> 1. Reject deletion of an entry, when an alias points to this entry. This
> is easy to check in the JdbmStore using the aliasIdx.
>   
No. We can have an alias pointing to nothing, we just have to return an 
AliasProbkel error :

aliasProblem (33)
         Indicates that an alias problem has occurred.  For example,
         the code may used to indicate an alias has been dereferenced
         that names no object.


> 2. Automatically delete all alias entries that point to the entry that
> should be deleted (cool, some kind of cascade delete). This is also easy
> to implement in JdmbStore.
>   
Same as previously : we should keep the alias, just in case.
> 3. Keep the current sitation, but then we need to add some error
> handling for the aliasIdx, oneAliasIdx and subAliasIdx, what is painful
> IMHO.
>   
+1. Painful, but necessary, IMHO... Don't we have a cache will all the 
aliases taht is built when we start the server ? (I don't remember from 
the top of my head ...)

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org