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

278 Commits

Author SHA1 Message Date
Andrew Tridgell
2e77ee8f4d merged from ronnie
(This used to be ctdb commit 521484a462dcddeebe02bb9c725e18939919b6fe)
2007-04-28 13:02:59 +02:00
Ronnie Sahlberg
acb4bc095b add a few more controls that are useful for debugging a cluster
(This used to be ctdb commit 751c1365ab55a217ff33d985d52bd26581578617)
2007-04-28 20:40:26 +10:00
Andrew Tridgell
6c56be8888 allow ctdbd_allocate_pkt to be used in client code
(This used to be ctdb commit 2c37cc7bb97dee5bb2e929958e6c834b27c9ae6a)
2007-04-28 12:01:46 +02:00
Ronnie Sahlberg
643bfe83d3 add a control to pull the database list from a remote node
(This used to be ctdb commit d130e02936ea4bdcd3a6f02c53be4b7771993138)
2007-04-28 20:00:50 +10:00
Andrew Tridgell
ee228e870d fixed some warnings
(This used to be ctdb commit b5434a40cf2db008eb1e681fcd2ceeff331324fa)
2007-04-28 11:35:49 +02:00
Ronnie Sahlberg
fd9b5591ba you cant dereference ctdb->vnnmap in the client since it is null in hte
client

(This used to be ctdb commit cbd01fc8978f798a5eb5c8920a1acb68d43f7a80)
2007-04-28 19:28:25 +10:00
Andrew Tridgell
353a82f87c factor out the packet allocation code
(This used to be ctdb commit 4cbaf22cc4bede8c95dd9b87e21bbe886307e23b)
2007-04-28 10:50:32 +02:00
Andrew Tridgell
a8de91b83f merge from ronnie
(This used to be ctdb commit 9253714401de1d7fea6ad44c35f324004683abd7)
2007-04-28 09:54:45 +02:00
Ronnie Sahlberg
21331d3c94 ctdb will now verify that the generation id for all CTDB_REQ_CALLs that
it receives from remote nodes with its own generation number.

if the generation id do not match the daemon will just discard the 
packet completely.
this will require that clients such as samba3 will have to be aware that 
calls it sends to remote nodes may get lost and will have to resend the 
requests after a timeout.

during cluster recovery/reconfiguration the generation nnumbers will be 
changing and this can be used to prevent nodes that are still in the 
"old" instance from talking to nodes that belong to the new generation 
instance

(This used to be ctdb commit 4c197f1cbfdd5f65af9c059aae2b4508ebd0cd34)
2007-04-28 01:48:31 +10:00
Ronnie Sahlberg
8d670cbf74 clients should not fill in "generation" nor be aware of what generation
the cluster is currently in.

remove all instances where the clients try to fill in the generation 
field of the header

(This used to be ctdb commit fd75463f69f9f9100b2fe4cb710201a8262cdcec)
2007-04-28 01:19:40 +10:00
Andrew Tridgell
d2f600b15f always use allocated packets to avoid alignment errors
(This used to be ctdb commit 47b53d344941a3203c87788439e7df59477681be)
2007-04-27 17:10:47 +02:00
Ronnie Sahlberg
916c55ec2f add a generation field to the pdu header.
this will allow a node to verify that a received pdu is sent from a node 
in the same generation instance of a cluster.

(This used to be ctdb commit e32d3ca9a622237c4e2622de98825c0962760d48)
2007-04-28 01:06:26 +10:00
Andrew Tridgell
e629252b2c merge from ronnie
(This used to be ctdb commit d21de127cceea7174b2e05701c8846c0b0c881c0)
2007-04-27 16:53:52 +02:00
Andrew Tridgell
eee3912c99 some debug code
(This used to be ctdb commit 957801ad6285c21fd11469a60dbdcc170e7009cb)
2007-04-27 16:42:43 +02:00
Ronnie Sahlberg
5b4ebe1345 make srvid 64 bits instead of 32 bits
(This used to be ctdb commit 723bcfbba1d5aa711496d37b9658190b78a2d66b)
2007-04-28 00:31:45 +10:00
Ronnie Sahlberg
7d1b82fd09 merge from tridge
(This used to be ctdb commit 0d6fb241faa15cb2183d2faa4c5ffa607b9d5f46)
2007-04-27 23:41:45 +10:00
Andrew Tridgell
3dc6331aee merged broadcast messages from ronnie
(This used to be ctdb commit bc20a7de280dbaa5e8ceb5493c51c059aa80d41c)
2007-04-27 15:26:13 +02:00
Ronnie Sahlberg
f616f2de10 add a special VNN that means "all" nodes so that a message can be
broadcasted to all daemons in the cluster

change the message dispatch routine for sending messages so that it 
allows several clients to use the same srvid
messages are then passed on to all clients that have that srvid

