1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

55 Commits

Author SHA1 Message Date
Rusty Russell
398d0c2929 lib/tdb: don't overwrite TDBs with different version numbers.
In future, this may happen, and we don't want to clobber them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-08-28 13:43:05 +10:00
Jeremy Allison
4fc9f9c3f9 Add define guards around otherwise unused variable.
Jeremy.
2009-08-06 11:47:08 -07:00
Rusty Russell
252f7da702 There is one signedness issue in tdb which prevents traverses of TDB records
over the 2G offset on systems which support 64 bit file offsets.  This fixes
that case.

On systems with 32 bit offsets, expansion and fcntl locking on these records
will fail anyway.  SAMBA already does '#define _FILE_OFFSET_BITS 64' in
config.h (on my 32-bit x86 Linux system at least) to get 64 bit file offsets.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-08-06 13:13:42 +10:00
Rusty Russell
a207cca1d3 tdb: don't alter tdb->flags in tdb_reopen_all()
The flags are user-visible, via tdb_get_flags/add_flags/remove_flags.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-07-31 14:40:28 +02:00
Rusty Russell
3b2f074bda tdb: Reimplementation of Metze's "lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() should be a noop".
This version just wraps the reopen code, so we still re-grab the lock and do
the normal sanity checks.

The reason we do this at all is to avoid global fd limits, see:
http://forums.fedoraforum.org/showthread.php?t=210393

Note also that this whole reopen concept is fundamentally racy: if the parent
goes away before the child calls tdb_reopen_all, the database can be left
without an active lock and another TDB_CLEAR_IF_FIRST opener will clear it.
A fork_with_tdbs() wrapper could use a pipe to solve this, but it's hardly
elegant (what if there are other independent things which have similar needs?).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-07-31 14:40:28 +02:00
Rusty Russell
fa91bc6719 tdb: Revert "lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() should be a noop"
This reverts commit e17df483fb.

tdb_reopen_all also restores the active lock, required for TDB_CLEAR_IF_FIRST.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-07-31 14:40:28 +02:00
Rusty Russell
36c0f0f99a realloc() has that horrible overloaded free semantic when size is 0:
current code does a free of the old record in this case, then fail.
2009-07-30 13:10:33 -07:00
Rusty Russell
a88c281ddc If the record is at the end of the database, pretending it has length 1
might take us out-of-bounds.  Only pretend to be length 1 for the malloc.
2009-07-30 13:09:33 -07:00
Rusty Russell
760104188d tdb: fix locking error
54a51839ea "Make tdb transaction lock
recursive (samba version)" was broken: I "cleaned it up" and prevented
it from ever unlocking.

To see the problem:
	$ bin/tdbtorture -s 1248142523
	tdb_brlock failed (fd=3) at offset 8 rw_type=1 lck_type=14 len=1
	tdb_transaction_lock: failed to get transaction lock
	tdb_transaction_start failed: Resource deadlock avoided

My testcase relied on the *count* being correct, which it was.  Fixing that
now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael Adam <obnox@samba.org>
2009-07-21 10:21:53 +02:00
Rusty Russell
54a51839ea Make tdb transaction lock recursive (samba version)
This patch replaces 6ed27edbcd and
1a416ff13c, which fixed the bug where traversals
inside transactions would release the transaction lock early.

