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

91 Commits

Author SHA1 Message Date
Amitay Isaacs
d36aa928fd ctdbd: Remove incomplete ctdb_db_statistics_wire structure
Send the ctdb_db_statistics directly instead of first copying it to
duplicate ctdb_db_statistics_wire structure.  This simplifies the
implementation of the control to get database statistics.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 26a4653df594d351ca0dc1bd5f5b2f5b0eb0a9a5)
2013-07-10 14:33:18 +10:00
Mathieu Parent
ecaf710193 libctdb: Include config.h in libctdb/ctdb.c
Bug-Debian: http://bugs.debian.org/703551

(This used to be ctdb commit 14a79c0f3967c88f8ffc8200d122f6c5ffdb63a8)
2013-06-14 16:45:27 +10:00
Amitay Isaacs
6635092a76 libctdb: Do not include sys/time.h to support build on AIX
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 2c19fa78ce0b25c3615b23664df32233bdbdea42)
2013-05-29 15:16:54 +10:00
Amitay Isaacs
41f0252da2 client: Set the socket non-blocking only after connect succeeds
If the socket is set non-blocking before connect, then we should catch
EAGAIN errors and retry. Instead of adding a random number of retries,
better to wait for connect to succeed and then set the socket to
non-blocking.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 524ec206e6a5e8b11723f4d8d1251ed5d84063b0)
2013-04-05 13:21:41 +11:00
Martin Schwenke
cc5f37f293 libctdb: Add comments to effect that some controls return result in status
These controls include:

  CTDB_CONTROL_GET_RECMODE
  CTDB_CONTROL_GET_RECMASTER
  CTDB_CONTROL_GET_PID
  CTDB_CONTROL_GET_PNN
  CTDB_CONTROL_PING
  CTDB_CONTROL_GET_DB_PRIORITY

In these cases the data field is empty.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b89e959904d7d1b0e5525abd7789f5101537a46a)
2012-10-02 17:37:52 +10:00
Martin Schwenke
e05fc0e7b0 libctdb: add ctdb_getcapabilities()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 140fafef23050d40d66f5b5558c7efcb78f80cd2)
2012-09-28 17:05:34 +10:00
Amitay Isaacs
e379fc3ea5 Fix compiler warnings.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit d29e1880c8ce7219e065d31b47b0e8ad9e83146d)
2012-07-13 14:50:56 +10:00
Ronnie Sahlberg
59565c05cf STATISTICS: Add tracking of the 10 hottest keys per database measured in hopcount
and add mechanisms to dump it using the ctdb dbstatistics command

(This used to be ctdb commit 8307c70ed98996b430c470e9641a09fdeeb81bd8)
2012-06-13 16:19:18 +10:00
Volker Lendecke
8428f48708 Add includes required on FreeBSD
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit be5c3a57df39d85fbb7ee922924787340e2b0595)
2012-02-13 16:23:17 +01:00
Ronnie Sahlberg
73f8be16c6 ReadOnly: add per-database statistics to view how much delegations/revokes we have
(This used to be ctdb commit 751ed46197661eb841042ab6a02855a51dd0b17c)
2012-02-08 15:29:27 +11:00
Martin Schwenke
ed8a8ee966 libctdb - add ctdb_getvnnmap()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f6039eaece4224b866a98dd49010f278a7b3f015)
2012-02-06 16:00:23 +11:00
Ronnie Sahlberg
65e1e1d3ef Niceify the readonlyrecord API. Dont force clients to be exposed to the featch_with_header function
We dont strictly need to force clients to use CTDB_FETCH_WITH_HEADER instead of CTDB_FETCH when they ask for readonly records.
Have ctdbd internally remap this internally to FETCH_WITH_HEADER and map the reply back to CTDB_FETCH_FUNC or CTDB_FETCH_WITH_HEADER_FUNC based on what the client initially asked for.

This removes the need for the client to know about the CTDB_FETCH_WITH_HEADER_FUNC function and simplifies the client code.
Clients that do not care what the header after the request is can just continue using the old CTDB_FETCH_FUNC call and ctdbd will do all the difficult stuff.

