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

Re: How can I lock a record using php-ldap?



Jim C wrote:

I need to be able to lock an attribute, series of entries or one record and then perform several actions and then unlock the attribute. How can this be done?

Not being able to do this would constitute a bug because it means that there will always be problems with race conditions between scripts. This is easily proveable.

As people have already pointed out, LDAP is not a transactional database but is rather optimized for search and retrieval. This isn't a bug, it's a new and unwieldy requirement. I wouldn't expect it in an LDAP implementation anytime soon (if ever), so you need to consider addressing it at an application layer. This may be difficult using a scripting language like PHP, and I definitely don't recommend storing the highest uidNumber value in the directory database itself.


I've been considering this issue, and will probably be implementing a solution in my software (LDAPHttp) in the coming months as a "managed" identifier attribute type. I use Java servlets, not PHP, so I can take advantage of synchronization and memory residence. I would use a single process for creating new entries. This process would internally deduce and store the highest uidNumber (or whatever) in memory. Upon each new creation, a synchronized block of code would increment the highest uidNumber and return it, thereby avoiding race conditions.

If there are other perspectives on how to do this, I'd be interested to hear them. While I don't think LDAP should match the RDBMS model function for function, managed identifiers would make a nice addition.

Jon Roberts
www.mentata.com