(This used to be ctdb commit 05d7ebb3556785f0f17a87d808f31ffe8dac288a)
2007-04-27 23:16:17 +10:00
Andrew Tridgell
22546add19 debug level controls
(This used to be ctdb commit 85f883c081dd1ab069420d2e7f4f2e9d708b3cde)
2007-04-27 15:14:36 +02:00
Andrew Tridgell
837c3cc4b1 nicer testing of control data size
(This used to be ctdb commit 67d51cd74c8bbd20cae1da9f04f32ff887fc4f8c)
2007-04-27 14:49:44 +02:00
Ronnie Sahlberg
d4c54a93a0 add a new control : SETVNNMAP to set the generation id and also the vnn
map on a ctdbd daemon

(This used to be ctdb commit f55707885f7b233ad6ddfc952d08851577063200)
2007-04-27 22:08:12 +10:00
Ronnie Sahlberg
d9edf88ae5 add a control to read the vnnmap configuration from a node
add support in ctdb_control to fetch this information from a node

(This used to be ctdb commit 8d7f26c8d78d30c3ccb15a28ddea940d8666e052)
2007-04-27 20:56:10 +10:00
Ronnie Sahlberg
ec3856ead9 add a mapping table from a hash value to a lmaster vnn number
update ctdb_lmaster() return the lmaster based on this tables contents


initialize the vnn table based on number of nodes for now.
later when recovery is implemented the recovery process will populate 
this mapping table.

(This used to be ctdb commit 71e440f6c26ea074f9887237c962101c8cef8c80)
2007-04-27 18:43:52 +10:00
Andrew Tridgell
7d3ab0f5fb null terminate a string
(This used to be ctdb commit a7408802c7bff235bd917d06f98e00e309d2d5ca)
2007-04-26 23:29:26 +02:00
Andrew Tridgell
f0a582e454 got rid of the getdbpath call
(This used to be ctdb commit 736ce5c00a1d1b47abb44c4b262b14bfba5202b1)
2007-04-26 23:10:35 +02:00
Andrew Tridgell
afa0876335 added a ctdb_get_config call
added a ctdb ping control

(This used to be ctdb commit 7d17378b6e6076a922cffe98239e20dfbbae3bf7)
2007-04-26 19:27:07 +02:00
Andrew Tridgell
fc43701cbb removed some bogus debug lines
(This used to be ctdb commit 25aa579058ecd2a33b13b4c1d6c7c75427bbdafa)
2007-04-26 18:31:13 +02:00
Andrew Tridgell
e51142c8f3 validate the vnn
(This used to be ctdb commit 025e58ba2b870ebb861b015d5c79dac7f5402bfb)
2007-04-26 15:38:33 +02:00
Andrew Tridgell
1b36d7bebd fixed typo
(This used to be ctdb commit 9755f9c62fd14abc65189fc06629f37546f53082)
2007-04-26 15:33:17 +02:00
Andrew Tridgell
c23d1694db merge from peter
(This used to be ctdb commit ddf390da2bceb5b3f431433aec424d99d98c05f4)
2007-04-26 15:28:13 +02:00
Peter Somogyi
9d521cf16a merged tridge's branch
(This used to be ctdb commit 02ec7d6abb75a7c0a414efd4a50d44e6f1e5e407)
2007-04-26 15:00:24 +02:00
Andrew Tridgell
8ae14b4052 moved status to ctdb_control
(This used to be ctdb commit 9a543968ba0379fbf8e977e184f22f4349d6243f)
2007-04-26 14:51:41 +02:00
Andrew Tridgell
d955485e7b added a ctdb control message, and tool
(This used to be ctdb commit 0d7a71f35bb8ce95231f8ca1e8e3e4024fe657e5)
2007-04-26 14:27:49 +02:00
Andrew Tridgell
c1a4b3c687 merge from ronnie
(This used to be ctdb commit 37ef65737571a4290a150c28cf2b0a6b221253fd)
2007-04-26 11:13:49 +02:00
Andrew Tridgell
3d14b79c2f popt not needed in lockwait code
(This used to be ctdb commit 796fdbe8efc3d74515218ddcb25abdbec2e9c2b7)
2007-04-23 23:33:37 +02:00
Ronnie Sahlberg
dabf61075f add pdu's that the client can use to query the ctdb daemon of the path
to the database it created (so the client can open and access the same 
file)

(This used to be ctdb commit c2eda19499b3263b2248c41bd531fb73c7b42212)
2007-04-24 00:06:48 +10:00
Ronnie Sahlberg
bd62c78154 split the 32bit idr field into two.
store the idr as the high 16 bits and use a rotating counter for the low 
16 bits.

(This used to be ctdb commit 7c763b7b5e6ca54a6df4586893ddaf1b508b4c22)
2007-04-23 18:19:50 +10:00
Ronnie Sahlberg
42971d6565 add a comment that sometimes sending remote calls straight to the
lmaster instead of what the nodes think is the dmaster (which might be 
stale) improve performance.

