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

360 Commits

Author SHA1 Message Date
Volker Lendecke
b78c282a91 lib: Make ctdbd_parse return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
4636912985 lib: Make ctdbd_migrate return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
210e1fb265 lib: Make ctdbd_db_attach return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-07 23:54:06 +02:00
Volker Lendecke
cc93469a04 lib: Fix CID 1128553 Unchecked return value from library
At the same time, avoid chmod in favor of fchmod

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Oct  6 13:12:48 CEST 2015 on sn-devel-104
2015-10-06 13:12:48 +02:00
Volker Lendecke
025fb48360 lib: Move lp_ctdbd_socket() to cluster_support.c
There we have a #ifdef CTDB_SOCKET anyway

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-03 00:01:11 +02:00
Volker Lendecke
ccd31e0c18 lib: Pass parameters to ctdbd_init_connection()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-03 00:01:11 +02:00
Volker Lendecke
a1187bb873 dbwrap: Remove talloc from dbwrap_watch_record_stored()
This happens on every store to locking.tdb for example, so we should
make it cheap.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Sep 22 07:50:58 CEST 2015 on sn-devel-104
2015-09-22 07:50:57 +02:00
Volker Lendecke
1a8750a2c6 dbwrap: Convert dbwrap_record_watchers_key to not use talloc
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-22 04:51:16 +02:00
Volker Lendecke
2e0e06c3c5 dbwrap: Simplify dbwrap_record_watchers_key()
It took a bit for me to figure out what the rec_key parameter to
dbwrap_record_watchers_key does. I think it's simpler to parse the watcher key
in dbwrap_record_watch_recv to retrieve the watched record key than to store it

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-22 04:51:16 +02:00
Volker Lendecke
9964d60e3e dbwrap: Make dbwrap_db_id return size_t
This will make an on-stack db-id easier

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-22 04:51:16 +02:00
Volker Lendecke
db5b766903 lib: Remove procid_str_static
Replace all callers with direct calls to server_id_str_buf without
talloc_tos()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-04-28 18:11:13 +02:00
Volker Lendecke
de811f14af lib: Remove tdb_compat
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-17 11:30:52 +01:00
Volker Lendecke
cf368cbdc5 lib: Remove tdb_fetch_compat
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-03-17 11:30:52 +01:00
Volker Lendecke
1106ede280 dbwrap_ctdb: Pass on mutex flags to tdb_open
Without this, ctdb can create a tdb file with mutex activated, but the
local tdb_open will not open the tdb due to strict flags checks whether
mutexes are possible.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10922

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sun Nov 16 12:13:54 CET 2014 on sn-devel-104
2014-11-16 12:13:54 +01:00
David Disseldorp
176259f2c4 dbwrap_watch: don't leak lock_path onto talloc tos
Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-11-03 23:46:05 +01:00
Amitay Isaacs
18100b80b9 build: Remove checks for ctdb features
Since we are always building with integrated CTDB, there is no need for
these checks.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-10-28 05:42:04 +01:00
Stefan Metzmacher
64d140197e s3:messaging: make it possible to receive a fd array from another process
In order to receive the fd array the caller needs to use
messaging_filtered_read_send/recv(). For all higher level
methods we silently close/ignore the fd array.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-09-24 08:44:11 +02:00
Volker Lendecke
064dd03223 dbwrap: Print wait times with full precision
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2014-06-27 06:49:10 +02:00
Volker Lendecke
aaaff84b44 dbwrap_ctdb: open locally with TDB_VOLATILE if requested
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-05-24 13:48:14 +02:00
Volker Lendecke
41cf51b774 dbwrap_tdb: Use mutexes on demand
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-05-22 21:05:15 +02:00
Volker Lendecke
8d65512e69 dbwrap: Use messaging_filtered_read
This does not really save any code lines, but IMHO the code is simpler
this way. Also, in case we have lots of watchers this will be slightly
cheaper, because we don't have to re-establish a tevent_req.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-05-08 09:10:12 +02:00
Volker Lendecke
d6db35d7a5 tdb_wrap: Remove tdb_wrap_open_ again
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-31 22:52:14 +02:00
Volker Lendecke
994d75574b dbwrap: Avoid passing lp_ctx to tdb_wrap_open in db_open_ctdb
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-31 22:52:13 +02:00
Stefan Metzmacher
74b359c616 s3:build: remove global CLUSTER_SUPPORT define
All ctdb specific code is isolated in samba-cluster-support.so now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Mon Mar 24 19:08:44 CET 2014 on sn-devel-104
2014-03-24 19:08:44 +01:00
Stefan Metzmacher
e93b85dbd8 s3:wscript: only build ctdb_dummy.c if we have no cluster support
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-03-24 17:09:11 +01:00
Stefan Metzmacher
24054b5f8b s3:param: move lp_ctdbd_socket() to ctdbd_conn.c
This allows us to use CTDB_PATH only in ctdbd_conn.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-03-24 17:09:10 +01:00
Stefan Metzmacher
b2c9921622 s3:lib: move all ctdb related dummy functions to ctdb_dummy.c
This gets all dummy functions for the build without CLUSTER_SUPPORT.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-03-24 17:09:10 +01:00
Michael Adam
925625b528 dbwrap_ctdb: avoid smbd/ctdb deadlocks: check whether we can work locally in db_ctdb_parse_record()
If the same process tries to re-lock the same record
it has already locked, don't go to the ctdbd again.

There are situations where we already have a lock on a record
and then do a dbwrap_parse_record() on that record, for instance
in locking code:

