summaryrefslogtreecommitdiff
path: root/source3/lib/gencache.c
AgeCommit message (Collapse)AuthorFilesLines
2013-04-03s3:lib/gencache: place gencache.tdb into /var/cache/sambaStefan Metzmacher1-1/+1
/var/lock/samba is located on tmpfs on newer systems, but we want to keep things like the server affinity cache across reboots. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2013-02-19gencache: fix an extra newline in a DEBUG message in gencache_set_data_blob()Michael Adam1-1/+1
by using timestring() instead of ctime() Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19gencache: fix an extra newline in a DEBUG message in gencache_iterate_fn()Michael Adam1-1/+1
by using timestring() instead of ctime() Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19gencache: fix an extra newline in a DEBUG message in gencache_iterate_blobs_fn()Michael Adam1-1/+1
by using timestring() instead of ctime() Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19gencache: unify a DEBUG message in gencache_set_data_blob()Michael Adam1-2/+3
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19gencache: unify a DEBUG message in gencache_iterate_fn()Michael Adam1-1/+1
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19gencache: unify a DEBUG message in gencache_iterate_blobs_fn()Michael Adam1-1/+2
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19gencache: unify a DEBUG message in gencache_del()Michael Adam1-1/+1
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2012-11-28s3: Open gencache_notrans with TDB_NOSYNCVolker Lendecke1-1/+4
We are doing CLEAR_IF_FIRST here, and we are doing the transactions only to protect gencache_stabilize against concurrent writers. tdb's transaction.c says: - if TDB_NOSYNC is passed to flags in tdb_open then transactions are still available, but no fsync/msync calls are made. This means we are still proof against a process dying during transaction commit, but not against machine reboot. For gencache_notrans.tdb this is exactly what we want and avoids some expensive disk syncs. Reviewed by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Nov 28 03:13:56 CET 2012 on sn-devel-104
2012-11-27s3: Avoid some transaction_commit on gencache.tdbVolker Lendecke1-0/+110
Commits are expensive, and in some scenarios we are overwriting existing values again and again. Reviewed by: Jeremy Allison <jra@samba.org>
2012-06-19TDB2: make SAMBA use tdb1 again for the moment.Rusty Russell1-5/+0
Otherwise the following surgery will break the SAMBA build and testsuite. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb2: tdb_parse_record() returns negative errors, not -1.Rusty Russell1-2/+2
Fixup callers to tdb_parse_record() to be compatible with tdb2. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb2: #ifdef out TDB_ERR_NOLOCK and TDB_ERR_LOCK_TIMEOUT.Rusty Russell1-1/+6
These don't exist in tdb2. The former is used in one weird place in tdb1, and the latter not at all. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_compat: use tdb_errorstr_compat()Rusty Russell1-6/+6
Since TDB2 functions return the error directly, tdb_errorstr() taken an error code, not the tdb as it does in TDB1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_traverse/tdb_traverse_read: check returns for negative, 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. 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_transaction_cancel: ignore return value.Rusty Russell1-11/+5
TDB2 returns void here. tdb_transaction_cancel will *always* return with the transaction cancelled, but it will complain via the log function if a transaction wasn't in progress. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20tdb_transaction_commit: check returns for 0, not -1.Rusty Russell1-4/+4
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_delete: check returns for 0, not -1.Rusty Russell1-3/+3
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-1/+1
This is a noop for tdb1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-04-19gencache: don't use CLEAR_IF_FIRST as fallback.Rusty Russell1-7/+3
CLEAR_IF_FIRST only works if *all* openers use that flag. So just truncate the file: it's racy, but that's what we're doing anyway. We'd really need a TDB_OPENCHECK_OR_CLEAR flag to do this properly (or in TDB2, a open hook at the right point). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-05-06s3: only include tdb headers where needed.Günther Deschner1-0/+1
Guenther
2011-05-05More const fixes for compiler warnings from the waf build.Jeremy Allison1-1/+1
2011-03-30s3-includes: only include system/filesys.h when needed.Günther Deschner1-0/+1
Guenther
2011-03-30s3-includes: only include system/glob.h when needed.Günther Deschner1-0/+1
Guenther
2010-12-22s3:lib/gencache: fix memory leak in error pathStefan Metzmacher1-0/+3
metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Wed Dec 22 15:08:30 CET 2010 on sn-devel-104
2010-11-28s3: Add gencache_iterate_blobsVolker Lendecke1-57/+87
2010-11-28s3: Convert gencache_get_data_blob to gencache_parseVolker Lendecke1-59/+38
2010-11-28s3: Add gencache_parseVolker Lendecke1-0/+59
2010-09-27Change to using TDB_INCOMPATIBLE_HASH (the jenkins hash) on allJeremy Allison1-4/+4
TDB_CLEAR_IF_FIRST tdb's. For tdb's like gencache where we open without CLEAR_IF_FIRST and then with CLEAR_IF_FIRST if corrupt this is still safe to use as if opening an existing tdb the new hash will be ignored - it's only used on creating a new tdb not opening an old one. Jeremy.
2010-03-28s3: Use tdb_transaction_start_nonblock in gencache_stabilizeVolker Lendecke1-1/+10
This avoids the thundering herd problem when 5000 smbds exit simultaneously because the network went down.
2010-03-28Revert "s3: Optimize gencache for smbd exit"Volker Lendecke1-75/+14
This reverts commit 5ca63676dc59e83ffd9560fdcfa26063f267f283. That does not fully fix the problem, adding a tdb_transaction_start_nonblock to fix it.
2010-03-24s3: Optimize gencache for smbd exitVolker Lendecke1-14/+75
If thousands of smbds try to gencache_stabilize at the same time because the network died, all of them might be sitting in transaction_start. Don't do the stabilize transaction if nothing has changed in gencache_notrans.tdb. Volker
2009-12-07s3: let gencache_init() use tdb_check()Stefan Metzmacher1-0/+25
If the check fails we try to clear the tdb and start with an empty cache. metze
2009-11-02s3-gencache: restore gencache_get behavior with NULL args (with torture test).Günther Deschner1-4/+8
Without this, we panic in wins_srv_is_dead() and fail to start nmbd with wins support. Volker, please check. Guenther
2009-09-28s3:gencache: Add my copyrightVolker Lendecke1-0/+1
2009-09-23s3:gencache: Make gencache_del() return success for expired entriesVolker Lendecke1-4/+13
This fixes nasty error messages from "net cache flush"
2009-09-23s3:gencache: Remove some over-paranoid lockingVolker Lendecke1-6/+0
2009-09-23s3:gencache: Add a "was_expired" argument to gencache_get_data_blobVolker Lendecke1-10/+19
This is set to true if the routine returns failure due to an existing but expired entry.
2009-07-15Consolidate gencache also every 100 writes in a single processVolker Lendecke1-0/+14
2009-07-15Consolidate string and data_blob routines in gencacheVolker Lendecke1-138/+56
2009-07-15Make gencache more stableVolker Lendecke1-15/+268
This provides a compromise between stability and performance: gencache is a persistent database these days that for performance reasons can not use tdb transactions for all writes. This patch splits up gencache into gencache.tdb and gencache_notrans.tdb. gencache_notrans is used with CLEAR_IF_FIRST, writes to it don't use transactions. By default every 5 minutes and when a program exits, all entries from _notrans.tdb are transferred to gencache.tdb in one transaction.
2009-07-15Remove gencache_init/shutdownVolker Lendecke1-20/+1
gencache_get/set/del/iterate call gencache_init() internally anyway. And we've been very lazy calling gencache_shutdown, so this seems not really required.
2009-07-15Remove gencache_[un]lock_keyVolker Lendecke1-25/+0
2009-07-15TDB_CONTEXT -> "struct tdb_context"Volker Lendecke1-1/+1
2009-07-15Replace ASSERTs in gencache with "return false"Volker Lendecke1-12/+18
It's a bit strong to panic here I think.
2009-01-19simplify gencache_iterate a bit, fix nonempty blank linesVolker Lendecke1-86/+84
2008-07-11Revert "Return timed out entries from gencache_get if timeout param != NULL"Volker Lendecke1-15/+10
This reverts commit 2954b2be563149380e1fae7fe088b98d6cbd42e7. (This used to be commit 77ab2fb306a7ad59447a3e1591c2af03447e09c5)
2008-07-11Revert "Remove gencache_[un]lock_entry"Volker Lendecke1-0/+25
This reverts commit 7a5a575ffe5196caecedc93970a25abfbe6f8059. (This used to be commit 62e444dd50ae974c2ab9a553cdf7f188a8f2c538)
2008-07-03Remove gencache_[un]lock_entryVolker Lendecke1-25/+0
Günther agreed that it might be unnecessary in dsgetdcname_cache_store() :-) (This used to be commit 7a5a575ffe5196caecedc93970a25abfbe6f8059)
2008-07-03Return timed out entries from gencache_get if timeout param != NULLVolker Lendecke1-10/+15
net cache get was the only one interested in the timeout. That single caller can take care of the timeout itself then. With this API change idmap_cache.c can be converted to gencache. (This used to be commit 2954b2be563149380e1fae7fe088b98d6cbd42e7)