(This used to be ctdb commit f535f79e6a2a6c6d07141b96e0b957fa93c684f4)
2007-04-23 17:05:09 +10:00
Andrew Tridgell
f651581460 added max_redirect_count status field
(This used to be ctdb commit ecea04741fe552aa409ab165d7c69ead9649986c)
2007-04-22 18:57:22 +02:00
Andrew Tridgell
9e8002dd67 fixed the reverse of the last bug - handle the case when the new dmaster is the lmaster
(This used to be ctdb commit b2599834d2ace7369a1b36f85fdf6eb62f047e30)
2007-04-22 18:19:49 +02:00
Andrew Tridgell
107d91e391 - when handling a record migration in the lmaster, bypass the usual
dmaster request stage, and instead directly send a dmaster
  reply. This avoids a race condition where a new call comes in for
  the same record while processing the dmaster request

- don't keep any redirect records during a ctdb call.  This prevents a
  memory leak in case of a redirect storm

(This used to be ctdb commit 59889ca0fd606c7d2156839383a09dfc5a2e4853)
2007-04-22 14:26:45 +02:00
Andrew Tridgell
2a08818e24 added a useful tool for dumping a ctdb
(This used to be ctdb commit 671ed94011e21396571a3f4a5191b9a83911c952)
2007-04-22 09:24:27 +02:00
Andrew Tridgell
9398d48c54 update the vnn as well when getting the connection information
(This used to be ctdb commit 25f36f7edaa56a16692949d6750b65d74bf4218f)
2007-04-21 23:24:39 +02:00
Andrew Tridgell
520f7971cd - prevent sending dmaster requests to ourselves
- add some debug code

(This used to be ctdb commit 26ad1ec3a3b872520a735e4fe4f224f716643731)
2007-04-21 09:22:46 +02:00
Andrew Tridgell
3fb0fa97b3 merge fixes from samba4
(This used to be ctdb commit 23d892c2696c5c1dd9f12f1ccd1acfa264be4fb6)
2007-04-21 13:08:22 +10:00
Peter Somogyi
ddce8a5b6d merged tridge's branch
(This used to be ctdb commit b40d044fc5b057b707a6f5637313c0836981a66e)
2007-04-20 14:50:10 +02:00
Peter Somogyi
933cb2efce Simplified code in ctdb_init_transport.
(This used to be ctdb commit 9a30e0fcbdde587cb1f3d854b8f1d22da19d9af4)
2007-04-20 14:47:52 +02:00
Peter Somogyi
e5f2e5e5eb - ctdb/ib minor bugfixes (error case)
- make ctdb capable of alternative connection (like ib) again, solved the fork problem
- do_debug memory overwrite bugfix (occured using ibwrapper_test with wrong address given)

(This used to be ctdb commit da0b84cda26d544f63841dfd770ed7ebad401944)
2007-04-20 14:26:19 +02:00
Andrew Tridgell
e9d43f5e43 - expanded status to include count of each call type
- added lockwait latency

(This used to be ctdb commit 0b5d196147e644cf8b172cb4b593fd46b1caa386)
2007-04-20 21:02:53 +10:00
Andrew Tridgell
2e5aae04de added ctdb_status tool
(This used to be ctdb commit 908d6c6a936e21f70f05827ce302e966cca0132a)
2007-04-20 20:07:47 +10:00
Andrew Tridgell
00c706c2b8 - fixed a problem with packets to ourselves. The packets were being
processed immediately, but the input routines indirectly assumed
  they were being called as a new event (for example, a calling
  routine might queue the packet, then afterwards modify the ltdb
  record). The solution was to make self packets queue via a zero
  timeout.

- fixed unlinking of the socket in a exit in the lockwait code. Needed
  an _exit instead of exit so atexit() doesn't trigger

- print latency of lockwait delays

(This used to be ctdb commit 1b0684b4f6a976f4c5fe54394ac54d121810b298)
2007-04-20 17:58:37 +10:00
Andrew Tridgell
bba02ce182 merged fix from volker (thanks!)
(This used to be ctdb commit 5f51864f837de5fd262d6a41722605789494cb66)
2007-04-20 07:50:34 +10:00
Andrew Tridgell
01b7eac536 minor debug changes
(This used to be ctdb commit 1950d96458238782c3bfd8e41a053c4be8330ef9)
2007-04-20 07:47:37 +10:00
Volker Lendecke
5edb0a8011 The remote node needs to get the IMMEDIATE_MIGRATION flag to actually send the
record


(This used to be ctdb commit 9159434b1eef39b7de58b30626039f1e45a97306)
2007-04-19 17:44:45 +02:00
Andrew Tridgell
eabe0bd7d4 fixed a bug found by volker - initialse the record on disk when initialised in memory
(This used to be ctdb commit f7903b00cdc91ae7d7e38b1a38d2b7b663e3a728)
2007-04-19 18:31:49 +10:00
Andrew Tridgell
e5c5a91a7b - split out ctdb_ltdb_lock_fetch_requeue() into a simpler
ctdb_ltdb_lock_requeue() and a small wrapper

- use ctdb_ltdb_lock_requeue() to fix a possible hang in
  ctdb_reply_dmaster(), where the ctdb_ltdb_store() could hang waiting
  for a client. We now requeue the reply_dmaster packet until we have
  the lock

