1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00
Commit Graph

76 Commits

Author SHA1 Message Date
Rusty Russell
d6251996fa tdb_transaction_cancel: ignore return value.
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-20 11:18:35 +02:00
Rusty Russell
2b1452b2fc tdb_transaction_commit: check returns for 0, not -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-20 11:18:35 +02:00
Rusty Russell
1078eb21c4 tdb_delete: check returns for 0, not -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-20 11:18:35 +02:00
Rusty Russell
058c4f8492 tdb_fetch_compat: use instead of tdb_fetch.
This is a noop for tdb1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:35 +02:00
Rusty Russell
7deeacae2b gencache: don't use CLEAR_IF_FIRST as fallback.
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-04-19 12:06:05 +09:30
Günther Deschner
d8cfca3a9b s3: only include tdb headers where needed.
Guenther
2011-05-06 10:48:10 +02:00
Jeremy Allison
e131c94ac1 More const fixes for compiler warnings from the waf build. 2011-05-05 23:56:07 +02:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Günther Deschner
739ca0e7db s3-includes: only include system/glob.h when needed.
Guenther
2011-03-30 01:13:06 +02:00
Stefan Metzmacher
d9be7e9368 s3:lib/gencache: fix memory leak in error path
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed Dec 22 15:08:30 CET 2010 on sn-devel-104
2010-12-22 15:08:30 +01:00
Volker Lendecke
1a91fe90b6 s3: Add gencache_iterate_blobs 2010-11-28 14:19:19 +01:00
Volker Lendecke
62afdb9cc0 s3: Convert gencache_get_data_blob to gencache_parse 2010-11-28 14:19:19 +01:00
Volker Lendecke
9843103b7d s3: Add gencache_parse 2010-11-28 14:19:19 +01:00
Jeremy Allison
f98d217514 Change to using TDB_INCOMPATIBLE_HASH (the jenkins hash) on all
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-09-27 17:18:54 -07:00
Volker Lendecke
4d8a974ddc s3: Use tdb_transaction_start_nonblock in gencache_stabilize
This avoids the thundering herd problem when 5000 smbds exit simultaneously
because the network went down.
2010-03-28 15:25:15 +02:00
Volker Lendecke
d5fd1f2077 Revert "s3: Optimize gencache for smbd exit"
This reverts commit 5ca63676dc59e83ffd9560fdcfa26063f267f283.

That does not fully fix the problem, adding a tdb_transaction_start_nonblock to fix it.
2010-03-28 15:25:15 +02:00
Volker Lendecke
fbdcaa929c s3: Optimize gencache for smbd exit
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
2010-03-24 08:57:29 +01:00
Stefan Metzmacher
909cd2617f s3: let gencache_init() use tdb_check()
If the check fails we try to clear the tdb and start
with an empty cache.

metze
2009-12-07 19:57:01 +01:00
Günther Deschner
f35a1b95aa s3-gencache: restore gencache_get behavior with NULL args (with torture test).
Without this, we panic in wins_srv_is_dead() and fail to start nmbd with
wins support.

Volker, please check.