do_lock()
  -> grabs lock on brl record with brl_get_locks()
    -> calls brl_lock()
      -> calls brl_lock_posix or _windows_default()
        -> calls contend_level2_oplocks_begin()
          -> calls brl_locks_get_read_only()
            -> calls dbwrap_parse_record on the same brl record as above

In the local (tdb) case, this is not a problem, because
identical fcntl locks in the same process don't contend each other,
but calling out to ctdb for this lets smbd and ctdb deadlock.

db_ctdb_fetch_lock() already correclty checks first
whether we can simply try to lock locally. But db_ctdb_parse_record()
failed to do so for empty records, i.e. records that only
consist of the ctdb record header. (These can be deleted records
but can also be freshly created and still empty records.)

This patch lets db_ctdb_parse_record() not skip local access
for empty records, hence fixing the deadlock.

PLAN: In the long run, it would be better to solve this
generically on the dbwrap_layer, i.e. root the notion of
an already locked record there, and skip any call to the
db (tdb or ctdb backend) if we have it. This would also
solve the problem for all calls like fetch_locked, parse_record
and possibly others.  But this is the urgent fix for now.

Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Tested-by: Björn Baumbach <bb@sernet.de>
2014-03-03 12:56:38 +01:00
Volker Lendecke
5e07731cf6 dbwrap: Slightly simplify dbwrap_watch_record_stored
We have messaging_send_buf, so there's no point to use an explicit
DATA_BLOB here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Feb 25 23:27:21 CET 2014 on sn-devel-104
2014-02-25 23:27:21 +01:00
Michael Adam
b210e7aade dbwrap: use DBWRAP_LOCK_ORDER_VALID() in db_open()
instead of the hand written test.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Feb  7 18:05:51 CET 2014 on sn-devel-104
2014-02-07 18:05:51 +01:00
Michael Adam
7e766a0a8a dbwrap: add dbwrap_flags argument to dbwrap_local_open()
To be consistent with db_open() and prepare for future
possible extensions.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-02-07 16:06:07 +01:00
Stefan Metzmacher
a20c977c7a dbwrap_open: add 'dbwrap_optimize_readonly:* = yes' option
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-02-07 16:06:06 +01:00
Stefan Metzmacher
a97b588b63 dbwrap_ctdb: implement DBWRAP_FLAG_OPTIMIZE_READONLY_ACCESS
For non-persistent databases we try to use CTDB_CONTROL_SET_DB_READONLY
in order to make use of readonly records.

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2014-02-07 16:06:06 +01:00
Michael Adam
6def1c3f6e dbwrap: add a dbwrap_flags argument to db_open_ctdb()
This is in preparation of directly supporting ctdb read only
record copies when opening a ctdb database from samba.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-02-07 16:06:06 +01:00
Michael Adam
cf0cb0add9 dbwrap: add a dbwrap_flags argument to db_open()
This is in preparation to support handing flags to backends,
in particular activating read only record support for ctdb
databases. For a start, this does nothing but adding the
parameter, and all databases use DBWRAP_FLAG_NONE.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-02-07 16:06:06 +01:00
Volker Lendecke
017609767f dbwrap_watch: Use messaging_read_send/recv
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-01-21 08:11:01 +01:00
Volker Lendecke
5f3ccfc16b messaging3: Add messaging_read_send/recv
This is made to replace the msg_channel abstraction.

msg_channel was created to not miss any messages. For this, some
complex queueing was installed. This complexity has caused quite a
few problems in the past (see bug 10284 for example).

messaging_read_send/recv is able to achieve the same goal with a
lot less complexity. The messaging_read_send atomically installs
the reader into the messaging_context, we will not miss any messages
while this installed. messaging_send_recv will deinstall that
listener, but in the callback function you can directly call
messaging_read_send again without going through the tevent_loop_once.
As long as this is always made sure, no messages will be lost.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-01-21 08:10:41 +01:00
Christof Schmitt
55b431fad5 s3:dbwrap: Use milliseconds for "Held tdb lock" message
This is consistent with the parameter using milliseconds and the other
warnings in the same file also using milliseconds.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jan 16 11:19:39 CET 2014 on sn-devel-104
2014-01-16 11:19:39 +01:00
Christof Schmitt
32f232d9ad s3:dbwrap: Store warning thresholds in db_ctdb_ctx
Avoid the parameter lookup for the warning thresholds in the hot code
path by reading them in db_open_ctdb and storing them in the
db_ctdb_ctx.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-01-16 09:18:45 +01:00
Christian Ambach
ef239302ed s3:dbwrap include the hashchain in the logs
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-01-16 09:18:45 +01:00
Christian Ambach
63a8f7e441 s3:dbwrap report time for chainlock and CTDB migrate
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-01-16 09:18:45 +01:00
Volker Lendecke
b64abab807 dbwrap_ctdb: Instrument chainunlock timing
We need an indication whether we run into the fcntl thundering
herd. fcntl unlock should be blindingly fast in the normal case. If it
takes longer than 5 milliseconds, warn. The timeout can be adapted by
setting

ctdb:unlock_warn_threshold = <number-of-milliseconds>

Reviewed-by: Christof Schmitt <cs@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
2014-01-16 09:18:45 +01:00
Volker Lendecke
34bfd0b6d2 ctdb_conn: Log long fetch_lock calls
With this patch, the number of fetch_lock attempts before dbwrap_ctdb
logs that it took x attempts to get a record is configurable with

net conf setparm global ctdb:migrate_attempts 10

This patch also adds

