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

107 Commits

Author SHA1 Message Date
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