diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-10-21 22:21:26 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-10-22 12:47:53 +1100 |
commit | 859cf72692f7daecbecb80559ebccc0d44087365 (patch) | |
tree | 9ed75d633d6b56def03efcd1b9fc874644ca6c73 /source4/lib/ldb/ldb_tdb/ldb_tdb.h | |
parent | c5de880c409224889c30837b76fb2fdaf31c02e0 (diff) | |
download | samba-859cf72692f7daecbecb80559ebccc0d44087365.tar.gz samba-859cf72692f7daecbecb80559ebccc0d44087365.tar.bz2 samba-859cf72692f7daecbecb80559ebccc0d44087365.zip |
s4-ldb: ldb indexing rewrite - part1
This gets rid of the @IDXPTR approach to in-transaction indexing,
instead using an in-memory tdb to hold index values during a
transaction. This also cleans up a lot of the internal indexing logic,
hopefully making it easier to understand.
One of the big changes is in memory management, with a lot more use
made of talloc tricks to avoid copying dn lists, and shortcuts used to
avoid high intersection and union calculation costs.
The overall result is that a re-provision on my laptop goes from 48s
to a bit over 10s.
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_tdb.h')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h index c8c1dad5de..c5eec0a518 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h @@ -17,6 +17,8 @@ struct ltdb_private { struct ltdb_cache { struct ldb_message *indexlist; struct ldb_message *attributes; + bool one_level_indexes; + bool attribute_indexes; struct { char *name; @@ -58,7 +60,7 @@ struct ltdb_context { #define LTDB_INDEX "@INDEX" #define LTDB_INDEXLIST "@INDEXLIST" #define LTDB_IDX "@IDX" -#define LTDB_IDXPTR "@IDXPTR" +#define LTDB_IDXVERSION "@IDXVERSION" #define LTDB_IDXATTR "@IDXATTR" #define LTDB_IDXONE "@IDXONE" #define LTDB_BASEINFO "@BASEINFO" @@ -83,9 +85,13 @@ int ltdb_check_at_attributes_values(const struct ldb_val *value); struct ldb_parse_tree; int ltdb_search_indexed(struct ltdb_context *ctx, uint32_t *); -int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg); -int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg); -int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int add); +int ltdb_index_add_new(struct ldb_module *module, const struct ldb_message *msg); +int ltdb_index_delete(struct ldb_module *module, const struct ldb_message *msg); +int ltdb_index_del_element(struct ldb_module *module, const char *dn, struct ldb_message_element *el); +int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn, + struct ldb_message_element *el); +int ltdb_index_del_value(struct ldb_module *module, const char *dn, + struct ldb_message_element *el, int v_idx); int ltdb_reindex(struct ldb_module *module); int ltdb_index_transaction_start(struct ldb_module *module); int ltdb_index_transaction_commit(struct ldb_module *module); @@ -122,12 +128,8 @@ int ltdb_lock_read(struct ldb_module *module); int ltdb_unlock_read(struct ldb_module *module); struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn); int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs); -int ltdb_delete_noindex(struct ldb_module *module, struct ldb_dn *dn); int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg); -int ltdb_index_del_value(struct ldb_module *module, const char *dn, - struct ldb_message_element *el, int v_idx); - struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx, const char *path, int hash_size, int tdb_flags, int open_flags, mode_t mode, |