net conf setparm global ctdb:migrate_duration 5000

to trigger the same log message if it took longer than x milliseconds
to retrieve a record.

Reviewed-by: Christof Schmitt <cs@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
2014-01-16 09:18:45 +01:00
Volker Lendecke
1cae59ce11 dbwrap_ctdb: Treat empty records as non-existing
This is a patch implementing the workaround Christian mentioned in
https://bugzilla.samba.org/show_bug.cgi?id=10008#c5

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10008
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
2013-08-28 23:37:08 +02:00
Christian Ambach
9910b8050c s3:lib/dbwrap add missing curly braces
violation of README.Coding

Signed-off-by: Christian Ambach <ambi@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-05-16 23:22:19 +02:00
Volker Lendecke
e13021e3af dbwrap: Allow dbwrap_record_watch_recv to not lock the record
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26 15:17:23 -07:00
Volker Lendecke
c2b26a43ff dbwrap-ctdb: Avoid a talloc_stackframe()
We have only a single allocation in this routine, so I think we can live
without a stackframe.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-26 11:19:59 +01:00
Volker Lendecke
1409895d9e dbwrap-ctdb: Use ctdbd_parse in db_ctdb_parse_record
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-26 11:19:19 +01:00
Volker Lendecke
bbb4068c93 dbwrap: Use tdb_null in db_ctdb_delete
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>

Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Mon Mar 25 19:42:30 CET 2013 on sn-devel-104
2013-03-25 19:42:30 +01:00
Michael Adam
ff65500f2b s3:dbrwap_ctdb: ZERO_STRUCT(rec) just to be sure in traverse_persistent_callback_read()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-04 17:14:22 +01:00
Michael Adam
3949854549 s3:dbwrap_ctdb: ZERO_STRUCT(rec) just to be sure in traverse_read_callback()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-04 17:14:22 +01:00
Stefan Metzmacher
a09f3a3551 s3:dbwrap_ctdb: add "db_context" to "db_record"
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-04 17:14:22 +01:00
Stefan Metzmacher
25bdab9c61 s3:dbwrap_ctdb: setup result->name in db_open_ctdb()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-04 17:14:22 +01:00
Volker Lendecke
aea49ed37a dbwrap: Use INCOMPATIBLE_HASH for dbwrap_watchers.tdb
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-11 17:10:48 +01:00
Volker Lendecke
2f38a77a2d dbwrap: Do not rely on dbwrap_record_get_value to return a talloc object
db_tdb_fetch_locked returns the value as part of a larger talloc object
that also contains the key.  This means we can not realloc, but have to
freshly alloc.

Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Nov 29 20:21:51 CET 2012 on sn-devel-104
2012-11-29 20:21:50 +01:00
Volker Lendecke
343ce16e0b s3: Remove db_ctdb_fetch
Note that this also makes the request for read only copies
much more explicity visible in the code.

Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:18:49 +01:00
Volker Lendecke
6b8a37f5ca s3: Directly parse local existing records in db_ctdb_parse_record
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:10:13 +01:00
Volker Lendecke
9dd047d67e s3: Factor out db_ctdb_can_use_local_hdr from db_ctdb_can_use_local_copy
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:08:06 +01:00
Volker Lendecke
55d75a3fbe s3: Remove unused code for fetching persistent ctdb records
The only entry point here is parse_record, and this catches the persistent
case with a direct parse now

Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:07:26 +01:00
Volker Lendecke
7b43362a9e s3: Avoid db_ctdb_fetch for persistent databases
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:05:25 +01:00
Volker Lendecke
93219f92bb s3: Factor out parse_newest_in_marshall_buffer from pull_newest_from_marshall_buffer
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:03:59 +01:00
Volker Lendecke
850d5de967 s3: reduce db_ctdb_marshall_loop_next to specialized db_ctdb_marshall_buf_parse
now that the db_ctdb_marshall_loop_next_key has been factored out.

Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 18:00:02 +01:00
Volker Lendecke
a742b6edd5 s3: Factor out db_ctdb_marshall_loop_next_key from db_ctdb_marshall_loop_next
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 17:55:19 +01:00
Volker Lendecke
664b170b13 s3: Slightly simplify db_ctdb_marshall_loop_next
Both callers give a key argument

Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 17:52:34 +01:00
Volker Lendecke
af608cdd8c s3: Use db_ctdb_ltdb_parse in db_ctdb_fetch_db_seqnum_from_db
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 17:52:02 +01:00
Volker Lendecke
7127344863 s3: Use db_ctdb_ltdb_parse in db_ctdb_ltdb_fetch
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 17:50:36 +01:00
Volker Lendecke
560ed93147 s3: Add db_ctdb_ltdb_parse
Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 17:43:02 +01:00
Volker Lendecke
6e0259d8ec s3: Slightly simplify db_ctdb_transaction_commit
Avoid an unnecessary "else".

Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 17:42:20 +01:00
Volker Lendecke
b206b52748 s3: Remove header==NULL code from db_ctdb_marshall_record
The only call chain (via db_ctdb_marshall_add) has header != NULL

Reviewed-by: Michael Adam <obnox@samba.org>
2012-11-29 17:41:46 +01:00
Volker Lendecke
611675fb37 s3: Fix some blank line endings
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Nov 20 19:18:33 CET 2012 on sn-devel-104
2012-11-20 19:18:33 +01:00
Gregor Beck
bfafb0ce83 s3:dbwrap_ctdb: set errno = ENOSYS if clustering is not supported
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Sep 21 18:05:56 CEST 2012 on sn-devel-104
2012-09-21 18:05:56 +02:00
Volker Lendecke
25bdc36418 s3: Fix a comment
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-09-04 15:15:00 -07:00
Christof Schmitt
424492a963 s3:dbwrap_ctdb: Add DB name and key to warning message
When a operation takes too long, it is useful for debugging to know the
DB and the key.

