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

720 Commits

Author SHA1 Message Date
Martin Schwenke
c5bcff6724 tools/ctdb: Remove duplicate command definition for "sync"
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 9e7b7cd04adc5e66e2ffa4edf463a682aaea379b)
2013-05-24 14:08:06 +10:00
Amitay Isaacs
a0cfc381d3 tools/ctdb: Fix racy ipreallocate code
This code tried to find the recovery master and send an ipreallocate
request to that node.  When a node is stopped, this code asked the
stopped node for recovery master.  Stopped node does not have up-to-date
information on the current recovery master.  So ipreallocate requests
were sent to the wrong node and ignored by that node which is not the
recovery master.

Send ipreallocate request to all active nodes.  That way we guarantee
that the current recovery master will see it and respond to it.

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

(This used to be ctdb commit 0577ce3c68e4febf49a1ef5093e918db9d5ec636)
2013-05-23 16:19:20 +10:00
Amitay Isaacs
6d0c388e5c build: Rename version.h to ctdb_version.h
This avoids clash with version.h from Samba tree.

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

(This used to be ctdb commit d18fcfff674e876abde8d51afec92d9c4a090d2f)
2013-05-23 16:18:23 +10:00
Amitay Isaacs
e062555da0 tools/ltdbtool: Fix handling of -e option
Also, include description of -e option in usage.

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

(This used to be ctdb commit 35264e42ade4676468cf7713fa339c784e932953)
2013-04-08 14:25:34 +10:00
Volker Lendecke
3ffd57f0c9 fix a typo
Reviewed-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 98abd344342a011a8599411deae79f94abc09541)
2013-03-12 14:02:08 +01:00
Martin Schwenke
8cd6a67b8b tools/ctdb: delip no longer fails if IP can not be moved
Moving the IP is an optimisation so should not cause failure.

Refactor and simplify the retry-move-IP into new function
try_moveip().

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

(This used to be ctdb commit 5402f85dde045576cbaf64e01c68e28ed52204e8)
2013-02-27 16:01:55 +11:00
Martin Schwenke
fe130ca85b tools/ctdb: Fix a compiler warning
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit d1ec06d30148e6fd344625a2fbf1c22391bd908a)
2013-02-04 11:22:43 +11:00
Amitay Isaacs
d85e40fbdb tools/ctdb: Add setdbseqnum command to set __db_sequence_number__
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit efaac27a9ed52ed0f436c7e194013fd06e8b02b3)
2013-01-09 13:18:34 +11:00
Amitay Isaacs
4ca50c7243 tools/ctdb: Re-factor code to check if db exists given name or id
Most of the commands related to database operations can now use the
common code (db_exists()) to refer to database with either name or id.

In addition to return db_id for db_name, the function returns all the
flags set for the database.

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

(This used to be ctdb commit ca6e7eccc90f2869c220231666bf284798342bce)
2013-01-09 13:18:33 +11:00
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
56ee668a51 tools/ctdb: Do not use function return value as pnn
This fixes the wrong code where same variable 'ret' is used to track the pnn
and the return value of a function call.

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

(This used to be ctdb commit 718233c445cd6627ab3962b6565c2655f1f8efd0)
2012-11-14 11:00:21 +11:00
Amitay Isaacs
b0f90052cb tool/ctdb: Always support ctdb version command, don't make it optional
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit f8af7d8de76e68e5c4bde15f832a31ce9107e8c7)
2012-10-30 11:56:00 +11:00
Martin Schwenke
d78ac9c364 tools/ctdb: Merge recoverd log handling into getlog/clearlog
We don't need extra commands for these.

Also, allow a default value of NOTICE for the getlog level.

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

(This used to be ctdb commit 7197e600f46f2d1638f6c45c0149f109ea25a47c)
2012-10-22 12:21:24 +11:00
Martin Schwenke
798b632e03 tools/ctdb: Add log ringbuffer handling for recoverd
This adds commands rdgetlog and rdclearlog

These are analogous to getlog and clearlog but operate on the logs for
the recovery daemon.

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

(This used to be ctdb commit ef55e06192819d840c09b65741bab737223ac34c)
2012-10-22 11:15:36 +11:00
Amitay Isaacs
a00e50e503 ctdbd: Replace lockwait with locking API and remove ctdb_lockwait.c
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 2126795153dacb255e441abcb36ee05107b6282a)
2012-10-20 02:48:44 +11:00
Amitay Isaacs
8d7d9ac8ce tools/ctdb: Display the locking statistics
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit e24b5bf283736624b387b0364d7200212bb3054b)
2012-10-20 02:48:44 +11:00
Martin Schwenke
7bf693fc1b tools/ctdb_diagnostics: Add "ctdb listvars" output
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 2d75a04ba9a2e87a0dcb9bf778c58e335af1871c)
2012-10-18 20:05:43 +11:00
Martin Schwenke
c5e24b23cf tools/ctdb: Remove extra header from natgwlist -Y output
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 59520c9785d113ad5063eb5fbe42a9efc7e30076)
2012-10-18 20:05:42 +11:00
Martin Schwenke
1aaaf7e20e tools/ctdb: Free the event context
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit dc2a8c638bd74b9f1dd75339cd2ae2f32ffa18a8)
2012-10-02 17:37:53 +10:00
Martin Schwenke
82922ec305 tools/ctdb: Clean up control_natgw()
* Factor out repeated code into new function find_natgw()
* Support both machine and human readable output
* Use libctdb

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

(This used to be ctdb commit a56ec75edd1705b0539513d396d311f0e80a3bf5)
2012-09-28 17:05:34 +10:00
Martin Schwenke
a7ff393d42 tools/ctdb: Convert some commands over to libctdb
control_getcapabilities(), control_lvs(), control_lvsmaster() updated
to use ctdb_getcapabilities(), ctdb_getnodemap() as appropriate.

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

(This used to be ctdb commit c30ec02615183ecf9b412ad415bf1abd859aec45)
2012-09-28 17:05:34 +10:00
Martin Schwenke
110cb67e2a tools/ctdb: Remove redundant filtering loop in control_natgwlist()
This used to catch trailing blank lines.  However, these are caught
just as effectively by the whitespace filtering in the loop below.

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

(This used to be ctdb commit 7b75a3bb722dc86139b1a07a0100d08c34620b91)
2012-09-28 17:05:34 +10:00
Martin Schwenke
860d757475 tools/ctdb: natgwlist output is either human readable or machine readable
The first line is currently human readable and the rest is machine
readable.  This doesn't make sense.  Do one or the other...

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

(This used to be ctdb commit b29d5bbaa7048291c4b3a39bf12e04f0436f67da)
2012-09-28 17:05:34 +10:00
Martin Schwenke
bd0e34a9fd tools/ctdb: Factor out printing of the machine readable status header
It is already in 2 places and we might use it in another.

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

(This used to be ctdb commit 12a0a7a208d1c8fa8991894200d1dc133f3a2d1a)
2012-09-28 17:05:34 +10:00
Martin Schwenke
1fbeb106e0 tools/ctdb: NAT gateway code should use CTDB_NATGW_NODES
... not NATGW_NODES.

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

(This used to be ctdb commit 2da7730dc06153173778ab14e228960e72ff8a86)
2012-09-28 17:05:34 +10:00
Martin Schwenke
e7c8e0d32d ctdb tool: recmaster command might as well be auto-all
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 076282622fcb2663d378e0c90ed0d9c19f73c005)
2012-07-30 15:43:32 +10:00
Martin Schwenke
f53b4f82f5 tools/onnode: Add -P option to push files to given nodes
A list of files is given rather than a command.  These files are
pushed to the specified nodes.

Quoting is fragile/broken so filenames with spaces won't work - you
win some, you lose some.  :-)

All of the other onnode options should work together with this option.

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

