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

120 Commits

Author SHA1 Message Date
Simo Sorce
2d24073e97 Fix release script with newer versins of git
(cherry picked from commit 4334092cba)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 093f57a2c00f2d629a3b58e58202f1a7e1bbd406)
2009-12-16 08:03:54 +01:00
Matthias Dieter Wallnöfer
6e3a572135 tdb tools: Mostly cosmetic adaptions
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from samba commit 9776cb0345)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit d1873bd81bfc9f486b88f3a38c65c7de8f5a0909)
2009-12-16 08:03:54 +01:00
Stefan Metzmacher
859ffb09b6 tdb: change version to 1.2.0 after adding TDB_*ALLOW_NESTING
metze
(cherry picked from samba commit 5ca0a4bfd6)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 04aeac728f56c65b973762f09977de1b1b99099e)
2009-12-16 08:03:54 +01:00
Stefan Metzmacher
5cbf0183f3 tdb: add TDB_DISALLOW_NESTING and make TDB_ALLOW_NESTING the default behavior
We need to keep TDB_ALLOW_NESTING as default behavior,
so that existing code continues to work.

However we may change the default together with a major version
number change in future.

metze
(cherry picked from samba commit 3b9f19ed91)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit c1c0ede32dc00ed619d1cf5fda40a9de43995f3a)
2009-12-16 08:03:54 +01:00
Stefan Metzmacher
b768146ef5 tdb: always set tdb->tracefd to -1 to be safe on goto fail
metze
(cherry picked from samba commit 85449b7bcc)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 855391c1e37012b0d6c673a304bb8da8a1efcd72)
2009-12-16 08:03:53 +01:00
Volker Lendecke
e0f59b0a19 tdb: Fix a C++ warning (cherry picked from samba commit be88a126ea)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 6126f04bd4982b66564dcccd92a15baf9cb856f3)
2009-12-16 08:03:53 +01:00
Kirill Smelkov
a96af9815b tdb: update README a bit
While studying tdb, I've noticed a couple of mismatches between readme
and actual code:

- tdb_open_ex changed it's log_fn argument to log_ctx
- there is now no tdb_update(), which it seems was transformed into
  non-exported tdb_update_hash()

There were other mismatches, but I don't remember them now, sorry.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit 83de5c8263)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 7a88f1df9190674deaf5dcbedad02ae4120a5263)
2009-12-16 08:03:53 +01:00
Kirill Smelkov
ad6e28c032 tdb: add tests for double .close() in pytdb
The reason I do it is that when using older python-tdb as shipped in
Debian Lenny, python interpreter crashes on this test:

    (gdb) bt
    #0  0xb7f8c424 in __kernel_vsyscall ()
    #1  0xb7df5640 in raise () from /lib/i686/cmov/libc.so.6
    #2  0xb7df7018 in abort () from /lib/i686/cmov/libc.so.6
    #3  0xb7e3234d in __libc_message () from /lib/i686/cmov/libc.so.6
    #4  0xb7e38624 in malloc_printerr () from /lib/i686/cmov/libc.so.6
    #5  0xb7e3a826 in free () from /lib/i686/cmov/libc.so.6
    #6  0xb7b39c84 in tdb_close () from /usr/lib/libtdb.so.1
    #7  0xb7b43e14 in ?? () from /var/lib/python-support/python2.5/_tdb.so
    #8  0x0a038d08 in ?? ()
    #9  0x00000000 in ?? ()