Signed-off-by: Christian Ambach <ambi@samba.org>
2012-08-31 11:10:14 +02:00
Stefan Metzmacher
ec69eb41bf s3:dbwrap_ctdb: initialize db_record->db
metze
2012-07-31 09:34:20 +02:00
Michael Adam
01863df25d s3_dbrwap_ctdb: improve a comment in db_ctdb_can_use_local_record()
Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
2012-06-29 15:21:21 +02:00
Michael Adam
b46977e4f6 s3:dbwrap_ctdb: fix a comment in db_ctdb_fetch()
Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
2012-06-29 15:21:20 +02:00
Michael Adam
92808a6005 s3:dbwrap_ctdb: expand the comment for the db_ctdb_can_use_local_copy() function
Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
2012-06-29 15:21:19 +02:00
Michael Adam
0a5f363333 s3:dbwrap_ctdb: rename db_ctdb_own_record() -> db_ctdb_can_use_local_copy()
This matches the function's intention much closer, since it
also tests whether we have a valid local read only copy.

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
2012-06-29 15:21:19 +02:00
Michael Adam
d6abf79247 s3:dbrwap_ctdb: remove commented out legacy code 2012-06-29 15:21:18 +02:00
Michael Adam
9d11277337 s3:dbwrap_ctdb: fix fetch/fetch_locked when samba is built against old ctdb
The introduction of read only copies has broken the algorithm for
deteting whether we can use the local record copy for fetch_locked
and fetch: For fetch locked the new code always uses the local copy
if there is one...

This patch re-establish the original algorithm for the build against
a ctdb without read only record copies.

Reported-by: Gregor Beck <gbeck@sernet.de>
2012-06-29 15:21:17 +02:00
Andrew Bartlett
666dba3353 s3-param: Rename loadparm_s3_context -> loadparm_s3_helpers
This helps clarify the role of this structure and wrapper function.

The purpose here is to provide helper functions to the lib/param
loadparm_context that point back at the s3 lp_ functions.  This allows
a struct loadparm_context to be passed to any point in the code, and
always refer to the correct loadparm system.  If this has not been
set, the variables loaded in the lib/param code will be returned.

As requested by Michael Adam.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 27 17:11:16 CEST 2012 on sn-devel-104
2012-06-27 17:11:16 +02:00
Gregor Beck
c71062fcf4 s3:lib:dbwrap: fix return value of db_ctdb_traverse[_read] for non-persistent dbs
to return the number of traversed records upon successful traverse.

Signed-off-by: Michael Adam <obnox@samba.org>
2012-06-27 08:18:17 +02:00
Rusty Russell
9d97bf3f47 dbwrap: dbwrap_local_open()
This simply opens a tdb: it will eventually switch depending on the
extension.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
1acf548eb7 dbwrap: remove get_flags().
The flags returned were TDB-specific: this was only used for detecting
the endianness of obsolete databases (the conversion code was put in in
2003, with reference to Samba 2.3).

It's easier to remove it than to translate the NTDB flags to TDB flags,
and it's a really weird thing to ask for anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Michael Adam
73b200064f s3:util: rename procid_equal() to serverid_equal()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-21 08:27:32 +02:00
Michael Adam
e945511aae move the dbwrap library to the top level
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Mon May 14 04:04:55 CEST 2012 on sn-devel-104
2012-05-14 04:04:55 +02:00
Michael Adam
e96a842527 s3:lib:dbwrap: use [u]int[num]_t consistently in dbwrap_tdb.c 2012-05-13 22:41:49 +02:00
Michael Adam
db7a8bf43c s3:lib:dbwrap: use [u]int[num]_t consistently in dbwrap_rbt.c 2012-05-13 22:41:49 +02:00
Michael Adam
746548401f s3:lib:dbwrap: use [u]int[num]_t consistently in dbwrap_ctdb.c 2012-05-13 22:41:49 +02:00
Michael Adam
03183e3584 s3:lib:dbwrap: use [u]int[num]_t consistently in dbwrap_file.c 2012-05-13 22:41:48 +02:00
Michael Adam
05afaa8361 s3:lib:dbwrap: use [u]int[num]_t consistently in dbwrap_util.c 2012-05-13 22:41:48 +02:00
Michael Adam
508a33fc2a s3:dbwrap: move definition of dbwrap_lock_order to dbwrap.h
This is needed in all of the library, not only in the dbwrap_open part.
2012-05-13 22:41:48 +02:00
Volker Lendecke
374ca0bd26 s3: Fix Coverity ID 2751: REVERSE_INULL 2012-04-24 13:28:50 +02:00
Andrew Bartlett
3969cc28e8 s3-dbwrap: A void function can not return a value
Only non-gcc compilers seem to notice this as an error.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Mon Apr 23 05:58:52 CEST 2012 on sn-devel-104
2012-04-23 05:58:52 +02:00
Volker Lendecke
13d667bbff s3: Implement db_id for dbwrap_cache
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Sat Apr 21 13:46:00 CEST 2012 on sn-devel-104
2012-04-21 13:46:00 +02:00
Volker Lendecke
d26028316d s3: Initialize "stored_callback" in dbwrap_cache
This should fix one of the recent flaky tests
2012-04-21 12:10:49 +02:00
Stefan Metzmacher
3f00295f5e s3-dbwrap: dbwrap_watch_record_stored => NT_STATUS_NOT_FOUND is ok...
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri Apr 20 17:05:52 CEST 2012 on sn-devel-104
2012-04-20 17:05:52 +02:00
Volker Lendecke
99fa29ae09 s3-dbwrap: Add dbwrap_record_watch_send/recv
With this API you can asynchronously wait for a record to be modified
2012-04-19 22:24:18 +02:00
Volker Lendecke
61c97506e8 s3-dbwrap: Add dbwrap_set_stored_callback
This is a per-db function that is called whenever some record is modified
2012-04-20 13:42:40 +02:00
Volker Lendecke
8e5b11bc14 s3-dbwrap: Add "db_context" to "db_record" 2012-04-20 13:42:40 +02:00
Volker Lendecke
0f20ffbcbd s3-dbwrap: Add dbwrap_db_id
This returns a blob uniquely identifying the database
2012-04-20 13:42:40 +02:00
Volker Lendecke
f1c90e12f5 s3: Fix Coverity ID 2744: CHECKED_RETURN 2012-04-19 17:37:38 +02:00
Volker Lendecke
85c1e895a5 s3: Fix Coverity ID 2745 and 2746: FORWARD_NULL
We can assume that the rbt dbs are around
2012-04-19 17:37:37 +02:00
Andrew Bartlett
00d493b00c s3-dbwrap: Remove dead code: talloc_stackframe() cannot fail 2012-04-19 12:34:33 +02:00
Volker Lendecke
0021fc17e4 s3-dbwrap: Fix an unused var warning 2012-04-18 18:16:27 +02:00
Andrew Bartlett
338e5a1d35 s3-dbwrap: push lp_ctx up another layer in the stack
This will allow db_open_tdb() to be called from common code, which may
already have a loadparm context loaded.