(This used to be ctdb commit aed9b98ddbbf3e81de4f7257a10676565f7d7507)
2012-07-30 15:34:41 +10:00
Amitay Isaacs
23a460602f Remove tevent_loop_allow_nesting()
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 538c68d0e83e14f0000981ee06408b8f0035be37)
2012-07-16 12:12:05 +10:00
Michael Adam
237d4c5c39 ctdb: use correct "persistent" state for ctdb_attach in "ctdb cattdb"
Originally, "ctdb cattdb" attached explicitly as non-persistent, which
is now forbidden for persistent databases by the server.

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

(This used to be ctdb commit 85a367005bd669309bb7e532b60d27621110180d)
2012-07-03 14:30:24 +02:00
Ronnie Sahlberg
d21337a0fb Add new command to find which interface is located on
(This used to be ctdb commit f07376309e70f5ccdb7de8453caacc71b451ab48)
2012-06-20 15:11:49 +10:00
Ronnie Sahlberg
59565c05cf STATISTICS: Add tracking of the 10 hottest keys per database measured in hopcount
and add mechanisms to dump it using the ctdb dbstatistics command

(This used to be ctdb commit 8307c70ed98996b430c470e9641a09fdeeb81bd8)
2012-06-13 16:19:18 +10:00
Ronnie Sahlberg
7a1aa560e7 Add new control to reload the public ip address file on a node
Also add a method to use the recovery master/daemon to reload the public ips on all nodes in the cluster.
Reloading the public ips on all node sin the cluster is only suported if all nodes in the cluster are available and healthy.

(This used to be ctdb commit 05603e914f8c12618d7e06943c0f7df207f645b0)
2012-05-01 10:48:08 +10:00
Amitay Isaacs
4392591555 Remove explicit include of lib/tevent/tevent.h.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 0681014ca5ed2a9b56f63fdace7f894beccf8a9a)
2012-04-13 17:28:14 +10:00
Ronnie Sahlberg
0cc3127beb CTDB: add back the "rebalanceip" command
(This used to be ctdb commit 83aea6488002aa75dd25752fa0d164afb8b4f300)
2012-04-03 13:43:21 +10:00
Ronnie Sahlberg
fa3a06246a STICKY: add prototype code to make records stick to a node to "calm" down if they are found to be very hot and accessed by a lot of clients.
This can improve performance and stop clients from having to chase a rapidly migrating/bouncing record

(This used to be ctdb commit d0d98f7e45e5084b81335b004d50bddc80cdc219)
2012-03-20 17:12:19 +11:00
Ronnie Sahlberg
6a493a0b08 STATISTICS: add per-db hop count statistics
(This used to be ctdb commit 1c976d83b1d7dac6f0ef81306774998e4c8b56a1)
2012-03-20 12:11:55 +11:00
Ronnie Sahlberg
c9f7c981e2 CTDB: change how the hop count buckets are displayed in ctdb statistics
(This used to be ctdb commit 05923a14bc8ae8e3c5cda28ff4e0fb0d473d5f7d)
2012-03-20 11:43:09 +11:00
Ronnie Sahlberg
038c946e80 add max hop count buckets to see how bad hopcounts are
(This used to be ctdb commit 7d3931298e6477d92f43652c3006b0c426cb1307)
2012-03-20 11:20:53 +11:00
Ronnie Sahlberg
b3ddf6901d Merge remote branch 'martins/master'
(This used to be ctdb commit af72f8bc05f78983f9624d81788f9d89af474b11)
2012-03-15 16:09:41 +11:00
Ronnie Sahlberg
ef2bd0b016 When adding ips to nodes, set up a deferred rebalance for the whole node to trigger after 60 seconds in case the normal ipreallocated is not sufficient to trigger rebalance.
(This used to be ctdb commit 4340263b219d75c39f8de22abe3f6f1c1ee63ea2)
2012-02-28 06:56:04 +11:00
Volker Lendecke
5e3b13a32a FreeBSD does not define s6_addr32, only s6_addr
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit d657af4fb68ce3f7c462856f2934f6bf169e120b)
2012-02-13 16:20:12 +01:00
Martin Schwenke
629553667e ctdb tool: fix thinko in nodestatus command output
If used with -n <nodes> the "current" node needs to change.

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

(This used to be ctdb commit a0340a50c2acd9ccc281faef032a364254f7f95a)
2012-02-13 13:31:18 +11:00
Ronnie Sahlberg
68245eee4e READONLY: allow specifying the db name for setdbreadonly instead of just the hash
(This used to be ctdb commit 3c2117e8e4156e0048fbd2c94546112f0c588522)
2012-02-13 10:27:59 +11:00
Ronnie Sahlberg
73f8be16c6 ReadOnly: add per-database statistics to view how much delegations/revokes we have
(This used to be ctdb commit 751ed46197661eb841042ab6a02855a51dd0b17c)
2012-02-08 15:29:27 +11:00
Ronnie Sahlberg
1eafa68f0f STATISTICS: add total counts for number of delegations and number of revokes
Everytime we give a delegation to another node we count this as one delegation.
If the same record is delegated to several nodes we count one for each node.

Everytime a record has all its delegations revoked we count this as one revoke.

(This used to be ctdb commit b098bcf8007be63889aaed640a951b0eeaa9d191)
2012-02-08 13:42:30 +11:00
Ronnie Sahlberg
b6de9d3d19 Ad test tool to store data and ctdb header into a local tdb file
(This used to be ctdb commit c6433e43ad2481d84e8d9a1ee1c6e29b90423a86)
2012-02-07 12:14:57 +11:00
Ronnie Sahlberg
c3bab541c9 TFETCH add verbose flag to print also the record ltdb heaer
(This used to be ctdb commit 25d797f61c3b5b7090fb662adde6ed9e434e8a61)
2012-02-07 10:53:49 +11:00
Ronnie Sahlberg
daf28e095e CTDB: update tfetch so we can specify a hexadecimal string as key
(This used to be ctdb commit 70d22efdf104db1fc951263cedfbdb95b0b44342)
2012-02-07 10:21:12 +11:00
Martin Schwenke
e2ceae48e3 ctdb tool - free some memory used by popt
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 7339e87019c0ab44522bf160234307472c05dc14)
2012-02-06 16:00:24 +11:00
Martin Schwenke
7a04587e88 ctdb tool - convert control_status() over to use just libctdb()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit abe9985e503d998cf597933a594b445de8d3cec6)
2012-02-06 16:00:23 +11:00
Martin Schwenke
bfab62dd41 ctdb tool - Fix parse_nodestring() related issues
An old, buggy version of this code was merged.  This fixes it.

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

(This used to be ctdb commit bc4d5d5f0048487776f9f5d9f04a0af2e5d45aac)
2012-02-06 16:00:23 +11:00
Ronnie Sahlberg
e648045499 Merge branch 'master' of ssh://git.samba.org/data/git/ctdb
(This used to be ctdb commit 15d8ae8b0f80f95d7839528b8ac60aa0e2485c77)
2012-01-03 12:40:15 +11:00
Michael Adam
5fdd7fefb8 ctdb-tool: adapt formatting of "listvars" output to lenght of longest name
(This used to be ctdb commit 295168d99183d2d21f27a8ac6825d421fa866b28)
2011-12-23 17:39:10 +01:00
Michael Adam
491c63c2a8 tools/ctdb: allow the "ctdb vacuum" stub to be run without the daemon running.
(This used to be ctdb commit e71afbf731f06a3b89b64220c7fd1b1ea5492d4a)
2011-12-23 17:39:05 +01:00
Michael Adam
d7611212c3 tools/ctdb: remove functionality of "ctdb vacuum", just keeping a stub.
(This used to be ctdb commit 8fc4d5018ee6eee8856634095694d3ad0de5b4ae)
2011-12-23 17:39:05 +01:00
Martin Schwenke
89b01c8e7b Rename struct traverse_state to allow tools C files to be #included.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 54377ef8b992f92d3a4ece42ee72e37d22cd2de6)
2011-12-08 17:21:24 +11:00
Martin Schwenke
a2095caf91 ctdb tool - remove verify_node() function
parse_nodestring() checks what this used to check.  parse_nodestring()
already has the nodemap.