(This used to be ctdb commit 444a7bac4e9a854b06c1ad4cb36c2b58a72001fa)
2012-01-31 17:20:35 +11:00
Michael Adam
5c7c66a30e libctdb: fix libctdb's traverse after changes in the core
In 8281bb210858ed04992eacea7f6d02261e0fc1b1, I forgot to change
this hunk back when hiding the wire changes done in commit
ddc5da3a0df7701934404192a0a0aa659a806acb behind a new control
CTDB_CONTROL_TRAVERSE_START_EXT.

(This used to be ctdb commit faf25e8a2fdf80a016048e1f698a014ceb5e604f)
2011-12-06 10:43:28 +01:00
Michael Adam
c56db0c3b5 Revert "Fix the build that broke in 8281bb210858ed04992eacea7f6d02261e0fc1b1"
This reverts commit 08e06176feab1ec244496e62a916fbb77817239f.

I wanted to fix this differently, not using the extended traverse_start
control...

(This used to be ctdb commit f60de23e0a8307b5baaa9c4b8406b2b223487a48)
2011-12-06 10:43:28 +01:00
Ronnie Sahlberg
609149bdc8 LibCTDB: Add support for the 'get interfaces' control and update the ctdb tool to use this interface
(This used to be ctdb commit 77dc0c7351071243d9096d3607d7499c82f46ec0)
2011-12-06 13:12:18 +11:00
Ronnie Sahlberg
27a0414a5d Fix the build that broke in 8281bb210858ed04992eacea7f6d02261e0fc1b1
The traverse control has changed wireformat so update also libctdb to use the correct
version of the wire structure and compile

(This used to be ctdb commit 08e06176feab1ec244496e62a916fbb77817239f)
2011-12-06 11:29:49 +11:00
Ronnie Sahlberg
11f3c947e6 LibCTDB: add support for the check-srvids control
(This used to be ctdb commit c32604fd0016de0df14845a2f222edaa3c52a4fa)
2011-11-30 10:00:07 +11:00
Ronnie Sahlberg
3cbff2edd8 LibCTDB: add get persistent db seqnum control
(This used to be ctdb commit 6e96a62494bbb2c7b0682ebf0c2115dd2f44f7af)
2011-11-30 08:48:14 +11:00
Michael Adam
1a31c84348 traverse: add a flag to enable transferring empty records in cluster wide traverse
This will be useful for also printing information about empty/deleted
records in "ctdb catdb", e.g. for debugging vacuuming issues.

(This used to be ctdb commit ddc5da3a0df7701934404192a0a0aa659a806acb)
2011-11-29 10:30:24 +01:00
Ronnie Sahlberg
74579a3193 libctdb: dont allow ctdb_writerecord() for readonly records
(This used to be ctdb commit c930a44731d24b3bb51851864c7cdd0061483c0b)
2011-10-28 13:38:32 +11:00
Ronnie Sahlberg
bb3509b6d2 ReadOnly: If record does not exist, upgrade to write-lock
If we attempt a readonly lock request for a record that do not exist (yet)
in the local TDB, then upgrade the request to ask for a write lock and force a
request for migrate the record onto the local node.
This allows the "only request record on second local request for known contended records"
heuristics to try to avoid creating readonly delegations unless we have good reason to
assume it is a contended record.

(This used to be ctdb commit e6003e52617385f731ccf93b13d21d5403534a78)
2011-10-28 12:41:27 +11:00
Ronnie Sahlberg
c21ec9fffc ReadOnly: add readonly record lock requests to libctdb
Initial readonly record support in libctdb.
New records are not yet created by the library but extising records will be delegated as readonly records.
This needs a bit more tests before we can drop the "old style" implementation of client
code in client/ctdb_client.c

(This used to be ctdb commit fb50a45a21ff56480d76acd1c33c13c323cbf5e2)
2011-10-28 11:55:46 +11:00
Ronnie Sahlberg
7e29817f61 LibCTDB : initialize ctdb->pnn to -1 when we create a new context
but before we learn the pnn of the local node

