ldb_rename()

tridge at samba.org tridge at samba.org
Tue Oct 19 01:16:43 GMT 2004


Metze,

Mostly looks good, except I think the index handling doesn't look
quite right, or at least it is more complex than it needs to be.

I would have thought that you could implement this much more simply
like this:

  ltdb_lock()
  ltdb_search_dn1()
  ltdb_add()
  ltdb_delete()
  ltdb_unlock()

rather than trying to manipulate the index correctly. The ltdb_add()
and ltdb_delete() calls will take care of the index changes for you,
and as you hold the ltdb lock the whole time there are no atomicity
issues.

It does mean that ltdb_cache_load() will be called more times than is
strictly necessary, but I doubt that ltdb_rename() is a performance
sensitive operation, so simplicity rules over speed in this case.

The only tricky thing will be error handling. If the ltdb_add() fails
its easy, but if the ltdb_delete() fails then you need to go back and
delete the new DN before failing the operation.

We also need a update to the ldbtest tools/ldbtest.c test suite to
stress the new rename code. 

Cheers, Tridge


More information about the samba-technical mailing list