obnox/ctdb.git
12 years agovacuum: use get_vacuum_interval() in ctdb_vacuum_event()
Michael Adam [Tue, 13 Dec 2011 13:32:12 +0000 (14:32 +0100)]
vacuum: use get_vacuum_interval() in ctdb_vacuum_event()

(instead of using the tunable directly)

12 years agovacuum: change get_vacuum_interval() to simply return the VacuumDefaultInterval tunable
Michael Adam [Tue, 13 Dec 2011 13:16:23 +0000 (14:16 +0100)]
vacuum: change get_vacuum_interval() to simply return the VacuumDefaultInterval tunable

12 years agovacuum: remove update_tuning_db()
Michael Adam [Tue, 13 Dec 2011 13:06:09 +0000 (14:06 +0100)]
vacuum: remove update_tuning_db()

12 years agoctdb_ltdb_store_server: when storing a record that is not to be scheduled for deletio...
Michael Adam [Thu, 7 Apr 2011 10:17:42 +0000 (12:17 +0200)]
ctdb_ltdb_store_server: when storing a record that is not to be scheduled for deletion, remove it from the delete queue

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

12 years agovacuum: add ctdb_local_remove_from_delete_queue()
Michael Adam [Thu, 7 Apr 2011 10:17:16 +0000 (12:17 +0200)]
vacuum: add ctdb_local_remove_from_delete_queue()

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

12 years agorb_tree: fix possible access-after-free-error in trbt_traversearray32_node
Michael Adam [Thu, 22 Dec 2011 17:09:36 +0000 (18:09 +0100)]
rb_tree: fix possible access-after-free-error in trbt_traversearray32_node

When the traverse callback frees the current node, the traverse of the
rbtree can fail (the next node->right fails since node is not there any more...).
This is fixed by introducing variables to store the right (and left)
pointers before the callback is called.

12 years agofix zero-initialization of header in _ctdbd_allocate_pkt to the correct size
Michael Adam [Thu, 22 Dec 2011 16:18:38 +0000 (17:18 +0100)]
fix zero-initialization of header in _ctdbd_allocate_pkt to the correct size

12 years agoTests: eventscripts - add tests for CTDB_DELETE_UNEXPECTED_IPS="yes"
Martin Schwenke [Mon, 21 Nov 2011 03:15:01 +0000 (14:15 +1100)]
Tests: eventscripts - add tests for CTDB_DELETE_UNEXPECTED_IPS="yes"

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoDOC: Update the manpage to describe all relevant tunables
Ronnie Sahlberg [Wed, 14 Dec 2011 03:23:53 +0000 (14:23 +1100)]
DOC: Update the manpage to describe all relevant tunables

12 years agotypo
Ronnie Sahlberg [Wed, 14 Dec 2011 01:52:35 +0000 (12:52 +1100)]
typo

12 years agolibctdb: fix libctdb's traverse after changes in the core
Michael Adam [Tue, 6 Dec 2011 09:38:04 +0000 (10:38 +0100)]
libctdb: fix libctdb's traverse after changes in the core

In 8281bb210858ed04992eacea7f6d02261e0fc1b1, I forgot to change
this hunk back when hiding the wire changes done in commit
ddc5da3a0df7701934404192a0a0aa659a806acb behind a new control
CTDB_CONTROL_TRAVERSE_START_EXT.

12 years agoRevert "Fix the build that broke in 8281bb210858ed04992eacea7f6d02261e0fc1b1"
Michael Adam [Tue, 6 Dec 2011 09:42:43 +0000 (10:42 +0100)]
Revert "Fix the build that broke in 8281bb210858ed04992eacea7f6d02261e0fc1b1"

This reverts commit 08e06176feab1ec244496e62a916fbb77817239f.

I wanted to fix this differently, not using the extended traverse_start
control...