(This used to be ctdb commit 97cd7aa09ce3abbb5e3e965c5c81668e0c0133a5)
2007-04-19 17:43:27 +10:00
Andrew Tridgell
273a3944a8 - added a --torture option to all ctdb tools. This sets
CTDB_FLAG_TORTURE, which forces some race conditions to be much more
  likely. For example a 20% chance of not getting the lock on the
  first try in the daemon

- abstraced the ctdb_ltdb_lock_fetch_requeue() code to allow it to
  work with both inter-node packets and client->daemon packets

- fixed a bug left over in ctdb_call from when the client updated the
  header on a call reply

- removed CTDB_FLAG_CONNECT_WAIT flag (not needed any more)

(This used to be ctdb commit 7559dcd184666c3853127e3c8f5baef4fea327c4)
2007-04-19 16:27:56 +10:00
Ronnie sahlberg
db12f3359b the checks for srcnode and destnode from the client are redundant since the daemon will sort these out itself before it sends the call of to either the local handler or a remote daemon
(This used to be ctdb commit 9175d49ba1ce2af99907fa227b50d281f85c98ae)
2007-04-19 12:48:19 +10:00
Ronnie sahlberg
63e513aeeb add some tests in the daemon that a REQ_CALL that a client sent us has valid srcnode and destnode
update ctdbd_test.c to show how to force a migration onto the local node

(This used to be ctdb commit fe313cee4927075be311e28ea106bd5cc035f217)
2007-04-19 12:33:13 +10:00
Andrew Tridgell
e830dfd18d much simpler fetch code!
fetch is now confined to the client code, no spcial code at
all in the daemon. 

(This used to be ctdb commit 3ec801c9717e250b902760862df188e03c9bdbf4)
2007-04-19 11:56:37 +10:00
Andrew Tridgell
d0af75d1fa - fully separate the client version of ctdb_call from the daemon
version. The client version is different enough that this is
  worthwhile

- enable local shortcut for client version of ctdb_call

- add idr_find_type(), with better error reporting in case of type
  mismatch

(This used to be ctdb commit 2388094c5f7b6ce003e86b05620c06217d63b49c)
2007-04-19 11:28:01 +10:00
Andrew Tridgell
b79e29c779 - make he packet allocation routines take a mem_ctx, which allows
us to put memory directly in the right context, avoiding quite a few
  talloc_steal calls, and simplifying the code

- make the fetch lock code in the daemon fully async

(This used to be ctdb commit d98b4b4fcadad614861c0d44a3854d97b01d0f74)
2007-04-19 10:37:44 +10:00
Andrew Tridgell
fde5a66531 avoid a deadlock the fetch_lock code. The deadlock could happen when
a client held the chainlock, and the daemon received a dmaster reply
at the same time. The daemon would not be able to process the dmaster
reply, due to the lock, but the fetch lock cannot make progres until
the dmaster reply is processed.

The solution is to not hold the lock in the client while talking to
the daemon. The client has to retry the lock after the record has
migrated. This means that forward progress is not guaranteed. We'll
have to see if that matters in practice.

(This used to be ctdb commit 737e5a1253cb048222c595a474aff71c99fc554f)
2007-04-19 10:03:20 +10:00
Andrew Tridgell
a3ab61b384 - use separate directories for the tdb files by default
- use TDB_CLEAR_IF_FIRST to ensure we don't use an old tdb
(This used to be ctdb commit ac47d7b4eb79597da1358da21f10e634cdc9dd2e)
2007-04-19 09:58:23 +10:00
Andrew Tridgell
36816ee12a merged the db_dir changes from volker. Changed them slightly,
to make the --dbdir option available to all ctdb tools, not just
the daemon

(This used to be ctdb commit add63b0ae11d8727163bb6f0c94a617d9b88ef28)
2007-04-19 09:14:25 +10:00
Volker Lendecke
9135024fc7 Add --dbdir to ctdbd. Necessary for shared operation between ctdbd and smbd.
(This used to be ctdb commit bce40105e2ccbca5e364793bbf1a6357e6dd69b2)
2007-04-18 16:36:22 +02:00
Andrew Tridgell
31e2331608 this fixes a timeout error spotted by volker
It ensures that when the client context goes away (such as when the client exits) 
that any timed events and partially completed requests from that client also go away
(This used to be ctdb commit 45a45a0a44d4da9b45719aac72b0ae4bd4c74462)
2007-04-18 19:12:29 +10:00
Andrew Tridgell
908f5085b0 validate dmaster on a client fetch request
(This used to be ctdb commit b49069aac0c14e5a02be843247930c197d620a81)
2007-04-18 18:39:02 +10:00
Andrew Tridgell
ddf430b2f2 simpler shutdown process. The reply is not actually needed, and
occasionally leads to problems if an immediate send on the socket
causes a context switch and the client exiting before the daemon. We
now exit the client when the daemon goes away.

