summaryrefslogtreecommitdiffstats
path: root/source3/lib/dbwrap
Commit message (Collapse)AuthorAgeFilesLines
* dbwrap: use DBWRAP_LOCK_ORDER_VALID() in db_open()Michael Adam2014-02-071-9/+1
| | | | | | | | | | 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
* dbwrap: add dbwrap_flags argument to dbwrap_local_open()Michael Adam2014-02-071-1/+1
| | | | | | | | 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>
* dbwrap_open: add 'dbwrap_optimize_readonly:* = yes' optionStefan Metzmacher2014-02-071-0/+25
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* dbwrap_ctdb: implement DBWRAP_FLAG_OPTIMIZE_READONLY_ACCESSStefan Metzmacher2014-02-071-0/+21
| | | | | | | | | | 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>
* dbwrap: add a dbwrap_flags argument to db_open_ctdb()Michael Adam2014-02-073-4/+7
| | | | | | | | 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>
* dbwrap: add a dbwrap_flags argument to db_open()Michael Adam2014-02-073-3/+6
| | | | | | | | | | 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>
* dbwrap_watch: Use messaging_read_send/recvVolker Lendecke2014-01-211-13/+7
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging3: Add messaging_read_send/recvVolker Lendecke2014-01-211-1/+0
| | | | | | | | | | | | | | | | | | | 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>
* s3:dbwrap: Use milliseconds for "Held tdb lock" messageChristof Schmitt2014-01-161-5/+6
| | | | | | | | | | | 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
* s3:dbwrap: Store warning thresholds in db_ctdb_ctxChristof Schmitt2014-01-161-4/+18
| | | | | | | | | 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>
* s3:dbwrap include the hashchain in the logsChristian Ambach2014-01-161-3/+12
| | | | | | Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:dbwrap report time for chainlock and CTDB migrateChristian Ambach2014-01-161-2/+15
| | | | | | Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* dbwrap_ctdb: Instrument chainunlock timingVolker Lendecke2014-01-161-2/+26
| | | | | | | | | | | | 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>
* ctdb_conn: Log long fetch_lock callsVolker Lendecke2014-01-161-4/+22
| | | | | | | | | | | | | | | | | 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>
* dbwrap_ctdb: Treat empty records as non-existingVolker Lendecke2013-08-281-0/+10
| | | | | | | | | 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>
* s3:lib/dbwrap add missing curly bracesChristian Ambach2013-05-161-2/+4
| | | | | | | | violation of README.Coding Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* dbwrap: Allow dbwrap_record_watch_recv to not lock the recordVolker Lendecke2013-04-261-0/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap-ctdb: Avoid a talloc_stackframe()Volker Lendecke2013-03-261-4/+2
| | | | | | | | 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>
* dbwrap-ctdb: Use ctdbd_parse in db_ctdb_parse_recordVolker Lendecke2013-03-261-9/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: Use tdb_null in db_ctdb_deleteVolker Lendecke2013-03-251-4/+1
| | | | | | | | 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
* s3:dbrwap_ctdb: ZERO_STRUCT(rec) just to be sure in ↵Michael Adam2013-02-041-0/+1
| | | | | | | traverse_persistent_callback_read() Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:dbwrap_ctdb: ZERO_STRUCT(rec) just to be sure in traverse_read_callback()Michael Adam2013-02-041-0/+2
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:dbwrap_ctdb: add "db_context" to "db_record"Stefan Metzmacher2013-02-041-2/+5
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:dbwrap_ctdb: setup result->name in db_open_ctdb()Stefan Metzmacher2013-02-041-0/+7
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* dbwrap: Use INCOMPATIBLE_HASH for dbwrap_watchers.tdbVolker Lendecke2013-01-111-3/+4
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dbwrap: Do not rely on dbwrap_record_get_value to return a talloc objectVolker Lendecke2012-11-291-2/+3
| | | | | | | | | | | 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
* s3: Remove db_ctdb_fetchVolker Lendecke2012-11-291-55/+11
| | | | | | | 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>
* s3: Directly parse local existing records in db_ctdb_parse_recordVolker Lendecke2012-11-291-0/+22
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Factor out db_ctdb_can_use_local_hdr from db_ctdb_can_use_local_copyVolker Lendecke2012-11-291-11/+14
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Remove unused code for fetching persistent ctdb recordsVolker Lendecke2012-11-291-129/+0
| | | | | | | 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>
* s3: Avoid db_ctdb_fetch for persistent databasesVolker Lendecke2012-11-291-0/+44
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Factor out parse_newest_in_marshall_buffer from ↵Volker Lendecke2012-11-291-15/+51
| | | | | | pull_newest_from_marshall_buffer Reviewed-by: Michael Adam <obnox@samba.org>
* s3: reduce db_ctdb_marshall_loop_next to specialized db_ctdb_marshall_buf_parseVolker Lendecke2012-11-291-48/+21
| | | | | | now that the db_ctdb_marshall_loop_next_key has been factored out. Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Factor out db_ctdb_marshall_loop_next_key from db_ctdb_marshall_loop_nextVolker Lendecke2012-11-291-9/+24
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Slightly simplify db_ctdb_marshall_loop_nextVolker Lendecke2012-11-291-4/+3
| | | | | | Both callers give a key argument Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Use db_ctdb_ltdb_parse in db_ctdb_fetch_db_seqnum_from_dbVolker Lendecke2012-11-291-20/+21
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Use db_ctdb_ltdb_parse in db_ctdb_ltdb_fetchVolker Lendecke2012-11-291-30/+46
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Add db_ctdb_ltdb_parseVolker Lendecke2012-11-291-0/+42
| | | | Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Slightly simplify db_ctdb_transaction_commitVolker Lendecke2012-11-291-1/+2
| | | | | | Avoid an unnecessary "else". Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Remove header==NULL code from db_ctdb_marshall_recordVolker Lendecke2012-11-291-12/+5
| | | | | | The only call chain (via db_ctdb_marshall_add) has header != NULL Reviewed-by: Michael Adam <obnox@samba.org>
* s3: Fix some blank line endingsVolker Lendecke2012-11-201-10/+10
| | | | | | | 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
* s3:dbwrap_ctdb: set errno = ENOSYS if clustering is not supportedGregor Beck2012-09-211-0/+1
| | | | | | | 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
* s3: Fix a commentVolker Lendecke2012-09-041-1/+1
| | | | Signed-off-by: Jeremy Allison <jra@samba.org>
* s3:dbwrap_ctdb: Add DB name and key to warning messageChristof Schmitt2012-08-311-1/+8
| | | | | | | 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>
* s3:dbwrap_ctdb: initialize db_record->dbStefan Metzmacher2012-07-311-0/+1
| | | | metze
* s3_dbrwap_ctdb: improve a comment in db_ctdb_can_use_local_record()Michael Adam2012-06-291-1/+3
| | | | Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
* s3:dbwrap_ctdb: fix a comment in db_ctdb_fetch()Michael Adam2012-06-291-2/+3
| | | | Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
* s3:dbwrap_ctdb: expand the comment for the db_ctdb_can_use_local_copy() functionMichael Adam2012-06-291-1/+4
| | | | Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
* s3:dbwrap_ctdb: rename db_ctdb_own_record() -> db_ctdb_can_use_local_copy()Michael Adam2012-06-291-3/+3
| | | | | | | 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>
* s3:dbrwap_ctdb: remove commented out legacy codeMichael Adam2012-06-291-5/+1
|