It was a 50-50 decision to decide whether to update verify_node() to
check against a nodemap that is passed in or to delete it.

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

Conflicts:

	tools/ctdb.c

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

(This used to be ctdb commit 2c1baf5ddd3c2cdd2a3f98b8e208d3a48530d1d1)
2011-12-08 17:21:24 +11:00
Martin Schwenke
d5b1a6a9c6 ctdb tool - new command "ctdb nodestatus [nodestring]"
This is very much like "ctdb status" but actually returns the status
for use in scripts.

This can be used in 2 modes:

* An optional nodestring is passed directly to the command without
  using -n.  In this mode the current node is asked for the status of
  all listed nodes.

* The nodestring is passed via -n.  In this mode the designated nodes
  will be asked for their status.  This is like "ctdb status".

These modes can be mixed.  For example:

  ctdb nodestatus 1,2,3 -n 0

asks node 0 for the status of nodes 1, 2 and 3, returning the bitwise
OR of their statuses.

This version uses the auto_all functionality, so the output isn't
necessarily pretty.  An improved version that does its own -n
processing may appear soon.

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

(This used to be ctdb commit 355685a14be17bf4648788f8a72c54790fe03502)
2011-12-08 17:21:17 +11:00
Martin Schwenke
b646815567 ctdb tool - factor out status printing functions
Create 2 new functions: control_status_1_machine() and
control_status_1_human() that contain chunks of code from
control_status().  We're about to find another purpose for these
functions.

This should be a no-op.

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

(This used to be ctdb commit fade71539482e8276f57ba3c003fe004d8666ce7)
2011-12-08 17:18:19 +11:00
Martin Schwenke
8b74037633 ctdb tool - generalise nodestring parsing for -n
Centralise -n nodestring parsing and add the ability to pass a
comma-separated list of node numbers.  Listing a node that is
disconnected or deleted results in failure, similar to the way passing
a single node currently works.  All of the auto_all commands inherit
this functionality.  For now, the non-auto_all commands do not inherit
this - they need to be individually tweaked.  Therefore, we haven't
updated the documentation to advertise this feature.

Implemented via a new function parse_nodestring() that parses an
optional (pass NULL when not available to indicate "current node")
comma-separated list of node numbers or "all".  parse_nodestring() can
be told to be non-fatal for disconnected/deleted nodes so it can also
be used in other contexts (yes, coming soon).  main() is changed to
call this function.

A new magic PNN value CTDB_MULTICAST is added and along with a
corresponding option.nodes structure member (a talloc-ed array of
PNNs).  This is also populated for "all" as well.

control_status() has new function pretty_print_flags() factored out so
pretty-printed flags can be used in error/debug messages.  New
function is_partially_online() is also factored out - this simplifies
some of the logic.

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

(This used to be ctdb commit 920e3a732eb9e09004edde6cfb3c7db8a004016f)
2011-12-08 17:00:17 +11:00
Martin Schwenke
7f25864db0 ctdb tool - move parsing of nodestring to where it is needed
This puts the parsing and checking logic close together.  This makes
it easy to change the parsing code.  Changed parsing code can now
easily use both old client code and libctdb since both are guaranteed
to be setup.

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

(This used to be ctdb commit 57fb074a65dc56168fc3813b79a5bab4b3727cf3)
2011-12-06 13:59:32 +11:00
Martin Schwenke
dbd452c801 ctdb tool - replace fprintf with DEBUG
It's the only one in the file.

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

(This used to be ctdb commit bf1174ef699b06485b36ee8ae70412be0759e142)
2011-12-06 13:59:32 +11:00
Martin Schwenke
ba6e6f689c ctdb tool - short circuit most of the logic in main for non-daemon commands
This allows all that logic to be hacked a little more easily.

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

(This used to be ctdb commit f93ffeee7b9e9ca5dd116655bdc7f89fc987ed8a)
2011-12-06 13:59:32 +11:00
Martin Schwenke
7e9f998745 ctdb tool - commands that don't use the daemon can't take -n/--node
It just doesn't make sense!

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

(This used to be ctdb commit c4b72683eb046007fbc2e60b4a54bc91faf4cf7e)
2011-12-06 13:59:32 +11:00
Martin Schwenke
5f69ad3c0a ctdb tool - simplify main() by taking most code out of a loop
Most of the action in main() happens inside a for loop and an if
statement.  This causes 2 levels of extra indent for the code and
makes it harder to read.

Instead, the current body of the loop is put below the loop and its
corresponding failure check.

To see how small this change really is, view with "diff -w".  ;-)

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

(This used to be ctdb commit 8527396b7290cfc8378779631e91d2ae09e2a106)
2011-12-06 13:59:32 +11:00
Ronnie Sahlberg
609149bdc8 LibCTDB: Add support for the 'get interfaces' control and update the ctdb tool to use this interface
(This used to be ctdb commit 77dc0c7351071243d9096d3607d7499c82f46ec0)
2011-12-06 13:12:18 +11:00
Ronnie Sahlberg
7d31c64c1c ctdb: use libctdb version of check-srvids call
(This used to be ctdb commit 36105b7283df729946e0a2ed61a696a14221efa6)
2011-11-30 10:00:27 +11:00
Ronnie Sahlberg
5a1e8df451 check_srvids: remove the <pnn> from the commandline so that we only specify the list of <srvids>
Specifying the pnn can be done via '-n <pnn>'

(This used to be ctdb commit e9250775f5a1234f27a1a62caa902d7b86194285)
2011-11-30 09:50:12 +11:00
Volker Lendecke
6f657dadd3 Add "ctdb check_srvid"
(This used to be ctdb commit 92a391a81d0697956b96e96e39bb1b9d13e18097)
2011-11-30 09:02:26 +11:00
Ronnie Sahlberg
3cbff2edd8 LibCTDB: add get persistent db seqnum control
(This used to be ctdb commit 6e96a62494bbb2c7b0682ebf0c2115dd2f44f7af)
2011-11-30 08:48:14 +11:00
Michael Adam
31d62794fe ctdb: add an option --print-recordflags to trigger printing record flags in catdb and dumpdbbackup
This changes the default behaviour to not print record flags.

(This used to be ctdb commit 2d2ce07c51055d9400b22cd3c1fd682597cb921c)
2011-11-29 13:43:35 +01:00
Michael Adam
e6923904e8 ctdb: add an option --print-hash to enable printing of record hashes when dumping dbs
(This used to be ctdb commit efc033c28ade97f9884794256d59a4553e052d5f)
2011-11-29 13:43:34 +01:00
Michael Adam
86cd78efee ctdb: add an option --print-lmaster to enable printing of lmaster in "ctdb catdb"
(This used to be ctdb commit 326f88ef622620cb9e0569c4497bc0e86124beaa)
2011-11-29 13:43:33 +01:00
Michael Adam
dc98c12ac9 ctdb: add an option --print-datasize to only print datasize instead of dumping data in db dumps
Used in catdb, cattdb and dumpdbbackup.

(This used to be ctdb commit dd866116041e71cbf91e7fd91edcc9501634051d)
2011-11-29 13:43:32 +01:00
Michael Adam
1fcc7651f4 ctdb: add an option --print-emptyrecords to enable printing of empty records in dumping databases
this option is used with the commands catdb, cattdb and dumpdbbackup.

