summaryrefslogtreecommitdiff
path: root/source4/lib/tdb/common/tdb.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r23798: updated old Temple Place FSF addresses to new URLAndrew Tridgell1-2/+1
(This used to be commit 40c0919aaa9c1b14bbaebb95ecce53eb0380fdbb)
2007-10-10r23795: more v2->v3 conversionAndrew Tridgell1-1/+1
(This used to be commit 84b468b2f8f2dffda89593f816e8bc6a8b6d42ac)
2007-10-10r23590: Fix realloc leak on failure case from Jim Meyering <jim@meyering.net>.Jeremy Allison1-1/+5
Jeremy. (This used to be commit 59ba128cb61e77a830ddd8b8e1d5d0fd00f99736)
2007-10-10r22832: merged the latest tdb changes from ctdb to Samba4Andrew Tridgell1-6/+27
(This used to be commit a88ab4fa3a07c31bc45c612043f9e096f384eda4)
2007-10-10r22041: merge trivial changes from samba3Stefan Metzmacher1-2/+3
metze (This used to be commit 902a76ca705f07c61f86a9ef1346583ba9d3157d)
2007-10-10r21722: Add the dead record functionality presented on ↵Volker Lendecke1-6/+175
samba-technical@samba.org. If you do a tdb_set_max_dead(tdb, n), then for this tdb a delete operation will only mark a record as dead and re-use it if a new record is created. The parameter n allows for at most n dead records per hash chain. If this number is exceeded, all dead records are put on the central freelist. Volker (This used to be commit 98a27ab28a3cd554e370a9a0e3652f4dea8749e9)
2007-10-10r21445: Apply tdb_parse_record Tridges error return, merge to 3_0_25 and 4_0Volker Lendecke1-13/+51
(This used to be commit afe7d7855841066b88859976ac748cbf438a9a9f)
2007-10-10r21412: The last patch also incremented the seqnum when tdb_store failed. ↵Volker Lendecke1-8/+10
Not as bad as not doing it at all, but needs fixing. Also simplify the logic, I had missed the "goto out" at the end of the function. Volker (This used to be commit ed30a0ff602d0a1d4409bee4faf12b6979b5f4b8)
2007-10-10r21410: We have to increment the sequence number also when tdb_update_hash()Volker Lendecke1-1/+1
succeeded. Found while testing the brlock seqnum patch. Tridge, please check! Volker (This used to be commit e518c68fc5446304611d096ac2e3cab744734fc3)
2007-10-10r19425: two more tdb functions from samba3Andrew Tridgell1-0/+11
(This used to be commit c9d9d79c34e8a36a6f684b173b1cc861330adc5c)
2007-10-10r19423: merge some tdb changes from SAMBA_3_0 to SAMBA_4_0Andrew Tridgell1-0/+5
this is in preparation of a merge in the other direction (This used to be commit db3211079fd594aa03c3b9bb3eb6ad86bdd32837)
2007-10-10r19401: make tdb_lockall() much more efficient, and add a tdb_lockall_read()Andrew Tridgell1-2/+2
call which does a read lock on all chains. These will be used to make ldb searches more efficient (This used to be commit de664ec1f8cf179f1d650563272c0de3f7636e2b)
2007-10-10r16916: Implement metze's proposed changes to the tdb logging API.Andrew Bartlett1-1/+1
This clearly links the log function with its private pointer, and makes the argument list for tdb_open_ex a bit shorter. Andrew Bartlett (This used to be commit 5d5503e8d8a10ead3ef21a5ffda52cadb9a07727)
2007-10-10r16774: This patch modifies the tdb API to allow the logging function to be usedAndrew Bartlett1-1/+1
as part of ldb. This allows tdb failures to be passed all the way up to Samba's DEBUG system, which allowed easier debugging. Unfortunately I had to extend the tdb API, as the logging function didn't have a context pointer. I've worked over the 'debug levels' in TDB. Most of them were 0, which didn't seem right, as some were trace-like messages. We didn't see any of these previously, except when accessing TDB directly. Andrew Bartlett (This used to be commit 58898092c1ce043f6d698db5065f372b79109e22)
2007-10-10r14799: added a tdb_get_seqnum() call, and the TDB_SEQNUM flag. This allowsAndrew Tridgell1-0/+54
for an extremely lightweight test to see if a tdb has possibly changed. (This used to be commit f325ba605ccceca63712c0f2c98961e35e437b3d)
2007-10-10r10465: separate out a read_only db from a read-only traversal to ensure weAndrew Tridgell1-2/+2
don't end up doing a mmap read only (This used to be commit 294ccfd46a0c4e1af9365d028acdabec03c41ad3)
2007-10-10r10421: following on discussions with simo, I have worked out a way ofAndrew Tridgell1-0/+5
allowing searches to proceed while another process is in a transaction, then only upgrading the transaction lock to a write lock on commit. The solution is: - split tdb_traverse() into two calls, called tdb_traverse() and tdb_traverse_read(). The _read() version only gets read locks, and will fail any write operations made in the callback from the traverse. - the normal tdb_traverse() call allows for read or write operations in the callback, but gets the transaction lock, preventing transastions from starting inside the traverse In addition we enforce the following rule that you may not start a transaction within a traverse callback, although you can start a traverse within a transaction With these rules in place I believe all the deadlock possibilities are removed, and we can now allow for searches to happen in parallel with transactions (This used to be commit 7dd31288a701d772e45b1960ac4ce4cc1be782ed)
2007-10-10r10405: added transactions into tdb, and hook them into ldb. See myAndrew Tridgell1-2/+2
samba-technical posting for more details on the transactions design. This also adds a number of command line arguments to tdbtorture, making it more flexible, and fixes some lock deadlock conditions in the tdbtorture code. (This used to be commit 06bd8abba942ec9f1e23f5c5d546cbb71ca3a701)
2007-10-10r10253: a fairly large tdb cleanup and re-organise. Nearly all of this changeAndrew Tridgell1-1806/+69
just involves splitting up the core tdb.c code into separate files on logical boundaries, but there are some minor functional changes as well: - move the 'struct tdb_context' into tdb_private.h, hiding it from users. This was done to allow the structure to change without breaking code that uses tdb. - added accessor functions tdb_fd(), tdb_name(), and tdb_log_fn() to access the elements of struct tdb_context that were used by external code but are no longer visible - simplied tdb_append() to use tdb_fetch()/tdb_store(), which is just as good due to the way tdb locks work - changed some of the types (such as tdb_off to tdb_off_t) to make syntax highlighting work better - removed the old optional spinlock code. It was a bad idea. - fixed a bug in tdb_reopen_all() that caused tdbtorture to sometimes fail or report nasty looking errors. This is the only real bug fixed in this commit. Jeremy/Jerry, you might like to pickup this change for Samba3, as that could definately affect smbd in Samba3. The aim of all of these changes is to make the tdb transactions/journaling code I am working on easier to write. I started to write it on top of the existing tdb.c code and it got very messy. Splitting up the code makes it much easier to follow. There are more cleanups we could do in tdb, such as using uint32_t instead of u32 (suggested by metze). I'll leave those for another day. (This used to be commit 4673cdd0d261614e707b72a7a348bb0e7dbb2482)
2007-10-10r9774: r11605@blu: tridge | 2005-08-30 12:02:19 +1000Andrew Tridgell1-0/+3
make sure we don't walk off the end of the hash array (This used to be commit 3c32f24e2c6a99ec294fb16e1684cd22b08f2df4)
2007-10-10r9773: r11599@blu: tridge | 2005-08-30 11:55:57 +1000Andrew Tridgell1-5/+13
optimise this case a bit more. The total speedup using non-indexed ldbtest is now around a factor of 80x. The code is ugly as hell, but I think this speed is worth it. Of course, if we only ever do indexed searches in ldb then this doesn't help, but it seems all too common that we get unindexable searches, so the optimisation is worthwhile (This used to be commit 2e14fb893dd9815cdb2488c630131dc549e5c361)
2007-10-10r9769: r11592@blu: tridge | 2005-08-30 10:40:19 +1000Andrew Tridgell1-0/+37
added a tdb optimisation that speeds up non-indexed ldb by a large margin (often 10x or more). I'd be interested in any comments on the safety of this optimisation. See the comment in the code for an explanation. (This used to be commit 7f9efaceb6d6dfc0c82923344cc45ec34493f2ed)
2007-10-10r8624: removed valgrind comment on tdb that no longer appliesAndrew Tridgell1-19/+0
(This used to be commit 8f222c8c7a750c739d3288da0b1edb1efc3b1ffc)
2007-10-10r7641: Fix based on work from "Shlomi Yaakobovich" <Shlomi@exanet.com> to catchJeremy Allison1-6/+7
loops in corrupted tdb files. Jeremy. (This used to be commit f9f3037d6855259edd56fd5a23d63dbb37f0a751)
2007-10-10r7276: - moved static tdb function ltdb_dn_fold() into common/ so that it can beDerrell Lipman1-1/+10
called from multiple backends. (ldb_sqlite3 needs it too.) Added parameter for a callback function that determines whether an attribute needs case folding. - begin to prepare for sqlite3 in build process - work-in-progress updates, on ldb_sqlite3 (This used to be commit a80bced0b96ffb655559a43cf7f4d7a34deb5a7d)
2007-10-10r6528: - in tdb_fetch() we effectively disallowed zero length records byAndrew Tridgell1-7/+4
returning NULL/0, which is the same as we used for a failure. Having to look at tdb->ecode (which we never do) is too error prone. Instead, tdb_fetch() should behave like malloc() and talloc(), where zero length is not special and malloc(0) returns a valid pointer. - similarly in data_blob(), asking for data_blob(NULL, 0) should return a zero blob, but asking for data_blob(ptr, 0) should return a zero length blob with a valid pointer, just like talloc() and malloc() This change fixes the SummaryInformation stream stored in the tdb backend when manipulated from w2k. The w2k client was using SET_EOF_INFORMATION to create a zero-length stream, which we return STATUS_NOT_FOUND on, as the tdb_fetch() gave us back a NULL/0 blob, which we returned as not-found (This used to be commit 162bbe4402b9de6ac06103df904b9fc204fbff29)
2007-10-10r6238: Ensure if realloc fails on an internalJeremy Allison1-3/+8
tdb we fail gracefully. Jeremy. (This used to be commit d69f7c05468ae54e0474b188fedabe14e7297d53)
2007-10-10r5779: Remove signal and timeout gubbage from tdb.Tim Potter1-26/+2
(This used to be commit dbb56e9a59cf00d57b09ded6d60bf9424d5f1f4c)
2007-10-10r5533: Patch to detect infinite loops when traversing a tdb from "Shlomi ↵Jeremy Allison1-0/+7
Yaakobovich" <Shlomi@exanet.com> Jeremy. (This used to be commit 84f6d2b3dd29c1aa478708db9617a79382158f64)
2007-10-10r5296: - only include the tdb headers where they are neededAndrew Tridgell1-1/+1
- removed the u32 hack in events.c as I think this was only needed as tdb.h defines u32. Metze, can you check that this hack is indeed no longer needed on your suse system? (This used to be commit 6f79432fe656164d4770dbce114a30dda5e7bf9a)
2007-10-10r4466: rather than defining "STANDALONE" for building tdb, ldb and tallocAndrew Tridgell1-1/+1
outside the tree, instead defined _SAMBA_BUILD_ inside the Samba build. This makes it easier to pull code out of Samba for external use. (This used to be commit 09e98c8745cca7ccb1ad7134c0c09b8e4c0f4f06)
2007-10-10r3454: moved a few more things out if includes.h into the include/system/ ↵Andrew Tridgell1-0/+1
include files. this brings us down to about 11k lines of headers included with includes.h, while still retaining the speed of building with pch (This used to be commit 10188869ef072309ca580b8b933e172571fcdda7)
2007-10-10r3447: more include/system/XXX.h include filesAndrew Tridgell1-0/+2
(This used to be commit 264ce9181089922547e8f6f67116f2d7277a5105)
2007-10-10r2985: got rid of the unused tdb_lockkeys() and tdb_unlockkeys() functionsAndrew Tridgell1-71/+0
they have been broken for 4 years (ever since they were added) and have been never used, which makes them prime candidates for destruction. (This used to be commit 0b53ab85aae4569c04495f07c18a65fd6b47bf4c)
2007-10-10r2981: Fix incorrect locks/unlocks in tdb_lockkeys()/tdb_unlockkeys().Jeremy Allison1-3/+3
Spotted by Taj Khattra <taj.khattra@gmail.com>. Jeremy. (This used to be commit a7d92301bbf45cb9e475e4876fdbb37644ad5871)
2007-10-10r2238: the tdb_debug() function was totally bogus - remove it (you can'tAndrew Tridgell1-5/+10
convert a ... varargs function to a va_list by just a cast!!) also mark the tdb log function with PRINTF_ATTRIBUTE() and fixed some bad format errors in tdb.c that jim found. (This used to be commit c26c92eb8f538748fcbb2ae5a0a8a02bffbbbf86)
2007-10-10r2154: Merge of Jim's format string fixup in r2130:2131Tim Potter1-1/+1
(This used to be commit 17a53eaac2d0d76413c8bb27a6f1c80536ccf3a7)
2007-10-10r2034: Allow user-selectable hash functions on open only.Jeremy Allison1-15/+17
Jeremy. (This used to be commit b43320ee5c9ac14c330e61ae62e0786b088e04fa)
2007-10-10r1053: Make tdb build standalone:Tim Potter1-1/+2
- #include <stdint.h> - uint_t isn't a valid type, change back to unsigned int (This used to be commit f690325565d2393bba3cb9f6e7cdf3753cbd4423)
2007-10-10r962: convert 'unsigned' and 'unsigned int' to uint_tStefan Metzmacher1-1/+1
metze (This used to be commit 57151e80eb1090281401930c8fe25b20a8cf3a38)
2007-10-10r943: change samba4 to use 'uint8_t' instead of 'unsigned char'Stefan Metzmacher1-2/+2
metze (This used to be commit b5378803fdcb3b3afe7c2932a38828e83470f61a)
2007-10-10r848: convert lib/tdb into the same layout as lib/ldbStefan Metzmacher1-0/+2139
metze (This used to be commit bacab322ce89979f0ad0811cd15b73d81eceb69d)