master's pytdb does not (we have a check for self->closed in obj_close()),
but still...

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit 71a21393dd)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 03372b4ea8ba2938468a5c0fc234d604966ce070)
2009-12-16 08:03:53 +01:00
Kirill Smelkov
5ea8bd3851 tdb: reset tdb->fd to -1 in tdb_close()
So that erroneous double tdb_close() calls do not try to close() same
fd again. This is like SAFE_FREE() but for fd.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit b4424f8234)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit f5c992bdaeb73ef726ff4728a9922721474cd6f5)
2009-12-16 08:03:53 +01:00
Kirill Smelkov
8af1b8bf96 tdb: fix typo in python's Tdb.get() docstring
It's Tdb.get(), not Tdb.fetch().

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit cfed5f946d)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 76aacdd8e1106f26565e25903091a757b59cd7e2)
2009-12-16 08:03:53 +01:00
Andrew Tridgell
a51ad4a3be tdb: detect tdb store of identical records and skip
This can help with ldb where we rewrite the index records
(cherry picked from samba commit d4c0e8fdf0)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 470750fa2e3cf987f10de48451b1ee13aab03907)
2009-12-16 08:03:52 +01:00
Stefan Metzmacher
2b10c14e35 tdb: rename 'struct list_struct' into 'struct tdb_record'
metze
(cherry picked from samba commit 3b62e250c0)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 03b3682e3fa53c9f5fdf2c4beac8b5d030fd2630)
2009-12-16 08:03:52 +01:00
Rusty Russell
f836eeb79b lib/tdb: make tdbtool use tdb_check() for "check" command
Also, set logging function so we get more informative messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(cherry picked from samba commit 0944931159)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 6ac7ef8bf4d384f880c7f483ace70f8e08c15a8b)
2009-12-16 08:03:52 +01:00
Rusty Russell
b0a4a82370 lib/tdb: add tdb_check()
ctdb wants a quick way to detect corrupt tdbs; particularly, tdbs with
loops in their hash chains.  tdb_check() provides this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(cherry picked from samba commit 022b4d4aa6)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit df1a3ce0380fa9d8722b2f9b16f65557095e4c83)
2009-12-16 08:03:52 +01:00
Kirill Smelkov
b4bb5257f6 tdb: kill last bits from swig
We no longer use swig for pytdb, so there is no need for swig make
rules. Also pytdb.c header should be updated.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit ecbe5ebd8d)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 27611d6a0c313732e438cb24c82b9de126e50156)
2009-12-16 08:03:52 +01:00
Stefan Metzmacher
42d131d951 lib/tdb: sync build files from samba master
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 1d5c5a221c28f1dc652a80ed516a0f18ba588d9f)
2009-12-16 08:03:52 +01:00
Stefan Metzmacher
4576b9aae8 s3 build: Remove unused fstat check to fix a bunch of HAVE_FSTAT warnings (cherry picked from samba commit 2c2545d45a)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit c40d14b1b7ba7c9ae40c0306a2e552504e0f92a6)
2009-12-16 08:03:51 +01:00
Stefan Metzmacher
a60db0255b lib/tdb: include replace.h and system/filesys.h in pytdb.c
This fixes the build on Tru64.

metze
(cherry picked from samba commit 3718cf294a)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 5652e403be099f35cdd29fda8ba4fe2c35de8035)
2009-12-16 08:03:51 +01:00
Stefan Metzmacher
c0131bbcc7 Avoid using a utility header for Python replacements included in Samba, since this will not be shipped with talloc/tdb/tevent/etc. (cherry picked from samba commit ba5d6e6d70)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit da47169c4d3bc1b446b49610d892df05638e912c)
2009-12-16 08:03:51 +01:00
Stefan Metzmacher
c5827f2c2d s3/s4 build: Fix Py_RETURN_NONE to work with python versions < 2.4 (cherry picked from samba commit 61a23c5eea)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 4130c5dd10869b071124e2bf04d6807bbb11ab1f)
2009-12-16 08:03:51 +01:00
Stefan Metzmacher
31bc9f3ee1 py: Properly increase the reference counter of Py_None. (cherry picked from samba commit d2c70d24e1)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit e7242221c3318a5c312e17ff4074bef80b639ca8)
2009-12-16 08:03:51 +01:00
Jelmer Vernooij
fc9d260310 Make sure to not close tdb database more than once. (cherry picked from samba commit 6fe6983e4c)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 52f78e040749d24058ee1f575d949b57d15f5987)
2009-12-16 08:03:51 +01:00
Jelmer Vernooij
c9907f2634 Implement missing functions in pytdb. (cherry picked from samba commit 2da551bbcc)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 3a671b11770057c91e0ae646499d4714f52bc5c0)
2009-12-16 08:03:51 +01:00
Stefan Metzmacher
50ceb83180 Add simple manually written replacement for the tdb module. (cherry picked from samba commit 2a61fd41e9)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 2231ee0aa163d68383dd9636f25f033fe7c1f3e7)
2009-12-16 08:03:50 +01:00
Jelmer Vernooij
4c69b5e0fd tdb: Add simple reimplementation of tdbdump in Python as an example of the tdb Python bindings. (This used to be commit 47d797f788) (cherry picked from samba commit 6bdd1425b7)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 363c34d4bb488609317794cd3153d85c12643110)
2009-12-16 08:03:50 +01:00
Jeremy Allison
e58068d666 Remove unecessary msync. Jeremy. (cherry picked from samba commit 0bae1ef3de) (This used to be commit db2acaf46f) (cherry picked from samba commit a1cf3ad5d6)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 236dc2fa29b3c0caec51859dbd469f0a13f5917e)
2009-12-16 08:03:50 +01:00
Stefan Metzmacher
61c7444943 The msync manpage reports that msync *must* be called before munmap. Failure to do so may result in lost data. Fix an ifdef check, I really think we meant to check HAVE_MMAP here. (cherry picked from samba commit 74c8575b3f) (This used to be commit 8fd54bb55f) (cherry picked from samba commit b39e332bd7)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 5aa0ab328c36ecd4d7ec03f921e6027340c2ef13)
2009-12-16 08:03:50 +01:00
Volker Lendecke
a3b4f9b59e Attempt to fix bug 5684
With the ctdb checkin dde9f3f006 tdb optimized out write lock checks for
write-enabled transaction. Sadly, this also removed the possibility to ever
remove dead records left over from tdb_delete calls within a transaction.