(This used to be ctdb commit 6ec68a2e667f66d2b194fe48cb75229a2777842e)
2011-11-29 10:30:24 +01:00
Martin Schwenke
08ebcf6e6a Fix ctdb scriptstatus -n all
This didn't have auto_all set as true.  However, there's no special
code to handle "-n all" and it just fails.  If auto_all works for
status then it might as well work for scriptstatus.

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

(This used to be ctdb commit 3084220e2aac3664511969f10cad206e505150a0)
2011-11-10 15:41:03 +11:00
Mathieu Parent
fa197073cd config can be in /etc/default/ instead of /etc/sysconfig/ (ctdb_gnostics part)
(This used to be ctdb commit b6a9dacefd8f031677702f0fbf6b321beb4c4d54)
2011-11-08 16:32:03 +11:00
Ronnie Sahlberg
afd0b63273 Merge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master
(This used to be ctdb commit d772743e9a4d4d40eb95cd8d5178708e77057b79)
2011-11-08 14:01:22 +11:00
Ronnie Sahlberg
0f92fa224c RB_TREE: Add mechanism to abort a traverse
This patch changes the callback signature for traversal
functions to allow a client to abort a traverse before it finishes.
Updates to all callers and examples as well as rb-test tool.

(This used to be ctdb commit 8ab0c63ad36cfbbb1e5fed46a1f4c47b1fdb581f)
2011-11-08 13:40:28 +11:00
Martin Schwenke
2e3febe283 onnode: unset EXTRA_SSH_OPTS when using fakessh
This case was never tested and fakessh obviously won't handle the
extra arguments.

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

(This used to be ctdb commit 02184bd5b9ab94cdf2b9ff92e56a509f92f9e4aa)
2011-10-18 11:51:06 +11:00
Ronnie Sahlberg
24b56c62b1 Merge branch 'master' of ssh://git.samba.org/data/git/ctdb
(This used to be ctdb commit dd9f82dbe2346c7143b0229e3611c402ee8c4025)
2011-10-17 15:08:39 +11:00
Martin Schwenke
71b8015ccf Make ctdb_diagnostics more resilient to uncontactable nodes.
Current behaviour is for onnode to timeout (for about 20s) for each
attempted ssh to a down node.  With 40 or 50 invocations of onnode
this takes a long time.

2 changes to work around this:

* If EXTRA_SSH_OPTS (which is passed to ssh by onnode) does not
  contains a ConnectTimeout= setting then add a setting for a 5 second
  timeout.

* Filter the nodes before starting any diagnosis, taking out any "bad
  nodes" that are uncontactable via onnode.

  In the nodes summary at the beginning of the output, print
  information about any "bad nodes".

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

(This used to be ctdb commit 8c3b6427dbaade87e1a0f5590f0894c2e69b31a3)
2011-10-13 14:27:34 +11:00
Gregor Beck
28a434051c ltdbtool: ignore empty (deleted) records per default.
Add option -e to get the old behaviour and process empty records too.

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

(This used to be ctdb commit d9859540c2000864bc6c58be5afe19aa3b1064b2)
2011-10-12 22:38:02 +02:00
Ronnie Sahlberg
8a104331e8 Change the 'This Node' column of the machinereadable output for 'ctdb status -Y' to Y/N instead of 1/0
1/0 is unsuitable since it can be useful to check 'if a column is "1" there is something wrong with that node'

(This used to be ctdb commit b963f5e40b1e73a60363568da88557cad9e58a28)
2011-09-21 15:41:28 +10:00
Ronnie Sahlberg
a46d94bca2 Document 'cattdb' more clearly that it dumps the content of the local TDB and not the CTDB database
(This used to be ctdb commit 71bf1260b1cac5ce83a92b4b944096b631ca87d8)
2011-09-13 18:44:13 +10:00
Michael Adam
f5a3119dc0 Fix a typo in a message in ctdb backupdb.
(This used to be ctdb commit f6a47197dbb64cc7705fc564fa8dc78e958226c4)
2011-09-12 17:05:19 +02:00
Ronnie Sahlberg
0dc5584101 Merge branch 'master-readonly-records' into foo
Conflicts:

	Makefile.in
	tools/ctdb.c

(This used to be ctdb commit 0fedef0ffba4178126eee9544c5e2db52f5db893)
2011-09-12 09:34:34 +10:00
David Disseldorp
941ba90126 client: flag local node in ctdb -Y status output
Regular "ctdb status" output flags which node is the local node, do the
same for machine readable output.

(This used to be ctdb commit 3885141f37724b3dea61b45fbac38489ec356588)
2011-09-06 13:57:04 +02:00
David Disseldorp
5296da5609 client: add timeout argument to ctdb_attach
Rather than using a fixed 2 second CTDB_CONTROL_GETDBPATH timeout.

(This used to be ctdb commit 9e178671560cb95121e11d718a76b05380ecd6c5)
2011-09-06 13:57:04 +02:00
David Disseldorp
0628d1c0e6 client: add req timeout argument to ctdb_cmdline_client
Following connection to the local ctdbd, ctdb_cmdline_client() currently
issues a CTDB_CONTROL_GET_PNN request with a fixed 3 second timeout.

The ctdb cmd line client accepts a --timelimit argument for specifying
a per request timeout, pass this value through to ctdb_cmdline_client()
for use as a CTDB_CONTROL_GET_PNN request timeout.

(This used to be ctdb commit 0634d0305f42f17048b6830733767e8dc300e11c)
2011-09-06 13:56:54 +02:00
Michael Adam
a74f352271 tools/ctdb: fix a typo in a debug message
(This used to be ctdb commit 9bded1832179fbadc8bc94c5328ffa6c45a6d2ab)
2011-09-02 16:23:48 +02:00
Ronnie Sahlberg
206a3c0c66 ReadOnly: add a new control to activate readonly lock capability for a database.
let all databases default to not support this  until enabled through this control

(This used to be ctdb commit 908a07c42e5135a3ba30a625fc4f4e4916de197a)
2011-09-01 11:08:18 +10:00
Ronnie Sahlberg
a0d4d240c3 ReadOnly: add a readonly flag to the getdbmap control and show the readonly setting in ctdb getdbmap output
(This used to be ctdb commit 4cac9ad7d9c9ca657a247a6c215476399c7d2210)
2011-09-01 10:28:15 +10:00
Ronnie Sahlberg
63dc96cdb2 ReadOnly: Change the ctdb_db structure to keep a uint8_t for flags instead of a boolean for
the persistent flag.
This is the same size as the original boolean but allows ut to add additional flags for the database

(This used to be ctdb commit 7462761638d25880ad46024ad4ef21667eb99a98)
2011-09-01 10:21:55 +10:00
Martin Schwenke
f9eb60ba0b Tools - fix "ctdb scriptstatus -Y" output
Lines in machine readable output always start with a colon (':').

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

(This used to be ctdb commit a779d83a6213e2ba21621f7e090964428f89422d)
2011-08-30 16:37:04 +10:00
Ronnie Sahlberg
6692512299 LibCTDB : update the ctdb tool to use libctdb to read the recovery mode
(This used to be ctdb commit 750a31cf95c356a0ee071967537eb615dce35845)
2011-08-23 16:35:08 +10:00
Ronnie Sahlberg
75afbee956 LibCTDB : uptade the ctdb tool to use libctdb to query for the recmaster
(This used to be ctdb commit 81c14c8625a6d5670b8795a655d7a3f3318009e5)
2011-08-23 16:32:38 +10:00
Ronnie Sahlberg
49923d4fdc Add the missing "persistent" argument to db_exist()
The API for this function has changed since the 1.2 branch where readonly locks are being merged from