This solution is more general, and solves the more minor symptom that nested
traversals would also release the transaction lock early.  (It was also suggestd in
Volker's comment in 6ed27ed).

This patch also applies to ctdb, if the traverse.c part is removed (ctdb's tdb
code never received the previous two fixes).

Tested using the testsuite from ccan (adapted to the samba code).  Thanks to
Michael Adam for feedback.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael Adam <obnox@samba.org>
2009-07-20 22:17:20 +02:00
Björn Jacke
cdf025f012 tdb: fix define of tdbdir when srcdir != "." 2009-07-03 18:24:42 +02:00
Simo Sorce
7119241c0d Sort the signature files 2009-07-03 08:45:30 -04:00
Jelmer Vernooij
43b7a0e34e tdb: Fix help string in configure flag to enable Python bindings. 2009-06-17 21:12:50 +02:00
Simo Sorce
ac1d311e9c fix release scripts to always git clean
This makes sure we do not include foreign object files or other
build byproducts by mistake.
2009-06-17 14:18:03 -04:00
Simo Sorce
7aee9f92e7 Add exports file and abi checker for tdb
This is a first attempt at exporting symbols only for public functions
We also provide a rudimentary ABI checker that tries to check that
function signatures are not changed by mistake.
Given our use of macros this is not an API checker.
It's all based on tdb.h contents and the gcc -aux-info option
2009-06-15 16:31:12 -04:00
Simo Sorce
57ba31ca96 Add option to --disable-python on build 2009-06-15 16:31:11 -04:00
Slava Semushin
497b9e460b lib/tdb/tools/tdbtorture.c: fixed memory leak.
Found by cppcheck:
[lib/tdb/tools/tdbtorture.c:326]: (error) Memory leak: pids
2009-06-06 22:33:39 +02:00
Andrew Tridgell
a6cc04a200 overallocate all records by 25%
This greatly reduces the fragmentation of databases where records
tend to grow slowly by a small amount each time. The case where this
is most seen is the ldb index records. Adding this overallocation
reduced the size of the resulting database by more than 20x when
running a test that adds 10k users.
2009-06-01 13:13:07 +10:00
Andrew Tridgell
a386173fa1 auto-repack in transactions that expand the tdb
The idea behind this is to recover from badly fragmented free
lists. Choosing the point where the file expands is fairly arbitrary,
but seems to work well.
2009-06-01 13:11:39 +10:00
Andrew Tridgell
08be1420ba fixed tdbbackup to give tdb error messages 2009-05-28 17:35:12 +10:00
Andrew Tridgell
5ab03dbecc Merge branch 'master' of ssh://git.samba.org/data/git/samba 2009-05-28 16:12:34 +10:00
Andrew Tridgell
4b4fec65db make TDB_NOSYNC affect all the fsync/msync calls in transactions
During a transaction commit tdb normally uses fsync/msync calls to
make it crash safe. This can be disabled using the TDB_NOSYNC flag,
but it wasn't disabling all the code paths that caused a fsync/msync.
2009-05-28 16:08:28 +10:00
Tim Prouty
c299833bf8 tdb: Fix some recently introduced warnings in tdbtool 2009-05-27 13:18:12 -07:00
Andrew Tridgell
e15027155d added some more speed tests to tdbtool
This adds 3 simple speed tests to tdbtool, for transaction store,
store and fetch.

On my laptop this shows transactions costing about 10ms
2009-05-26 09:24:37 +10:00
Jim McDonough
a91bcbccf8 Detect tight loop in tdb_find() 2009-05-21 16:29:48 -04:00
Jelmer Vernooij
6230eb94af Update copies of config.guess and config.sub. 2009-05-16 04:03:12 +02:00
Simo Sorce
d52172654c Update tdb and talloc web pages 2009-05-05 19:04:39 -04:00
Simo Sorce
b58abb262c Add release scripts for talloc and tdb 2009-05-05 09:51:00 -04:00
Tim Prouty
42c0931441 tdb: Remove unused variable 2009-03-31 16:24:07 -07:00
Andrew Tridgell
7a5e6940cf up the version to 1.1.4 with the addition of
tdb_transaction_prepare_commit()
2009-03-31 15:06:23 +11:00
Andrew Tridgell
84547b8dba added basic testing of tdb_transaction_prepare_commit() in tdbtorture 2009-03-31 13:59:03 +11:00
Howard Chu
b90863c0b7 Add tdb_transaction_prepare_commit()
Using tdb_transaction_prepare_commit() gives us 2-phase commits. This
allows us to safely commit across multiple tdb databases at once, with
reasonable transaction semantics

Signed-off-by: tridge@samba.org
2009-03-31 13:15:54 +11:00
Stefan Metzmacher
e17df483fb lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() should be a noop
The reason for tdb_reopen_all() is that the seek pointer on fds are shared between
parent and child.

metze
2009-02-25 13:57:11 -08:00
Stefan Metzmacher
e6bb55c3d5 lib/tdb: don't generate a static library for the samba4 build
We also don't do this for talloc and ldb.

metze
2009-02-03 10:24:38 +01:00
Stefan Metzmacher
662e05f7a9 lib/tdb: the python bindings don't use swig anymore
metze
2009-02-02 15:16:08 +01:00
Tim Prouty
2c2545d45a s3 build: Remove unused fstat check to fix a bunch of HAVE_FSTAT warnings 2009-01-30 14:41:07 -08:00
Stefan Metzmacher
3718cf294a lib/tdb: include replace.h and system/filesys.h in pytdb.c
This fixes the build on Tru64.

metze
2009-01-30 19:38:59 +01:00
Jelmer Vernooij
ba5d6e6d70 Avoid using a utility header for Python replacements included in Samba,
since this will not be shipped with talloc/tdb/tevent/etc.
2009-01-08 12:20:20 +01:00
Tim Prouty
61a23c5eea s3/s4 build: Fix Py_RETURN_NONE to work with python versions < 2.4 2009-01-07 15:03:16 -08:00
Jelmer Vernooij
d2c70d24e1 py: Properly increase the reference counter of Py_None. 2009-01-06 04:13:57 +01:00
Jeremy Allison
07e0094365 Fix all warnings in source3 with gcc4.3.
Jeremy.
2008-12-31 18:06:57 -08:00
Jelmer Vernooij
22703bf3ff standalone: Use more variables, preparing to include these files from main
Samba 4 makefile.
2008-12-23 19:44:11 +01:00
Jelmer Vernooij
6704c27a78 Fix standalone build of tdb python module, update ignores for standalone tdb. 2008-12-22 23:39:30 +01:00
Jelmer Vernooij
6fe6983e4c Make sure to not close tdb database more than once. 2008-12-18 20:42:50 +00:00
Jelmer Vernooij
8c1ede0b32 Remove swig use from tdb standalone build. 2008-12-18 19:49:53 +00:00
Jelmer Vernooij
2da551bbcc Implement missing functions in pytdb. 2008-12-18 19:41:02 +00:00
Jelmer Vernooij
2a61fd41e9 Add simple manually written replacement for the tdb module. 2008-12-18 18:57:21 +00:00
Tim Prouty
e48a5cd5d4 s3/s4: Fix "shadows a global declaration" warning 2008-12-16 08:34:53 -08:00
Holger Hetterich
42366bcbbd Added a simple tdb integrity check to tdbtool. The command "check" runs traverse on the currently open tdb, and returns the number of entries if the integrity check is successful. 2008-12-16 13:58:48 +01:00
Andrew Tridgell
936d76802f imported the tdb_repack() code from CTDB
The tdb_repack() function repacks a TDB so that it has a single
freelist entry. The file doesn't shrink, but it does remove all
freelist fragmentation. This code originated in the CTDB vacuuming
code, but will now be used in ldb to cope with fragmentation from
re-indexing
2008-12-16 14:38:17 +11:00