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

115 Commits

Author SHA1 Message Date
Michael Adam
27dc0adfb5 client: in catdb, print the keyname first, and separate records by a blank line
Michael

(This used to be ctdb commit b9882710e12f28c96a0af298e419160f00578241)
2009-12-04 11:30:21 +01:00
Michael Adam
c532347a45 client: randomize the transaction_start retry loop:
instead of sleeping 1 second, sleep between 1 and 100 milliseconds

Michael

(This used to be ctdb commit a5d90d8ed8b44355c4ffb9c32ded772025fcc174)
2009-10-30 22:02:21 +11:00
Michael Adam
118185670d client: fix a race in the local race condition fix in transaction_start
The gap that remained is between checking whether a transaction commit
is in progress and taking the lock. Now we first take the lock and then
check whether a transaction commit is in progress. If so, we release the
lock, wait for one second and retry.

Michael

(This used to be ctdb commit b95524c08bf12914120cb6c818ecc1c99738fe37)
2009-10-30 22:01:16 +11:00
Michael Adam
c2855a11a8 client: add a debug message when a transaction_commit needs to be retried
Michael

(This used to be ctdb commit 9e4902c7d3ad1329c296f4196fcb1396f2a7a6a0)
2009-10-30 22:00:42 +11:00
Michael Adam
45c17515c3 client: log db_id as 8-digit hex in ctdb_transaction_fetch_start()
Michael

(This used to be ctdb commit d7b9babda2f7c7f7b95ee19ec75c37200816c6ef)
2009-10-30 09:28:49 +11:00
Michael Adam
361aec199e client: improve "control timed out" debug message
* add __location__
* wrap overly long line
* print unsigned ints as unsigned (reqid, opcode, destnode)

Michael

(This used to be ctdb commit 6b47ea111867c845974aa2687a658ebca2854816)
2009-10-30 09:22:52 +11:00
Ronnie Sahlberg
023d09cd38 Revert "update the "uptime" command to indicate the "time since last" is the time since the last recovery OR failover."
This reverts commit 3b0d44497800a16400d05a30bdaf6e6c285d4b36.

(This used to be ctdb commit cb36bbb5418290e8e5b770d2d836285b15da2a6f)
2009-10-29 10:49:00 +11:00
Ronnie Sahlberg
279b7ca564 update the "uptime" command to indicate the "time since last" is the time since the last recovery OR failover.
(This used to be ctdb commit 3b0d44497800a16400d05a30bdaf6e6c285d4b36)
2009-10-29 10:37:10 +11:00
Michael Adam
2419eab0d9 ctdb_client: reformat a comment slightly to enhance clearness.
Michael

(This used to be ctdb commit 9560f8b7fe0f7ee0386a87c2653333071050fe4b)
2009-10-29 10:15:54 +11:00
Michael Adam
5d579cf665 client: fix race condition with concurrent transactions on the same node.
In ctdb_transaction_commit(), when the trans2_commit control fails, there
is a race condition in the 1 second sleep between the local transaction_cancel
and the call to ctdb_replay_transaction(): The database is not locked, and
neither is the transaction_lock record. So another client can start and possibly
complete a new transaction in this gap, but only on the same node: The locking
of the transaction_lock record on a different node which involves migration of
the record to the other node has been disabled by introduction of the
transaction_active flag on the db which closes precisely this gap from the start
of the commit until the call to TRANS2_FINISH or TRANS2_ERROR.
But this mechanism does not cover the case where a process on the same node
tries to start a transaction: There is no obstacle to locking the transaction_lock
record because the record does not need to be migrated.

This commit closes this race condition in ctdb_transaction_fetch_start()
by using the new ctdb_ctrl_transaction_active() call to ask the local
ctdb daemon whether it has a transaction running on the database.
If so, the check is repeated until the running transaction is done.

This does introduce an additional call to the local ctdbd when starting
transactions, but it does close the (hopefully) last race condition.

Michael

(This used to be ctdb commit 02ee9dfd3c6b09f5c5172a7e38738c20b7f0aecd)
2009-10-29 10:15:21 +11:00
Michael Adam
953ccee5c5 client: add ctdb_ctrl_transaction_active() which calls out to CTDB_TRANS2_ACTIVE
Michael