(This used to be ctdb commit d01b9716d3e50f4c6d102e8411f0401b0f499699)
2011-08-23 10:23:18 +10:00
Ronnie Sahlberg
b77142ccc0 ReadOnly: Add a new command 'ctdb cattdb'. This fucntion differs from 'ctdb catdb' in that 'cattdb' will always traverse the local tdb file only, while 'catdb' does a cluster traverse.
Since some record flags may differ between nodes in the cluster when read only delegations are in use, cattdb is needed when you need to know the exact flag settings on the current node itself.

(This used to be ctdb commit d2342b680a3a8160d903d12550b86ee21c8b277d)
2011-08-23 10:22:41 +10:00
Ronnie Sahlberg
9d0a5b167c Add a new command 'ctdb checktcpport <port>'
that tries to bind to the specified port on INADDR_ANY.

This can be used for testing if a service is listening to that port or not.

Errors are printed to stdout and the returned status code is either 0 : if we managed to bind to the port (in which case the service is NOT listening on that bort) or the value of errno that stopped us from binding to a port.

errno for EADDRINUSE is 98 so a script using this command should check the status code against the value 98.
If this command returns 98 it means the service is listening to the specified port.

(This used to be ctdb commit 04cbb490c5a075080923fde58af7082572c55c43)
2011-08-17 10:20:19 +10:00
Martin Schwenke
07d2ecfbcc ctdb natgwlist should return non-zero when there is no natgw.
This makes it 2, since this error corresponds loosely to ENOENT.

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

(This used to be ctdb commit 1bf289abdd3067a40e9a67091aba78222d13eddf)
2011-08-03 15:39:33 +10:00
Ronnie Sahlberg
20a7c19691 Add log output to wipedb and backupdb
CQ S1025379

(This used to be ctdb commit 6f51d4a75f8a9f2cdb8ecde946ed31809ab5a415)
2011-07-06 13:13:18 +10:00
Martin Schwenke
5ddc10128a onnode: fix natgwlist nodespec
This hasn't worked for a while if ever.

We treat this case specially because the output has 2 works on the 1st
line.  We also handle the error case where /etc/ctdb_natgw_nodes
exists but none of the other $NATGW_* configuration is done.

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

(This used to be ctdb commit 66e89797c7866d207a5bbf1836f52d70dba7cea6)
2011-06-08 14:24:00 +10:00
Martin Schwenke
1ef399e48d onnode: fix get_nodes_with_status()
Setting IFS and looping though items with colons in them doesn't work.
Change this to read through the output line by line.  The header line
needs to be thrown away by throwing away everything up to the 1st
newline.

Keep stderr from the "ctdb status" command, otherwise debugging is
impossible.

On error, append any output from ctdb to onnode's error message.

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

(This used to be ctdb commit d60592cf99999f10344a05ef0571fb300bb9d97c)
2011-06-08 14:23:40 +10:00
Martin Schwenke
41436193dd onnode: Remove an unnecessary comment.
The comment about $CTDB_NODES_SOCKETS is meaningless.  The code ti
refers to works just find with $CTDB_NODES_SOCKETS.

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

(This used to be ctdb commit 74e69a564bac653dadfffe8b08145b9b3be16e61)
2011-06-08 14:23:14 +10:00
Martin Schwenke
f730194f12 onnode: Future-proof get_nodes_with_status().
The current code requires knowledge of the number of status bits
output by "ctdb status -Y".

This changes the code to be completely general.

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

(This used to be ctdb commit e1788f25fde3d1f26bf4831a331741aa280f6fbc)
2011-06-08 14:22:49 +10:00
Martin Schwenke
f3ea7bec68 onnode: Exit with error for unknown command-line flags.
Use of "local" was masking errors in command-line processing.

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

(This used to be ctdb commit ca80adda7517b43147ef30156ae34c66b29fa2bd)
2011-06-08 14:22:16 +10:00
Martin Schwenke
350f3e5b09 onnode: Be defensive when listing IPs of nodes with designated status.
The current version gives the last item left after stripping the known
fields.  If an insufficent number of status fields is stripped then
this would return a residual status field value, which turned out to
be a valid IP address for localhost...  so no error occurs.

This change means that the node number is stripped and any residual
status field value will stay appended, causing an error the first time
this command is tested.

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

(This used to be ctdb commit 74715e6ec7b67c6f0e863aa51c87279758d6bf91)
2011-06-08 14:21:53 +10:00
Martin Schwenke
597083d37a onnode - Fix long standing bug in onnode healthy/ok/connected/con.
When the output of "ctdb status -Y" changed to add an extra status
column we didn't fix onnode.

This adds a match for the extra column.

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

(This used to be ctdb commit 793febaebd3d484ddfbbcb47aaa0cdf3cfc1a00d)
2011-06-08 14:21:26 +10:00
Ronnie Sahlberg
5b93e0a870 Remove all checking of GPFS from ctdb_diagnostics
CQ S1023524

(This used to be ctdb commit 4cddba08b46db0a56a86b32403a41b89cd097317)
2011-05-11 21:25:25 +10:00
Gregor Beck
082de99f87 add ltdbtool - a standalone ltdb tool
This this is a tool to handle (dump and convert) ctdb's local tdb
copies (ltdbs) without connecting to a ctdb daemon.

It can be used to

* dump the contents of a ltdb, printing
  the ctdb record header information

* dump a non-clustered tdb database (like tdbdump)

* convert between an ltdb and a non-clustered tdb
  (adding or removing ctdb headers)

* convert between 64 and 32 bit ltdbs
  (the ctdb record headers differ by 4 bytes of padding)

usage: bin/ltdbtool dump [-p] [-s{0|32|64}] <idb>
       bin/ltdbtool convert [-s{0|32|64}] [-o{0|32|64}] <idb> <odb>

Pair-Programmed-With: Michael Adam <obnox@samba.org>

(This used to be ctdb commit efcf2815711cd5371633614fb91273bd0a786da0)
2011-05-04 12:48:50 +02:00
Ronnie Sahlberg
c23f2e8bea We default to non-deterministic ip now where ips are "sticky" and dont change
too much.
This means we can simplify the way we add ips significantly and stop
trying to move them.

We also check if the node already hosts the ip, in which case we used to return an error. Instead just print an error string but return 0, ok.
This makes it easier to script, and works around broken scripts.

CQ1021034

(This used to be ctdb commit 307e5e95548155a31682dfcb0956834d0c85838e)
2011-02-08 17:06:10 +11:00
Ronnie Sahlberg
6494574d8f db_exists() takes 3 arguments, not two.
(This used to be ctdb commit 2c02fc2d45cd7364d7bee0d6a89f1386131ef002)
2011-01-14 09:53:25 +11:00
Ronnie Sahlberg
2edbf0b2fb ADDIP failure
Found during automatic regression testing.
We do not allow the takeip/releaseip events to be executed during a recovery.

All of "ctdb addip, ctdb delip, ctdb moveip" use and force these events to
trigger to perform the ip assignments required.

If these commands collide with a recovery, these commands could fail since we do
not allow takeip/releaseip events to trigger during the recovery.
While it is easy to just try running hte command again, this is suboptimal for script use.

Change these commands to retry these operations a few times until either successfull or until we give up.
This makes the commands much easier to use in scripts.

(This used to be ctdb commit 6954c9df67501183995f408cca358c8fdfb176ab)
2011-01-13 16:18:58 +11:00
Ronnie Sahlberg
99d7e39efc ctdb addip:
After finishing "ctdb addip"  wait for an implicit "iptakeover" to complete
the assignment to a node.

This makes it more wasteful and timeconsuming when adding multiple ips
at once, or the same ip to multiple nodes,
but makes it easier to script the use of this command.

(This used to be ctdb commit d86cbf3d7d426c558d110d67dc985634c754a522)
2010-12-13 14:24:30 +11:00
Ronnie Sahlberg
a75bf138ab add new command line functions
ctdb readkey <dbid> <key>
ctdb writekey <dbid> <key> <value>

