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

4557 Commits

Author SHA1 Message Date
Amitay Isaacs
d8a3ec42c1 tools/ctdb: Add pdelete command to delete a record from persistent database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit d23adec89b69e7c6f96c8e1417ef4ca4c9edc57e)
2013-01-09 13:18:33 +11:00
Amitay Isaacs
9eeb94c5c0 daemon: Update the comment and remove redundant check in ctdb_start_transport()
ctdb_start_transport() is called just before "setup" event, when CTDB
is ready to process the requests. "startup" event happens much later
after a successful recovery.

Transport method ctdb->methods is successfully initialized before
ctdb_start_transport() is called.  No need to check again.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 9a70a4d23d00f6cb996c061ba3dfb7c47b4f6a4f)
2013-01-09 13:18:33 +11:00
Martin Schwenke
aca9299669 eventscripts: Fail the setup event if CTDB does not become ready
Currently it silently continues without attempting to set tunables.

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

(This used to be ctdb commit 735ec99b99c7bb579851ce8293011aaf1dcc552a)
2013-01-09 12:45:59 +11:00
Martin Schwenke
4f622fe9fb scripts: Make script_log() use supplied message, stop logger from hanging
When using syslog any provided message arguments are ignored and not
passed to logger.  This means that logger blocks waiting on stdin.
That's bad.

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

(This used to be ctdb commit 50abf597cefe6f8ea2a2ff7694bf84641344a9b1)
2013-01-08 15:18:47 +11:00
Martin Schwenke
095fac9491 scripts: Rework ctdb-crash-cleanup.sh so that it uses existing functions
This improves maintainability.

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

(This used to be ctdb commit e2aaa64925cca359c71520e01a18fc9461b0da4d)
2013-01-08 15:18:47 +11:00
Martin Schwenke
d801b02681 scripts: Make drop_all_public_ips() more robust
Incorporate some of the logic from ctdb-crash-cleanup.sh that ensures
IPs are deleted even if they have the wrong netmask or are on the
wrong interface.

Factoring out some of the code will allow it to be used elsewhere.

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

(This used to be ctdb commit 03356fd5ae7a3ac35fde0289cbea7c71ecf07367)
2013-01-08 15:18:47 +11:00
Martin Schwenke
663858e5de ctdbd: Default value for debug_hung_script should use ETCDIR
That is, it should use whatever was specified in ./configure and
should not hardcode /etc.

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

(This used to be ctdb commit 13e5e609b262847b607e7af7e0685f44e7cb8e36)
2013-01-08 15:18:47 +11:00
Martin Schwenke
4157efdcbb scripts: debug-hung-script.sh doesn't need functions/loadconfig
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8507303b525d20c74e8ec4e7c4f5f275945cd3b6)
2013-01-08 15:18:47 +11:00
Martin Schwenke
f5226c9a75 scripts: statd-callout should calculate CTDB_BASE if it is not set
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 376015ba5ad6b7703ae9949a1d40a0c72dfaba0c)
2013-01-08 15:18:46 +11:00
Martin Schwenke
297b98d5b6 eventscripts: Each script should set CTDB_BASE if it is not set
This makes it easier to run the scripts externally.

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

(This used to be ctdb commit 740ea8ea5084149c8b552a01ee1c98c558b12384)
2013-01-08 15:18:46 +11:00
Martin Schwenke
0eb757329e scripts: Move drop_all_public_ips() to the functions file
... so it can be improved and used elsewhere.

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

(This used to be ctdb commit b23c30253cc9eb274b895cac0f8c65245ba0a200)
2013-01-08 15:18:46 +11:00
Martin Schwenke
ef7329a415 tests/simple: Add test to check recovery daemon IP verification
Also update ips_are_on_nodeglob() to handle negation.

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

(This used to be ctdb commit 13a5944f8a27d43006acfffba76958693cae7702)
2013-01-08 13:27:10 +11:00
Martin Schwenke
e2306dd82b tests/eventscripts: Ratchet down debug level for ctdb_takeover_tests
The default IP allocation algorithm used by ctdb_takeover_tests
changed from "non-deterministic IPs" to "LCP2".  The latter generates
a lot more debug output.  ctdb_takeover_tests is used by the ctdb tool
stub to calculate IP address changes for failovers.  This resulted in
unexpected debug output that caused tests to fail.  Since eventscript
tests don't care how IP allocations are arrived at, the best solution
is to turn down the debug level.

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

(This used to be ctdb commit 3cc596d2b459d834f9785b3a98027e46431ff2b9)
2013-01-08 10:53:28 +11:00
Martin Schwenke
53bd183683 recoverd: Separate each IP allocation algorithm into its own function
This makes the code much more readable and maintainable.