(This used to be ctdb commit b7bed0088e700f25105ceea63640b38804f51e4d)
2007-04-18 15:35:41 +10:00
Andrew Tridgell
7060030889 make sure we don't double free in the async lock handler
(This used to be ctdb commit 67d3e64f82fd71ff1e32bf377d0cf1f636b9602f)
2007-04-18 15:27:26 +10:00
Ronnie sahlberg
adb4becfb7 add/finish the ctdb_shutdown() function.
this function can be used in test applications to perform an orderly shutdown of the ctdb cluster once the test has completed.
the ctdb nodes will remain operational until all of them have received a shutdown from their client(s)  after which the ctdb daemons will all terminate.

this eliminates the need to using sleep() in some of the test applications

(This used to be ctdb commit f35db69dc190b11659aad85495bb66308fdb5599)
2007-04-18 14:08:45 +10:00
Ronnie sahlberg
e390c925c1 initial shutdown function where a client can request an orderly shutdown of a ctdb cluster
(This used to be ctdb commit 00d2748bd4e7209ff7e253f6652fdd9bf16cf147)
2007-04-18 12:39:03 +10:00
Andrew Tridgell
7a02b09b01 started adding a cleaner daemon finish method
(This used to be ctdb commit 5ef0cd83d7f24616dad85cece485b770376ecd45)
2007-04-18 11:55:54 +10:00
Andrew Tridgell
aac20642b2 bit less verbose when client exits
(This used to be ctdb commit a6477577beba71bd9185b968de43b763378f234b)
2007-04-18 11:33:16 +10:00
Andrew Tridgell
8f059f4d91 - merge volkers debug changes
- fixed memory leaks in the 3 packet receive routines. The problem was
  that the ctdb_call logic would occasionally complete and free a
  incoming packet, which would then be freed again in the packet
  receive routine. The solution is to make the packet a child of a
  temporary context in the receive routine then free that temporary
  context. That allows other routines to keep or free the packet if
  they want to, while allowing us to safely free it (via a free of the
  temporary context) in the receive function

(This used to be ctdb commit 304aaaa7235febbe97ff9ecb43875b7265ac48cd)
2007-04-18 11:20:24 +10:00
Volker Lendecke
27837c197a Clean up the call_states correctly
(This used to be ctdb commit 9fcc40a2ddd8f7f62bdd8b5ab71d182220e23af0)
2007-04-17 23:40:33 +02:00
Volker Lendecke
84d276a5be Some more debug and two memleak fixes
(This used to be ctdb commit 1e2802422794956827263265306952df5e69b377)
2007-04-17 23:03:30 +02:00
Volker Lendecke
6c597d3e83 typo
(This used to be ctdb commit bf2799504498ae452bb7244ae3eb6a51797afe9b)
2007-04-17 21:23:22 +02:00
Volker Lendecke
3057f683f3 Add timestamps to debug output.
(This used to be ctdb commit 197a02384bd2ca42dfff4c0357175424d2321e9c)
2007-04-17 17:59:39 +02:00
Andrew Tridgell
98bb60e9d6 add debug tracing to fetch_lock
(This used to be ctdb commit b58d2ae0e4ef3393a93724526f2aebc7529de14f)
2007-04-17 22:39:23 +10:00
Andrew Tridgell
8a7b573320 more DEBUG() calls
(This used to be ctdb commit 79f3d63eec5652d87f13875c76e90ead81a26ad9)
2007-04-17 22:27:17 +10:00
Andrew Tridgell
1e2d91c761 moved cmdline.c to common code
(This used to be ctdb commit 32b31a6b91a19fc0c5225cb88c35cc1d14b4a6df)
2007-04-17 22:16:50 +10:00
Andrew Tridgell
7758511568 use the common cmdline code in ctdbd
add a basic debug system with -dXX

(This used to be ctdb commit af9f21cef79f888c57d3b50a23ca787c9567ce60)
2007-04-17 22:13:06 +10:00
Andrew Tridgell
0d91f8043e fixed a missing idr remove, and check the types after idr_find()
(This used to be ctdb commit 74028de89d18bfedcea17415d6d6dc2f7c69b076)
2007-04-17 20:03:01 +10:00
Volker Lendecke
748cc9e4b7 ZERO_STRUCT writes one byte too many here.
(This used to be ctdb commit 3c5c433e5b92f8fe2193a6e5720e31e3eb6bc76b)
2007-04-17 09:36:53 +02:00
Andrew Tridgell
6fce6e419a update destination in a redirect reply
(This used to be ctdb commit b2836974ad270e823c630e3acf12327b53c37d88)
2007-04-17 17:11:12 +10:00
Andrew Tridgell
5d8bf8e781 stop the client looping (temporary measure)
(This used to be ctdb commit 8e6a25f4c4a63145c0dee33453a0693dd395ee68)
2007-04-17 17:10:50 +10:00
Andrew Tridgell
eba2a4b88c start using ctdb_ltdb_lock_fetch_requeue()
(This used to be ctdb commit f89ab3a06b4677f56c92768c3a8ae5ec9f5abbc2)
2007-04-17 16:54:03 +10:00
Andrew Tridgell
1a1aedf78f when we get a lmaster request, skip updating the header when we are also the new dmaster
(This used to be ctdb commit 6c48dcc5df7b855fc8e0774c9572c7b2af618348)
2007-04-17 16:35:28 +10:00
Andrew Tridgell
040e69c1c4 we should not lock in a normal ctdb_call(), as we want them to run concurrently
(This used to be ctdb commit f4c8c4b3d4c6fb8f1b8e770d1788816af74a7e1f)
2007-04-17 16:34:53 +10:00
Andrew Tridgell
296b0c2a20 - send the record header from the client to the daemon when doing a
fetch, to avoid the daemon re-reading it

