sahlberg/ctdb.git
17 years agomerge local copy of tdb from samba4 tdb
Andrew Tridgell [Mon, 16 Apr 2007 12:52:58 +0000 (22:52 +1000)]
merge local copy of tdb from samba4 tdb

17 years agofixed a fd bug (thanks volker)
Andrew Tridgell [Mon, 16 Apr 2007 12:49:37 +0000 (22:49 +1000)]
fixed a fd bug (thanks volker)

17 years agothis is a demonstration of an idea for handling locks in ctdb.
Andrew Tridgell [Mon, 16 Apr 2007 06:01:37 +0000 (16:01 +1000)]
this is a demonstration of an idea for handling locks in ctdb.

The problem we have is this:

  - we want the client smbd processes to be able to 'shortcut' access
    to the ltdb, by directly accessing the ltdb, and if the header of
    the record shows we are the dmaster then process immediately, with
    no overhead of talking across the unix domain socket

  - a client doing a shortcut will use tdb_chainlock() to lock the
    record while processing

  - we want the main ctdb daemon to be able to set locks on the
    record, and when those locks collide with a 'shortcut' fcntl lock,
    we want the ctdb daemon to keep processing other operations

  - we don't want to have to send a message from a smbd client to the
    ctdbd each time it releases a lock

The solution is shown in this example. Note that the expensive fork()
and blocking lock is only paid in case of contention, so in the median
case I think this is zero cost.

17 years agomerged from samba4
Andrew Tridgell [Mon, 16 Apr 2007 04:13:10 +0000 (14:13 +1000)]
merged from samba4

17 years agopull out common command line code for tests into tests/cmdline.c
Andrew Tridgell [Mon, 16 Apr 2007 04:12:50 +0000 (14:12 +1000)]
pull out common command line code for tests into tests/cmdline.c

17 years agomerge CTDB_SRVID_ALL patch from Samba4
Andrew Tridgell [Mon, 16 Apr 2007 00:31:39 +0000 (10:31 +1000)]
merge CTDB_SRVID_ALL patch from Samba4

17 years ago- fix includes to work in both samba4 and ctdb standalone
Andrew Tridgell [Mon, 16 Apr 2007 00:21:44 +0000 (10:21 +1000)]
- fix includes to work in both samba4 and ctdb standalone
- when we do a store_unlock the lock record becomes unlocked, so we
  must destroy it (or we leak memory)

17 years agoadded --dblist option to ctdbd, to allow list of databases to be specified on the...
Andrew Tridgell [Sun, 15 Apr 2007 23:29:10 +0000 (09:29 +1000)]
added --dblist option to ctdbd, to allow list of databases to be specified on the command line

17 years agomerge from ronnie
Andrew Tridgell [Sun, 15 Apr 2007 22:58:57 +0000 (08:58 +1000)]
merge from ronnie

17 years agoadd code to fetch1 test to tell the two child processes one at a time to fetch_lock...
Ronnie sahlberg [Sun, 15 Apr 2007 22:37:27 +0000 (08:37 +1000)]
add code to fetch1 test to tell the two child processes one at a time to fetch_lock the same record

they both successfully fetch and lock the same record at this stage  but when the actual locking works properly  the second child will block.

this test allows us to verify the blocking once we have implemented it

17 years agoadd examples for volker on how to do fetchlock/storeunlock
Ronnie sahlberg [Sun, 15 Apr 2007 04:39:23 +0000 (14:39 +1000)]
add examples for volker on how to do fetchlock/storeunlock

note that the actual locking/unl;ocking does not still work

17 years agoupdate to fetch1.sh test
Ronnie sahlberg [Sun, 15 Apr 2007 04:02:39 +0000 (14:02 +1000)]
update to fetch1.sh test

there is still a bug in the ctdb code in that the children no longer receive messages from the parent for unknown reasons

17 years agomerge from tridge
Ronnie sahlberg [Sat, 14 Apr 2007 21:41:35 +0000 (07:41 +1000)]
merge from tridge

17 years agomerge from ronnie
Andrew Tridgell [Sat, 14 Apr 2007 10:44:43 +0000 (20:44 +1000)]
merge from ronnie

