ldb_rename()

Stefan (metze) Metzmacher metze at samba.org
Tue Oct 19 04:25:57 GMT 2004


tridge at samba.org schrieb:
> 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()

does that work?, because ltdb_add() also tries to call ltdb_lock().

> 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.

yep, and what is is that deleting of the new record fails too?

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

yep


-- 
metze

Stefan Metzmacher <metze at samba.org> www.samba.org


More information about the samba-technical mailing list