- suffix the database name with the node name so that testing on
  loopback doesn't result in a name collision in the database open

(This used to be ctdb commit ad30a4db75450643ff146c40faa306a021de3dd2)
2007-04-17 16:20:32 +10:00
Andrew Tridgell
b87de399f2 block SIGPIPE in the daemon to prevent a SIGPIPE on write to a dead socket
(This used to be ctdb commit 02c09dc07c9bed57ca3692b14e41ac8cca0a29f4)
2007-04-17 15:33:20 +10:00
Andrew Tridgell
5299b7e0e2 now that both daemon and client access the database, it needs to be a real disk file
(This used to be ctdb commit 5159f3a61f41bbaf563edd8d901a6bf5bfee4e4e)
2007-04-17 15:32:49 +10:00
Andrew Tridgell
6f9b29da22 - removed the non-daemon mode from ctdb, in order to simplify the
code. It may be added back later once everything is working nicely,
  or simulated using a in-process pipe instead of a unix domain socket

- rewrote the ctdb_fetch_lock() code to follow the new design

(This used to be ctdb commit 5024dd1f305fe1ecc262db2240c56f773b4f28f0)
2007-04-17 14:52:51 +10:00
Ronnie sahlberg
bccf3c7e8e create symbols for fetch lock response status
(This used to be ctdb commit d8243f474897dc65fb7286225b07bdf48b6faed0)
2007-04-17 12:42:52 +10:00
Ronnie sahlberg
11b5345afc finalize fetch lock changes to get rid of the record handle
(This used to be ctdb commit 36c1e98a5533214d5507699dc5d8bdec35cb28c2)
2007-04-17 12:36:31 +10:00
Ronnie sahlberg
e5fff3d611 do not use a ctdb_record_handle for client fetch_lock/store_unlock any more
change ctdb_client_fetch_lock to return a status code instead of a record handle and make it unconditionally fill in data.

change ctdb_client_store_unlock to take ctdb_db and key as arguments instead of a record handle

update the ctdb_fetch.c test to use the clientside helpers for fetching and storing data

(This used to be ctdb commit 22d5d40375e0135916c97945646f94119612615d)
2007-04-17 12:22:17 +10:00
Ronnie sahlberg
45660a3c48 remaning code to finish lock_fetch/store_unlock clientside helpers
(This used to be ctdb commit edf1e1fea8500461a08cd2795251a5cc0bd10229)
2007-04-17 11:48:27 +10:00
Ronnie sahlberg
481e029768 initial change to remove store_unlock pdu and use tdb chainlock in the client
(This used to be ctdb commit 87dd265d2c61125ca2fa922cfcf9371a234fff0c)
2007-04-17 11:34:45 +10:00
Andrew Tridgell
80ec427ec7 merge from ronnie
(This used to be ctdb commit fcf3669c27691ddb383d1c585234622efa498d90)
2007-04-17 11:30:19 +10:00
Andrew Tridgell
3c2ebff3cb partial merge from volker (some overlaps removed)
(This used to be ctdb commit c4747460a8e0017acfd2a97a632ecd9395562d4f)
2007-04-17 11:26:59 +10:00
Andrew Tridgell
3fc279760c better error handling in ctdb_ltdb_lock_fetch_requeue()
(This used to be ctdb commit 1952be19f625dbe257050acebf468e7e6eb0da8c)
2007-04-17 11:20:00 +10:00
Ronnie sahlberg
ee9712620f change some error printouts to make it easier to determine whether the error occured in the client or in the daemon
(This used to be ctdb commit a7e42c2c56e38b4b58ede0ad45767695d704dac4)
2007-04-17 10:15:44 +10:00
Andrew Tridgell
71bf837a19 add an explanation of ctdb_ltdb_lock_fetch_requeue()
(This used to be ctdb commit 7c749315130a2bc87dcc07460d10dcb089ae4202)
2007-04-17 09:18:20 +10:00
Andrew Tridgell
a024989597 add an explanation of how to use ctdb_lockwait()
(This used to be ctdb commit e0c9844ea6270ff506b0b5906aa6ccfcc3bcce7a)
2007-04-17 09:14:52 +10:00
Andrew Tridgell
7db4320e84 fixed crash bug - thanks volker
(This used to be ctdb commit e293f6fadf673d8bc7203198d709bcb28c26b482)
2007-04-17 09:10:52 +10:00
Andrew Tridgell
4c787fdff5 darn, forgot this
(This used to be ctdb commit 0feb5da60c0331f6c391622910ca1f436263ce46)
2007-04-17 07:41:27 +10:00
Andrew Tridgell
8147d033a3 added a ctdb_ltdb_lock_fetch_requeue() function
this will be the core of the non-blocking lock idea for ctdb, it will be used
in place of ctdb_ltdb_fetch(), but will also get a lock. It re-starts a request
if it needs to block
(This used to be ctdb commit afa479026cf6293e6a878c8a329cdac035284672)
2007-04-16 23:52:14 +10:00
Andrew Tridgell
07ade5e488 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.