12 years agoctdb tool - move parsing of nodestring to where it is needed
Martin Schwenke [Tue, 29 Nov 2011 04:18:45 +0000 (15:18 +1100)]
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>
12 years agoctdb tool - replace fprintf with DEBUG
Martin Schwenke [Tue, 29 Nov 2011 04:17:09 +0000 (15:17 +1100)]
ctdb tool - replace fprintf with DEBUG

It's the only one in the file.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoctdb tool - short circuit most of the logic in main for non-daemon commands
Martin Schwenke [Tue, 29 Nov 2011 03:38:39 +0000 (14:38 +1100)]
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>
12 years agoctdb tool - commands that don't use the daemon can't take -n/--node
Martin Schwenke [Tue, 29 Nov 2011 03:25:31 +0000 (14:25 +1100)]
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>
12 years agoctdb tool - simplify main() by taking most code out of a loop
Martin Schwenke [Tue, 29 Nov 2011 03:20:26 +0000 (14:20 +1100)]
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>
12 years agoReturn the peer_pid properly to the caller
Ronnie Sahlberg [Tue, 6 Dec 2011 02:15:41 +0000 (13:15 +1100)]
Return the peer_pid properly to the caller

12 years agoLibCTDB: Add support for the 'get interfaces' control and update the ctdb tool to...
Ronnie Sahlberg [Tue, 6 Dec 2011 02:11:13 +0000 (13:11 +1100)]
LibCTDB: Add support for the 'get interfaces' control and update the ctdb tool to use this interface

12 years agoGNU/Hurd support
Mathieu Parent [Fri, 25 Nov 2011 19:58:49 +0000 (20:58 +0100)]
GNU/Hurd support

CTDB has the following limitations on GNU Hurd:

- The pid of a peer is not get from the socket [1]. As a consequence, the peer
  process is not killed when releasing IP [2].

- Gratuitous arp are not yet supported [3]

- network interfaces are always considered present [4]

[1]: ctdb_get_peer_pid() in common/system_gnu.c
[2]: release_kill_clients() in server/ctdb_takeover.c
[3]: ctdb_sys_send_arp() in common/system_gnu.c
[4]: ctdb_sys_check_iface_exists() in common/system_gnu.c

12 years agoMove platform-specific code to common/system_*
Mathieu Parent [Sat, 5 Nov 2011 18:04:40 +0000 (19:04 +0100)]
Move platform-specific code to common/system_*

This removes #ifdef AIX and ease the addition of new platforms.

12 years agoRemove zero-length gnu_printf format string in ctdb_daemon.c (gcc warning)
Mathieu Parent [Sat, 5 Nov 2011 16:26:40 +0000 (17:26 +0100)]
Remove zero-length gnu_printf format string in ctdb_daemon.c (gcc warning)

server/ctdbd.c: In function ‘main’:
server/ctdb_daemon.c:943:7: warning: zero-length gnu_printf format string [-Wformat-zero-length]

12 years agoFix ctdb-crash-cleanup sysconfig handling
Mathieu Parent [Fri, 25 Nov 2011 20:12:43 +0000 (21:12 +0100)]
Fix ctdb-crash-cleanup sysconfig handling

12 years agoFix the build that broke in 8281bb210858ed04992eacea7f6d02261e0fc1b1
Ronnie Sahlberg [Tue, 6 Dec 2011 00:29:49 +0000 (11:29 +1100)]
Fix the build that broke in 8281bb210858ed04992eacea7f6d02261e0fc1b1

The traverse control has changed wireformat so update also libctdb to use the correct
version of the wire structure and compile

12 years agotraverse: fix traversing with empty records by adding a new (internal) control CTDB_C...
Michael Adam [Sat, 3 Dec 2011 01:15:30 +0000 (02:15 +0100)]
traverse: fix traversing with empty records by adding a new (internal) control CTDB_CONTROL_TRAVERSE_START_EXT

By this, the original CTDB_CONTROL_TRAVERSE_START control that is
used by e.g. samba's smbstatus, is not changed, so that samba
continues working without code change.

The  CTDB_CONTROL_TRAVERSE_START currently just adds the "withemptyrecords"
flag to the state and processon on as CTDB_CONTROL_TRAVERSE_START_EXT.