17 years agomerge from tridge
Ronnie sahlberg [Fri, 13 Apr 2007 11:10:20 +0000 (21:10 +1000)]
merge from tridge

17 years agoprivate -> private_data for samba3
Andrew Tridgell [Fri, 13 Apr 2007 10:38:24 +0000 (20:38 +1000)]
private -> private_data for samba3

17 years agoadd missing code to store_unlock so that the data that a client writes is stored...
Ronnie sahlberg [Fri, 13 Apr 2007 10:37:41 +0000 (20:37 +1000)]
add missing code to store_unlock so that the data that a client writes is stored in ltdb

this makes it possible to do fetch_lock and store_unlock across a domain socket to read/write data.

note that the actual locking is NOT implemented yet

17 years agomerge store_unlock code from ronnie
Andrew Tridgell [Fri, 13 Apr 2007 05:49:33 +0000 (15:49 +1000)]
merge store_unlock code from ronnie

17 years agoadd more elaborate test to fetch1 test
Ronnie sahlberg [Thu, 12 Apr 2007 23:44:56 +0000 (09:44 +1000)]
add more elaborate test to fetch1 test

for now:
fetch a record
store a known entry for this record
fetch the record again  (and later verify we got the same record)
store it back again

this will not work right now since we dont yet store the record inside the daemon

17 years agoadd store_unlock pdu's for the domain socket.
Ronnie sahlberg [Thu, 12 Apr 2007 23:41:15 +0000 (09:41 +1000)]
add store_unlock pdu's for the domain socket.

note that the store_unlock does not actually do anything yet apart from passing the pdu from client to daemon   and daemon responds.

next is to make sure the daemon actually stores the data in a database

17 years agomerge from tridge
Ronnie sahlberg [Thu, 12 Apr 2007 11:35:16 +0000 (21:35 +1000)]
merge from tridge

17 years agomerge from ronnie
Andrew Tridgell [Thu, 12 Apr 2007 11:32:16 +0000 (21:32 +1000)]
merge from ronnie

17 years agoadd the two missing file from the previous commit
Ronnie sahlberg [Thu, 12 Apr 2007 11:19:00 +0000 (21:19 +1000)]
add the two missing file from the previous commit

17 years agoadd a beginning of a new test
Ronnie sahlberg [Thu, 12 Apr 2007 11:17:10 +0000 (21:17 +1000)]
add a beginning of a new test

right now this test only does one fetch lock   but this will be enhanced as more code is added to ctdb to handle fetch_lock and store_unlock

17 years agowhen sending back a fetch lock reply to a client
Ronnie sahlberg [Thu, 12 Apr 2007 11:14:41 +0000 (21:14 +1000)]
when sending back a fetch lock reply to a client
we cant peek in state->c since this is uninitialized
and even if it were not it would be wrong

create a new structure to pass BOTH client and also the reqid to respond back to
the client with

17 years agomerge from tridges tree
Ronnie sahlberg [Thu, 12 Apr 2007 07:13:48 +0000 (17:13 +1000)]
merge from tridges tree

17 years agomerge from ronnie
Andrew Tridgell [Thu, 12 Apr 2007 06:51:33 +0000 (16:51 +1000)]
merge from ronnie

17 years agodont hardcode gdb in the test script. ooops
Ronnie sahlberg [Thu, 12 Apr 2007 06:49:37 +0000 (16:49 +1000)]
dont hardcode gdb in the test script.     ooops

17 years agoinitial support for two new pdus for the domain socket to do fetch_lock
Ronnie sahlberg [Thu, 12 Apr 2007 05:46:50 +0000 (15:46 +1000)]
initial support for two new pdus for the domain socket to do fetch_lock

no locking is yet done and the store_unlock call is still missing

the ./tests/fetch.sh --daemon  test fails with parent process dying which needs to be investigated.

17 years agomerge from volker
Ronnie sahlberg [Thu, 12 Apr 2007 00:52:19 +0000 (10:52 +1000)]
merge from volker

17 years agomerge from vl
Andrew Tridgell [Thu, 12 Apr 2007 00:51:55 +0000 (10:51 +1000)]
merge from vl