(This used to be ctdb commit a3248c3e2b740cd2403acffd3c1f6a33dca0ea03)
2007-04-16 16:01:37 +10:00
Andrew Tridgell
f62bb4e8fc merge CTDB_SRVID_ALL patch from Samba4
(This used to be ctdb commit 43cd05ab58e940a1ef0352aabe0b63075264a7a0)
2007-04-16 10:31:39 +10:00
Andrew Tridgell
34bf25e227 - 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)

(This used to be ctdb commit d85955640e670dd580073da96b25fb8a10c08d18)
2007-04-16 10:21:44 +10:00
Andrew Tridgell
303c464c49 merge from ronnie
(This used to be ctdb commit 867468a7aadc11d0cb4d9f0eab55d3f34f11d6d3)
2007-04-14 20:44:43 +10:00
Andrew Tridgell
65cdf2297a private -> private_data for samba3
(This used to be ctdb commit 080b6901173afb2ad618dd0621876ff478c7d6e5)
2007-04-13 20:38:24 +10:00
Ronnie sahlberg
332f5ad063 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

(This used to be ctdb commit c7a397c56caf71283c081e5b97620085ed5108c6)
2007-04-13 20:37:41 +10:00
Ronnie sahlberg
03c49c0526 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

(This used to be ctdb commit 167d6993e78f6a1d0f6607ef66925a14993ae6a1)
2007-04-13 09:41:15 +10:00
Ronnie sahlberg
3aeac33da2 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

(This used to be ctdb commit e1a0da3dfbb4a927e8d98723b5e51a201c2a3428)
2007-04-12 21:14:41 +10:00
Ronnie sahlberg
35ffefb01f 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.

(This used to be ctdb commit 7d7141c968950a8856f1be79871932b688bfb07f)
2007-04-12 15:46:50 +10:00
Volker Lendecke
6f2b236909 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.

(This used to be ctdb commit bd10f4e62146493848258df8a3dc3b9222337a12)
2007-04-11 13:17:36 +02:00
Volker Lendecke
f2d13d0ea9 Fix uninitialized variable warnings
(This used to be ctdb commit b84f97adfd25b2fbfab1c7964b68931643e8029c)
2007-04-11 12:49:10 +02:00
Ronnie sahlberg
153bf81026 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

(This used to be ctdb commit 57fd1aa54b234545e1e465b5ace2ce93fcfbc22a)
2007-04-11 19:04:09 +10:00
Andrew Tridgell
8386b0e345 add proper support for ctdb_connect_wait in daemon mode
(This used to be ctdb commit 8d110df5939b3e6a6341909956453887f4eb6b0d)
2007-04-11 14:54:47 +10:00
Andrew Tridgell
d5584e5611 fixed sending messages to ourselves in non-daemon mode
(This used to be ctdb commit 325afd2de2f5a96fb4f8ec624e04f253c712c97d)
2007-04-11 14:26:14 +10:00
Andrew Tridgell
c658d5c1e8 merge from ronnie, plus complete the client side of inter-node messaging
(This used to be ctdb commit e605417436855d22343462acae4cbb79a374977e)
2007-04-11 14:05:01 +10:00
Ronnie sahlberg
185cd326da add a test that sends messages between clients connected to the same ctdb
add code to actually pass the messages between clients and ctdb

(This used to be ctdb commit 6d5b55d7b9c611fb5e98765906757a7d82e4bf6b)
2007-04-11 13:43:15 +10:00
Andrew Tridgell
ad1f17ab1c 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
(This used to be ctdb commit 1b5e65a700e2bd0a5c913d7866024b25600a14c9)
2007-04-11 11:58:28 +10:00
Andrew Tridgell
2daf1d3006 forgot to add ctdb_client.c
(This used to be ctdb commit 136f912562ef00ede5589a7aa080503538d14bc3)
2007-04-11 11:02:26 +10:00
Andrew Tridgell
110fe0c5a5 - 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

(This used to be ctdb commit 53555db45f3583ae4a32cc3aa9e07fb8ef2a77e3)
2007-04-11 11:01:42 +10:00
Andrew Tridgell
5861917468 make some functions static, and remove an unused structure
(This used to be ctdb commit 8d09cac96b2c604a68e4903346cc9db3a66d80da)
2007-04-10 19:40:29 +10:00
Andrew Tridgell
82e4ccbf3e merge from ronnie
(This used to be ctdb commit 886a3e9122168ececc257aa1bef2f5de2f2d8d7e)
2007-04-10 19:35:21 +10:00
Andrew Tridgell
f1e0174e83 made all sockets handle partial IO
abstract IO via ctdb_queue_*() functions