12 years agoDOC: document the check_srvids debugging command
Ronnie Sahlberg [Tue, 29 Nov 2011 23:05:59 +0000 (10:05 +1100)]
DOC: document the check_srvids debugging command

12 years agoctdb: use libctdb version of check-srvids call
Ronnie Sahlberg [Tue, 29 Nov 2011 23:00:27 +0000 (10:00 +1100)]
ctdb: use libctdb version of check-srvids call

12 years agoLibCTDB: add support for the check-srvids control
Ronnie Sahlberg [Tue, 29 Nov 2011 23:00:07 +0000 (10:00 +1100)]
LibCTDB: add support for the check-srvids control

12 years agocheck_srvids: remove the <pnn> from the commandline so that we only specify the list...
Ronnie Sahlberg [Tue, 29 Nov 2011 22:50:12 +0000 (09:50 +1100)]
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>'

12 years agoAdd "ctdb check_srvid"
Volker Lendecke [Mon, 31 Oct 2011 15:21:54 +0000 (16:21 +0100)]
Add "ctdb check_srvid"

12 years agoAdd CTDB_CONTROL_CHECK_SRVID
Volker Lendecke [Mon, 31 Oct 2011 12:29:13 +0000 (13:29 +0100)]
Add CTDB_CONTROL_CHECK_SRVID

12 years agoDOC: describe the RecoverPDBBySeqNum tunable
Ronnie Sahlberg [Tue, 29 Nov 2011 21:59:03 +0000 (08:59 +1100)]
DOC: describe the RecoverPDBBySeqNum tunable

12 years agoRecover Persistent database DB by DB and not record by record
Ronnie Sahlberg [Mon, 28 Nov 2011 02:56:30 +0000 (13:56 +1100)]
Recover Persistent database DB by DB and not record by record

Add a new tunable that changes the mode how persistent databases are recovered.
RecoveryPDBBySeqNum

When set to 1, persistent databases will be recovered in whole from the node which
has the highest "__db_sequence_number__" record.
This record is managed by samba for those databases where we do persistent writes and have
inter-record relations.
For these databases we do not want the usual "blend records from all nodes based
on individual record RSN" but instead a mode where we pick one instance of the persistent database.

If no node was found with a "__db_sequence_number__" record at all, we fail back to the original "recover records independently based on record RSN".
Some persistent databases do not contain record interrelations and as such does not
contain this special record at all.

12 years agoLibCTDB: add get persistent db seqnum control
Ronnie Sahlberg [Mon, 28 Nov 2011 05:30:46 +0000 (16:30 +1100)]
LibCTDB: add get persistent db seqnum control

12 years agoDB Seqnum: must provide a ctdb_ltdb_header when calling ctdb_ltdb_fetch()
Ronnie Sahlberg [Sun, 27 Nov 2011 23:41:17 +0000 (10:41 +1100)]
DB Seqnum: must provide a ctdb_ltdb_header when calling ctdb_ltdb_fetch()

12 years agodoc: commit generated ctdb.1 manpages after xml change
Michael Adam [Tue, 29 Nov 2011 12:42:40 +0000 (13:42 +0100)]
doc: commit generated ctdb.1 manpages after xml change

12 years agodoc: document the "--print-recordflags" parameter to "ctdb"
Michael Adam [Tue, 29 Nov 2011 12:41:16 +0000 (13:41 +0100)]
doc: document the "--print-recordflags" parameter to "ctdb"

12 years agoctdb: add an option --print-recordflags to trigger printing record flags in catdb...
Michael Adam [Tue, 29 Nov 2011 09:24:52 +0000 (10:24 +0100)]
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.

12 years agodoc: commit generated ctdb.1 manpages after xml change
Michael Adam [Tue, 29 Nov 2011 12:39:37 +0000 (13:39 +0100)]
doc: commit generated ctdb.1 manpages after xml change