(This used to be ctdb commit 813cfd7c625ac8af4ef169cc92fb6d69f66004c9)
2009-10-29 10:15:00 +11:00
Ronnie Sahlberg
4d40b86805 for debugging
add a global variable holding the pid of the main daemon.
change the tracking of time() in the event loop to only check/warn when called from the main daemon

(This used to be ctdb commit a10fc51f4c30e85ada6d4b7347b0f9a8ebc76637)
2009-10-27 13:18:52 +11:00
Stefan Metzmacher
1c6829f3c2 ctdb_client: fix DEBUG statement in ctdb_ctrl_modflags()
metze

(This used to be ctdb commit a244b75ee49556b0ff51e254cc812594ee3b23a7)
2009-10-26 14:22:07 +11:00
Ronnie Sahlberg
73c0adb029 initial attempt at freezing databases in priority order
(This used to be ctdb commit e8d692590da1070c87a4144031e3306d190ebed2)
2009-10-12 12:08:39 +11:00
Ronnie Sahlberg
d4c98516a2 uptade the freeze/thaw commands to be able to send the requested database priority to freeze/thaw to the daemon.
this is encoded in the srvid field of the request header

(This used to be ctdb commit 0cb3d33caa42ed783e03bc825b181dde4cf63616)
2009-10-12 09:22:17 +11:00
Ronnie Sahlberg
3219f81710 add a control to read the db priority from a database
(This used to be ctdb commit ca6d045e419f308f57e74d4c978907afb05ddb85)
2009-10-10 15:04:18 +11:00
Ronnie Sahlberg
6cf7d8e131 add a control to set a database priority. Let newly created databases default to priority 1.
database priorities will be used to control in which order databases are locked during recovery in.

(This used to be ctdb commit 67741c0ee01916d94cace8e9462ef02507e06078)
2009-10-10 14:26:09 +11:00
Ronnie Sahlberg
71e4259150 add a new function to collect a list of all active nodes EXCEPT a certain node
(This used to be ctdb commit be52954d921e7d443304cf49fbd488c619a9c4ec)
2009-10-06 10:52:31 +11:00
Michael Adam
3cb4bcd211 ctdb_client: fix race in starting concurrent transactions on a single node
There are two races in concurrent transactions on a single node.
One in starting a transaction, and one with committing (replaying).

This commit closes the first race by storing the pid in the
transaction-lock record and comparing the own pid against it
as a measure to prevent starting a second transaction when
a second node has come inbetween and changed the pid in the lock
record.

Michael

(This used to be ctdb commit 84e5a55a900b01903b80e23045edfc726d8d77a1)
2009-09-21 11:16:18 +02:00
Ronnie Sahlberg
cda5f02c7c new prototype banning code
(This used to be ctdb commit 0c4c2240267af183d54ffd4c0aacda208f6eff6a)
2009-09-04 02:20:39 +10:00
Ronnie Sahlberg
1cc79905ad add new controls to make it possible to enable/disable individual eventscripts
update scriptstatus output so it lists disabled scripts

(This used to be ctdb commit 7e799b7523c9699bd65a8a8207f7e03d668b0b81)
2009-08-13 13:04:08 +10:00
Michael Adam
572d397626 client: fix a debug message (misplaced newline).
Michael

(This used to be ctdb commit c513a31d755003d7af91529790b06ce0d226c90f)
2009-08-04 09:46:39 +02:00
Michael Adam
cfbdba0be6 client:ctdb_control_send: remove duplicate setting of the reqid header.
Michael

(This used to be ctdb commit 875778fbbfd6b0f09fd2db76f7348ad6271350a3)
2009-08-04 09:46:39 +02:00
Michael Adam
a6bd36933a client: refuse to do record_store() on a persistent tdb.
Only allow stores wrapped in transactions on persistent dbs.

Michael

(This used to be ctdb commit 9dea71cf72ef79a9aadf8ee7cf1a1899527459ff)
2009-07-29 11:17:07 +10:00
Michael Adam
188ab0f96c client: set dmaster in ctdb_transaction_store() also when updating an existing record
Michael

(This used to be ctdb commit e9194a130327d6b05a8ab90bd976475b0e93b06d)
2009-07-29 10:28:35 +10:00
Ronnie Sahlberg
62c4a841d2 When processing the stop node control reply in the client code we should
also check the returned status code in case the _stop() command failed
due to the eventscripts failing.

