1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
Commit Graph

2111 Commits

Author SHA1 Message Date
Rusty Russell
d66a7c40da Port from SAMBA tdb: commit 4b4fec65db Author: Andrew Tridgell <tridge@samba.org> Date: Thu May 28 16:08:28 2009 +1000
make TDB_NOSYNC affect all the fsync/msync calls in transactions

    During a transaction commit tdb normally uses fsync/msync calls to
    make it crash safe. This can be disabled using the TDB_NOSYNC flag,
    but it wasn't disabling all the code paths that caused a fsync/msync.

(This used to be ctdb commit e03980add02a28609a7a0a0c87ebc85419b98144)
2009-08-04 16:43:17 +09:30
Rusty Russell
f10db37b82 Port from SAMBA tdb: commit a91bcbccf8 Author: Jim McDonough <jmcd@samba.org> Date: Thu May 21 16:26:26 2009 -0400
Detect tight loop in tdb_find()

(This used to be ctdb commit 5253a0ba3a34fbf5810f363ecc094203d49e835f)
2009-08-04 16:43:14 +09:30
Rusty Russell
c153b85a93 Port from SAMBA tdb: commit 42c0931441 Author: Tim Prouty <tprouty@samba.org> Date: Tue Mar 31 16:24:07 2009 -0700
tdb: Remove unused variable

(This used to be ctdb commit aa22d1875b1997664af983c0baeabe34e40dd253)
2009-08-04 16:43:10 +09:30
Rusty Russell
166e74a8b1 Port from SAMBA tdb:
commit b90863c0b7
Author: Howard Chu <hyc@highlandsun.com>
Date:   Tue Mar 31 13:15:54 2009 +1100

    Add tdb_transaction_prepare_commit()

    Using tdb_transaction_prepare_commit() gives us 2-phase commits. This
    allows us to safely commit across multiple tdb databases at once, with
    reasonable transaction semantics

    Signed-off-by: tridge@samba.org

(This used to be ctdb commit 4c3dac215a088947f645f727343997f5d47e3260)
2009-08-04 16:43:06 +09:30
Ronnie Sahlberg
690f1537f0 Merge commit 'martins/master'
(This used to be ctdb commit 32a69b0efa078b069802470be6488a4efe32961d)
2009-07-30 10:55:56 +10:00
Martin Schwenke
063bd6e278 Test suite: fix test file permissions in complex/44_failover_nfs_oneway.sh.
Something, perhaps root_squash, causing permission denied on the test
file after we copy it over with scp.  This sets the initial
permissions to be friendly and adds -p to the scp command to maintain
those friendly permissions.

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

(This used to be ctdb commit 52f21f5a92eb14df7540a2ae9e212d936e646c06)
2009-07-30 10:47:36 +10:00
Martin Schwenke
73ca4b6c8b Test suite: fix the test suite's generic event script.
Add a "stopped" case to log events and stop the event script from
failing with an unknown event.

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

(This used to be ctdb commit 7f67f7395e2233f0bba2e9662404aad49e13f645)
2009-07-29 18:10:05 +10:00
Martin Schwenke
48078dd24f Test suite: Fixes for node state parsing plus new stop/continue tests.
The parsing of "ctdb status -Y" output to determine various node
states was implemented very strictly.  Therefore, the parsing broke
due to the addition of the new "stopped" state to the output of "ctdb
status -Y".  This relaxes the parsing so that it should work for
versions prior to the introduction of the "stopped" state, as well as
future versions that add new states to the end of the list of bits in
output of "ctdb status -Y".

Similarly the check for cluster unhealthy (in _cluster_is_healthy())
now just checks for a single 1 in any bit in the "ctdb status -Y"
output, rather than checking for a particular number of 0s.

New tests
tests/simple/{41_ctdb_stop.sh,42_ctdb_continue.sh,43_stop_recmaster_yield.sh}
do rudimentary testing of the stop and continue functions.