As a side effect, fix a memory leak in LCP2.

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

(This used to be ctdb commit 6a1d88a17321f7e1dc84b4823d5e7588516a6904)
2013-01-08 10:16:11 +11:00
Martin Schwenke
2e8df43561 recoverd: New function unassign_unsuitable_ips()
Move the code into a new function so it can be called from a number of
places.

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

(This used to be ctdb commit 8adb255e62dbe60d1e983047acd7b9c941231d11)
2013-01-08 10:16:11 +11:00
Martin Schwenke
bcefb76884 recoverd: Move failback retry loop into basic_failback() and lcp2_failback()
The retry loop is currently in ctdb_takeover_run_core().  Pushing it
into each function will make it possible to put each algorithm into a
separate top-level function.  This will make the code much clearer and
more maintainable.

Also keep associated test code compatible.

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

(This used to be ctdb commit f6ce18d011dd9043b04256690d826deb2640cd89)
2013-01-08 10:16:11 +11:00
Martin Schwenke
443fbb9e01 recoverd: Trying to failback more IPs no longer allocates unassigned IPs
Neither basic_failback() nor lcp2_failback() unassign IPs anymore, so
there's no point looping back that far.

Also fix a unit test that now fails because looping back to handle
unassigned IPs is no longer logged.

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

(This used to be ctdb commit c09aeaecad7d3232b1c07bab826b96818756f5e0)
2013-01-08 10:16:11 +11:00
Martin Schwenke
dfa7ce7b73 recoverd: basic_failback() can call find_takeover_node() directly
Instead of unassigning, looping back and depending on
basic_allocate_unassigned.

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

(This used to be ctdb commit 4dc08e37dec464c8785a2ddae15c7c69d3c81ac3)
2013-01-08 10:16:11 +11:00
Martin Schwenke
326328d520 recoverd: Don't do failback at all when deterministic IPs are in use
This seems to be the right thing to do instead of calling into the
failback code and continually skipping the release of an IP.

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

(This used to be ctdb commit 4c87e7cb3fa2cf2e034fa8454364e0a7fe0c8f81)
2013-01-08 10:16:11 +11:00
Martin Schwenke
ef403f70f2 recoverd: Move the test for both 'DeterministicIPs' and 'NoIPFailback' set
If this is done earlier then some other logic can be improved.  Also,
this should be a warning since no error condition is set.

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

(This used to be ctdb commit e06476e07197b7327b8bdac9c0b2e7281798ffec)
2013-01-08 10:16:11 +11:00
Martin Schwenke
a3911ed7bf recoverd: Fix a memory leak in IP allocation
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit bcd5f587aff3ba536cb0b5ef00d2d802352bae25)
2013-01-08 10:16:11 +11:00
Martin Schwenke
fdfc61a96d tests/takeover: Add some LCP2 tests for case when no node are healthy
3 tests should assign IPs to all nodes.

3 tests set NoIPTakeoverOnDisabled=1 and should drop all IPs.

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

(This used to be ctdb commit edda58a45915494027785608126b5da7c98fee85)
2013-01-08 10:16:11 +11:00
Martin Schwenke
565fc4ff46 tests/takeover: Initial tests for deterministic IPs
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5c820b2398a42af0e94bc524854a1ad144a63f7b)
2013-01-08 10:16:11 +11:00
Martin Schwenke
64a83fb72d tests/takeover: Do output filtering for deterministic IPs algorithm too
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 98bd58a98d34ecca89c9042417d7527a18a5ecf9)
2013-01-08 10:16:11 +11:00
Martin Schwenke
34bfecf99f tests/takeover: Support testing of NoIPTakeoverOnDisabled
Via $CTDB_SET_NoIPTakeoverOnDisabled.

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

(This used to be ctdb commit d357d52dbd533444a4af6151d04ba119a1533068)
2013-01-08 10:16:11 +11:00
Martin Schwenke
6c1b6c980e tests/takeover: IP allocation now selected via $CTDB_IP_ALGORITHM
Default to LCP2, like ctdbd.  Also support "det" for deterministic
IPs.

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

(This used to be ctdb commit 20631f5f29859920844dd8f410e24917aabd3dfd)
2013-01-08 10:16:11 +11:00
Martin Schwenke
c43da5d1c0 tests/takeover: Support valgrinding the takeover code
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 06ad6b8a19f830472b0ed65cb52e7c3ea74ed1dc)
2013-01-08 10:16:11 +11:00
Martin Schwenke
752ab15cb1 tests: new simple integration test for delip interface garbage collection
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 1a5410e8349cdb96fdc51aa5ecd4f5734f6798a5)
2013-01-07 12:19:34 +11:00
Martin Schwenke
f6be6f387a tests: new function ip2ipmask() for integration testing
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8164d9b29bf9080ccc76b1305fb6c07f1ed61d55)
2013-01-07 12:19:33 +11:00
Martin Schwenke
4f0d68cba6 ctdbd: Clean up orphaned interfaces when an IP is deleted
Add a new function ctdb_remove_orphaned_ifaces() and call it in
ctdb_control_del_public_address().