12 years agodoc: document the "--print-hash" parameter to "ctdb".
Michael Adam [Tue, 29 Nov 2011 12:39:08 +0000 (13:39 +0100)]
doc: document the "--print-hash" parameter to "ctdb".

12 years agoctdb: add an option --print-hash to enable printing of record hashes when dumping dbs
Michael Adam [Mon, 28 Nov 2011 23:56:23 +0000 (00:56 +0100)]
ctdb: add an option --print-hash to enable printing of record hashes when dumping dbs

12 years agodoc: commit generated ctdb.1 manpages after xml change
Michael Adam [Tue, 29 Nov 2011 12:37:29 +0000 (13:37 +0100)]
doc: commit generated ctdb.1 manpages after xml change

12 years agodoc: document the "--print-lmaster" parameter to "ctdb"
Michael Adam [Tue, 29 Nov 2011 12:36:38 +0000 (13:36 +0100)]
doc: document the "--print-lmaster" parameter to "ctdb"

12 years agoctdb: add an option --print-lmaster to enable printing of lmaster in "ctdb catdb"
Michael Adam [Mon, 28 Nov 2011 16:36:03 +0000 (17:36 +0100)]
ctdb: add an option --print-lmaster to enable printing of lmaster in "ctdb catdb"

12 years agodoc: commit generated ctdb.1 manpages after xml change
Michael Adam [Tue, 29 Nov 2011 12:35:02 +0000 (13:35 +0100)]
doc: commit generated ctdb.1 manpages after xml change

12 years agodoc: document the "--print-datasize" parameter to "ctdb"
Michael Adam [Tue, 29 Nov 2011 12:31:11 +0000 (13:31 +0100)]
doc: document the "--print-datasize" parameter to "ctdb"

12 years agoctdb: add an option --print-datasize to only print datasize instead of dumping data...
Michael Adam [Mon, 28 Nov 2011 16:19:03 +0000 (17:19 +0100)]
ctdb: add an option --print-datasize to only print datasize instead of dumping data in db dumps

Used in catdb, cattdb and dumpdbbackup.

12 years agodoc: commit generated ctdb.1 manpages after xml change
Michael Adam [Tue, 29 Nov 2011 12:32:25 +0000 (13:32 +0100)]
doc: commit generated ctdb.1 manpages after xml change

12 years agodoc: document the --print-emptyrecords switch in the "ctdb" manpage.
Michael Adam [Tue, 29 Nov 2011 12:28:35 +0000 (13:28 +0100)]
doc: document the --print-emptyrecords switch in the "ctdb" manpage.

12 years agoctdb: add an option --print-emptyrecords to enable printing of empty records in dumpi...
Michael Adam [Mon, 28 Nov 2011 16:11:16 +0000 (17:11 +0100)]
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.

12 years agoclient: add version ctdb_traverse_ext() of ctdb_traverse() that can list empty records.
Michael Adam [Wed, 22 Dec 2010 11:45:06 +0000 (12:45 +0100)]
client: add version ctdb_traverse_ext() of ctdb_traverse() that can list empty records.

12 years agotraverse: add a flag to enable transferring empty records in cluster wide traverse
Michael Adam [Sun, 27 Nov 2011 22:16:33 +0000 (23:16 +0100)]
traverse: add a flag to enable transferring empty records in cluster wide traverse

This will be useful for also printing information about empty/deleted
records in "ctdb catdb", e.g. for debugging vacuuming issues.

12 years agorecoverd: try to become the recovery master if we have the capability, but the curren...
Stefan Metzmacher [Tue, 21 Jun 2011 13:49:30 +0000 (15:49 +0200)]
recoverd: try to become the recovery master if we have the capability, but the current master doesn't

metze
(cherry picked from commit 6ba8af28f8a8f79db65120a97d7157dcc5c7e083)

