s4-dsdb: Try to avoid much of the time a db search for msDS-IntID
authorMatthieu Patou <mat@matws.net>
Sat, 12 May 2012 09:13:42 +0000 (02:13 -0700)
committerMatthieu Patou <mat@matws.net>
Sat, 23 Jun 2012 06:22:02 +0000 (23:22 -0700)
commit6edd940135d97e80d70e2b48d8019be5d3557f64
treec2df17fb50e6cf098399839f26de622f2b9a94da
parent1521bb95a7bb3df5cb3a128085a088cb09555f8b
s4-dsdb: Try to avoid much of the time a db search for msDS-IntID

We search in the schema if we have already this intid (using dsdb_attribute_by_attributeID_id because
in the range 0x80000000 0xBFFFFFFFF, attributeID is a DSDB_ATTID_TYPE_INTID).
If so generate another random value.
If not check if the highest USN in the database for the schema partition is the
one that we know.
If so it means that's only this ldb context that is touching the schema in the database.
If not it means that's someone else has modified the database while we are doing our changes too
(this case should be very bery rare) in order to be sure do the search in the database.
source4/dsdb/samdb/ldb_modules/repl_meta_data.c
source4/dsdb/samdb/ldb_modules/samldb.c
source4/dsdb/samdb/samdb.h