ctdb_remove_orphaned_ifaces() uses a naive implementation that does
things in a very obvious way.  There are many ways to improve the
performance - some are mentioned in a comment in the code.  However, I
doubt that this will be a bottleneck even with a large number of
public IPs.  Running the eventscript is likely to outweigh the cost of
this cleanup.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit cc1a3ae911d3fee8b87fda5de5ab6d9499d7510a)
2013-01-07 12:19:33 +11:00
Amitay Isaacs
1eddc33d70 tests/complex: Add NFS test when CTDB is killed on one of the nodes
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit b849fb4923d6a34141fe19006a974de81508ceda)
2013-01-07 12:08:39 +11:00
Martin Schwenke
217ad07b72 Eventscripts: Change the default reconfigure action to do nothing
A default action of restarting the service doesn't obey the principle
of least surprise.  It cause the NFS service to be implicitly
reintroduced.

This allows no-op functions to be removed from some eventscripts and
service restart functions to be added to others.

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

(This used to be ctdb commit c75b5e5b4d000f5c7dab403df8238ceed390c1c0)
2013-01-07 10:35:39 +11:00
Martin Schwenke
3d408ca1e1 Eventscripts: Do not restart NFS on reconfigure
It looks like this restart was accidentally reintroduced in commit
fc0678d351187cfa4c71123f97c0f493aacd5d16 when $service_reconfigure
became unset so the default action of restarting the service would
occur.  From there cleanups have explicitly reintroduced it and
carried it through the code.

Also update the unit tests affected by this change.

The restart was originally removed in commit
bc481c3f1a44c50648488c4f8a7f15ec395d446f.

The default reconfigure action of restarting a service is clearly
suboptimal and will be addressed in a separate patch.

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

(This used to be ctdb commit 2629de72e1f37b5e46772c2ef8d8d0012fc4ed37)
2013-01-07 10:35:39 +11:00
Martin Schwenke
6fbd3ea2c2 ctdbd: Initialise the node flags in just one place
Currently flags are initialised in 2 places.  One of them is in
ctdb_tcp_listen_automatic(), which just seems wrong.  This makes the
code easier to follow by just doing it in ctdb_start_daemon().

This means that the flags are now initialised later than previously.
However, it is still done before the transport is started and before
clients can connect.

In future it might make sense to do a similar thing with setting the
PNN.  However, the current optimisation is reasonably obvious...

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 2bbee8ac23ad5b7adf7122d8c91d5f0d54582507)
2013-01-07 10:35:39 +11:00
Martin Schwenke
80a2bb84e7 ctdbd: Remove debug option --node-ip, use --listen instead
This effectively reverts d96cb02c2c24f9eabbc53d3d38e90dea49cff3e0

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 496387a585b2c5778c808cf02b8e1435abde4c3e)
2013-01-07 10:35:39 +11:00
Martin Schwenke
5cf98c80ff tests: Local daemons should use --listen instead of --node-ip
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 3221fce9ee2f6fdd3bb17a5e1629ad52a32f90d6)
2013-01-07 10:35:39 +11:00
Martin Schwenke
df7152fe87 Initscript: when checking status, print output of "ctdb ping" if it fails
At the moment the caller has no idea why it thinks CTDB isn't running
and we can't debug failures...

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

(This used to be ctdb commit 776590bf84d221092298346a28d7fc0552a67c9d)
2013-01-07 10:35:38 +11:00
Michael Adam
f5b15e21c5 ctdb:recover: fix a comment typo
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 5067392d2e06795559f25828b65c129608b65c0b)
2013-01-05 01:15:19 +01:00
Michael Adam
b64e237f9b events/50.samba: fix testparm background update
creating the smb.conf cache with "-v" results in a cache file
that fails to load with "testparm -s ..." later on due to
"copy = " not being processable. (Copying the empty service name fails).

Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 81788cfabe960497b050c5ee4e4e487ee061012a)
2013-01-05 01:15:19 +01:00
Amitay Isaacs
a73f13ada7 daemon: Add a tunable to enable automatic database priority setting
Samba versions 3.6.x and older do not set the database priority.
This can cause deadlock between Samba and CTDB since the locking order
of database will be different. A hack was added for automatic promotion
of priority for specific databases to avoid deadlock.  This code should
not be invoked with Samba version 4.x which correctly specifies the
priority for each database.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 4a9e96ad3d8fc46da1cd44cd82309c1b54301eb7)
2013-01-05 01:14:57 +01:00
Amitay Isaacs
13518b9e33 daemon: Check if log_latency_ms is set before using it
This fixes a bug where wrong variable is checked.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit f81e9add466b1d9b2796c09c6ba63b77296ea149)
2012-11-30 12:21:30 +11:00
Martin Schwenke
606ddb1647 Git should ignore generated include/version.h file
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 905cd1293aa97dc7839a59b4f68eca02981f0891)
2012-11-27 18:43:34 +11:00
Volker Lendecke
83862c5c8d vacuum: Avoid some tallocs in ctdb recovery
In a heavily loaded and volatile database a lot of SCHEDULE_FOR_DELETION
requests can come in between fast vacuuming runs. This can lead to
significant ctdb cpu load due to the cost of doing talloc_free. This
reduces the number of objects a bit by coalescing the two objects
of delete_record_data into one. It will also avoid having to allocate
another talloc header for a SCHEDULE_FOR_DELETION key. Not the full fix
for this problem, but it might contribute a bit.