Signed-off-by: Michael Adam <obnox@samba.org>
12 years agoThis breaks the build since the recovery loop is different in master
Ronnie Sahlberg [Tue, 29 Nov 2011 03:38:02 +0000 (14:38 +1100)]
This breaks the build since the recovery loop is different in master
compared to old 1.0 branches
This must have been mistakenly applied to master when you intended to push
for a different branch i guess.

Revert "recoverd: try to become the recovery master if we have the capability, but the current master doesn't"

This reverts commit a97d417aba85e901540147a4dff4794249442939.

12 years agorecoverd: try to become the recovery master if we have the capability, but the curren...
Stefan Metzmacher [Tue, 21 Jun 2011 13:49:30 +0000 (15:49 +0200)]
recoverd: try to become the recovery master if we have the capability, but the current master doesn't

metze

12 years agorecoverd: let async_getcap_callback() also update ctdb->capabilities
Stefan Metzmacher [Tue, 21 Jun 2011 13:46:34 +0000 (15:46 +0200)]
recoverd: let async_getcap_callback() also update ctdb->capabilities

metze

12 years agovacuum: update (C) from vacuum rewrite
Michael Adam [Sat, 26 Nov 2011 00:06:13 +0000 (01:06 +0100)]
vacuum: update (C) from vacuum rewrite

12 years agovacuum: write a big and up-to-date explaining comment for ctdb_vacuum_db()
Michael Adam [Fri, 25 Nov 2011 12:55:20 +0000 (13:55 +0100)]
vacuum: write a big and up-to-date explaining comment for ctdb_vacuum_db()

12 years agovacuum: fix a comment typo in vacuum_traverse()
Michael Adam [Fri, 25 Nov 2011 12:54:48 +0000 (13:54 +0100)]
vacuum: fix a comment typo in vacuum_traverse()

12 years agovacuum: fix horrible indentation/whitespacing for ctdb_vacuum_event()
Michael Adam [Fri, 25 Nov 2011 12:35:05 +0000 (13:35 +0100)]
vacuum: fix horrible indentation/whitespacing for ctdb_vacuum_event()

12 years agovacuum: fix a comment typo in vacuum_traverse()
Michael Adam [Fri, 25 Nov 2011 12:34:15 +0000 (13:34 +0100)]
vacuum: fix a comment typo in vacuum_traverse()

12 years agovacuum: fix an abundance of indentation white spaces in ctdb_vacuum_db()
Michael Adam [Fri, 25 Nov 2011 12:25:27 +0000 (13:25 +0100)]
vacuum: fix an abundance of indentation white spaces in ctdb_vacuum_db()

12 years agovacuum: rename "size" to "freelist_size" for clarity
Michael Adam [Fri, 25 Nov 2011 12:23:23 +0000 (13:23 +0100)]
vacuum: rename "size" to "freelist_size" for clarity

12 years agobuild: add target libctdb.so.0 and symlink libctdb.so
Michael Adam [Fri, 2 Sep 2011 23:30:08 +0000 (01:30 +0200)]
build: add target libctdb.so.0 and symlink libctdb.so

12 years agobuild: add socket_wrapper objects to test binaries
Michael Adam [Fri, 25 Nov 2011 16:07:24 +0000 (17:07 +0100)]
build: add socket_wrapper objects to test binaries

12 years agobuild: add option --enable-socket-wrapper to build binaries with socket wrapper support
Michael Adam [Thu, 20 Oct 2011 12:17:45 +0000 (14:17 +0200)]
build: add option --enable-socket-wrapper to build binaries with socket wrapper support

12 years agoadd socket_wrapper from samba
Michael Adam [Thu, 20 Oct 2011 12:17:25 +0000 (14:17 +0200)]
add socket_wrapper from samba

12 years agolibutil: Remove obsolete signal type cast.
Andreas Schneider [Fri, 19 Feb 2010 11:44:07 +0000 (12:44 +0100)]
libutil: Remove obsolete signal type cast.

12 years agobuild: add libreplace network checks to configure
Michael Adam [Fri, 25 Nov 2011 15:29:44 +0000 (16:29 +0100)]
build: add libreplace network checks to configure