Remove tests tests/simple/41_ctdb_ban.sh and
tests/simple/42_ctdb_unban.sh.  They were both unreliable.

tests/simple/21_ctdb_disablemonitor.sh now schedules a restart, since
one will be required.

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

(This used to be ctdb commit 67c5bfb5f02c9d45a32d976021ede4fb2174dfe9)
2009-07-29 18:01:07 +10:00
Ronnie Sahlberg
a1e1503328 change the defaults for repacking to repack once every 120 seconds and letting it work for 30 second before timing out.
(This used to be ctdb commit 2aa5d18bb42dca4ef9cb049b4fa9d7bc999ce4ad)
2009-07-29 13:31:12 +10:00
Wolfgang Mueller-Friedt
16af87bf25 repack limit tunable
Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>

(This used to be ctdb commit a2768b0732f2ab2e3fafda55587bd2e99eedf0fa)
2009-07-29 13:30:39 +10:00
Wolfgang Mueller-Friedt
345df3c714 remove repack from eventscript
Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>

(This used to be ctdb commit dd334caa98882fc59765b7c84eca8e86de785487)
2009-07-29 13:29:38 +10:00
Wolfgang Mueller-Friedt
fddfaaaa4b added event repacking
Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>

(This used to be ctdb commit 78466364f22d6a183710338f138b8c808c6b7753)
2009-07-29 13:28:48 +10:00
Ronnie Sahlberg
1653af16a6 vacuum event framework
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>

(This used to be ctdb commit 30cdad97706a9e9bb210120699aa939f6b16e8ca)
2009-07-29 13:26:29 +10:00
Ronnie Sahlberg
fb63d27e4e initial part of new vacuuming patch.
create some new fields for ctdb_db and tunables

(This used to be ctdb commit 3a8e7d36cc42aedf4b7665364224140dcbfb3efa)
2009-07-29 13:25:43 +10:00
Ronnie Sahlberg
cca0aae1f5 From Michael Adam:
Update the transaction test tool to the new api for transactions

(This used to be ctdb commit 4d9a53f142deba6ab578af2fc35bfa99c29c3a99)
2009-07-29 11:18:02 +10: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
a6cf23362f ctdbd: refuse PERSISTENT_STORE if transaction is running.
Michael

(This used to be ctdb commit c07d6d90f7afd19213ad44624c3e2b9c85f4eea8)
2009-07-29 11:13:38 +10:00
Michael Adam
4cd06a330e Fix persistent transaction commit race condition.
In ctdb_client.c:ctdb_transaction_commit(), after a failed
TRANS2_COMMIT control call (for instance due to the 1-second
being exceeded waiting for a busy node's reply), there is a
1-second gap between the transaction_cancel() and
replay_transaction() calls in which there is no lock on the
persistent db. And due to the lack of global state
indicating that a transaction is in progress in ctdbd, other nodes
may succeed to start transactions on the db in this gap and
even worse work on top of the possibly already pushed changes.
So the data diverges on the several nodes.

This change fixes this by introducing global state for a transaction
commit being active in the ctdb_db_context struct and in a db_id field
in the client so that a client keeps track of _which_ tdb it as
transaction commit running on. These data are set by ctdb upon
entering the trans2_commit control and they are cleared in the
trans2_error or trans2_finished controls. This makes it impossible
to start a nother transaction or migrate a record to a different
node while a transaction is active on a persistent tdb, including
the retry loop.

This approach is dead lock free and still allows recovery process
to be started in the retry-gap between cancel and replay.
Also note, that this solution does not require any change in the
client side.

This was debugged and developed together with
Stefan Metzmacher <metze@samba.org> - thanks!

Michael

(This used to be ctdb commit f88103516e5ad723062fb95fcb07a128f1069d69)
2009-07-29 11:12:39 +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
Martin Schwenke
e50a067cb5 Merge commit 'origin/master'
(This used to be ctdb commit d7ff60a74595dcb4ae41f5a8193de5b898d61227)
2009-07-29 10:08:56 +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
Martin Schwenke
50650fbbd1 onnode: update tests for healthy and connected to cope with new stopped bit.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit bfc926c866e361ab28330747544b268ba130bf30)
2009-07-28 16:00:11 +10:00
Ronnie Sahlberg
c413ee95b8 document the two new commands setlmasterrole and setrecmasterrole
(This used to be ctdb commit 1d7d7dd515e7ef62cacf2a712a2f4c4d62a38fa5)
2009-07-28 13:54:08 +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
ad98e6a1f4 Document the natgw flag and how this changes the output of "ctdb
getcapabilities"

