1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-15 23:24:37 +03:00

3342 Commits

Author SHA1 Message Date
Rusty Russell
5f2d43157d vacuum: disabling vacuuming during a freeze
We shouldn't even think about vacuuming when we've frozen the database
(which is earlier than when we set CTDB_RECOVERY_ACTIVE)

CQ:S1018154 & S1018349
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(This used to be ctdb commit d8df6835a931082af232c4b94f1dede6f16169f9)
2010-08-18 11:01:52 +09:30
Rusty Russell
0b07f91d36 vacuum: fix crash on vacuum abort
Martin Schwenke discovered that 517f05e42f17766b1e8db8f1f4789cbad968e304
("freeze: abort vacuuming when we're going to freeze.") used ctdb_db for
a logging message which is in fact uninitialized, causing a crash (even
if it wasn't actually logged).

Initialize it properly.  Also fix incorrect format in another logging
message introduced in that same change.

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

(This used to be ctdb commit 8e518950ba281502318d6300f7a5ec6cdf6b5674)
2010-08-18 11:00:11 +09:30
Martin Schwenke
4e9fe3545c Test suite: loosen the getmonmode test.
Monitoring could be off at the beginning of the test.

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

(This used to be ctdb commit 6a33a7715067175869ea2f3f15b64c3371079a6b)
2010-08-18 11:25:44 +10:00
Rusty Russell
af55c910a4 freeze: abort vacuuming when we're going to freeze.
There are some reports of freeze timeouts, and it looks like vacuuming might
be the culprit.  So we add code to tell them to abort when a freeze is
going on.

(This is based on the 1.0.112 branch version 517f05e42f, but far
 simpler since tdb is now robust against processes being killed during
 transaction commit)

CQ:S1018154 & S1018349
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(This used to be ctdb commit f5d7dc679501e607c2c83a248a89d3cada9df146)
2010-08-18 10:54:28 +09:30
Ronnie Sahlberg
44ff992806 Add a new "ctdb addtickle" command to manually add tickles to ctdbd
This can be used to set ctdbd up to generate a tickle for non-samba
services.
(samba contains code to set tickles up automatically)

(This used to be ctdb commit 7ef2cddad5326fdcc26138906948342039829495)
2010-08-18 11:09:32 +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
Ronnie Sahlberg
e8ffb0d8a4 We use eventloop nesting in a couple of places, notably the sync
parts of the recovery daemon.

Initialize all event contexts to allow nesting

(This used to be ctdb commit 5bf6bd5e7f33aabbeb7b9707716ef99cf471e590)
2010-08-18 10:11:59 +10:00
Ronnie Sahlberg
ddf3c621c1 Merge commit 'rusty/libctdb-new' into foo
(This used to be ctdb commit 1566d2d23ab698896b3b6a76974a5c7452db4a62)
2010-08-18 09:53:52 +10:00
Rusty Russell
f93440c4b7 event: Update events to latest Samba version 0.9.8
In Samba this is now called "tevent", and while we use the backwards
compatibility wrappers they don't offer EVENT_FD_AUTOCLOSE: that is now
a separate tevent_fd_set_auto_close() function.

This is based on Samba version 7f29f817fa939ef1bbb740584f09e76e2ecd5b06.

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


(This used to be ctdb commit 85e5e760cc91eb3157d3a88996ce474491646726)
2010-08-18 09:16:31 +09:30
Rusty Russell
532e4a7077 talloc: update to 2.0.3 version from SAMBA
This is based on SAMBA as at revision 2de63aa2801a907905b3e05557074af5b896d486.

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


(This used to be ctdb commit cecd93be0a0aab868430dd43f8276bfb4e35f02e)
2010-08-18 09:11:58 +09:30
Martin Schwenke
a3e9fe2058 Test suite: Add more timestamping of debugging information.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 4cdf3b9adc7edfd80a2901ef8457ae67aab0829a)
2010-08-17 09:55:48 +10:00
Martin Schwenke
e28d2b8f22 Test suite: print date/time at test completion.
This should help with log cross-checking.

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