It also slowly moves the lp_ctx up the stack, as required to remove
the library loop between smbconf and the registry.

Andrew Bartlett
2012-04-18 12:04:59 +10:00
Andrew Bartlett
235016bcf9 s3-dbwrap: Add talloc_stackframe() calls
This is in preperation for calling dbwrap from common code, where we may not
have a stackframe set up.

Andrew Bartlett
2012-04-18 12:04:59 +10:00
Volker Lendecke
94cf5cc284 s3: Add dbwrap_try_fetch_locked
This is designed to spread the load on individual ctdb records to allow upper
layers to do backoff mechanisms. In the ctdb case, do not get the record if a
local lock is already taken. If we are not dmaster, do at most one migrate
attempt.

For the tdb case, this is a nonblocking fetch_locked. If someone else has the
lock, give up.
2012-04-17 10:21:00 +02:00
Volker Lendecke
bd9178506e s3: Add dbwrap_cache
This is a caching layer for the notify database and potentially for the brlock
database. It caches the parse_record operation as long as the underlying seqnum
does not change.
2012-04-17 10:21:00 +02:00
Volker Lendecke
ba8f19c556 s3: Open up 3 levels of dbwrap_lock_order 2012-04-17 10:21:00 +02:00
Volker Lendecke
a49ac23a10 s3: Return CTDB_PATH from lp_ctdbd_socket()
All callers had that fallback
2012-04-17 10:21:00 +02:00
Volker Lendecke
5138b1f7fb s3: Compile fix for dbwrap_file.c
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Sat Apr  7 14:10:35 CEST 2012 on sn-devel-104
2012-04-07 14:10:35 +02:00
Andrew Bartlett
43e9be8894 build: Remove sys_lseek wrapper 2012-04-05 02:39:08 +02:00
Andrew Bartlett
5c89d12ca4 build: Remove sys_ftruncate wrapper 2012-04-05 02:39:08 +02:00
Volker Lendecke
22a6497526 s3: Enhance the dbwrap needed x attempts msg
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Tue Apr  3 15:17:11 CEST 2012 on sn-devel-104
2012-04-03 15:17:11 +02:00
Volker Lendecke
1e24997e3e s3: Avoid a crash with debug level 10
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri Mar 30 16:52:16 CEST 2012 on sn-devel-104
2012-03-30 16:52:16 +02:00
Volker Lendecke
1909af434e s3-dbwrap: Move "lock_order" initialization to db_open_xx 2012-03-16 11:20:10 +01:00
Jelmer Vernooij
ce4531ee31 tdb_wrap: Move to specific directory.
It's a bit confusing to mix low-level and high-level libraries.  We had
multiple libraries in one directory, and there were have circular
dependencies with other libraries outside that directory (in this case,
samba-hostconfig).

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Mar 10 23:13:01 CET 2012 on sn-devel-104
2012-03-10 23:13:01 +01:00
Amitay Isaacs
5c5111ca03 s3-ctdb: Enable CTDB readonly support only if CTDB supports it
Autobuild-User: Amitay Isaacs <amitay@samba.org>
Autobuild-Date: Mon Mar  5 02:47:36 CET 2012 on sn-devel-104
2012-03-05 02:47:36 +01:00
Rusty Russell
5bda068773 dbwrap_ctdb: only fetch a read-only copy if we had a record already.
Because revoking read-only copies of records is expensive, we only
want ctdbd to do it for high-turnover records.  A basic heuristic is
that if we don't find a local copy of the record, don't ask for a
read-only copy.