12 years agoupdate lib/replace to current upstream version (samba master)
Michael Adam [Fri, 25 Nov 2011 15:36:40 +0000 (16:36 +0100)]
update lib/replace to current upstream version (samba master)

12 years agosystem_linux: correctly cast sockaddr_in6 to sockaddr for sendto() in ctdb_sys_send_tcp()
Michael Adam [Fri, 25 Nov 2011 16:01:58 +0000 (17:01 +0100)]
system_linux: correctly cast sockaddr_in6 to sockaddr for sendto() in ctdb_sys_send_tcp()

12 years agosystem_linux: correctly cast sockaddr_in to sockaddr in ctdb_sys_send_tcp()
Michael Adam [Fri, 25 Nov 2011 15:59:51 +0000 (16:59 +0100)]
system_linux: correctly cast sockaddr_in to sockaddr in ctdb_sys_send_tcp()

12 years agologging: properly cast sockaddr_in to sockaddr for sendto() in ctdb_syslog_log()
Michael Adam [Fri, 25 Nov 2011 15:42:53 +0000 (16:42 +0100)]
logging: properly cast sockaddr_in to sockaddr for sendto() in ctdb_syslog_log()

12 years agologging: some whitespace cleanup in ctdb_syslog_log()
Michael Adam [Fri, 25 Nov 2011 15:41:59 +0000 (16:41 +0100)]
logging: some whitespace cleanup in ctdb_syslog_log()

12 years agologging: properly cast sockaddr_in to sockaddr for bind in start_syslog_daemon()
Michael Adam [Fri, 25 Nov 2011 15:40:52 +0000 (16:40 +0100)]
logging: properly cast sockaddr_in to sockaddr for bind in start_syslog_daemon()

12 years agoMerge remote branch 'martins/eventscripts'
Ronnie Sahlberg [Fri, 18 Nov 2011 04:01:13 +0000 (15:01 +1100)]
Merge remote branch 'martins/eventscripts'

12 years agoMerge remote branch 'martins/scriptstatus'
Ronnie Sahlberg [Fri, 18 Nov 2011 03:46:45 +0000 (14:46 +1100)]
Merge remote branch 'martins/scriptstatus'

12 years agoMerge remote branch 'martins/ctdb_control_oom'
Ronnie Sahlberg [Fri, 18 Nov 2011 03:45:56 +0000 (14:45 +1100)]
Merge remote branch 'martins/ctdb_control_oom'

12 years agoMerge remote branch 'martins/hashinclude'
Ronnie Sahlberg [Fri, 18 Nov 2011 03:42:10 +0000 (14:42 +1100)]
Merge remote branch 'martins/hashinclude'

12 years agoMerge remote branch 'martins/warnings'
Ronnie Sahlberg [Fri, 18 Nov 2011 03:36:45 +0000 (14:36 +1100)]
Merge remote branch 'martins/warnings'

12 years agoEventscripts: Add special -ECANCELED status for monitor events that are cancelled
Ronnie Sahlberg [Thu, 17 Nov 2011 02:34:29 +0000 (13:34 +1100)]
Eventscripts: Add special -ECANCELED status for monitor events that are cancelled

When a monitor event is canceled by a higher priority script, make sure we return
status -ECANCELED to the callback in ctdB_monitor.c
Also treat -ECANCELED as a simple "try monitor event again" and skip modifying any HEALTHY/UNHEALTHY flags when this happens

12 years agoEventscripts - add facility to 10.interface to delete unmanaged IPs
Martin Schwenke [Thu, 17 Nov 2011 05:47:00 +0000 (16:47 +1100)]
Eventscripts - add facility to 10.interface to delete unmanaged IPs

For a number of reasons (delip failure, admin stupidity, ...) an
interface that hosts public addresses can also contain spurious,
unmanaged addresses.