Guenther
2009-11-02 13:04:26 +01:00
Volker Lendecke
2185490176 s3:gencache: Add my copyright 2009-09-28 19:47:19 +02:00
Volker Lendecke
cd749ef8bd s3:gencache: Make gencache_del() return success for expired entries
This fixes nasty error messages from "net cache flush"
2009-09-23 18:50:33 +02:00
Volker Lendecke
aece84f22d s3:gencache: Remove some over-paranoid locking 2009-09-23 18:50:33 +02:00
Volker Lendecke
76d95b9a2d s3:gencache: Add a "was_expired" argument to gencache_get_data_blob
This is set to true if the routine returns failure due to an existing but
expired entry.
2009-09-23 18:50:33 +02:00
Volker Lendecke
76705d10c6 Consolidate gencache also every 100 writes in a single process 2009-07-15 10:55:20 +02:00
Volker Lendecke
3d7dfc1197 Consolidate string and data_blob routines in gencache 2009-07-15 10:55:20 +02:00
Volker Lendecke
8a17cd810f Make gencache more stable
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-15 10:55:20 +02:00
Volker Lendecke
3edcd55bf1 Remove gencache_init/shutdown
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-15 10:55:20 +02:00
Volker Lendecke
e5a34b2533 Remove gencache_[un]lock_key 2009-07-15 10:55:20 +02:00
Volker Lendecke
3e965d017d TDB_CONTEXT -> "struct tdb_context" 2009-07-15 10:55:19 +02:00
Volker Lendecke
565046891f Replace ASSERTs in gencache with "return false"
It's a bit strong to panic here I think.
2009-07-15 10:55:19 +02:00
Volker Lendecke
eaec865148 simplify gencache_iterate a bit, fix nonempty blank lines 2009-01-19 00:05:56 +01:00
Volker Lendecke
cc78ea5d09 Revert "Return timed out entries from gencache_get if timeout param != NULL"
This reverts commit 2954b2be56.
(This used to be commit 77ab2fb306)
2008-07-11 17:53:25 +02:00
Volker Lendecke
d670d0a09b Revert "Remove gencache_[un]lock_entry"
This reverts commit 7a5a575ffe.
(This used to be commit 62e444dd50)
2008-07-11 17:53:25 +02:00
Volker Lendecke
352b5c1857 Remove gencache_[un]lock_entry
Günther agreed that it might be unnecessary in dsgetdcname_cache_store() :-)
(This used to be commit 7a5a575ffe)
2008-07-03 16:40:46 +02:00
Volker Lendecke
c4503f5658 Return timed out entries from gencache_get if timeout param != NULL
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 2954b2be56)
2008-07-03 15:59:19 +02:00
Günther Deschner
077f24e51e gencache: add some const.
Guenther
(This used to be commit ec9f8c4cf6)
2008-05-08 01:10:54 +02:00
Volker Lendecke
3176392878 Fix some warnings
warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result
(This used to be commit ad37b7b0ae)
2008-02-25 16:09:26 +01:00
Volker Lendecke
3ba59d4616 don't store cache_readonly in gencache
tdb won't allow us to write anyway
(This used to be commit 069cd6d63a)
2007-12-28 17:09:57 +01:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Günther Deschner
2af9637925 r24733: Add support for storing DATA_BLOBs in gencache.tdb (including torturetest).
Mimir, please have a look. DATA_BLOBs will now just show up as "DATA_BLOB"
values with "net cache list".

Guenther
(This used to be commit b8ad546d04)
2007-10-10 12:30:15 -05:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Stefan Metzmacher
bc2b6436d0 r22009: change TDB_DATA from char * to unsigned char *
and fix all compiler warnings in the users

metze
(This used to be commit 3a28443079)
2007-10-10 12:19:00 -05:00
Stefan Metzmacher
8960af9558 r21976: make use of tdb_*_bystring() and string_term_tdb_data() in lib/
to avoid creating the TDB_DATA struct from strings "by hand"

metze
(This used to be commit c22b86595a)
2007-10-10 12:18:54 -05:00
Günther Deschner
1e86361080 r19415: oh la la, always compile before commit, I'm very sorry.
Guenther
(This used to be commit bdd2e0361c)
2007-10-10 12:15:33 -05:00
Günther Deschner
9034063617 r19414: gencache is getting really important now, make sure that lp_lockdir
always exists so that the gencache.tdb can get created there.

Guenther
(This used to be commit e5ed286125)
2007-10-10 12:15:33 -05:00
Jeremy Allison
b96aae779b r19054: Callers of gencache may not have the rights to
open read/write. Allow them to fallback to read-only.
Jeremy
(This used to be commit ec526e1b88)
2007-10-10 12:15:06 -05:00
Volker Lendecke
eab60e2bb1 r18312: Change gencache_get slightly: Delete expired keys, and only strdup the value
if a valid entry was found. The newer calls got the latter one wrong, change
the older calls.

Volker
(This used to be commit 554e68887b)
2007-10-10 11:51:19 -05:00
Volker Lendecke
cfefd8fd78 r18311: Simplify gencache_get by using strtol instead of sscanf
(This used to be commit f6497adac6)
2007-10-10 11:51:19 -05:00
Volker Lendecke
96c72e2f81 r18310: Add a little test for some gencache routines
Remove unused gencache_set_only
Use CONST_DISCARD instead of SMB_STRDUP

Volker
(This used to be commit 651e7e44e2)
2007-10-10 11:51:19 -05:00