The fetch itself will cause ctdbd to migrate the record, so eventually
we will have a local copy.  Next time it gets migrated away, we'll
call ctdbd_fetch() with local_copy = true.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-05 01:11:26 +01:00
Rusty Russell
a3e6f55065 dbwrap_ctdb: handle read-only records.
The new read-only record flags make determining if we can use a record
a bit more complex, so extract it into its own function.

The OLD logic was:
1) If the record doesn't exist, we can't use it.
2) If we are the dmaster for the record, we can use it.

The new logic is:
1) If the record doesn't exist, we can't use it.
2) If we are the dmaster for the record, we can use it IF we only
   want read-only access, OR there are no read-only delegations.
3) If we are not dmaster, we can only use it if we want read-only
   access and it is marked as a read-only copy.

This logic is unused until the next patches which begin to ask
for read-only copies of records.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-05 01:11:26 +01:00
Andrew Tridgell
8a0e420d4c dbwrap: changed log level for information about lock order
we were filling our logs with lock ordering debug lines

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Mon Feb 27 12:50:29 CET 2012 on sn-devel-104
2012-02-27 12:50:29 +01:00
Volker Lendecke
d2bf6af165 s3: Use lock_order for setting the db priority
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Jan 18 16:21:52 CET 2012 on sn-devel-104
2012-01-18 16:21:52 +01:00
Volker Lendecke
d2068d33a4 s3: Pass down lock_order to db_open_ctdb 2012-01-18 14:48:04 +01:00
Volker Lendecke
333c92384b s3: Enforce a lock order in dbwrap
This makes sure we do not deadlock from doing two dbwrap_fetch_locked in two
processes in different orders. At open time, we assign a strict order to all
databases. lock_order 1 will be locked first, lock_order 2 second. No two
records of the same lock order may be locked at the same time.
2012-01-18 14:48:04 +01:00
Volker Lendecke
45e61fcf61 s3: Add a "lock_order" argument to db_open
This will be used to enforce a lock hierarchy between the databases. We have
seen deadlocks between locking.tdb, brlock.tdb, serverid.tdb and notify*.tdb.
These should be fixed by refusing a dbwrap_fetch_locked that does not follow a
defined lock hierarchy.
2012-01-18 14:48:04 +01:00
Volker Lendecke
69b51e9053 s3: Fix some nonempty blank lines 2012-01-05 13:09:35 +01:00
Christian Ambach
411d498b8a s3:dbwrap fix return value of db_tdb_parse
use the TDB ecode to determine the NTSTATUS return value
and not the return code that is just -1
2011-12-16 18:43:08 +01:00
Volker Lendecke
8eeb3ff753 s3-dbwrap: All relevant backends provide parse_record(). Remove the fallback.
Signed-off-by: Michael Adam <obnox@samba.org>

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Thu Dec 15 17:41:53 CET 2011 on sn-devel-104
2011-12-15 17:41:53 +01:00
Volker Lendecke
f6d8f7440c s3-dbwrap: Remove the "fetch" db_context callback
Signed-off-by: Michael Adam <obnox@samba.org>
2011-12-15 16:00:47 +01:00
Volker Lendecke
b5d056ca23 s3-dbwrap: Rewrite dbwrap_fetch in terms of dbwrap_parse_record
Signed-off-by: Michael Adam <obnox@samba.org>
2011-12-15 16:00:46 +01:00
Volker Lendecke
77dca70350 s3-dbwrap: Rewrite dbwrap_fallback_parse_record based on dbwrap_fetch_locked
This is in preparation to remove the db_context->fetch function pointer

Signed-off-by: Michael Adam <obnox@samba.org>
2011-12-15 16:00:46 +01:00
Volker Lendecke
daa365493e s3-dbwrap: For nostalgic reasons, make dbwrap_file.c compile at least
Signed-off-by: Michael Adam <obnox@samba.org>
2011-12-15 16:00:46 +01:00
Volker Lendecke
29f62bbed7 s3-dbwrap: Fix some blank line endings
Signed-off-by: Michael Adam <obnox@samba.org>
2011-12-15 16:00:46 +01:00
Volker Lendecke
098048a89c s3-dbwrap: Implement db_ctdb_parse_record in terms of db_ctdb_fetch
Signed-off-by: Michael Adam <obnox@samba.org>
2011-12-15 16:00:45 +01:00
Volker Lendecke
26fc72921f s3-dbwrap: Make dbwrap_parse_record return NTSTATUS
Also, the parser now returns void. The parser is called if and only if
dbwrap_parse_record returns NT_STATUS_OK.