(This used to be ctdb commit c0a916c40c623c0aa8245526283a064dbeea4b57)
2010-08-17 09:52:15 +10:00
Volker Lendecke
a79168f587 Correctly set docdir
(This used to be ctdb commit a69916d0687309766b0014dc9cee6a966aaa89da)
2010-08-16 11:28:05 +10:00
Rusty Russell
c27094742b tdb: workaround starvation problem in locking entire database.
(Imported from SAMBA 11ab43084b10cf53b530cdc3a6036c898b79ca38)

We saw tdb_lockall() take 71 seconds under heavy load; this is because Linux
(at least) doesn't prevent new small locks being obtained while we're waiting
for a big log.

The workaround is to do divide and conquer using non-blocking chainlocks: if
we get down to a single chain we block.  Using a simple test program where
children did "hold lock for 100ms, sleep for 1 second" the time to do
tdb_lockall() dropped signifiantly.  There are ln(hashsize) locks taken in
the contended case, but that's slow anyway.

More analysis is given in my blog at http://rusty.ozlabs.org/?p=120

This may also help transactions, though in that case it's the initial
read lock which uses this gradual locking routine; the update-to-write-lock
code is separate and still tries to update in one go.

Even though ABI doesn't change, minor version bumped so behavior change
can be easily detected.

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

(This used to be ctdb commit 9ec0009443a0ac4187ce5212a5143689daa58a02)
2010-08-16 10:22:21 +09:30
Rusty Russell
546eff9c93 tdb: Fix tdb_check() to work with read-only tdb databases.
(Import from SAMBA bc1c82ea137e1bf6cb55139a666c56ebb2226b23)
The function tdb_lockall() uses F_WRLCK internally, which doesn't work on
a fd opened with O_RDONLY. Use tdb_lockall_read() instead.

(This used to be ctdb commit a5db1122ec48d7e7384066848457c850c1a6cf3c)
2010-08-16 10:20:59 +09:30
Rusty Russell
fa2a32d5ef tdb: remove unused variable in tdb_new_database().
(Imported from SAMBA 2eab1d7fdcb54f9ec27431ca4858eb64cb1bd835)

(This used to be ctdb commit 52a87e608d0406aee9df99f7ac3ce16e834b520b)
2010-08-16 10:20:53 +09:30
Rusty Russell
55010cab63 tdb: fix short write logic in tdb_new_database
Commit 207a213c/24fed55d purported to fix the problem of signals during
tdb_new_database (which could cause a spurious short write, hence a failure).
However, the code is wrong: newdb+written is not correct.

Fix this by introducing a general tdb_write_all() and using it here and in
the tracing code.

Cc: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(This used to be ctdb commit 27ba0e5a6681063225df7244a85aa304c51c6948)
2010-08-16 10:20:19 +09:30
Martin Schwenke
03aa9ee702 Test suite: strengthen function _cluster_is_healthy().
If there's a chance that "ctdb status -Y" can return 0 but print
garbage then this function might return a false positive.

So, we do 2 things:

* Redirect stderr to >/dev/null rather than looking at it.  This
  minimises the chance that we will see garbage.

* Since we need at least 1 good line to decide the cluster is healthy,
  we sanity check each line to esnure it starts with :[0-9].

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

(This used to be ctdb commit d4189c7c3fceaa833f9f0446a2b06af6fed714ec)
2010-08-13 17:01:54 +10:00
Martin Schwenke
a9fb1e318b Test suite: use $CTDB rather than ctdb everywhere in ctdb_test_functions.sh.
Also ensure that $CTDB is set by default it to "ctdb".

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