Tridge, please check this! Did dde9f3f006 have any reason beyond performance
optimizations?

Thanks,

Volker
(cherry picked from samba commit 3f884c4ae3)
(This used to be commit 1d85e0647e)
(cherry picked from samba commit 8c88209c6f)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit b02bf7659f04f1fa203834bd75a2392b48e56c16)
2009-12-16 08:03:50 +01:00
Slava Semushin
06ab3cfe60 lib/tdb/tools/tdbtorture.c: fixed memory leak.
Found by cppcheck:
[lib/tdb/tools/tdbtorture.c:326]: (error) Memory leak: pids
(cherry picked from samba commit 497b9e460b)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 5d4cc4b018a538dc3f1d79fe091f3e6e67003daf)
2009-12-16 08:03:50 +01:00
Andrew Tridgell
3e04b100c1 added basic testing of tdb_transaction_prepare_commit() in tdbtorture (cherry picked from samba commit 84547b8dba)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 923b61fe722c0aec8a5b6ac8dd1df74957dc102b)
2009-12-16 08:03:50 +01:00
Andrew Tridgell
5b6b852691 make tdbbackup use transactions
tdbbackup was originally written before we had transactions, and it
attempted to use its own fsync() calls to make it safe. Now that we
have transactions we can do it in a much safer (and faster!) fashion
(cherry picked from samba commit 2e4247782b)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit cd23d36ada9631095ca68663516de0c8d8c3bbed)
2009-12-16 08:03:49 +01:00
Andrew Tridgell
6eaaa52a1d fixed tdbbackup to give tdb error messages (cherry picked from samba commit 08be1420ba)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 3d44412593b8748a5158e15b83cd9eb548231194)
2009-12-16 08:03:49 +01:00
Rusty Russell
b52a06ffc6 lib/tdb: add -t (always use transactions) option to tdbtorture
This means you can kill it at any time and expect no corruption.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(cherry picked from samba commit 0fc6800005)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit f7278a277ed91587cae5b5e3660dad7124bdb73f)
2009-12-16 08:03:49 +01:00
Rusty Russell
8dcc760f1e lib/tdb: wean off TDB_ERRCODE.
It was a regrettable hack which I used to reduce line count in tdb; in fact it caused confusion as can be seen in this patch.
In particular, ecode now needs to be set before TDB_LOG anyway, and having it exposed in
the header is useless (the struct tdb_context isn't defined, so it's doubly useless).
Also, we should never set errno, as io.c was doing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(cherry picked from samba commit b77f41d58b)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit a6620f6e74aadc708395b21b42303d1082192fcc)
2009-12-16 08:03:49 +01:00
Rusty Russell
7f857c4d14 lib/tdb: TDB_TRACE support (for developers)
When TDB_TRACE is defined (in tdb_private.h), verbose tracing of tdb operations is enabled.
This can be replayed using "replay_trace" from http://ccan.ozlabs.org/info/tdb.

The majority of this patch comes from moving internal functions to _<funcname> to
avoid double-tracing.  There should be no additional overhead for the normal (!TDB_TRACE)
case.

