directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Seelmann <seelm...@apache.org>
Subject Re: [DAS] Unique IDs for Model Instances (Was Initial Context?)
Date Thu, 19 Apr 2007 08:01:54 GMT
Hi Ole,

Ole Ersoy wrote:

> Here's what I'm thinking the process is:
>
> For each model instance we generate a surrogate key.
>
> We do that by getting the total number of children that
> the context cn=accounts, cn=users, cn=example, ou=com
> has, and then add 1.  So if there are 14 children, the
> new child gets a surrogate key assigned to it which is
> 15.
>
> Then we write the surrogate key, along with a descriptive human
> readable/identifiable string (Like "Alex Karasulu") taken from one of 
> the root object's attributes a file designated
> by the DAS's configuration.  This is so that if the server
> crashes (Hardware - never ADS), we'll know because we did
> not write a completion flag into the file, and next time we run
> the DAS it can recover.
>
> Then we create the subcontext like this (dirContext is
> cn=accounts, cn=users, cn=example, ou=com):
>
> dirContext.createSubcontext("cn=15", attributes);
>
The are some (LDAP-related) problems with this approach:
- This operation isn't atomic. There is some time between you calculate 
the key and the real write operation. If there are many concurrent 
threads writing model instances you will get an 
NameAlreadyBoundException. Then you have to try again. I think with 
random keys there are less collisions.
- There is no count(*) in LDAP. So to determine the number of children 
you have to retrieve all children and count them within the DAS. Imagine 
you have thousands or millions of children all of the DNs must be 
transfered over the wire. This can take some time and will slow down the 
system and doesn't scale well.

Regards,
Stefan


Mime
View raw message