17 years agomerge from ronnie
Andrew Tridgell [Thu, 12 Apr 2007 00:44:18 +0000 (10:44 +1000)]
merge from ronnie

17 years agoadd an example on how to read a message from the domain socket
Ronnie sahlberg [Wed, 11 Apr 2007 23:09:27 +0000 (09:09 +1000)]
add an example on how to read a message from the domain socket

17 years agodo an infinite loop calling event_loop_once() in the ctdbd parent process instead...
Ronnie sahlberg [Wed, 11 Apr 2007 22:44:15 +0000 (08:44 +1000)]
do an infinite loop calling event_loop_once() in the ctdbd parent process instead of event_loop_wait()  since the latter will return and thus take down the daemon

17 years agoadd a test message to the messaging test so we can see that the message data is also...
Ronnie sahlberg [Wed, 11 Apr 2007 22:28:54 +0000 (08:28 +1000)]
add a test message to the messaging test so we can see that the message data is also passed from originator to receiver

17 years agomerge from ridge and vl
Ronnie sahlberg [Wed, 11 Apr 2007 21:49:28 +0000 (07:49 +1000)]
merge from ridge and vl

17 years agoRename "private" to "private_data"
Volker Lendecke [Wed, 11 Apr 2007 18:12:15 +0000 (20:12 +0200)]
Rename "private" to "private_data"

17 years agoMerge tridge's tree
Volker Lendecke [Wed, 11 Apr 2007 14:52:06 +0000 (16:52 +0200)]
Merge tridge's tree

17 years agoAdd a test to read back the message
Volker Lendecke [Wed, 11 Apr 2007 14:51:25 +0000 (16:51 +0200)]
Add a test to read back the message

Volker

17 years agouse event_loop_wait instead of while(1)
Andrew Tridgell [Wed, 11 Apr 2007 12:21:43 +0000 (22:21 +1000)]
use event_loop_wait instead of while(1)

17 years agouse lib/replace for signal.h
Andrew Tridgell [Wed, 11 Apr 2007 12:19:46 +0000 (22:19 +1000)]
use lib/replace for signal.h

17 years agomerge from volker
Andrew Tridgell [Wed, 11 Apr 2007 12:17:24 +0000 (22:17 +1000)]
merge from volker

17 years agomerge from ronnie
Andrew Tridgell [Wed, 11 Apr 2007 12:11:07 +0000 (22:11 +1000)]
merge from ronnie

17 years agomerge
Volker Lendecke [Wed, 11 Apr 2007 11:57:58 +0000 (13:57 +0200)]
merge

17 years agoHandle a client that exited correctly: We need to ignore SIGPIPE and when the
Volker Lendecke [Wed, 11 Apr 2007 11:17:36 +0000 (13:17 +0200)]
Handle a client that exited correctly: We need to ignore SIGPIPE and when the
read returns 0 bytes this means the client has exited. Close the connection
then.

17 years agoFix uninitialized variable warnings
Volker Lendecke [Wed, 11 Apr 2007 10:49:10 +0000 (12:49 +0200)]
Fix uninitialized variable warnings

17 years agoadd an example on how to send a message to the daemon
Ronnie sahlberg [Wed, 11 Apr 2007 10:32:24 +0000 (20:32 +1000)]
add an example on how to send a message to the daemon
(send a message to ourself)

this unfortunately terminates the ctdb daemon when running   but im too tired right now to debug it.
checkin so that nothing gets lost overnight.

17 years agoadd call/reply parsing of the cluster connect-wait call to the test daemon.
Ronnie sahlberg [Wed, 11 Apr 2007 09:27:19 +0000 (19:27 +1000)]
add call/reply parsing of the cluster connect-wait call to the test daemon.

17 years agoadd a vnn field to the ctdb_reply_connect_wait pdu so that we can tell
Ronnie sahlberg [Wed, 11 Apr 2007 09:04:09 +0000 (19:04 +1000)]
add a vnn field to the ctdb_reply_connect_wait pdu so that we can tell
non-ctdb-linked clients what the vnn of the local cluster daemon is