Note that the verbose traces compress really well with rzip.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit 703004340c)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit b01b756cb577f32a1ec4597efb00017241e01685)
2009-12-16 08:03:49 +01:00
Andrew Tridgell
805ef91707 tdb: fixed the intermittent failure of tdbtorture in the build farm
There was a race condition that caused the torture.tdb to be left in a
state that needed recovery. The torture code thought that any message
from the tdb code was an error, so the "recovered" message, which is a
TDB_DEBUG_TRACE message, marked the run as being an error when it
isn't.
(cherry picked from samba commit 5dcf0069b6)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 43c97b259b19c42b4edc7f83dbfc5e486568b4e3)
2009-12-16 08:03:49 +01:00
Michael Adam
8fd54bbbe1 tdb:tdbtool: fix indentation.
Michael
(cherry picked from samba commit e440a2e11e)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit c1b8d32b4ef87b9d8f37b451f47fcee2ea753d21)
2009-12-16 08:03:48 +01:00
Stefan Metzmacher
42648556a6 Fix all warnings in source3 with gcc4.3. Jeremy. (cherry picked from samba commit 07e0094365)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit e4d49c182e12c2d429d0414209cc2c8ccc19dc91)
2009-12-16 08:03:48 +01:00
Tim Prouty
a04fecb1c2 s3/s4: Fix "shadows a global declaration" warning (cherry picked from samba commit e48a5cd5d4)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 94f5728a77b8c772fb16c4744c24b45de8016e52)
2009-12-16 08:03:48 +01:00
Tim Prouty
c8366fcfb4 tdb: Fix some recently introduced warnings in tdbtool (cherry picked from samba commit c299833bf8)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 5830a2427b84e1cce74390b58fe12c45b5a056a6)
2009-12-16 08:03:48 +01:00
Andrew Tridgell
e0bed62820 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
(cherry picked from samba commit e15027155d)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 463279c972fa4538919bdd1dff48ca6b2fb8d49c)
2009-12-16 08:03:48 +01:00
Michael Adam
886cb3e86d tdb:tdbtool: add transaction_start/_commit/_cancel commands.
So one can perform tdbtool operations protected by transactions.

Michael
(cherry picked from samba commit 91e1bab2e9)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 35a5b874b925380f7c227e47aebb590c9db4739e)
2009-12-16 08:03:48 +01:00
Michael Adam
168bb40b4b tdb:tdbtool: add the "speed" command to the help text.
Michael
(cherry picked from samba commit 817383d88d)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit dc287a7d7420cca0b104049e689a73202bc535f8)
2009-12-16 08:03:47 +01:00
Holger Hetterich
0a0281444d 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. (cherry picked from samba commit 42366bcbbd)
Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 02b35ba77672727c96ad004be37c7f6f1d3fe474)
2009-12-16 08:03:47 +01:00
Andrew Tridgell
09f7874151 tdb: allow reads after prepare commit
We previously only allowed a commit to happen after a prepare
commit. It is in fact safe to allow reads between a prepare and a
commit, and the s4 replication code can make use of that, so allow it.
(cherry picked from samba commit 46c99ec2a3)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 5ef5ddb8369e5e76173285fe9a08498dc8dc73ab)
2009-12-16 08:03:46 +01:00
Michael Adam
d05b49aaf2 tdb:mksigs: allow PRINTF_ATTRIBUTE(..) macros function types as funcion args
Michael
(cherry picked from samba commit 55dcf928eb)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit ef1dc585d869a9e48164cd65bafc92c1da245007)
2009-12-16 08:03:46 +01:00
Michael Adam
ab37ff7c04 tdb:mksigs: normalize bool -> _Bool
Michael
(cherry picked from samba commit cfa4e7ec75)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 0ae735b7a2096a40e5e47086ec41d9d45ef6d36b)
2009-12-16 08:03:46 +01:00
Michael Adam
a0dba36390 tdb:mksigs: ignore symbols (like _DEPRECATED_) after closing function parentheses
Michael
(cherry picked from samba commit 25939a627f)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 2e69647404c87c438ae7c180277ac3b532941efd)
2009-12-16 08:03:46 +01:00
Michael Adam
6d9ce0ef50 tdb:mksigs: correctly ignode multiline function typedefs
by first concatenating multilint parentheses and removing typefes afterwards.

Michael
(cherry picked from samba commit 13bfcd5a93)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 37225f1ed3f70d7259c2af2c51c671105c34476a)
2009-12-16 08:03:46 +01:00
Michael Adam
67da31e222 tdb:mksigs: ignore struct forward declarations.
Michael
(cherry picked from samba commit ecd12bfb38)

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 66fffa577e051212ac7541be906b6c80f4a7c0c9)
2009-12-16 08:03:45 +01:00