Add functionality to 10.interfaces, controlled by new configuration
variable CTDB_DELETE_UNEXPECTED_IPS, to delete these addresses when
encountered as part of a monitor event.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts - remove $0 from error messages in 40.fs_use
Martin Schwenke [Fri, 14 Oct 2011 04:55:12 +0000 (15:55 +1100)]
Eventscripts - remove $0 from error messages in 40.fs_use

The script name is now prepended to output by ctdbd.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: Make 40.fs_use use less processes and arguably clearer.
Martin Schwenke [Fri, 14 Oct 2011 04:52:12 +0000 (15:52 +1100)]
Eventscripts: Make 40.fs_use use less processes and arguably clearer.

* $fs can be parsed using shell prefix and suffix removal.

* df output can be parsed with a single call to sed.

  Failure is indicated by empty output from sed, so we check for that
  as the error condition, changing the associated message
  appropriately.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoRelax an out of memory message.
Martin Schwenke [Wed, 16 Nov 2011 04:25:14 +0000 (15:25 +1100)]
Relax an out of memory message.

The call to ctdb_transport_allocate() can fail for 2 reasons:

* Unable to allocate memory.

* The transport is down, perhaps because CTDB is shutting down.

Either cause will be appropriately logged.

The current use of CTDB_NO_MEMORY_VOID() prints an "out of memory"
message regardless of what happened in ctdb_transport_allocate() and
this could be misleading.

Change this to print a more relaxed message.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoMake some ctdb_takeover.c functions static
Martin Schwenke [Fri, 11 Nov 2011 03:41:47 +0000 (14:41 +1100)]
Make some ctdb_takeover.c functions static

These were intentionally not static so they could be linked to in unit
test programs.  However, using the CCAN-style unit tests where
relevant code is just included, this is no longer necessary.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests: change ctdb_takeover_tests.c to include ctdbd code
Martin Schwenke [Fri, 11 Nov 2011 03:15:52 +0000 (14:15 +1100)]
Tests: change ctdb_takeover_tests.c to include ctdbd code

Do this instead of linking to it.  This means that, after previous
cleanups, we can fix ctdb_takeover.c to use static functions when
appropriate and simply include all the code we need to run tests.

To make this reusable in other tests, new file ctdbd_tests.c does all
of the relevant including.  ctdb_takeover_tests.c just includes that
file.

Test objects built in this way can depend on new Makefile macro
$(CTDB_TEST_C), which contains ctdbd_tests.c and everything it
includes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoRename ctdb_control_get_stat_history() local variable to avoid shadowing.
Martin Schwenke [Fri, 11 Nov 2011 03:06:21 +0000 (14:06 +1100)]
Rename ctdb_control_get_stat_history() local variable to avoid shadowing.

Local variable stat generates a warning because it shadows a global
declatation, presumably stat(2).  Rename it to s.

This is in the context of wanting to run CCAN-style tests where most
of the ctdbd code is just included in the test program.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoRename ctdb_ctrl_getscriptstatus() parameter to avoid shadowing a global
Martin Schwenke [Fri, 11 Nov 2011 03:03:59 +0000 (14:03 +1100)]
Rename ctdb_ctrl_getscriptstatus() parameter to avoid shadowing a global

Rename parameter script_status to scripts to avoid shadowing a global
function with the same name in eventscript.c.

This is in the context of wanting to run CCAN-style tests where most
of the ctdbd code is just included in the test program.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoRename ctdb_control_destructor() to ctdb_client_control_destructor()
Martin Schwenke [Fri, 11 Nov 2011 03:02:09 +0000 (14:02 +1100)]
Rename ctdb_control_destructor() to ctdb_client_control_destructor()

This avoids a name clash with a slightly different function in
ctdb_control.c.

This is in the context of wanting to run CCAN-style tests where most
of the ctdbd code is just included in the test program.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoMove some common functions to common/ctdb_ltdb.c
Martin Schwenke [Fri, 11 Nov 2011 02:56:46 +0000 (13:56 +1100)]
Move some common functions to common/ctdb_ltdb.c