(This used to be ctdb commit 9b395986962909a5b0548eaea7e45215df72a08e)
2009-07-28 10:02:39 +10:00
Ronnie Sahlberg
4d5823ba7c update the natgw eventscript to set the NATGW capability when this feature is used
This does not modify any behaviour of the daemon itself other than showing this flag as ON in the ctdeb getcapabilities output

(This used to be ctdb commit fb337c151bd16ad5ad0c99431224451979d8c651)
2009-07-28 10:00:33 +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
679ef878f8 describe how to activate NATGW without restarting the nodes on a running
cluster

(This used to be ctdb commit b6c8011024ce4574f945d5a470075c6779b34a43)
2009-07-28 09:27:00 +10:00
Ronnie Sahlberg
366d413f2b new version 1.0.87
(This used to be ctdb commit d187eb8507f35a650ff3ffc50fa49110eebca0bd)
2009-07-17 13:01:11 +10:00
Ronnie Sahlberg
4a405e564e Merge commit 'martins/master'
(This used to be ctdb commit febf3d6d3f2bdf187c042f560aefc54b8ac72454)
2009-07-17 12:45:08 +10:00
Ronnie Sahlberg
6db0f01532 document the new stopped event
(This used to be ctdb commit 70603d9a79c80379bf65d9d703c399a65c109c52)
2009-07-17 12:30:05 +10:00
Ronnie Sahlberg
e5e9fc48b1 create a new event : stopped.
This event is called when a node is stopped and is used by eventscripts that need to do certain cleanup and removal of configuration or ip addresses or routing ...

Note that a STOPPED node is considered "inactive" and as such will not be running the "recovered" event when the rest of the cluster has recovered.

(This used to be ctdb commit 65e9309564611bf937ded3c74a79abff895d7c59)
2009-07-17 12:26:16 +10:00
Ronnie Sahlberg
df00979158 When we create new election data to send during elections, we must re-read the node flags from the main daemon to catch when the STOPPED flag is changed.
(This used to be ctdb commit ca4982c40d81db528fe915d5ecc01fcf7df0b522)
2009-07-17 11:37:03 +10:00
Ronnie Sahlberg
9c6aa4e420 update the eventscript to ensure that stopped nodes can not become the natgw master
also verify that we actually do have a natgw master available if this is configured and make the node unhealthy if not.

(This used to be ctdb commit 7f273ee769d671d8c8be87c9187302fb77e814f3)
2009-07-17 09:45:05 +10:00
Ronnie Sahlberg
5ce69e2fa3 if all nodes are STOPPED, pick one of the STOPPED nodes as natgw master
(This used to be ctdb commit 8bbd96cfbbe98f3fc19e432797cbf4478f753a0b)
2009-07-17 09:36:22 +10:00
Ronnie Sahlberg
bf9ad9c934 Do not allow STOPPED or DELETED nodes to become the NATGW master
(This used to be ctdb commit 4505ea15408ad40dd8deb4041fd75a65a0ad9336)
2009-07-17 09:29:58 +10:00
Martin Schwenke
d846eb78db Test suite: Fix debug code for unexpectedly unhealthy cluster.
The debug code should run "ctdb status" on a cluster node, not on the
test client.

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

(This used to be ctdb commit 34e6f8a04b12f8879eb42d417f9741502ccccf0f)
2009-07-16 14:04:06 +10:00
Ronnie Sahlberg
0c5f5ae58d stopped nodes can not win a recmaster election
stopped nodes must yield the recmaster role