these are mainly intended for debugging of databases and dmaster migration issues

(This used to be ctdb commit 70c2e7dd04727371590fb94579ffd20318fbeb58)
2010-12-07 15:33:08 +11:00
Stefan Metzmacher
e75f6907c0 tools/ctdb: allow "ctdb pfetch" only on persistent databases
metze

(This used to be ctdb commit 63ad4a7fe7bd7c9597a4f5573e87f66e5234eb48)
2010-10-21 11:10:21 +11:00
Stefan Metzmacher
be7545e83a tools/ctdb: add 'persistent' flag to "ctdb attach"
metze

(This used to be ctdb commit 7a5790de22e8370b2812414aa1adef8201e8b269)
2010-10-21 11:10:15 +11:00
Stefan Metzmacher
19bc2e40ca tools/ctdb: let "ctdb catdb" pass the persistent flag to ctdb_attach()
metze

(This used to be ctdb commit 4ec99c1eeab529865ac790ef554f3b099a14faf1)
2010-10-21 11:09:55 +11:00
Ronnie Sahlberg
c1612205f1 Remove a debug message "Timed out waiting ..."
from the ctdb command.

This is a debugging message and is normal tro tigger on a busy system.
It should not be logged as ERROR.

(This used to be ctdb commit 9ddf89e01f1845eec1712d75fb811240e8bb0e37)
2010-10-13 09:23:17 +11:00
Ronnie Sahlberg
5ef29f9f25 Update latency countes to show min/max and average
(This used to be ctdb commit 1919e949af4641ffe919123e44b02fb87c13ab9f)
2010-10-11 15:12:24 +11:00
Ronnie Sahlberg
d0054d383d get rid of the "ctdb setflags" command since
1, we dont need it
2, it uses the ugly "modify flags" control that should die

(This used to be ctdb commit 25f96db966230e90291eee57841c9faaae33713b)
2010-10-07 16:19:24 +11:00
Ronnie Sahlberg
b67754fa4d when printing machinereadable statistics only print the header with the fieldnames once
(This used to be ctdb commit 70c8d429d7c13cbbd08184ff8f0aa506de5adccc)
2010-09-30 15:08:12 +10:00
Ronnie Sahlberg
1a716ec300 add a machinereadable version of ctdb stats/statistics
(This used to be ctdb commit 3a033156c48d821d48fd18f12c3b0ac14bbddc93)
2010-09-30 15:01:08 +10:00
Ronnie Sahlberg
9f66a93f12 Add rolling statistics that are collected across 10 second intervals.
Add a new command "ctdb stats [num]" that prints the [num] most recent statistics intervals collected.

(This used to be ctdb commit e6e16fcd5a45ebd3739a8160c8fb5f44494edb9e)
2010-09-29 12:14:45 +10:00
Ronnie Sahlberg
bb22ff0f50 Dont try to read the nodemap from the daemon for "ctdb listnodes"
Always read it from the /etc/ctdb/nodes file

(This used to be ctdb commit a0fdb25bb2cac177cdc32b938fa08fd665aa873e)
2010-09-09 07:38:28 +10:00
Ronnie Sahlberg
f5c0539dc6 Change how NATGW is configured to allow special nodes that do not have
network connectivity outside of the cluster to still be able to
participate in a natgw group.
These nodes can not become natgw master since they lack external network
connectivity.

These nodes are configured just the same way as for any other node with
NATGW, with the following two exceptions :
* we do NOT set CTDB_NATGW_PUBLIC_IFACE at all on these nodes.
  since these ndoes lack external network we should not check the interface
  for link.
* we must set CTDB_NATGW_SLAVE_ONLY=yes to flag that this is a node that
  can not become natgw master.

(This used to be ctdb commit ab7b00a37e55beffc074be95b55d8a5c7cb9eef2)
2010-09-08 09:20:16 +10:00
Ronnie Sahlberg
55c619f072 the tfetch command can be used without the daemon running, so flag it as such.
fix a couple of incorrect settings for "auto-all" for a few of the commands as well.

(This used to be ctdb commit 9999771105d7105efaa232fe2842e21e66f78706)
2010-08-25 11:11:12 +10:00
Ronnie Sahlberg
018063b8eb add a new command "ctdb tfetch" that can read a record straight out of the
tdb file.

the command automatically strips off the initial ctdb header off the record so it can only be used on ctdb managed tdb files, not on normal tdb files.

(This used to be ctdb commit c3a816e5174abefb5155f65d8faad7b1e831e481)
2010-08-25 10:56:02 +10:00
Ronnie Sahlberg
f75b984b71 When "ctdb pfetch" creates a new file, make sure we set some initial sane mode bits
(This used to be ctdb commit 87160c91bfd87e8b9c510dacbf00e5aa481d2305)
2010-08-25 10:35:12 +10:00
Ronnie Sahlberg
4c5a4015f3 change "ctdb pfetch" to take an optional third argument
as a file to store the record in.

(This used to be ctdb commit 6d7e62f5401f0647a519fe0b74ec628418e33231)
2010-08-25 08:07:47 +10:00
Ronnie Sahlberg
a8db1adcd6 add a command to write a record to a persistent database
"ctdb pstore <db> <key> <file containing possibly binary data>"

(This used to be ctdb commit 14184ab7c80a3ef16c54b4ab168fd635b7add445)
2010-08-24 14:00:18 +10:00
Ronnie Sahlberg
4da818504a get rid of two compiler warnings
(This used to be ctdb commit 0865f0e6ef671396aa862f6a79a48a4891d72122)
2010-08-24 14:00:10 +10:00
Ronnie Sahlberg
401732a56b Add a command "ctdb pfetch <db> <record>" to read a record from
a persistent database.

(This used to be ctdb commit 3bef831b96ce8b40457ed4de527f0d62fa6a5b00)
2010-08-24 14:00:02 +10:00
Ronnie Sahlberg
1ef66379d7 ctdb ip is very busy.
revert the defauls case back to only showing the ip and node
and only display the extra info if -v verbose output is requested

(This used to be ctdb commit 6488651aa7e105c57324f4a300760a010d098fbb)
2010-08-20 11:38:34 +10:00
Ronnie Sahlberg
08a5b0c7c5 add a new commandline flag -v to enable verbose output
(This used to be ctdb commit 96dd9f40f9464c3d9de98f1323568724a1e31dc9)
2010-08-20 11:28:24 +10:00
Ronnie Sahlberg
388d18cc93 make it possible to "ctdb gettickle" to only list tickles for a certain
port.

Default is to continue to show all tickles, but if a second argument
is given, only tickles for that port will be shown.

(This used to be ctdb commit 5b985eb2cbbb92bf6ccfcacd633d793bcd4e3ec1)
2010-08-20 11:25:12 +10:00
Ronnie Sahlberg
31126b2ef0 Add machinereadable output for the "ctgdb gettickles <ip>" command
(This used to be ctdb commit c3eb53509331045074579468d94ed7e31101bba4)
2010-08-18 14:37:16 +10:00
Ronnie Sahlberg
5aa5f3e7bf Remove the structure ctdb_control_tcp_vnn since this is identical to the structure ctdb_tcp_connection.
Add a new "ctdb deltickle" command to delete tickles from the database.
This can ONLY be used for tickles created by "ctdb addtickle".

Push any "addtickle/deltickle" updates to other nodes every TickleUpdateInterval seconds'

(This used to be ctdb commit acded034e2f0dcae4c2c9e54e16a001caf23caec)
2010-08-18 12:36:03 +10:00
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
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 7f29f817fa.

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


