summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb/ldb_index.c
AgeCommit message (Collapse)AuthorFilesLines
2011-07-05ldb: make ldb a top level library for Samba 4.0Andrew Bartlett1-1599/+0
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-06-20tdb_compat: use tdb_open_compat.Rusty Russell1-1/+1
This is a helper for the common case of opening a tdb with a logging function, but it doesn't do all the work, since TDB1 and TDB2's log functions are different types. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_traverse/tdb_traverse_read: check returns for negative, not -1.Rusty Russell1-2/+2
TDB2 returns a negative error number on failure. This is compatible if we always check for < 0 instead of == -1. Also, there's no tdb_traverse_read in TDB2: we don't try to make traverse reliable any more, so there are no write locks anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_store: check returns for 0, not -1.Rusty Russell1-1/+1
TDB2 returns a negative error number on failure. This is compatible if we always check for != 0 instead of == -1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_fetch_compat: use instead of tdb_fetch.Rusty Russell1-2/+2
This is a noop for tdb1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-12-18lib/ldb Remove talloc_free() that causes double-free in callbacks.Andrew Bartlett1-1/+3
This partially reverts 0941099a, which was a little over-eager in fixing what were presumed to be memory leaks. It is always the callbacks responsiblity to free the ares, but if they don't then the end of the request should handle the cleanup. Attempting to talloc_free() here will result (as it did in the descriptor module) in a double-free error if the callback does free it, and no other caller of ldb_module_send_entry() has this behaviour. Andrew Bartlett
2010-10-20ldb:ldb_index.c - fix some memory leaksMatthias Dieter Wallnöfer1-1/+6
Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date: Wed Oct 20 13:11:49 UTC 2010 on sn-devel-104
2010-10-20ldb:ldb_index.c - let "ldb_module_oom" generate the return codeMatthias Dieter Wallnöfer1-15/+8
2010-10-13s4-ldb: take advantage of ldb_match_msg_error() in more placesAndrew Tridgell1-2/+8
this gives better error checking
2010-08-17s4-ldb: fixed the ldb 'displayName=a,b' indexing bugAndrew Tridgell1-2/+4
the problem was the inconsistency between the key form of DNs between the itdb used for indexing and the on disk form Thanks to Matthieu Patou for finding this bug! Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-08-17s4-ldb: add some comments explaining the ltdb_index_idxptr() functionAndrew Tridgell1-0/+8
this function copes with alignment sensitive CPUs Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-03-08s4:LDB TDB index code - reintroduce accidentally removed code partMatthias Dieter Wallnöfer1-1/+3
This was removed by 95d726f3018ef5d249f89d56bde24b7ee0c24ecf. Sorry.
2010-03-08LDB:TDB backend - change counter variables to "unsigned" where appropriateMatthias Dieter Wallnöfer1-6/+6
2010-02-14s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb codeAndrew Tridgell1-1/+1
2010-01-16s4-ldb: cope with bad ptr alignment in ldb_index.cAndrew Tridgell1-3/+3
We can't assume that a rec_ptr will come back from a tdb traverse with alignment sufficient for a pointer.
2010-01-08s4-ldb: improve error handling in indexing codeAndrew Tridgell1-4/+32
When we get an indexing failure we want a clear error message
2009-11-20ldb:ldb_tdb backend/indexes - Outside APIMatthias Dieter Wallnöfer1-18/+25
- The outside API contains "DN" string arguments: Bad. Since in this way we fully rely on the outside calls regarding the right DN format. Solution: Use always a "struct ldb_dn" entry. Since this one is interchangeable and we can handle it in our preferred way.
2009-11-20ldb:ldb_tdb backend/indexes - DN comparisonMatthias Dieter Wallnöfer1-4/+5
- DN comparison: The function doesn't seem that efficient. I "upgraded" it a bit to be more powerful (added a second length check and do both before the string comparison)
2009-10-27s4:ldb Add detail to failures in the indexing codeAndrew Bartlett1-2/+8
2009-10-25s4-ldb: allow for unescaped '=' in a index DNAndrew Tridgell1-4/+0
The ldb_dn_explode code normally enforces all special characters, including a '=', must be escaped. Unfortunately this conflicts with the ltdb index DNs, which for binary attributes may be base64 encoded. This allows a unescaped '=' as a special case for index DNs.
2009-10-25s4-ldb: ensure DNs pass validity tests in indexingAndrew Tridgell1-0/+4
2009-10-25s4-ldb: fixed string length handling on index recordsAndrew Tridgell1-2/+2
2009-10-25s4-ldb: fixed re-index during a complex transactionAndrew Tridgell1-10/+31
We may have modified index objects in the in-memory index tdb
2009-10-22s4-ldb: added a TODO about checking the indexlistAndrew Tridgell1-0/+2
2009-10-22s4-ldb: fixed some memory leaks in new indexing codeAndrew Tridgell1-1/+3
2009-10-22s4-ldb: don't try to index non-indexed attributesAndrew Tridgell1-0/+4
2009-10-22s4-ldb: ensure new dn_list elements are not owned by callerAndrew Tridgell1-1/+1
2009-10-22s4-ldb: over-allocate index records to save on realloc costsAndrew Tridgell1-1/+5
2009-10-22s4-ldb: fixed tdb error handling in ldb_index.cAndrew Tridgell1-3/+8
2009-10-22s4-ldb: delete empty index recordsAndrew Tridgell1-0/+8
2009-10-22s4-ldb: do more validation of idxptr listsAndrew Tridgell1-12/+31
2009-10-22s4-ldb: when taking a list intersection, the result can be as long as the ↵Andrew Tridgell1-1/+1
first list Intuitively you would think it couldn't be longer than the minimum of the two lists, but we are deliberately allowing for duplicates at this level of the indexing code, which means the result can be longer
2009-10-22s4-ldb: ldb indexing rewrite - part1Andrew Tridgell1-840/+651
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.
2009-09-15s4-ldb: cope better with corruption of tdb recordsAndrew Tridgell1-3/+8
When doing an indexed search if we hit a corrupt record we abandoned the indexed search and did a full search. The problem was that we might have sent some records to the caller already, which means the caller ended up with duplicate records. Fix this by returning a search error if indexing returns an error and we have given any records to the caller.
2009-09-08s4/ldb: added --show-binary command line optionAndrew Tridgell1-1/+1
This add --show-binary to ldbsearch. When this flag is set, binary blobs will be shown as-is, instead of base64 encoded. This is useful for some XML encoded attributes, and will also be used as part of some NDR print formatting for attributes like repsTo.
2009-08-28s4:ldb Don't sleep(100) in this error case, but debug the LDIFAndrew Bartlett1-6/+6
2009-07-14remove all '\n' from ldb_debugSumit Bose1-3/+3
2009-06-01use the unique flag on ldb attributes to optimise & clausesAndrew Tridgell1-46/+72
When a attribute is marked unique we know that if we find a match it will be the only possible match. This means that in a list of subtrees connected by an &, it is best to first load the index values for the unique entries, as if they find something then we know we won't have to look any further. This helps with searches like this: (&(objectclass=user)(samaccountname=tridge)) the old code would first have loaded the very large index for the objectclass=user attribute, and then loaded the single entry for samaccountname=tridge. Now we load the samaccountname=tridge entry first, notice that it gives us a single result, and stop, thereby skipping the load of the objectclass=user index record completely.
2009-06-01added support for unique indexing in ldbAndrew Tridgell1-7/+26
When a attribute is marked as LDB_ATTR_FLAG_UNIQUE_INDEX then attempts to add a 2nd record that has the same attribute value for this attribute as another record will fail. This provides a much more efficient mechanism for ensuring that attributes like objectGUID are unique
2009-05-28fixed one-level indexingAndrew Tridgell1-6/+2
one-level indexing was not always effective due to some broken logic in the indexing code. This change means that if normal indexing fails, we can still fall back on one-level indexing. This reduces the number of full unindexed searches in s4 quite a lot
2009-03-09Fix potential segfaults using freed memory.Simo Sorce1-1/+1
In some code paths ltdb_context was still referenced even after we were returned an error by one of the callbacks. Because the interface assumes that once an error is returned the ldb_request may be freed, and because the ltdb_context was allocated as a child of the request, this might cause access to freed memory. Allocate the ltdb_context on ldb, and keep track of what's going on with the request by adding a spy children on it. This way even if the request is freed before the ltdb_callback is called, we will safely free the ctx and just quietly return.
2009-02-23Fix headers, ldb_includes.h is a private header,Simo Sorce1-0/+1
do not reference it from ldb.h
2009-01-30Fix the mess with ldb includes.Simo Sorce1-35/+65
Separate again the public from the private headers. Add a new header specific for modules. Also add service function for modules as now ldb_context and ldb_module are opaque structures for them.
2008-12-19s4:cosmetic: Remove trailing tabs and spacesSimo Sorce1-59/+59
2008-12-19Small cosmetic LDB patch regarding return values.Matthias Dieter Wallnöfer1-4/+4
It changes some "return 0" in "return LDB_SUCCESS"
2008-12-18Rename ldb index pointer wrapper functionAndrew Bartlett1-8/+8
This also asserts that it is used only for index records. Andrew Bartlett
2008-12-17s4:ldb: make it possible to return per entry controlsAndrew Bartlett1-1/+1
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2008-12-17an experimental patch for fixing ldb bloatAndrew Tridgell1-9/+337
ldb indexing can cause huge files, and huge memory usage. This experiment allows us to keep indexes in memory during a transaction, then to write the indexes to disk when the transaction completes. The result is that the db is much smaller (we have seen improvements of about 100x in file size) and memory usage during large transactions is also greatly reduced Note that this patch uses the unusual strategy of putting pointers into a ldb (and thus into a tdb). This works because the pointers are only there during a transaction, so the pointers are not exposed to any other users of the database. The pointers allow us to avoid some really bad allocation problems with tdb record allocation during the re-indexing.
2008-12-16repack the ldb after re-indexingAndrew Tridgell1-0/+4
re-indexing in ldb is triggered on any modification to the @ATTRIBUTES or @INDEXLIST records. This happens to produce a worst-case fragmentation of the database, as all @INDEX records are deleted then re-created. By repacking after re-indexing we ensure that the database ends up without extreme fragmentation.
2008-09-29LDB ASYNC: ldb_tdb backendSimo Sorce1-40/+21