[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Get Max uidNumber ...



Ignacio Coupeau <icoupeau@unav.es> writes:

> I added an maxAccount objectClass wit "MUST uidNumber..." and update it
> by one...
> but test before call to the ldap_add if the uid was "stolen" by other
> concurrent process... if the uid is in use perform a new maxAccount read
> cycle...

The best approach, if I remember correctly, was proposed by Norbert
Klausen and was based in using the atomicity property of modify
operations.  If instead of using replace for that attribute you ask in
the same Modify operation 'delete' of the old value plus 'add' of the
new (incremented) value, you are guaranteeed to either fail if someone
got there since you read the old max and tried to increment or succeed
and thus preempt anyone else following the same algorithm.  Because
all changes in the same modify MUST succeed or all of them MUST fail,
according to RFC2251.

But searching the directory to find the highest value in the absence
of efficient server-side sorting and multi-entry locking in a possibly
distributed directory does not seem to be scalable.

Julio