(This used to be ctdb commit b75ac1185481060ab71bd743e1e48d333d716eba)
2009-07-09 14:44:03 +10:00
Ronnie Sahlberg
b57811bee6 change the infolevel when logging stop/continue commands
(This used to be ctdb commit 1e007c833098b03dd81797c081da1ae1b10c971c)
2009-07-09 14:34:12 +10:00
Ronnie Sahlberg
82c1be95ed recovery daemon needs to monitor when the local ctdb daemon is stopped and ensure that the databases gets frozen and the node enters recovery mode
(This used to be ctdb commit 99f239f8b96c8c0a06ac8ca8b8083be96265865a)
2009-07-09 14:19:32 +10:00
Ronnie Sahlberg
9d0941bf83 document the new commands ctdb stop/continue
(This used to be ctdb commit d6ddea4167ccdad05e88378ee3f22b6125969562)
2009-07-09 13:07:15 +10:00
Ronnie Sahlberg
41a519191e dont let other nodes modify the STOPPED flag for the local process when pushing out flags changes
(This used to be ctdb commit 501a2747d839ca291b70c761098549cf6d47a158)
2009-07-09 13:20:14 +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
66c8d4fb3d make it possible to start the daemon in STOPPED mode
(This used to be ctdb commit 866aa995dc029db6e510060e9e95a8ca149094ac)
2009-07-09 11:57:20 +10:00
Ronnie Sahlberg
d6a5fd5c9d remove the header printed for the machinereadable output for natgwlist
(This used to be ctdb commit 049271c83a09afb8d6c3e5212cf9ca782956b0c6)
2009-07-09 11:43:37 +10:00
Ronnie Sahlberg
9f0dc4b93b Add a new node flag : STOPPED
This node flag means the node is DISABLED and that all its public ip addresses
are failed over, but also that it has been removed from the VNNmap.

A STOPPED node should be in recovery mode active untill restarted using the continue command.

Adding two new commands "ctdb stop" "ctdb continue"

(This used to be ctdb commit d47dab1026deba0554f21282a59bd172209ea066)
2009-07-09 11:38:18 +10:00
Martin Schwenke
d6862832ed Merge branch 'ronnie_merge'
(This used to be ctdb commit 2ff6ee042080ba1c2bea76bbef3742997d84c9a8)
2009-07-08 14:21:36 +10:00
Martin Schwenke
168ec02adf Test suite: new tests and code factoring.
* 2 new tests for NFS failover.

* Factor repeated code from tests into new functions
  select_test_node_and_ips(), gratarp_sniff_start() and
  gratarp_sniff_wait_show().  Use these new functions in existing and
  new tests.

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

(This used to be ctdb commit de0b58e18fcc0f90075fca74077ab62ae8dab5da)
2009-07-08 13:37:52 +10:00
Martin Schwenke
dae498a1e7 Test suite: better debug info when the cluster is unexpectedly unhealthy.
cluster_is_healthy() is now run locally in tests and internally causes
_cluster_is_healthy() to be run on node 0.  When it detects that the
cluster is unhealthy and $ctdb_test_restart_scheduled is not true,
debug information is printed.  This replaces the previous use of
$CTDB_TEST_CLEANING_UP.

To avoid spurious debug on expected restarts, added scheduled
restarts to several tests.

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

(This used to be ctdb commit b67946a6f6b185a7920bf1e560988417c8c4d87d)
2009-07-08 09:45:35 +10:00
Martin Schwenke
7e1cdac0ab Make ctdbd restarts in tests more reliable.
This works around potential race conditions in the init script where
the restart operation is not necessarily reliable.  It just wraps the
actual restart in a loop and tries for a successful restart up to 5
times.

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

(This used to be ctdb commit 3f7a4afa0fcc5825beb89267973939df8cde4999)
2009-07-08 09:43:55 +10:00