(This used to be ctdb commit 85e5e760cc91eb3157d3a88996ce474491646726)
2010-08-18 09:16:31 +09:30
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
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
043045dcc5 remove the "ctdb freeze" debugging command
(This used to be ctdb commit bd005b987255eb65cd3826dce984281ee757daf6)
2010-08-05 16:30:47 +10:00
Rusty Russell
61d3e09632 ctdb: fix crash on "ctdb scriptstatus --events=releaseip"
Martin accidentally typed this instead of "ctdb scriptstatus releaseip"
and it crashes.

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

(This used to be ctdb commit 70877b2e7f8fd0d46899bbeca2c6caad6e6e6820)
2010-07-12 16:08:37 +09:30
Ronnie Sahlberg
5699091e9a Some "ctdb ..." commands can be run without having the main daemon running.
In that case, when the main daemon is not running
the ctdb context will be initialized to NULL, since we can not connect.

Move the calls to read the ctdb socketname and connecting via libctdb to
only happen when we are executing a "ctdb ..." command that requires that we talk to the actual daemon.
Otherwise we will get an ugly SEGV for the "ctdb ..." commandline tool
when trying to run a command that is supposed to work also when the daemon is down.

(This used to be ctdb commit 18168da84a6aa8d69465e43402444c7ec979604a)
2010-06-09 09:17:35 +10:00
Ronnie Sahlberg
6e0d612750 update "ctdb pnn" to use the new return value for _recv() where
bool false means failure and true means success.

(This used to be ctdb commit 8fec60cb92d26886d853c918b8bc7931fec46469)
2010-06-05 14:38:01 +10:00
Ronnie Sahlberg
433bc560fb Update the ctdb tool to use the new signature for ctdb_connect()
(This used to be ctdb commit ced3bc40f841d353bc86a6ee9dd1868473223f52)
2010-06-05 14:21:42 +10:00
Ronnie Sahlberg
c05f3ee99b When we say "current time of statistics" in the "ctdb statistics" output,
print the current time and not the start time

(This used to be ctdb commit d42ea3b1892f6a4abd1dbcf822d0a4d5db422d38)
2010-06-02 17:07:27 +10:00
Ronnie Sahlberg
53ea238c6c Add a variable for start/current time to ctdb statistics
and print the time startistics was taken and for how long the statistics have been collected to the "ctdb statistics" output.

(This used to be ctdb commit 1bdfe0cd3370a335b960ce1ef97eade93b0cd2fa)
2010-06-02 13:14:53 +10:00
Ronnie Sahlberg
ae3e91f0ce link ctdb with libctdb and connect to the daemon both the old way and by using libctdb
update the function "control_pnn()" to use libctdb to ask the daemon for the pnn

(This used to be ctdb commit 3f651eb8d71c7af0268460bc4b1476112140b290)
2010-06-02 10:37:00 +10:00
Ronnie Sahlberg
bc208bc916 rename ctdb_set_message_handler to ctdb_client_set_message_handler
to avoid a colission with the function of the same name in libctdb

(This used to be ctdb commit 41dbdd4fc0ab560420fb0e24a3179ff7c94c5bb7)
2010-06-02 09:51:47 +10:00
Ronnie Sahlberg
761a075de9 rename ctdb_send_message to ctdb_client_send_message to resolve colission with the function of the same name in libctdb
(This used to be ctdb commit ac3292c12832484a22715f1d46aa23f3b7c8a6f6)
2010-06-02 09:45:21 +10:00
Ronnie Sahlberg
0d46488f6e Merge commit 'rusty/libctdb2'
(This used to be ctdb commit d41b802250ddc0a89581eb6285edfd66bdc7a78a)
2010-05-25 12:48:49 +10:00
Rusty Russell
d5f6026a22 libctdb: reorganize headers: remove ctdb.h, add ctdb_client.h and ctdb_protocol.h
ctdb_client.h is the existing internal client interface (which was mainly
in ctdb.h), and ctdb_protocol.h is the information needed for the wire
protocol only.

ctdb.h will be the new, shiny, libctdb API.

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

(This used to be ctdb commit 4bba6b8cd47b352f98d41f9f06258d5ac3c9adef)
2010-05-20 15:18:30 +09:30
Ronnie Sahlberg
6c5256ae69 In control_ipreallocate() we wait at most 5 tries before aborting the command
and returning an error.
This might not be sufficient if there are several recoveries in a row.

Instead loop as long as it takes for the recovery master to finish the recoveries and re
spond to the ipreallocate call.

Increase the log level of the error message when the recovery master was busy and could
not perform the ipreallocation promptly

BZ61783

(This used to be ctdb commit 8e9fd36e4619b7cc7bb6f7f7416d13e4c00a296a)
2010-05-20 12:35:57 +10:00
Ronnie Sahlberg
e1d1c230d3 Enhance the "ctdb restoredb" command so you can restore a backup into a different database.
(This used to be ctdb commit c692b09851fce85b61c8c654faafb49db8cb601b)
2010-05-20 11:26:37 +10:00
Ronnie Sahlberg
6f1221e9e1 Add the number of performed recoveries to the "ctdb statistics" output.
(This used to be ctdb commit fa045733cb81412f0d02ab52d74eabc7efca8b3d)
2010-05-11 09:44:53 +10:00
Ronnie Sahlberg
4a43428440 The recent change to the recovery daemon to keep track of and
verify that all nodes agree on the most recent ip address assignments
broke "ctdb moveip ..." since that call would never trigger
a full takeover run and thus would immediately trigger an inconsistency.

Add a new message to the recovery daemon where we can tell the recovery daemon to update its assignments.

BZ62782

(This used to be ctdb commit e7069082e5f0380dcddee247db8754218ce18cab)
2010-05-03 15:47:17 +10:00
Ronnie Sahlberg
05dcbed90e ctdb regsrvids is much more useful for testing if it sleeps once it has registered its srvid.
Othervise, as soon as it terminates, ctdbd will deregister the id automatically.

(This used to be ctdb commit 23b059dcb8074872d7900b225790d4df7da071b6)
2010-02-22 15:34:26 +11:00
Ronnie Sahlberg
e01c8454ef commands that relate to manual failover of ip addresses (moveip)
can sometimes take long so allow for a longer timeout for the controls used.

(This used to be ctdb commit 144c69b633eeb17e120f962162feed6de3dc16a6)
2010-02-09 18:34:47 +11:00
Ronnie Sahlberg
ca9386a7f4 dont just exit(0) upon successful completion of waiting for an ipreallocate to finish.
return success back to the caller instead.

otherwise things like 'ctdb enable -n all' will just finish after the first disabled node has become enabled.

(This used to be ctdb commit f4eb41cd3a1099da8265351818fba9bd4688a188)
2010-02-09 14:35:10 +11:00
Ronnie Sahlberg
7a889c5f1d When trying to enable/disable a node.
Check if the node is already enabled/disabled and log an information
message if so.

(This used to be ctdb commit c3eec8f10764a647106087099eeb47b7196f7aac)
2010-02-04 10:03:21 +11:00
Ronnie Sahlberg
7a5254ae69 add two new debug controls to send and receive messages
ctdb msglisten and msgsend

(This used to be ctdb commit 8c89aac20260dc7f3746e29fe99f17422a77cb88)
2010-02-04 09:45:32 +11:00
Martin Schwenke
52dbd65825 onnode: update algorithm for finding nodes file.
2 changes:

* If a relative nodes file is specified via -f or $CTDB_NODES_FILE but
  this file does not exist then try looking for the file in /etc/ctdb
  (or $CTDB_BASE if set).

* If a nodes file is specified via -f or $CTDB_NODES_FILE but this
  file does not exist (even when checked as per above) then do not
  fall back to /etc/ctdb/nodes ((or $CTDB_BASE if set).  The old
  behaviour was surprising and hid errors.

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

(This used to be ctdb commit 60aa570aaa77d293b963105b3f605f9625a4594b)
2010-01-21 18:52:44 +11:00
Martin Schwenke
7569b21f2d onnode - respect $CTDB_BASE rather than hard-coding /etc/ctdb.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 503e4908b3028330bc25dc6de8561dbd53ee6a8d)
2010-01-21 18:52:31 +11:00
Stefan Metzmacher
f2854f75c8 tools/ctdb: add PartiallyOnline state for "ctdb status" and "ctdb status -Y"
This is based on the GET_IFACES control against each node.