(This used to be ctdb commit 9a02f61547ddf74629aca21639d8fb61c1df7cbb)
2012-11-26 10:31:53 +11:00
Amitay Isaacs
b2e96641eb doc: Update ping_pong documentation to add -c option
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit d05faf294e58e22ae3fbc76162258f1ae8178129)
2012-11-21 19:40:22 +11:00
Michael Adam
05cf7bce49 utils🏓 add a -c switch to check the lock before reading/writing
This is to verify that the fcntl F_GETLK call reports F_UNLCK if called
from a process already holding a lock. This is for example used by samba's
strict locking code in combination with "posix locking = true".

Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 4f42d17b74ce891691eee1cead498959cc8e4837)
2012-11-20 00:48:52 +01:00
Michael Adam
8732e2356f recovery: data corruption of persistent DBs after recoveries: don't delete emtpy records
The record-by-record mode of recovery deletes empty records.
For persistent databases, this can lead to data corruption
by deleting records that should be there:

- Assume the cluster has been running for a while.

- A record R in a persistent database has been created and
  deleted a couple of times, the last operation being deletion,
  leaving an empty record with a high RSN, say 10.

- Now a node N is turned off.

- This leaves the local database copy of D on N with the empty
  copy of R and RSN 10. On all other nodes, the recovery has deleted
  the copy of record R.

- Now the record is created again while node N is turned off.
  This creates R with RSN = 1 on all nodes except for N.

- Now node N is turned on again. The following recovery will chose
  the older empty copy of R due to RSN 10 > RSN 1.

==> Hence the record is gone after the recovery.

On databases like Samba's registry, this can damage the higher-level
data structures built from the various tdb-level records.

This patch fixes that problem by not deleting empty records in recoveries
for persistent databases.

Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 6860c79aea416f56cfd7a6af790bbdf495dbc54e)
2012-11-20 00:48:24 +01:00
Michael Adam
9c65a7ef81 recoverd: fix a comment typo
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 909269a4a3690e1245117ca1af935401455785e6)
2012-11-20 00:48:23 +01:00
Michael Adam
79468f338a vacuum: fix a comment typo
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit bab744e3c49efef2e05dc09e8ea9bd3e3fa58716)
2012-11-19 14:53:14 +01:00
Martin Schwenke
8fad7670f1 Eventscripts: 10.interface should list configured interfaces
The current code lists available interfaces.  If IPs are configured in
some other way than the public addresses file (e.g. ctdb addip) and their
interfaces default to being marked down then, since down interfaces are
not available, these interfaces can never be marked up.

The configured interfaces should be listed instead.

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

(This used to be ctdb commit d8f010355b715e49709836e057a5d0f110919897)
2012-11-19 15:54:50 +11:00
Martin Schwenke
0f1bcebc80 ctdbd: Make the link status of new interfaces more flexible
Neither up nor down is a good default value for the link status of a
new interface.  Up means that IPs can be assigned to interfaces before
the true state is known and they can move away quickly if the interface
is actually down.  Down means that IPs can't be assigned to an interface
for a variable amount of time - until a monitor cycle occurs - and this
can result in imbalanced IPs.

This is a neat compromise.  Before the startup event completes, IPs
can't be assigned to interfaces because all interfaces begin in a down
state.  As soon as the startup event completes, IPs can be allocated
to any interface that has been marked up by the eventscript.  Later,
during normal operation, newly added IPs can be assigned to new
interfaces immediately.  The IPs will still move away if an interface
is noticed to be down in the next monitor cycle, but that is the
exception rather than the rule.

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

(This used to be ctdb commit 9275a69a414482f1053ae14528d5972575b9214e)
2012-11-19 15:53:13 +11:00