(This used to be ctdb commit 2cc48be3219b887b85649a14db311af0549041cf)
2011-08-23 16:16:48 +10:00
Ronnie Sahlberg
b00b0e9d2e LibCTDB : add support for getrecmode
(This used to be ctdb commit b663f286ea8edd64c0405a1ab45b6ef1da501bf5)
2011-08-23 15:32:14 +10:00
Ronnie Sahlberg
af19b5acff LibCTDB: add commands where an application can query how many commands are active
and we have not yet received a reply to.
Applications may use this command to query if it is "safe" to stop the event system and sleep
or whether it should first wait for all activity to ctdb daemons to cease first.

(This used to be ctdb commit 8d89bfdfd1f55dfeb22890b8bb0f08f31d1fa91a)
2011-08-23 12:43:16 +10:00
Volker Lendecke
85bc1ccb7e libctdb: "unpack_reply_control" does not need the ctdb_connection parameter
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit bb8f68f0256c43fe0671fe45023d1c88e340ad96)
2011-08-22 17:11:07 +02:00
Volker Lendecke
da528a65b1 libctdb: "unpack_reply_call" does not need the ctdb_connection parameter
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 77ae553249ef1e1d467d792ac033f2aaa4e337e6)
2011-08-22 17:11:07 +02:00
Volker Lendecke
21bb8abc93 libctdb: "ctdb_request_free" does not need the ctdb_connection parameter
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 5a5ed2a43b76bec69494b6cdc6451527f5c472e5)
2011-08-22 17:11:07 +02:00
Volker Lendecke
b0706be89e libctdb: Make sure ctdb_request->ctdb is filled correctly
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 06433d20a43d41f05b96a9dda6dc5931539feaa3)
2011-08-22 17:11:06 +02:00
Volker Lendecke
8638b5f5d2 libctdb: Ensure 0-termination of sun_path
Rusty, please check!

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

(This used to be ctdb commit 955f67a02026b157440d2ae87ead193773331e75)
2011-08-22 17:11:06 +02:00
Volker Lendecke
b4fd8024b5 libctdb: Fix a few format warnings
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit fa6564c24429e084be728dbe6eea1dec13e58709)
2011-08-22 17:11:06 +02:00
Volker Lendecke
ef64060898 libctdb: Add license header to messages.c
Rusty, please check!

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

(This used to be ctdb commit 4bceba374be82e76ba5d9d923172e85e9365b990)
2011-08-22 17:11:06 +02:00
Volker Lendecke
d55e6cf53c libctdb: Reorder attachdb
No code change, this is for easier reading the sequence of what happens

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

(This used to be ctdb commit 883b9b185dce03a6bf233fbf2cfabad9883519e5)
2011-08-22 17:11:06 +02:00
Volker Lendecke
a31d7516f5 libctdb: Reorder set_message_handler
No code change, this is for better readability

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

(This used to be ctdb commit e0f93459e05eef33024096654b4aaf1eb3c6d7c4)
2011-08-22 17:11:06 +02:00
Volker Lendecke
19f31f86ac libctdb: Correct 4bfdfda, stddef.h is needed by libctdb_private.h
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 683caa7bbf45d5b6791e53e2f3ee6d0ac3b08f28)
2011-08-22 17:11:06 +02:00
Volker Lendecke
452f6504a0 Add missing #include to libctdb/ctdb.c
We need that to have the "offsetof" macro, thus we don't need to redeclare it
in libctdb_private.h

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

(This used to be ctdb commit 4bfdfdae4f8ab23f14bc6ab4c06b66c07714ec17)
2011-08-17 15:12:46 +02:00
Ronnie Sahlberg
fcd98a7e59 LIBCTDB: add support for traverse
(This used to be ctdb commit 9463e04038ba36792583f83bd95c1af322dc283a)
2011-01-14 17:38:56 +11:00
Ronnie Sahlberg
1859cde18d LIBCTDB uninitialized inqueue element
From Michael Anderson,
initialize the inqueue element of the ctdb structure to NULL,
else it might be used uninitialized and cause a segv.

(This used to be ctdb commit 775d02180b825ae32d6536eaf2059884d5fed9f4)
2011-01-11 07:40:57 +11:00
Ronnie Sahlberg
f815237f8f libctdb
fix a compile problem after renaming a structure field