metze

(This used to be ctdb commit 38cb972382a09f830673277d0a9bd5d20deafff2)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
a6437bc707 tools/ctdb: display interfaces in "ctdb ip" and "ctdb ip -Y" outputs
metze

(This used to be ctdb commit dffa2b05acce8b73c2fdd085311732bf57f01b7f)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
df5805d6a0 tools/ctdb: add "ctdb ipinfo <ip>"
metze

(This used to be ctdb commit e05e236fc019bfd3b316609a7c190e0e028a4bbc)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
a6803f42a5 tools/ctdb: add "ctdb setifacelink <iface> <status>"
metze

(This used to be ctdb commit 8d0c00b60db69bd10f12da4c676e1142dc37af7a)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
0ceef7036b tools/ctdb: add "ctdb ifaces"
metze

(This used to be ctdb commit 80053d09eed967fb76898f4a53437bed2b43a02f)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
a23c409e73 tools/ctdb: display INACTIVE status in "ctdb status" and "ctdb status -Y"
metze

(This used to be ctdb commit 18af37e99ef8ff5623161495be432abfe5e3407f)
2010-01-20 09:44:36 +01:00
Stefan Metzmacher
a03cf0040b ctdb: print out some hints how to debug a "ctdb catdb" failure
metze

(This used to be ctdb commit 504cf78d00d1120b556124340b9312f890b8b8b9)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
965c000c6e ctdb: add machinereadable output fot "ctdb -Y getdbmap"
metze

(This used to be ctdb commit 45cfcd44093c7d2681e2ffd5cfb402823e8809f4)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
aa07a46bf5 ctdb: disallow "ctdb backupdb" on unhealthy databases
metze

(This used to be ctdb commit ecf799093c1989f5499c9d61ce8cc8a98d759160)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
c4bc231267 client: add "ctdb dumpdbbackup <filename>"
metze

(This used to be ctdb commit c63a0368d9d4b526ac1e49d891d3a1b7b8d20320)
2009-12-16 08:08:33 +01:00
Stefan Metzmacher
fb50e08942 tools/ctdb: let "ctdb restoredb" and "ctdb wipedb" mark the db as healthy on all
nodes

metze

(This used to be ctdb commit d1b10b0c0c323c39742a18e98a1dab7e82ddc7be)
2009-12-16 08:08:32 +01:00
Stefan Metzmacher
c56ce3d2f2 tools/ctdb: add "ctdb getdbstatus <dbname>"
metze

(This used to be ctdb commit 910c19f12448d293a755d1eb46d20f9591f8da7a)
2009-12-16 08:08:32 +01:00
Stefan Metzmacher
927dd3d9e5 tools/ctdb: display db health in "ctdb getdbmap"
metze

(This used to be ctdb commit c34535ff4dc6a44909283641596e0ed7c2316fbd)
2009-12-16 08:08:32 +01:00
Stefan Metzmacher
003985acfd ctdb: pass TDB_DISALLOW_NESTING to all tdb_open/tdb_wrap_open calls
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 1635e931b909c66eb3b1f5357e3a549b1a0da70d)
2009-12-16 08:03:55 +01:00
Rusty Russell
cab8da8dc4 ctdb: don't print OUTPUT: for DISABLED scripts
In other news, did you know ctime() returns a \n-terminated string?

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

(This used to be ctdb commit 1b4e7bb548976b99f122142b040494b6f9911962)
2009-12-14 15:46:49 +11:00
Rusty Russell
a46c3b4f2a ctdb: scriptstatus can now query non-monitor events
We also no longer return an error before scripts have been run; a special
zero-length data means we have never run the scripts.

"ctdb scriptstatus all" returns all event script results.

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


(This used to be ctdb commit 9b90d671581e390e2892d3a68f3ca98d58bef4df)
2009-12-08 01:50:55 +10:30
Rusty Russell
9e87377e7a ctdb: support --machinereadable (-Y) for scriptstatus
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 47ffe75848f216568ce3db0a60ca88cfe3d6903a)
2009-12-08 01:31:53 +10:30
Rusty Russell
9753b7e793 eventscript: rename ctdb_monitoring_wire to ctdb_scripts_wire
We're going to allow fetching status of all script runs, so this
name is no longer appropriate.

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


(This used to be ctdb commit f5cb41ecf3fa986b8af243e8546eb3b985cd902a)
2009-12-08 00:51:24 +10:30
Rusty Russell
c70afe0cd4 eventscript: handle and report generic stat/execution errors
Rather than ignoring deleted event scripts (or pretending that they were "OK"),
and discarding other stat errors, we save the errno and turn it into a negative
status.

This gives us a bit more information if we can't execute a script (eg.
too many symlinks or other weird errors).

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


(This used to be ctdb commit 5d894e1ae5228df6bbe4fc305ccba19803fa3798)
2009-12-07 23:12:19 +10:30
Rusty Russell
b9b75bd065 eventscript: use -ENOEXEC for disabled status value
This unifies code paths and simplifies things: we just hand -ENOEXEC to
ctdb_ctrl_event_script_stop().

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


(This used to be ctdb commit eadf5e44ef97d7703a7d3bce0e7ea0f21cb11f14)
2009-12-07 23:11:47 +10:30
Rusty Russell
066a791770 eventscript: use -ETIME for timeout status value
This starts the move toward more expressive encoding of return values:
positive values mean the script ran, negative means we had a problem with
the script (and the value is the errno).

This does timeout, but changes the ctdb tool to recognize it.

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


(This used to be ctdb commit 0eb1d0aa14e68b598d9e281c8a02b8f94a042fd9)
2009-12-07 23:09:42 +10:30
Michael Adam
92c5d9eefc ctdb: add command "ctdb wipedb" to wipe the contents of an attached tdb
Michael

(This used to be ctdb commit 5a7c1e7f15693522bbf1c39a53be2304ece9a134)
2009-12-04 11:30:20 +01:00
Ronnie Sahlberg
cc2d81a77c make the ringbuffer logging more efficient and marshall the data by writing to a tmpfile instead of continously talloc resizing a blob
(This used to be ctdb commit 6427f0b68d60b556a023f64e15e156000ba6f943)
2009-11-18 19:10:50 +11:00
Ronnie Sahlberg
bc2675119d add an in memory ringbuffer where we store the last 500000 log entries regardless of log level.
add commandt to extract this in memory buffer and to clear it

(This used to be ctdb commit 29d2ee8d9c6c6f36b2334480f646d6db209f370e)
2009-11-18 12:44:18 +11:00
Ronnie Sahlberg
f88fbb5f1e suggestion from Christian,
dont allow UNHEALTHY nodes to become natgw master, unless all nodes
are unhealthy

(This used to be ctdb commit e8e7129ff1371065fbd75e1aea844d6d04a96fa9)
2009-11-06 08:19:32 +11:00
Ronnie Sahlberg
fcd2ebc32b update the uptime command to indicate that time since last is either from alst recovery or from last failover
(This used to be ctdb commit 467da12a785ba3367ed9cbdf79440394e9703289)
2009-10-29 10:58:14 +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
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
3d713d9e53 ctdb_diagnostics: don't use hardcoded path to iptables
All event scripts use only the relative path, so we should
here.

Also PATH includes /sbin and /usr/sbin...

metze

(This used to be ctdb commit 20678e1506db1f96b58c326ee91339e797c07c22)
2009-10-26 14:23:09 +11:00