17 years agocreate a standalone ctdb daemon and a script ./direct/ctdbd.sh to start two such...
Ronnie sahlberg [Wed, 11 Apr 2007 08:54:22 +0000 (18:54 +1000)]
create a standalone ctdb daemon and a script ./direct/ctdbd.sh to start two such daemons in a 2 node cluster.

create a small test application that connects to the ctdb daemon at /tmp/ctdb.socket.127.0.0.1 and do some commands to the daemon.
currently this test tool only opens the socket and registers its pid with the daemon
(the daemon needs to know the pid so that it can forward messages to the correct client)

the test will be extended with additional ctdb commands

17 years agomerge from tridge
Ronnie sahlberg [Wed, 11 Apr 2007 05:40:03 +0000 (15:40 +1000)]
merge from tridge

17 years agoadded --num-clients option to ctdb_messaging test
Andrew Tridgell [Wed, 11 Apr 2007 05:23:50 +0000 (15:23 +1000)]
added --num-clients option to ctdb_messaging test

17 years agouse the new connect_wait code in the ctdb_messaging test
Andrew Tridgell [Wed, 11 Apr 2007 05:09:22 +0000 (15:09 +1000)]
use the new connect_wait code in the ctdb_messaging test

17 years agoadd proper support for ctdb_connect_wait in daemon mode
Andrew Tridgell [Wed, 11 Apr 2007 04:54:47 +0000 (14:54 +1000)]
add proper support for ctdb_connect_wait in daemon mode

17 years agofixed sending messages to ourselves in non-daemon mode
Andrew Tridgell [Wed, 11 Apr 2007 04:26:14 +0000 (14:26 +1000)]
fixed sending messages to ourselves in non-daemon mode

17 years agomerge from ronnie, plus complete the client side of inter-node messaging
Andrew Tridgell [Wed, 11 Apr 2007 04:05:01 +0000 (14:05 +1000)]
merge from ronnie, plus complete the client side of inter-node messaging

17 years agoadd a test that sends messages between clients connected to the same ctdb
Ronnie sahlberg [Wed, 11 Apr 2007 03:43:15 +0000 (13:43 +1000)]
add a test that sends messages between clients connected to the same ctdb

add code to actually pass the messages between clients and ctdb

17 years agopartially completed work towards full messaging system which will work in both daemon...
Andrew Tridgell [Wed, 11 Apr 2007 01:58:28 +0000 (11:58 +1000)]
partially completed work towards full messaging system which will work in both daemon and standalone mode. Does not compile\! committing so ronnie can continue while I'm out

17 years agomerge from ronnie
Andrew Tridgell [Wed, 11 Apr 2007 01:11:44 +0000 (11:11 +1000)]
merge from ronnie

17 years agomerge from tridge
Ronnie sahlberg [Wed, 11 Apr 2007 01:08:20 +0000 (11:08 +1000)]
merge from tridge

17 years agoforgot to add ctdb_client.c
Andrew Tridgell [Wed, 11 Apr 2007 01:02:26 +0000 (11:02 +1000)]
forgot to add ctdb_client.c

17 years ago - add --daemon flag to ctdb_fetch test code
Andrew Tridgell [Wed, 11 Apr 2007 01:01:42 +0000 (11:01 +1000)]
 - add --daemon flag to ctdb_fetch test code
 - split client specific routines out of ctdb_daemon.c
 - use ctdb_queue code in message send from client to daemon
 - use clearer names in client/daemon functions
 - use talloc autofree context to avoid global for unlink of socket on
   exit
 - start on API change for message handler, to allow ctdb messaging to
   handle daemon mode with multiple clients

17 years agorename client.id to client.messenger_id to make the purpose of the field more obvious
Ronnie sahlberg [Tue, 10 Apr 2007 11:14:55 +0000 (21:14 +1000)]
rename client.id to client.messenger_id to make the purpose of the field more obvious

17 years agoadd a call to register the pid for a messengin service
Ronnie sahlberg [Tue, 10 Apr 2007 11:05:29 +0000 (21:05 +1000)]
add a call to register the pid for a messengin service

store this pid inside the client structure in the ctdb daemon