(This used to be ctdb commit 8222fef1e61836b9bfd406205f9ffb9396aa7480)
2010-08-12 14:13:07 +10:00
Martin Schwenke
00fec0e76c Test suite: improve wait_until_node_has_status()
This currently does "onnode any ... wait_until ...".  If ctdbd is
being shutdown on a node then that node might be chosen anyway, if it
is asked early enough.  Then we'll loop on that node but our ctdb
client command may always fail, causing a timeout rather than the
expected behaviour.

This puts the loop on the outside of the "onnode any" so that if the
"wrong" node is chosen initially then on the next iteration the choice
can be remade.

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

(This used to be ctdb commit a88ee78686bd5aa2b789f5959e0562315a13525d)
2010-08-12 13:48:33 +10:00
Martin Schwenke
d549c31031 Test suite: make addip test use $CTDB rather than ctdb in debug code.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5bb6b28ab7b45b7242d100ae8f1483d02e1d0d1d)
2010-08-11 16:55:33 +10:00
Ronnie Sahlberg
8b0bbf960b Create a new command "ctdb sync" that isd just an alias for "ctdb ipreallocate"
(This used to be ctdb commit eededd592c92c59b435f0046989b2327fcc280b1)
2010-08-10 09:49:55 +10:00
Ronnie Sahlberg
7139faaeac Update a log message to reflect that this does no longer only happen
when trying/failing to ban a node.

(This used to be ctdb commit dc6b143c4785449e8c4ef7a46bf16adba750ab56)
2010-08-10 09:48:50 +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
Ronnie Sahlberg
f7ead50738 Merge remote branch 'martins/master'
(This used to be ctdb commit 9ca09ee9129b787428a2ceac9731b12166dc8718)
2010-08-09 11:35:38 +10:00
Martin Schwenke
0f18859a6c Add some command-line options to ctdb_diagnostics.
In some contexts ctdb_diagnostics generates too many errors when it is
run on heterogeneous and machine-configured clusters.  In some
clusters some nodes are expected to be differently configured and also
machine-generated configured files can have comments containing
timestamps.

This adds some command-line options that can be used to reduce the
number of errors reported:

    -n <nodes>  Comma separated list of nodes to operate on
    -c          Ignore comment lines (starting with '#') in file comparisons
    -w          Ignore whitespace in file comparisons
    --no-ads    Do not use commands that assume an Active Directory Server

The -n option simply allows ctdb_diagnostics to operate on a subset of
nodes, avoiding file comparisons with and data collection on nodes
that are differently configured.  For file comparisons, instead of
showing each file on the current node and then comparing other nodes
to that file, the file from the first (available or requested) nodes
is shown and then other nodes are compared to that.  That has resulted
in changes in output - that is, ctdb diagnostics no longer prints
messages referencing the current node.

-c and -w are used to weaken comparisons between configuration files.

--no-ads can be used to avoid running ADS-specific commands if a
cluster uses LDAP (or other non-ADS) configuration.

This also fixes a number of bugs in related code:

* A call to onnode was losing the >> NODE ...  << lines because they
  now go to stderr.  This was changed in onnode long ago but
  ctdb_diagnostics was never updated to match.

* ctdb_diagnostics was counting lines in /etc/ctdb/nodes to determine
  what nodes to operate on.  For some time the nodes file has
  supported syntax that makes this invalid.  "ctdb listnodes -Y" is
  now used to list available nodes.

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