Signed-off-by: Michael Adam <obnox@samba.org>
2011-12-15 16:00:45 +01:00
Volker Lendecke
3239c722aa s3-dbwrap: Simplify db_tdb_fetchlock_parse a bit
Introduce a local variable for the result, replace "state->result" by "result"
2011-12-13 17:27:26 +01:00
Volker Lendecke
ad5d315322 s3-dbwrap: Fix a typo
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Dec  9 13:37:51 CET 2011 on sn-devel-104
2011-12-09 13:37:51 +01:00
Volker Lendecke
664eb70e74 s3-dbwrap: & is not required when taking a function pointer
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu Dec  8 16:39:29 CET 2011 on sn-devel-104
2011-12-08 16:39:28 +01:00
Volker Lendecke
4856033410 s3-dbwrap: Make dbwrap_fallback_wipe private 2011-12-08 15:03:43 +01:00
Volker Lendecke
d9e5368fcc s3-dbwrap: Avoid an "else" by an early return 2011-12-08 15:03:43 +01:00
Volker Lendecke
5cda77d599 s3-dbwrap: Make dbwrap_fallback_parse_record private
We have the private fallback in dbwrap_parse_record anyway
2011-12-08 15:03:43 +01:00
Volker Lendecke
527dc2ed52 s3-dbwrap: Make dbwrap_fallback_fetch private 2011-12-08 15:03:43 +01:00
Volker Lendecke
b6d5dfc16d s3-dbwrap: use wrappers where appropriate 2011-12-08 15:03:43 +01:00
Volker Lendecke
883419a50b s3-dbwrap: Use simpler code for logging keys 2011-12-08 15:03:42 +01:00
Volker Lendecke
4552c28d6d s3: Fix some blank line endings 2011-12-08 15:03:42 +01:00
Volker Lendecke
a47780af22 s3: Fix some nonblank line endings
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Dec  2 20:39:33 CET 2011 on sn-devel-104
2011-12-02 20:39:33 +01:00
Volker Lendecke
259cb94c11 s3: Remove unused dbwrap_record_get_private_data
db_record->private_data is for backends which can include dbwrap_private.h
anyway.
2011-12-02 19:03:13 +01:00
Michael Adam
0ee447fef5 s3:dbwrap_tdb: pass NTSTATUS code further up from db_tdb_fetch_parse in db_tdb_fetch()
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Wed Nov 30 01:46:31 CET 2011 on sn-devel-104
2011-11-30 01:46:31 +01:00
Michael Adam
efb993b686 s3:dbwrap: turn the fetch dbwrap method to NTSTATUS return code.
This implement more correct NTSTATUS handling inside the backends.
This ensures that data.dptr != NULL if return code is NT_STATUS_OK.
2011-11-29 18:20:06 +01:00
Michael Adam
819ca3b697 s3:dbwrap_ctdb: re-use map_nt_error_from_tdb() in local tdb_error_to_ntstatus() 2011-11-29 18:20:06 +01:00
Gregor Beck
a719ce7c11 s3:dbwrap: do not burden the user of db_open_ctdb with ifdef voodoo
Signed-off-by: Michael Adam <obnox@samba.org>
2011-11-25 13:24:34 +01:00
Stefan Metzmacher
15b8efeae3 s3:dbwrap_ctdb: return the number of records in db_ctdb_traverse() for persistent dbs
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Oct 14 20:59:37 CEST 2011 on sn-devel-104
2011-10-14 20:59:37 +02:00
Michael Adam
71f5f41860 s3:dbwrap_ctdb: fix the build after changing signature of tdb_wrap_open()
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Thu Oct 13 18:50:47 CEST 2011 on sn-devel-104
2011-10-13 18:50:47 +02:00
Andrew Bartlett
01c934c81e lib/util: Add back control of mmap and hash size in tdb for top level build
This passes down a struct loadparm_context to allow these
parameters to be checked.  This may be s3 or s4 context, allowing the
#if _SAMBA_BUILD_ macro to go away safely.

Andrew Bartlett
2011-10-13 14:06:07 +02:00
Michael Adam
54649993b2 s3:dbwrap_ctdb: improve the check for skipping the __db_sequence_number__ record in traverse
It did not compare the last charcter (usually '\0')
2011-10-12 22:45:52 +02:00
Michael Adam
8a3aa56202 s3:dbwrap_ctdb: fix check for skipping the __db_sequence_number__ in traverse
Brown paperbag. This omitted the "== 0" hand hence skipped all keys of the
same length as __db_sequence_number__ but different from it...
2011-10-12 22:45:52 +02:00
Günther Deschner
fc320551d8 s3-dbwrap_ctdb: fix the build.
Michael, please check.

Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed Oct 12 15:25:56 CEST 2011 on sn-devel-104
2011-10-12 15:25:56 +02:00
Gregor Beck
7fff4e7f84 s3:dbwrap: remove m_all marshall buffer from ctdb transaction.
it was only used by ctdb_replay_transaction and was a actually write only