17 years agofix the queueing for partially connected tcp sockets
Andrew Tridgell [Tue, 10 Apr 2007 10:48:31 +0000 (20:48 +1000)]
fix the queueing for partially connected tcp sockets

17 years agoupdates from tridges tree
Ronnie sahlberg [Tue, 10 Apr 2007 10:25:11 +0000 (20:25 +1000)]
updates from tridges tree

17 years agomake some functions static, and remove an unused structure
Andrew Tridgell [Tue, 10 Apr 2007 09:40:29 +0000 (19:40 +1000)]
make some functions static, and remove an unused structure

17 years agomerge from ronnie
Andrew Tridgell [Tue, 10 Apr 2007 09:35:21 +0000 (19:35 +1000)]
merge from ronnie

17 years agomade all sockets handle partial IO
Andrew Tridgell [Tue, 10 Apr 2007 09:33:21 +0000 (19:33 +1000)]
made all sockets handle partial IO
abstract IO via ctdb_queue_*() functions

17 years agoremove old ifdef that remained from when this was a header file
Ronnie sahlberg [Tue, 10 Apr 2007 04:53:23 +0000 (14:53 +1000)]
remove old ifdef that remained from when this was a header file

17 years agomerge tcp changes from ronnie
Andrew Tridgell [Tue, 10 Apr 2007 04:48:13 +0000 (14:48 +1000)]
merge tcp changes from ronnie

17 years agoadded daemon mode to ctdb_bench
Andrew Tridgell [Tue, 10 Apr 2007 04:46:32 +0000 (14:46 +1000)]
added daemon mode to ctdb_bench

17 years agochange the tcp code to call ctdb_read_pdu() instead of doing the partial read thing...
Ronnie sahlberg [Tue, 10 Apr 2007 03:17:15 +0000 (13:17 +1000)]
change the tcp code to call ctdb_read_pdu() instead of doing the partial read thing explicitely

17 years agomerge from ronnie
Andrew Tridgell [Tue, 10 Apr 2007 03:06:47 +0000 (13:06 +1000)]
merge from ronnie

17 years agofix a possible free after use
Andrew Tridgell [Tue, 10 Apr 2007 03:05:23 +0000 (13:05 +1000)]
fix a possible free after use

17 years agofix configure for new test location
Andrew Tridgell [Tue, 10 Apr 2007 02:51:54 +0000 (12:51 +1000)]
fix configure for new test location

17 years agomove the checking of the CONNECT_WAIT flag into the start method for tcp
Ronnie sahlberg [Tue, 10 Apr 2007 02:39:25 +0000 (12:39 +1000)]
move the checking of the CONNECT_WAIT flag into the start method for tcp

17 years agorestore the test script that was updated by mistake in the previous checkin
Ronnie sahlberg [Tue, 10 Apr 2007 02:23:10 +0000 (12:23 +1000)]
restore the test script that was updated by mistake in the previous checkin

17 years agoadd a CONNECT_WAIT flag to replace the call ctdb_connect_wait() since
Ronnie sahlberg [Tue, 10 Apr 2007 02:18:58 +0000 (12:18 +1000)]
add a CONNECT_WAIT flag to replace the call ctdb_connect_wait() since
we can no longer use this function from the application if we are in daemon mode.

add a horrible "sleep()" to ctdb_test.c   to prevent the daemon from dissapearing (parent process died) when the application exits which may happen before the other nodes in the test have finished talking to our daemon

17 years agoadd a atexit() call to remove the domain socket when the daemon exits
Ronnie sahlberg [Mon, 9 Apr 2007 22:47:39 +0000 (08:47 +1000)]
add a atexit() call to remove the domain socket when the daemon exits

17 years agochange ctdb_client_read() to use the ctdb_read_pdu() helper
Ronnie sahlberg [Mon, 9 Apr 2007 22:38:29 +0000 (08:38 +1000)]
change ctdb_client_read() to use the ctdb_read_pdu() helper

17 years agomake normal/deamon mode controllable by a ctdb flag so that the api looks the same...
Ronnie sahlberg [Mon, 9 Apr 2007 20:03:39 +0000 (06:03 +1000)]
make normal/deamon mode controllable by a ctdb flag so that the api looks the same in both modes to a client.