If this happens, make "ctdb stop" log an error to the console and try
the operation again.

(This used to be ctdb commit 20e82e0c48e07d1012549f5277f1f5a3f4bd10d1)
2009-07-29 09:58:40 +10:00
Ronnie Sahlberg
37d68c58b8 add two commands : setlmasterrole and setrecmasterrole to enable/disable these capabilities at runtime
(This used to be ctdb commit 51aaed0e9e42e901451292e8dd545297ab725a62)
2009-07-28 13:45:13 +10:00
Ronnie Sahlberg
72e2380e92 add a command "setnatgwstate {on|off}" that can be used to indicate if this node is using natgw functionality or not.
(This used to be ctdb commit 89a9bb29a60a6fb1fba55987e6cf0a4baa695e50)
2009-07-28 09:58:11 +10:00
Ronnie Sahlberg
88f3c40d9c add two new controls, CTOP_NODE and CONTINUE_NODE
that are used to stop/continue a node instead of using modflags messages

(This used to be ctdb commit 54b4a02053a0f98f8c424e7f658890254023d39a)
2009-07-09 12:22:46 +10:00
Ronnie Sahlberg
5b235c3999 add a control to set the reclock file
(This used to be ctdb commit 36cc2e586f03fa497ee9b06f3e6afc80219c4aaa)
2009-06-25 14:25:18 +10:00
Ronnie Sahlberg
10db6a41df return NULL and not a "" when there is no reclock file returned from the server
(This used to be ctdb commit 6755f89f81aba63bfe00ee16d44a0201cbfa90ca)
2009-06-25 12:26:14 +10:00
Ronnie Sahlberg
2b253c094c add a control to read the current reclock file from a node
(This used to be ctdb commit ed6a4cbcdcbb4e0df83bec8be67c30288bf9bd41)
2009-06-25 12:17:19 +10:00
Ronnie Sahlberg
26e1486db7 Whitespace changes and using the CTDB_NO_MEMORY() macro changes to
the previous patch.

(This used to be ctdb commit d623ea7c04daa6349b42d50862843c9f86115488)
2009-05-21 11:49:16 +10:00
Sumit Bose
2fcedf6dac add missing checks on so far ignored return values
Most of these were found during a review by Jim Meyering <meyering@redhat.com>

(This used to be ctdb commit 3aee5ee1deb4a19be3bd3a4ce3abbe09de763344)
2009-05-21 11:22:21 +10:00
Ronnie Sahlberg
0d48af4741 add additional log info to track if/why we cant switch to client mode.
(This used to be ctdb commit 722171fc94a36ffe9e0a5c64502b916fde0a13a4)
2009-05-14 18:25:00 +10:00
Ronnie Sahlberg
98a54c4675 Track how long it takes to take out the recovery lock from both the main dameon and also from the recovery daemon.
Log this in "ctdb statistics".

Also add a varaible "RecLockLatencyMs" that will log an error everytime it takes longer than this to access the reclock file.

(This used to be ctdb commit 042377ed803bb8f7ca9d6ea1a387427b7b8ba45a)
2009-05-14 10:33:25 +10:00
root
629d5ee1fa add a new command "ctdb scriptstatus"
this command shows which eventscripts were executed during the last monitoring cycle and the status from each eventscript.

If an eventscript timedout or returned an error we also
show the output from the eventscript.

Example :
[root@rcn1 ctdb-git]# ./bin/ctdb scriptstatus
6 scripts were executed last monitoring cycle
00.ctdb              Status:OK    Duration:0.021 Mon Mar 23 19:04:32 2009
10.interface         Status:OK    Duration:0.048 Mon Mar 23 19:04:32 2009
20.multipathd        Status:OK    Duration:0.011 Mon Mar 23 19:04:33 2009
40.vsftpd            Status:OK    Duration:0.011 Mon Mar 23 19:04:33 2009
41.httpd             Status:OK    Duration:0.011 Mon Mar 23 19:04:33 2009
50.samba             Status:ERROR    Duration:0.057 Mon Mar 23 19:04:33 2009
   OUTPUT:ERROR: Samba tcp port 445 is not responding

Add a new helper function "switch_from_server_to_client()" which both
the recovery daemon can use as well as in the child process we start for running the actual eventscripts.