Signed-off-by: Michael Adam <obnox@samba.org>

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Wed Oct 12 05:20:36 CEST 2011 on sn-devel-104
2011-10-12 05:20:36 +02:00
Gregor Beck
a6cd71da85 s3:dbwrap: traverse records created within this transaction.
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-12 03:49:05 +02:00
Michael Adam
6760011761 s3:dbwrap: change dbwrap_store_uint32() to NTSTATUS return type
for consistency and better error propagation

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Tue Oct 11 15:51:00 CEST 2011 on sn-devel-104
2011-10-11 15:51:00 +02:00
Michael Adam
c9bc1e4924 s3:dbwrap: change dbwrap_store_int32() to NTSTATUS return type
for consistency and better error propagation
2011-10-11 14:17:58 +02:00
Michael Adam
658f72128f s3:dbwrap: change dbwrap_fetch_uint32() to NTSTATUS return type (instead of bool)
for consistency and better error propagation
2011-10-11 14:17:58 +02:00
Michael Adam
603c3e1bcb s3:dbwrap: convert dbwrap_fetch_int32() to NTSTATUS return code
Return the int32 value retrieved from the db by reference.
Before this, return value "-1" was used as a error indication,
but it could also be a valid value from the database.
2011-10-11 14:17:58 +02:00
Michael Adam
8750e3f22c s3:dbwrap: move definitions of db_record and db_contect structs to dbwrap_private.h
The API and callers now only need the forward declarations.
2011-10-11 14:17:58 +02:00
Michael Adam
f21a66f70b s3:dbwrap: convert dbwrap_util.c to use dbwrap wrapper functions 2011-10-11 14:17:56 +02:00
Michael Adam
e39cd86381 s3:dbwrap: use dbwrap_fetch_bystring() in dbwrap_fetch_[u]int32() 2011-10-11 14:17:56 +02:00
Michael Adam
0e28448a78 s3:dbwrap: convert dbwrap_fetch(), dbwrap_fetch_bystring() and dbwrap_fetch_bystring_upper() to NTSTATUS 2011-10-11 14:17:56 +02:00
Michael Adam
25a9978c2c s3:dbwrap: add dbwrap_fetch_locked(), a wrapper for db->fetch_locked 2011-10-11 14:17:56 +02:00
Michael Adam
46370441b7 s3:dbwrap: add dbwrap_record_delete(), a wrapper for record->delete_rec 2011-10-11 14:17:56 +02:00
Michael Adam
b257e83d89 s3:dbwrap: add dbwrap_record_store(), a wrapper for record->store 2011-10-11 14:17:56 +02:00
Michael Adam
bfed62c169 s3:dbwrap: add get-functions for db_record key, value and private_data 2011-10-11 14:17:56 +02:00
Michael Adam
3ed2fb4a87 s3:dbwrap: add wrapper function dbwrap_get_seqnum() 2011-10-11 14:17:56 +02:00
Michael Adam
373b0606a3 s3:dbwrap: add wrappers for transactions start/cancel/commit 2011-10-11 14:17:56 +02:00
Michael Adam
d8ce5bc656 s3:dbwrap: add wrapper dbwrap_get_flags() 2011-10-11 14:17:56 +02:00
Gregor Beck
7b9bf28514 s3:dbwrap: fix db_rbt_traverse() to return the record count on success
this makes it consistent with documented behaviour of tdb_traverse()

Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:56 +02:00
Gregor Beck
ebcb921182 s3:dbwrap: add specific dbwrap_wipe() implementation to dbwrap_rbt
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:56 +02:00
Gregor Beck
97fef0c2fd s3:dbwrap: add specific dbwrap_wipe() implementation to dbwrap_tdb
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:55 +02:00
Michael Adam
3dc607c0c6 s3:dbwrap: add a comment 2011-10-11 14:17:55 +02:00
Gregor Beck
dc4a5f5323 s3:dbwrap: add function dbwrap_wipe()
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:55 +02:00
Gregor Beck
63c5c0eccf s3:dbwrap: add specific dbwrap_parse_record() implementation to dbwrap_rbt
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:55 +02:00
Gregor Beck
c5d03cbff8 s3:dbwrap: implement dbwrap_fallback_exists() with dbwrap_parse_record()
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:55 +02:00
Gregor Beck
99fa6fa4a3 s3:dbwrap: allow NULL parser for dbwrap_parse_record()
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:55 +02:00
Gregor Beck
f5b7d87c25 s3:dbwrap: dbwrap_parse_record() should always return -1 on "not found"
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:55 +02:00
Gregor Beck
893805b99c s3:dbwrap: add function dbwrap_parse_record()
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:55 +02:00
Gregor Beck
fff09d066f s3:dbwrap: add specific dbwrap_exists() implementation to dbwrap_rbt 2011-10-11 14:17:55 +02:00
Gregor Beck
28e4c41d5b s3:dbwrap: factor out db_rpt_search_internal()
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:55 +02:00
Gregor Beck
5953839b18 s3:dbwrap: add specific dbwrap_exists() implementation to dbwrap_tdb
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:55 +02:00
Gregor Beck
87b68cea5b s3:dbwrap: add function dbwrap_exists()
Signed-off-by: Michael Adam <obnox@samba.org>
2011-10-11 14:17:55 +02:00
Michael Adam
87f51bfa99 s3:dbwrap: add a wrapper dbwrap_traverse_read() 2011-10-11 14:17:55 +02:00
Michael Adam
8f098a635f s3:dbwrap: change the dbwrap_traverse() wrapper to return the count in an additional parameter 2011-10-11 14:17:55 +02:00
Michael Adam
6608ba850b s3:dbwrap: reorganize dbwrap.h some 2011-10-11 14:17:55 +02:00
Michael Adam
2d52f6f8f5 s3:dbwrap: move dbwrap_traverse() to dbwrap.c, the core of the dbrwap subsystem 2011-10-11 14:17:55 +02:00
Michael Adam
663c661b11 s3:dbwrap: move dbwrap_store() back to dbwrap.c, the core of the dbwrap subsystem 2011-10-11 14:17:55 +02:00
Michael Adam
2aa5601c0a s3:dbwrap: move dbwrap_delete() back to dbwrap.c, the core of the dbwrap subsystem 2011-10-11 14:17:55 +02:00
Michael Adam
c3868b7488 s3:dbwrap: move dbwrap_fetch() back to dbwrap.c, the core of the dbwrap subsystem 2011-10-11 14:17:55 +02:00
Michael Adam
7a72c84ee7 s3:dbwrap: move the db_open_rbt() prototype to a new header dbwrap_rbt.h 2011-10-11 14:17:55 +02:00
Michael Adam
c768121661 s3:dbwrap: move the db_open_file() prototype to a new header dbwrap_file.h 2011-10-11 14:17:55 +02:00
Michael Adam
38f7f8e44d s3:dbwrap: move the db_open_tdb() prototype to a new header dbwrap_tdb.h 2011-10-11 14:17:55 +02:00
Michael Adam
82bc3fa81c s3:dbwrap: move the db_open_ctdb() prototype to a new header dbwrap_ctdb.h 2011-10-11 14:17:54 +02:00