send the correct structure back to a client

assorted other cleanups

(tests/test1.sh now works in daemon mode)

17 years agodispatcher daemon first try.
Ronnie sahlberg [Mon, 9 Apr 2007 01:51:27 +0000 (11:51 +1000)]
dispatcher daemon   first try.

does not yet work

17 years agomerge from tridge
Ronnie sahlberg [Sun, 8 Apr 2007 02:11:48 +0000 (12:11 +1000)]
merge from tridge

17 years agoanother memory leak
Andrew Tridgell [Sat, 7 Apr 2007 00:58:14 +0000 (10:58 +1000)]
another memory leak

17 years agoremove talloc debug code
Andrew Tridgell [Sat, 7 Apr 2007 00:46:47 +0000 (10:46 +1000)]
remove talloc debug code

17 years agofixed a bunch of memory leaks
Andrew Tridgell [Sat, 7 Apr 2007 00:45:00 +0000 (10:45 +1000)]
fixed a bunch of memory leaks

17 years agoput test code in tests/ directory
Andrew Tridgell [Sat, 7 Apr 2007 00:01:09 +0000 (10:01 +1000)]
put test code in tests/ directory

17 years agoadded a magic header for wireshark and packet version info
Andrew Tridgell [Fri, 6 Apr 2007 04:41:05 +0000 (14:41 +1000)]
added a magic header for wireshark and packet version info

17 years agomerge from ronnie
Andrew Tridgell [Thu, 5 Apr 2007 23:46:45 +0000 (09:46 +1000)]
merge from ronnie

17 years agoWhen we create a tcp connection to a remote ctdb node do an explicit bind() to set...
Ronnie sahlberg [Thu, 5 Apr 2007 23:08:41 +0000 (09:08 +1000)]
When we create a tcp connection to a remote ctdb node  do an explicit bind() to set our source side to the same ip address as we use to listen to ctdb traffic.

We need this since there is no guarantee that INADDR_ANY (which would be defaulted to if we dont bind) would be routable from the remote host.
This is entirely possible to happen since CTDB traffic is likely to be isolated to a private non-routable network.

17 years agomerge from ronnies branch
Andrew Tridgell [Thu, 5 Apr 2007 03:19:06 +0000 (13:19 +1000)]
merge from ronnies branch

17 years agomerge fetch code from ronnie, and add a simple fetch test
Andrew Tridgell [Thu, 5 Apr 2007 03:18:31 +0000 (13:18 +1000)]
merge fetch code from ronnie, and add a simple fetch test

17 years agofirst test of forced migration of records. compiles but not tested.
Ronnie sahlberg [Wed, 4 Apr 2007 11:15:56 +0000 (21:15 +1000)]
first test of forced migration of records.  compiles but not tested.

17 years agotridge
Ronnie sahlberg [Wed, 4 Apr 2007 05:05:35 +0000 (15:05 +1000)]
tridge

17 years agomerge back some changes from Samba4
Andrew Tridgell [Wed, 4 Apr 2007 05:02:49 +0000 (15:02 +1000)]
merge back some changes from Samba4

17 years agomerge multi-database support from ronnie
Andrew Tridgell [Tue, 3 Apr 2007 10:13:50 +0000 (20:13 +1000)]
merge multi-database support from ronnie

17 years agoSplit CTDB into sub contexts to handle multiple concurrent databases within the same...
Ronnie sahlberg [Tue, 3 Apr 2007 09:41:00 +0000 (19:41 +1000)]
Split CTDB into sub contexts to handle multiple concurrent databases within the same context.

17 years agomerged changes from peter
Andrew Tridgell [Thu, 8 Mar 2007 00:27:15 +0000 (11:27 +1100)]
merged changes from peter

17 years agoib: added external send queue to workaround downtime
Peter Somogyi [Mon, 26 Feb 2007 10:59:20 +0000 (11:59 +0100)]
ib: added external send queue to workaround downtime
Workaround is because I couldn't find a correct way in ib to reconnect cleanly (with queue kept) when destination is unreachable.
When connection is broken, all internal queue contents are being destroyed and reconnects automatically.
An "external" send queue is kept until the connection is up again for a dest node.