Create several new controls, both for the eventscript child process to inform the master daemon of the current status of the scripts as well as for the ctdb tool to extract this information from the runninc daemon.

(This used to be ctdb commit c98f90ad61c9b1e679116fbed948ddca4111968d)
2009-03-23 19:07:45 +11:00
root
dc05c1b80c create a helper function that converts a ctdb instance in daemon mode to become
a ctdb client instance.

use this from the recovery daemon child process to switch to client mode
and connect back to the main daemon

(This used to be ctdb commit 16f31786a031255ab5b3099a0a3c745de973347a)
2009-03-23 12:37:30 +11:00
Ronnie Sahlberg
94a56ea410 reqrite the handling of flag updates across the cluster to eliminate a
race between the ctdb tool and the recovery daemon both at once
trying to push flag changes across the cluster.

(This used to be ctdb commit a9a1156ea4e10483a4bf4265b8e9203f0af033aa)
2008-11-20 12:43:18 +11:00
Ronnie Sahlberg
07d35c754f add a CTDB_SOCKET variable that can be used to override the default
/tmp/ctdb.socket

(This used to be ctdb commit b75e2263c565c21ecbbd98fbd2c10787e467bf5c)
2008-11-11 14:49:30 +11:00
Ronnie Sahlberg
f9beb55bf5 we must also check the status returned from the get tickles control to
determine whether it was successful or not

(This used to be ctdb commit 6fb2f8a36239e5902e27cf10213f85faf216d6f1)
2008-10-15 08:33:37 +11:00
Ronnie Sahlberg
260718e017 update the client side of getnodemap and getpublicips controls to
fallback to the old-style ipv4-only controls if the new-style ipv4/ipv6
control fails.

this allows a 1.0.59+ (ipv4/ipv6) ctdb daemon being recmaster  to be
compatible with
pre-1.0.59  versions of ctdb that are ipv4 only.

(This used to be ctdb commit 8e912abc2c68f5fe7b06c600ba6fec1a6900127c)
2008-10-15 00:24:44 +11:00
Ronnie Sahlberg
cb300382b0 update TAKEIP/RELEASEIP/GETPUBLICIP/GETNODEMAP controls so we retain an
older ipv4-only version of these controls.

We need this so that we are backwardcompatible with old versions of ctdb
and so that we can interoperate with a ipv4-only recmaster during a
rolling upgrade.

(This used to be ctdb commit 6b76c520f97127099bd9fbaa0fa7af1c61947fb7)
2008-10-14 10:40:29 +11:00
Ronnie Sahlberg
6474f3278d additional monitoring between the two daemons.
we currently only monitor that the dameons are running by kill(0, pid)
and verifying the the domain socket between them is ok.

this is not sufficient since we can have a situation where the recovery
daemon is hung.

this new code monitors that the recovery daemon is operating.
if the recovery hangs, we log this and shut down the main daemon

(This used to be ctdb commit cd69d292292eaab3aac0e9d9fc57cb621597c63c)
2008-09-09 13:44:46 +10:00
Ronnie Sahlberg
ef997d344f initial ipv6 patch
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>

(This used to be ctdb commit 1f131f21386f428bbbbb29098d56c2f64596583b)
2008-08-19 14:58:29 +10:00
Andrew Tridgell
6e86fa34bd added retry handling in client
(This used to be ctdb commit b3b9707dd8244758ff1080401a9e03e74766e1ab)
2008-08-08 13:11:41 +10:00
Andrew Tridgell
f2fd0d8b59 imported failure handling from dbwrap_ctdb.c
(This used to be ctdb commit 7c6b621f7307dc39ffcd7d965ac613642af201b8)
2008-08-08 11:04:21 +10:00
Andrew Tridgell
dfdb41350b save writing the same data twice
(This used to be ctdb commit 2426b9010ef45f5e96ffc12b8a69a3b0566b4f98)
2008-08-08 10:15:23 +10:00
Andrew Tridgell
66d154ef5f Merge commit 'ronnie/1.0.53'
(This used to be ctdb commit 58e6dc722ad1e2415b71baf1d471885169dde14d)
2008-08-08 00:48:19 +10:00
Andrew Tridgell
5ee51ae84e fixed a looping error bug with the new transactions code
(This used to be ctdb commit 0592ba2a4fbd1b3b7a6bd0780eadbd6d449baaad)
2008-08-08 00:44:33 +10:00