Move identical copies of ctdb_null_func(), ctdb_fetch_func(),
ctdb_fetch_with_header_func() from ctdb_client.c and
ctdb_ltdb_server.c to somewhere common.

This is in the context of wanting to run CCAN-style tests where most
of the ctdbd code is just included in the test program.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoAdded some #ifndefs to stop files being included multiple times.
Martin Schwenke [Fri, 11 Nov 2011 01:41:24 +0000 (12:41 +1100)]
Added some #ifndefs to stop files being included multiple times.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoClean up warnings: rpcgen output contains unused variable.
Martin Schwenke [Thu, 10 Nov 2011 04:12:25 +0000 (15:12 +1100)]
Clean up warnings: rpcgen output contains unused variable.

Grep it out in the Makefile.  This should be very obvious if the
output changes and the grep breaks something.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoFix lib/replace
Martin Schwenke [Thu, 10 Nov 2011 04:07:55 +0000 (15:07 +1100)]
Fix lib/replace

Warnings are generated when compiling strptime.c.  Why is it being
compiled on Linux?  strptime(3) has been in glibc for 15 years!

It turns out that some of the test fragments were being looked for in
lib/replace/test/ and some in lib/replace/tests/.  In addition,
test*/strptime.c was missing.

Move the tests to lib/replace/test/ for consistency with upstream
(Samba) and copy in test/strptime.c from Samba.  Tweak repdir.m4 to
handle the directory rename.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoClean up warnings: popt sure does some strange things
Martin Schwenke [Thu, 10 Nov 2011 03:16:42 +0000 (14:16 +1100)]
Clean up warnings: popt sure does some strange things

popt generates 4 compiler warnings with GCC 4.6.  There are 2
different types:

* 3 instances of:

    warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

  One occurs in the _free() hack that is used to try and avoid a
  compiler warning.  I guess GCC got smarter?  ;-)

  The other is where an array of constant strings is passed to
  execvp(2), which arguably has the wrong type, since it has no need
  to modify the strings.

  Both of these can be worked around by casting to intptr_t before
  casting to the desired argument type.

  In poptReadConfigFile() the variable file is declared to be a
  constant string.  However, it is then passed to read(2) straight
  away and an attempt is made to cast away the "const".  However, to
  protect the value the of file is assigned to (const char *) chptr
  before it is passed to any other functions, so this protects the
  value anyway.  I'm not sure exactly what the thinking was
  here... but there seems to be no use having file be constant.

* 1 instance of:

    warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]

  for the result of an execvp(2) call.  Recast the return type to
  void.  However, due to some #if-fu in the function, that can make rc
  unused in this function.  So we also need to wrap the declaration of
  rc in some corresponding #if-fu to make it disappear if not used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoFix ctdb scriptstatus -n all
Martin Schwenke [Thu, 10 Nov 2011 04:41:03 +0000 (15:41 +1100)]
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>
12 years agoClean up warnings: add -Wno-format-zero-length to CFLAGS
Martin Schwenke [Thu, 10 Nov 2011 03:10:21 +0000 (14:10 +1100)]
Clean up warnings: add -Wno-format-zero-length to CFLAGS

There's an empty string passed to ctdb_event_script_callback() for
eventscript option arguments in ctdb_start_daemon() and this generates
a warning.

This type of warning seems pointless so let's switch it off.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoClean up warnings: -Wunused-but-set-variable in tevent_signal.c
Martin Schwenke [Thu, 10 Nov 2011 03:08:59 +0000 (14:08 +1100)]
Clean up warnings: -Wunused-but-set-variable in tevent_signal.c

Have sent this upstream to Samba.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoClean up warnings: remove unused function dump_packet()
Martin Schwenke [Wed, 9 Nov 2011 04:47:30 +0000 (15:47 +1100)]
Clean up warnings: remove unused function dump_packet()

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoClean up warnings: remove unused variable alen from scsi_io
Martin Schwenke [Wed, 9 Nov 2011 04:37:24 +0000 (15:37 +1100)]
Clean up warnings: remove unused variable alen from scsi_io

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