(This used to be ctdb commit 36c8244a0f68c7c9bbee40982f230e9d14d3c0ea)
2010-08-06 11:10:56 +10:00
Ronnie Sahlberg
4424c115cb iupdate the docs that ctdb freeze is no more
(This used to be ctdb commit 79ef9909dfa0904d789c69eb6b9c80e8908a1100)
2010-08-05 16:35:37 +10:00
Ronnie Sahlberg
043045dcc5 remove the "ctdb freeze" debugging command
(This used to be ctdb commit bd005b987255eb65cd3826dce984281ee757daf6)
2010-08-05 16:30:47 +10:00
Martin Schwenke
b50ec65963 Test suite: remove unnecessary verbosity from enable/continue tests.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 69c95b2a42f55b80cd8d91a90ab55166f964163b)
2010-08-05 16:03:21 +10:00
Martin Schwenke
f66b5b46d6 Test suite: Fix typo in continue test.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c2bce140da7c4b118394ee77bb9d0348d27e7e95)
2010-08-05 16:01:23 +10:00
Martin Schwenke
77ad2be488 Test suite: weaken ctdb continue/enable tests for non-deterministic IPs.
These tests currently wait for the old IPs to fail back to the test
node.  This isn't guaranteed with DeterministicIPs disabled.

This changes those tests to wait until the test node gets at least 1
IP assigned.

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

(This used to be ctdb commit e9b3f5b1b51d541a911a27eb4348b368f28d185e)
2010-08-05 15:58:56 +10:00
Martin Schwenke
b930c885b3 initscript: wait until we can ping ctdbd before setting tunables.
Currently we do a "sleep 1" after starting and before running
set_ctdb_variables to set the tunables.  This is too arbitrary and
might fail if the system is heavily loaded.  This, for example, could
result in some nodes running with DeterministicIPs and some without,
in which case a different IP allocation algorithm would run depending
on who is the recmaster!

This makes the start function wait until "ctdb ping" succeeds (with 10
second timeout) before trying to run set_ctdb_variables.  If a timeout
occurs then the start function attempts to kill ctdbd before exiting
with a failure.

It also cleans up the status reporting code for Red Hat and SUSE so
that the final status code is reported.  Currently there are cases
where a correct status is prematurely reported before a failure
occurs.

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

(This used to be ctdb commit cdcd05662a30b51caaeeab4ac44138cac2474e0a)
2010-08-05 15:29:40 +10:00
Martin Schwenke
774582c360 Test suite - make the ctdb_fetch test cope with "Reqid wrap!" messages.
Recent CTDB notice the wrap and print this message.  The test needs to
cope.

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

(This used to be ctdb commit b93b60ec96d02ce4f54921e85a5c5554d1fc0c55)
2010-08-05 13:43:50 +10:00
Martin Schwenke
dff9282917 Test suite: remove thaw/freeze tests.
They test debugging commands that no longer operate as expected.

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

(This used to be ctdb commit d33fa4d6557aab1938049f194c2de55f2c395bd2)
2010-08-05 11:40:05 +10:00
Martin Schwenke
4817f7e4ba Test suite - fix addip test.
The test currently checks that all existing IPs plus the newly added
IP are on the test node after "ctdb addip" is run.  With
DeterministicIPs enabled, if the new IP is "before" other IPs then the
other IPs may be shuffled by the deterministic IPs modulo algorithm.
This will happen on the 1st recovery after the move.  Sometimes this
recovery happens before we get the list of IPs to check and sometimes
after, so the test is racy.

The fix is to simply check for the presence of the new IP and not
worry about the others.  This reduces whatever value this test
had... but you can't have everything.

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

(This used to be ctdb commit 1ef7c8e64c7a39330be09ae4d00b70238133e0b5)
2010-08-04 16:08:12 +10:00
Martin Schwenke
9aa6a99740 Merge remote branch 'martins/master'
(This used to be ctdb commit 5d9e4b6ee7d2b5290a74e7be79bdf51a43b72f43)
2010-08-04 16:05:39 +10:00
Martin Schwenke
7edcb89857 Test suite - try to make addip test more reliable and add some debugging.
This test is failing in some situations.  The "ctdb addip" command
works but the IP never appears in the "ctdb ip" output.

Try restricting the last octet to be between 101-199.  At the moment
addresses like 10.0.2.1 are being chosen and these are often the
address of the host machine in autocluster configurations... so might
cause weirdness.

Also add some debugging if checking for the IP address times out.

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