(This used to be ctdb commit f44c02f45dbc13e3cc2e89ee1c96bd0d57042fcc)
2010-12-10 14:19:53 +11:00
Ronnie Sahlberg
e42fc0d4f5 LibCTDB
Add an input queue where we keep received pdus we have not yet processed
This allows us to perform SYNC calls from an ASYNC callback

(This used to be ctdb commit c111e98d3ad7bd3d09f4081e9bb1443d3722672f)
2010-12-10 13:42:25 +11:00
Ronnie Sahlberg
22ea35f17d adda GETPUBLICIPS control to libctdb and use this in the test example
enhance the test example to show the new releaseip/takeip messages

(This used to be ctdb commit 21cc57883e6c02b0e037211b26d1d866d5d7f03d)
2010-09-15 14:58:11 +10:00
Ronnie Sahlberg
a2c874bd61 Implement a new function GETNODEMAP in libctdb.
This function returns a pointer to a nodemap structure.

The returned structure must later be freed by calling ctdb_free_nodemap().

Move the definition of ctdb_sock_addr from ctdb_client.h to ctdb_protocol.h

Move the definition of the node flags, ctdb_node_and_flags and ctdb_node_map from ctdb_private.h to ctdb_protocol.h

Add both sync and async example for ctdb_getnodemap to the test application libctdb/tst.c

(This used to be ctdb commit 31c10eb2b337fd7d8a97a1f9e69b0e7570fec71d)
2010-09-13 14:32:11 +10:00
Ronnie Sahlberg
0e5be63bca update the example for the new signature of
ctdb_set_message_handler_send()

(This used to be ctdb commit 6aabe52d5ba629291aa630bc96a2b74dcecc5209)
2010-08-18 10:18:35 +10:00
Rusty Russell
a65cb6a9ae libctdb: add synchronous message handling and unregister, with tests.
It turns out that we *do* want a separate private arg for the message
handler and the completion callback, so we change that.

We also fix the prototypes of the remove_message functions as we
implement them.

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


(This used to be ctdb commit 332375246eccd95da626f434f6d49dd9458a9787)
2010-08-09 15:41:32 +09:30
Rusty Russell
7525493264 libctdb: test: run.sh script
This is a script which starts up a fake ctdbd and runs the libctdb
test suite.

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


(This used to be ctdb commit 67ca040b07713d83385db63489c887f7156b7853)
2010-06-21 16:09:16 +09:30
Rusty Russell
505e481588 libctdb: test: add readrecordlock support
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 1a23581c70a0c8c3b9c8fd4651ce1b2bb4464f97)
2010-06-21 16:06:00 +09:30
Rusty Russell
0be60b6a7a libctdb: test: add database save and restore
Once we do operations which alter the TDBs, we need to restore them to
pristine state after a failed child dies.

The method used here is a terrible hack: it should at least do a
tdb_lockall() on the database before blatting it.

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


(This used to be ctdb commit d48ec16bd2b4932442d95fc43bea52baa0425501)
2010-06-21 15:00:46 +09:30
Rusty Russell
d2def0ee1f libctdb: test: --no-failtest
Sometimes you just want to test that the basic test case is sane,
without all the failure paths being tested.

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


(This used to be ctdb commit be7c0bffb0d924c3e72753045d5b85ce90407579)
2010-06-21 14:48:54 +09:30
Rusty Russell
b0a8fd19ff libctdb: test: improve logging of failure paths
We include the file and line which called the functions, so the printed
failure path now looks like:

	[malloc(ctdb.c:144)]:1:S[socket(ctdb.c:168)]:1:S...

The form is:
    [ <function> ( <caller> ) ] : <input line> : <result>

<function> is the function which is called (eg. malloc).
<caller> is the file and line number which called <function>.
<input line> is the 1-based line number in the input which we were up to.
<result> is 'S' (success) or 'F' (failure).

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


(This used to be ctdb commit 5fb6da30b5b5a8b761c8ab9a8124b87b759ef055)
2010-06-21 14:57:11 +09:30
Rusty Russell
fee11bf13b libctdb: test: logging enhancement
Make children log through a pipe to the parent, which then spits it out
only if the child has a problem.

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


(This used to be ctdb commit 8ac006cf6c6cbfd3fe1606178eb0f0127d33f632)
2010-06-21 15:02:05 +09:30