(This used to be ctdb commit 636ae76f4632b29231db87be32c9114f58b37840)
2007-04-10 19:33:21 +10:00
Ronnie sahlberg
9ba0f9db6f remove old ifdef that remained from when this was a header file
(This used to be ctdb commit 050f302103b32ea3895fc97dae7726f11fbf01e3)
2007-04-10 14:53:23 +10:00
Andrew Tridgell
82b712d80f merge tcp changes from ronnie
(This used to be ctdb commit 18d6e58b92f59f18cd7772cdbc1b8812a8609ab4)
2007-04-10 14:48:13 +10:00
Ronnie sahlberg
f2e2d1c2f3 change the tcp code to call ctdb_read_pdu() instead of doing the partial read thing explicitely
(This used to be ctdb commit 6156bec0187df27578afd5afa3fcaadb1a202030)
2007-04-10 13:17:15 +10:00
Andrew Tridgell
e5fc2d4062 merge from ronnie
(This used to be ctdb commit fb06332c246e9f8b98a6391b4eda183e2f03333f)
2007-04-10 13:06:47 +10:00
Andrew Tridgell
9958ded5eb fix a possible free after use
(This used to be ctdb commit 55bc7ee10b9e9df32792b6b5779f094eb513069e)
2007-04-10 13:05:23 +10:00
Ronnie sahlberg
91c39b4852 move the checking of the CONNECT_WAIT flag into the start method for tcp
(This used to be ctdb commit 44f3e4456d931af642192e034f84c961ab1fdcf0)
2007-04-10 12:39:25 +10:00
Ronnie sahlberg
b84ade51db 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

(This used to be ctdb commit 74d35dafe06d71e755f3a58cc58d4b9b56fc821b)
2007-04-10 12:18:58 +10:00
Ronnie sahlberg
31ffe0af35 add a atexit() call to remove the domain socket when the daemon exits
(This used to be ctdb commit 2f685c68e0b17ed8a290a265ebd64c1d089ceec5)
2007-04-10 08:47:39 +10:00
Ronnie sahlberg
c7e54e1437 change ctdb_client_read() to use the ctdb_read_pdu() helper
(This used to be ctdb commit d476aa8533b394af6aced9c80fffaf0eefae1dd0)
2007-04-10 08:38:29 +10:00
Ronnie sahlberg
190b97f0ed 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)

(This used to be ctdb commit f4593754cab750dfdb9384884502e2e1b8fde1f0)
2007-04-10 06:03:39 +10:00
Ronnie sahlberg
b384019536 dispatcher daemon first try.
does not yet work

(This used to be ctdb commit ff428808c6546d6f2804a1ac1cf414d1bb9cdcb4)
2007-04-09 11:51:27 +10:00
Andrew Tridgell
76c666fe52 another memory leak
(This used to be ctdb commit 10466fe11da71c93fa764bea2b3e1e741c113f9c)
2007-04-07 10:58:14 +10:00
Andrew Tridgell
01c4a086e7 fixed a bunch of memory leaks
(This used to be ctdb commit 2ba2522f2def3032c89c7973915610a245842b07)
2007-04-07 10:45:00 +10:00
Andrew Tridgell
eb73358691 added a magic header for wireshark and packet version info
(This used to be ctdb commit 8366c212bde710dd46c8c1d9d4301f6c3738e300)
2007-04-06 14:41:05 +10:00
Andrew Tridgell
230c97b04d merge fetch code from ronnie, and add a simple fetch test
(This used to be ctdb commit 83b794befd8d34b3da544a483f9d39a3fa140655)
2007-04-05 13:18:31 +10:00
Ronnie sahlberg
4d189e2437 first test of forced migration of records. compiles but not tested.
(This used to be ctdb commit ac6ac290e79446f52caf31f429b4c38668c27eda)
2007-04-04 21:15:56 +10:00
Andrew Tridgell
b686f9d289 merge back some changes from Samba4
(This used to be ctdb commit b946ff61c0e4b3269d3c7e01093d0a6d5215d6ee)
2007-04-04 15:02:49 +10:00
Ronnie sahlberg
8ccef4cb75 Split CTDB into sub contexts to handle multiple concurrent databases within the same context.
(This used to be ctdb commit d995103143f6f13f59118549d93ab4b29c27ec89)
2007-04-03 19:41:00 +10:00
Peter Somogyi
1c8bcd6f57 ib: a trivial approach of integration
TODO: bugfix (not yet complete, something happens differently than expected 
at tcpip when connection is refused in the beginning)

(This used to be ctdb commit 330d76fb91f717d4fb8d1be29c11ddf8c25a4f1c)
2007-02-14 18:58:20 +01:00
Andrew Tridgell
f71f62fabd changed ctdb_bench.c to use messages instead of calls
(This used to be ctdb commit d147a434f827f83cf90228a3ed37338db8e9df13)
2007-02-09 12:45:58 +11:00