(This used to be ctdb commit ae52cb63756bc60de8d32e01bac5d70975a1c7a0)
2010-08-04 13:16:06 +10:00
Martin Schwenke
807567e992 Testing: IP allocation simulation - add option to change odds of a failure.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b2a2e301025d7fbfe5eeaac436693cde6d404490)
2010-08-03 11:51:14 +10:00
Martin Schwenke
4ffb6495ff Testing: IP allocation simulation - clean up usage message.
Group options better and make the language consistent between options.

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

(This used to be ctdb commit bc38c17e4115fae00c89d00537fdcfe621111b37)
2010-08-03 11:41:50 +10:00
Martin Schwenke
4728bf6ece Testing: IP allocation simulation - print maximum number of unhealthy nodes.
This can imply something about imbalance.

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

(This used to be ctdb commit ecb80e2b6be9326708d1fc87ad3028c6836d5858)
2010-08-03 11:37:34 +10:00
Martin Schwenke
8ca925fe5d Testing: IP allocation simulation - improve help for options.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 058501b92f602e7d2240d1cb08ed78a807564c48)
2010-08-03 11:36:33 +10:00
Martin Schwenke
8cc6ed1d0e Testing: IP allocation simulation - make usage/failure more obvious.
Tweak the usage message for -g option.

Print an error if no node groups defined, instead of curious Python
error.

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

(This used to be ctdb commit 8b883eb9346b8278d268e35b56ac680cd9526b97)
2010-08-02 15:46:23 +10:00
Martin Schwenke
326514f152 Testing: IP allocation simulation - rename an example to node_group_extra.py.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 974f849df0aca2cfedb38fa815894955e32803a8)
2010-08-02 15:09:13 +10:00
Martin Schwenke
d438b2398f Testing: IP allocation simulation - rename an example to node_group_simple.py.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0a2a5602233a8208e2729192e50d816faed0151a)
2010-08-02 15:07:56 +10:00
Martin Schwenke
4af049780a Testing: IP allocation simulation - add general node group example.
This allows node pool configuration to be specifed on the
command-line.

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

(This used to be ctdb commit d382d9023928f75f360a115ae1e9c1036423416e)
2010-08-02 15:06:39 +10:00
Martin Schwenke
0fdd7566c7 Testing: IP allocation simulation - update options processing in examples.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a65ca1a71386f40080dd553756f3600d3b20d523)
2010-08-02 15:01:47 +10:00
Martin Schwenke
ecdbd99557 Testing: IP allocation simulation - Update README.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ed64b7f2b3cd920bb0f5dfd7f64ed0afc0b99fc1)
2010-08-02 14:58:15 +10:00
Martin Schwenke
ae0f339173 Testing: IP allocation simulation - fix nondeterminism in do_something_random().
The current code makes random choices from unsorted lists.  This
ensures the lists are sorted.

Also, make the code easier to read by doing the random selction from
lists of PNNs rather than lists of Node objects.

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

(This used to be ctdb commit a01244499dc3567f5aa934b1864b9bc183a6c242)
2010-08-02 14:24:00 +10:00
Martin Schwenke
eac5edf322 Testing: IP allocation simulation - Tweak options handling and Cluster.diff().
process_args() must now be called by programs inporting this module.
Options are put into global variable "options", which can be
references using "ctdb_takeover.options".

Can now pass extra option specifications to process_args().

Remove global variable prev and make it a Cluster object variable.

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

(This used to be ctdb commit a32298e7bc819694518e859f100f9444ff5663cd)
2010-08-02 14:20:12 +10:00
Martin Schwenke
ef77f613fa Testing: IP allocation simulation - update copyright message.
There's a lot of new code here, so let's make the copyright message
make sense.

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

(This used to be ctdb commit e6e56e5989def6704b116e806c1f261c7f3fc03f)
2010-08-02 14:16:02 +10:00