obnox/samba/samba-obnox.git
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'

(This used to be ctdb commit 8959d15804bb5901356d7beec1ecddb1cabbca52)

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'

(This used to be ctdb commit c4ff223096e7dae2e67692825a78c520d30211e0)

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'

(This used to be ctdb commit 6a57c64c58c77fd9dc7c7a1583d402c3ce0313b1)

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'

(This used to be ctdb commit 0f6991010cf4e1f0dd9f39243bcc8fff5dcc0524)

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'

(This used to be ctdb commit 58a1e25e1c563ebede57eea2e8f4e2c5785d01bf)

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

(This used to be ctdb commit a15ec57c26d1bc82af85f74eebae0bd8abde3233)

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>
(This used to be ctdb commit 88f88d86b0d08240f749fb721b8c401c2eeb1099)

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>
(This used to be ctdb commit bfa0fe70db195413a6d7a98f46f7a1270aba678c)

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>
(This used to be ctdb commit c5ef0d1440f1d952784cc67946c414d149722d01)

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>
(This used to be ctdb commit 8c4a93e77c7d7d0cec6b2afd42c22475f1b5ccdc)

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>
(This used to be ctdb commit d0e9e8554614bd49ffb9ec3509feaa0e80d0f65d)

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>
(This used to be ctdb commit 41869d42194b74db43a176a068e96e411007e5f2)

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>
(This used to be ctdb commit d17efacb3aa6fac61d89f4c88ca17579341c335f)

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>
(This used to be ctdb commit 668358057c1e6b9bbad7209212f9135c5e6241a0)

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>
(This used to be ctdb commit 82f6108bfbc7e48ca88650297c6a1c6ede0e1c9c)

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>
(This used to be ctdb commit 126cb0d369b2b1aed63801dc4ba0554399e8b7e4)

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>
(This used to be ctdb commit fdca12c25e6fce6206135b994dedf44265e4eb09)

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>
(This used to be ctdb commit 79638bdd884caaf899c1b41984a5f0cf638207b5)

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>
(This used to be ctdb commit aaf1ddfc83cf2ede29288baf04a1aa1c69a5cab5)

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>
(This used to be ctdb commit ac9236e64bd0b61740cc787819a1222bc6a67d4a)

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>
(This used to be ctdb commit 3084220e2aac3664511969f10cad206e505150a0)

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>
(This used to be ctdb commit 23c164926c5ec4da6d90a5bdcbf2d0100729b451)

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>
(This used to be ctdb commit 080edee3d053d770466ebcc976eb1135c80feef8)

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>
(This used to be ctdb commit c22e201be15e7d5b788c2f5f7916b553e0faaa2a)

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>
(This used to be ctdb commit 79d31660c7e612f0290fd085203856ad9e70b26f)

12 years agoClean up warnings: remove set but unused variable from rb_test
Martin Schwenke [Wed, 9 Nov 2011 04:36:09 +0000 (15:36 +1100)]
Clean up warnings: remove set but unused variable from rb_test

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit d0244fec8d0dd2abd31a8677e2c2b254b030c47b)

12 years agoClean up warnings: log some unchecked return codes from function calls
Martin Schwenke [Wed, 9 Nov 2011 04:20:07 +0000 (15:20 +1100)]
Clean up warnings: log some unchecked return codes from function calls

In a few places functions are called, the return code is assigned into
a variable but it is not checked.  This generates a compiler warning
like this:

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

Instead we remove the warning by checking the return code variable and
log a warning at DEBUG level if the return code indicates an error.
The justification is that there may have been a future intent to check
the return code but it hasn't been important enough to follow-up.  If
it matters, it will be logged for easy debugging.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 1932466c76de2b184c2a257120768ab8c9d6c12a)

12 years agoFix typo in ctdb_ltdb_store_server()
Martin Schwenke [Wed, 9 Nov 2011 03:55:07 +0000 (14:55 +1100)]
Fix typo in ctdb_ltdb_store_server()

The if statement uses ret but means to use ret2.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit f40101a615f8b9826a484e4697bfea6ee2b9ba88)

12 years agoClean up warnings: remove changed_flags in monitor_helper
Martin Schwenke [Wed, 9 Nov 2011 03:45:01 +0000 (14:45 +1100)]
Clean up warnings: remove changed_flags in monitor_helper

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 3e4fa518f02db75e4e4a7f326a71df226913f8a8)

12 years agoClean up warnings: ‘tevent_loop_allow_nesting’ is deprecated
Martin Schwenke [Wed, 9 Nov 2011 03:41:17 +0000 (14:41 +1100)]
Clean up warnings: ‘tevent_loop_allow_nesting’ is deprecated

CTDB wants to use these functions but Samba's tevent wants to mark
them deprecated.  This adds a #define to shut up the warnings and sets
it in CFLAGS.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 788cdbddbc902a5b076d23473450065b551d274d)

12 years agoSRVID ranges: Change the ranges for SRVIDs to allow 8 bit prefixes
Ronnie Sahlberg [Tue, 8 Nov 2011 21:12:44 +0000 (08:12 +1100)]
SRVID ranges: Change the ranges for SRVIDs to allow 8 bit prefixes

Update the ranges used for SRVID allocation to allow 8 bit prefixes and thus
56 user-defined bits.
Define the defacto-use of the 0x00 prefix as a SRVID used to register a process id
Upgrade SAMBA/iSCSI/NFS/TEST from a 32 bit prefix each ot a 8 bit prefix each
for private use.

(This used to be ctdb commit 5de9ec2bdf8067406165bc470becdca87f458ae9)

12 years agoNagios plugin for CTDB
Mathieu Parent [Sat, 5 Nov 2011 15:39:55 +0000 (16:39 +0100)]
Nagios plugin for CTDB

This plugin is GPL2 or greater as generally found in Nagios.
(this is obviously compatible with GPL3 or greater).

(This used to be ctdb commit df1ac1cfd65f32743ca2588edfdad46ce5a4f03f)

12 years agoconfig can be in /etc/default/ instead of /etc/sysconfig/ (ctdb_gnostics part)
Mathieu Parent [Sat, 15 Oct 2011 17:50:12 +0000 (19:50 +0200)]
config can be in /etc/default/ instead of /etc/sysconfig/ (ctdb_gnostics part)

(This used to be ctdb commit b6a9dacefd8f031677702f0fbf6b321beb4c4d54)

12 years agoconfig can be in /etc/default/ instead of /etc/sysconfig/
Mathieu Parent [Sat, 15 Oct 2011 17:42:45 +0000 (19:42 +0200)]
config can be in /etc/default/ instead of /etc/sysconfig/

... on Debian system and derivated.

(ctdb_diagnostics still hardcodes /etc/sysconfig/)

(This used to be ctdb commit 1341329f6125d491b82c873f793af819e677f714)

12 years agoconfig/functions: CTDB_VARDIR is /var/lib/ctdb on Debian-like systems
Mathieu Parent [Thu, 13 Oct 2011 18:26:05 +0000 (20:26 +0200)]
config/functions: CTDB_VARDIR is /var/lib/ctdb on Debian-like systems

(This used to be ctdb commit 56160eccb62178f645b017b1257677a1e854b2bc)

12 years agoNew version 1.12
Ronnie Sahlberg [Tue, 8 Nov 2011 05:20:09 +0000 (16:20 +1100)]
New version 1.12

* Tue Nov 8 2011 : Version 1.12
 - Add new tunable : AllowClientDBAttach that can be used to stop
   client db access during maintenance operations
 - Updated logging for interfaces that are missing or dont exist but are
   configured to be used.
 - Add timeout argument to ctdb_cmdline_client
 - PDMA support
 - Initial support for 'readonly' delegations for ctdb databases
   This will when finished greatly improve performance for contended hot
   records that are used for just read-access.
 - New 'ctdb cattdb' command
 - Massive updates to tests and eventscripts
 - LCP2 ip allocation algorithm
 - Record Fetch collapse. Collapse multiple fetch-lock requests from cients
   to a single network fetch and defer other concurrent requests until the
   initial fetch completes, and then service the deferred calls locally.
   This will greatly improve performance for contended hot records
   where clients request write-locks.

(This used to be ctdb commit bda24b7f313289404b68ce8b9177fbd6b6a05dd7)

12 years agoRecord Fetch Collapse: Collapse multiple fetch request into one single request.
Ronnie Sahlberg [Mon, 7 Nov 2011 19:55:46 +0000 (06:55 +1100)]
Record Fetch Collapse: Collapse multiple fetch request into one single request.

When multiple clients fetch the same record concurrently, send only one single
fetch across the network and deferr all other fetches locally.
This improves performance for hot records and reduces cpu load on ctdb.

(This used to be ctdb commit 82d6946ad8b3348e8b9d3d971f24925ade02d1be)

12 years agoMerge remote branch 'martins/lcp2fix'
Ronnie Sahlberg [Tue, 8 Nov 2011 03:06:30 +0000 (14:06 +1100)]
Merge remote branch 'martins/lcp2fix'

(This used to be ctdb commit 7c02d242af552aa732f5c70ea4eeefbc8a8542e2)

12 years agoMerge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master
Ronnie Sahlberg [Tue, 8 Nov 2011 03:01:22 +0000 (14:01 +1100)]
Merge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master

(This used to be ctdb commit d772743e9a4d4d40eb95cd8d5178708e77057b79)

12 years agoRB_TREE: Add mechanism to abort a traverse
Ronnie Sahlberg [Wed, 2 Nov 2011 02:33:28 +0000 (13:33 +1100)]
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)

12 years agoFix some typos
Volker Lendecke [Tue, 1 Nov 2011 13:34:35 +0000 (14:34 +0100)]
Fix some typos

Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit f24e943eb7d8b86ce6b32ae37e3884ec4af0f7df)

12 years agoTests - IP allocation - add some extra output due to recent fix
Martin Schwenke [Tue, 1 Nov 2011 09:56:50 +0000 (20:56 +1100)]
Tests - IP allocation - add some extra output due to recent fix

A recent fix made the LCP2 algorithm try harder find a candidate
source node.  The debug output shows extra output because it is trying
harder so we accommodate that.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 9a6f918bf6db79c1f8c53c0df23d47b73c117ea2)

12 years agoLCP IP allocation algorithm - try harder to find a candidate source node
Martin Schwenke [Tue, 1 Nov 2011 09:52:57 +0000 (20:52 +1100)]
LCP IP allocation algorithm - try harder to find a candidate source node

There's a bug in LCP2.  Selecting the node with the highest imbalance
doesn't always work.  Some nodes can have a high imbalance metric
because they have a lot of IPs.  However, these nodes can be part of a
group that is perfectly balanced.  Nodes in another group with less
IPs might actually be imbalanced.

Instead of just trying the source node with the highest imbalance this
tries them in descending order of imbalance until it finds one where
an IP can be moved to another node.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 574091d5aced5e87aefad52f8bc47aa75c25fbf6)

12 years agoTests - IP allocation - new test that shows current LCP2 failure
Martin Schwenke [Tue, 1 Nov 2011 08:59:29 +0000 (19:59 +1100)]
Tests - IP allocation - new test that shows current LCP2 failure

There are 4 IPs across 2 nodes and 2 addresses across 2 other nodes.
If one of the latter nodes is unhealthy and then becomes healthy
again, an IP isn't failed back.  This is because the nodes in the 1st
group are >= unbalanced then the nodes in the 2nd group.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 1d26e7cff6292fcbf63efc4628ffbb63b6f1f73c)

12 years agoTests - Allow some tests in ctdb_takover_tests to specify allowed nodes
Martin Schwenke [Tue, 1 Nov 2011 08:54:28 +0000 (19:54 +1100)]
Tests - Allow some tests in ctdb_takover_tests to specify allowed nodes

This mainly applies to ctdb_takeover_run_core when you might want to
specify that some IPs can only be hosted by some nodes.

Syntax on each line is now:

IP current_pnn  allowed_pnns

where allowed_pnns is a comma-separated list.

allowed_pnns is optional.  If not specified then address can be
assigned to all nodes that aren't included in an allowed_pnns list.
Just think of it as all PNNs and that the behaviour is undefined when
you only specify allowed_pnns for some IPs.  ;-)

current_pnn is optional and defaults to -1.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit ed83604da82ebe566d6eb330ab7119e861e853c8)

12 years agoTests - IP allocation tests - must export CTDB_LCP2.
Martin Schwenke [Tue, 1 Nov 2011 08:54:01 +0000 (19:54 +1100)]
Tests - IP allocation tests - must export CTDB_LCP2.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit a97f19d1281eaf9874e64995a43524aeed315515)

12 years agoLCP IP allocation algorithm - new function lcp2_failback_candidate()
Martin Schwenke [Tue, 1 Nov 2011 08:49:38 +0000 (19:49 +1100)]
LCP IP allocation algorithm - new function lcp2_failback_candidate()

There's a bug in LCP2.  Selecting the node with the highest imbalance
doesn't always work.  Some nodes can have a high imbalance metric
because they have a lot of IPs.  However, these nodes can be part of a
group that is perfectly balanced.  Nodes in another group with less
IPs might actually be imbalanced.

Factor out the code from lcp2_failback() that actually takes a node
and decides which address should be moved to which node.

This is the first step in fixing the above bug.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 75718c5768b5bb5c0bcd7dd90e0327c6ed22a63d)

12 years agoMerge remote branch 'ddiss/master_pmda_namespace'
Ronnie Sahlberg [Mon, 31 Oct 2011 09:25:16 +0000 (20:25 +1100)]
Merge remote branch 'ddiss/master_pmda_namespace'

(This used to be ctdb commit 6dbbc86f36a1fd07d90ca947a35ad7b1f8554636)

12 years agoMerge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master
Ronnie Sahlberg [Fri, 28 Oct 2011 05:04:55 +0000 (16:04 +1100)]
Merge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master

(This used to be ctdb commit bdcaf531e07ad5a08841aab2f396849c554a0fa6)

12 years agoTests: convert test tool for fetching a readonly lock to libctdb
Ronnie Sahlberg [Fri, 28 Oct 2011 04:50:44 +0000 (15:50 +1100)]
Tests: convert test tool for fetching a readonly lock to libctdb

(This used to be ctdb commit 18b6969dd1760521f839e5a928f1c7e9b3c34d4e)

12 years agoMerge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master
Ronnie Sahlberg [Fri, 28 Oct 2011 02:51:46 +0000 (13:51 +1100)]
Merge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master

(This used to be ctdb commit 996aa01af9b402d2cd07c6942fdcc5ffc111ca85)

12 years agolibctdb: dont allow ctdb_writerecord() for readonly records
Ronnie Sahlberg [Fri, 28 Oct 2011 02:38:32 +0000 (13:38 +1100)]
libctdb: dont allow ctdb_writerecord() for readonly records

(This used to be ctdb commit c930a44731d24b3bb51851864c7cdd0061483c0b)

12 years agoMerge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master
Ronnie Sahlberg [Fri, 28 Oct 2011 01:56:24 +0000 (12:56 +1100)]
Merge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master

(This used to be ctdb commit 0474a9244c6721f85955efcbdd630c0e5990e76c)

12 years agoReadOnly: If record does not exist, upgrade to write-lock
Ronnie Sahlberg [Fri, 28 Oct 2011 01:41:27 +0000 (12:41 +1100)]
ReadOnly: If record does not exist, upgrade to write-lock

If we attempt a readonly lock request for a record that do not exist (yet)
in the local TDB, then upgrade the request to ask for a write lock and force a
request for migrate the record onto the local node.
This allows the "only request record on second local request for known contended records"
heuristics to try to avoid creating readonly delegations unless we have good reason to
assume it is a contended record.

(This used to be ctdb commit e6003e52617385f731ccf93b13d21d5403534a78)

12 years agoMerge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master
Ronnie Sahlberg [Fri, 28 Oct 2011 01:10:38 +0000 (12:10 +1100)]
Merge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master

(This used to be ctdb commit 0452f212f2ddc1089dce83339bad0d73763f238f)

12 years agoReadOnly: add readonly record lock requests to libctdb
Ronnie Sahlberg [Fri, 28 Oct 2011 00:55:46 +0000 (11:55 +1100)]
ReadOnly: add readonly record lock requests to libctdb

Initial readonly record support in libctdb.
New records are not yet created by the library but extising records will be delegated as readonly records.
This needs a bit more tests before we can drop the "old style" implementation of client
code in client/ctdb_client.c

(This used to be ctdb commit fb50a45a21ff56480d76acd1c33c13c323cbf5e2)

12 years agoReadOnly: fix bug writing incorrect amount of data in delegated record
Ronnie Sahlberg [Fri, 28 Oct 2011 00:44:19 +0000 (11:44 +1100)]
ReadOnly: fix bug writing incorrect amount of data in delegated record

Fix bug when ctdbd updates the local copy of a delegated record to write the correct
amount of data to the record.

(This used to be ctdb commit 8814d8bc159a5e368afaa236ac7d865165db04b2)

12 years agoMerge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master
Ronnie Sahlberg [Mon, 24 Oct 2011 02:30:28 +0000 (13:30 +1100)]
Merge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master

(This used to be ctdb commit 0a2ea7e1a1e034a9a17debff763084a0936b0515)

12 years agoReadOnly DOCS: update the docs for readonly delegations to remove the passage that...
Ronnie Sahlberg [Mon, 24 Oct 2011 02:19:30 +0000 (13:19 +1100)]
ReadOnly DOCS: update the docs for readonly delegations to remove the passage that records are written/updated by the client

(This used to be ctdb commit b44ded0e0771c87321b568588c08195222a026c3)

12 years agoReadOnly: Dont update the record header from the calling client. While it is convenie...
Ronnie Sahlberg [Mon, 24 Oct 2011 02:14:26 +0000 (13:14 +1100)]
ReadOnly: Dont update the record header from the calling client. While it is convenient since it avoids having to create a child process from the main dameon for writing the updated record it makes the cleitn more complex.

Remove the code in the example client code that writes the record to the local tdb.
Add code to the local ctdbd processing of replies to check if this reply contain a ro delegation and if so, spawn a child process to lock the tdb and then write the data.

(This used to be ctdb commit bf1d429227dc4f5818263cc39401d0a22663cdba)

12 years agoRemove debug message
Ronnie Sahlberg [Mon, 24 Oct 2011 01:21:55 +0000 (12:21 +1100)]
Remove debug message

(This used to be ctdb commit db0fdc2281c4742113c92d697371c37815db35a0)

12 years agoMerge remote branch 'martins/tests'
Ronnie Sahlberg [Tue, 18 Oct 2011 00:54:55 +0000 (11:54 +1100)]
Merge remote branch 'martins/tests'

(This used to be ctdb commit 99de5bceb788ba56ebc052c05d29a834ba2496fa)

12 years agoonnode: unset EXTRA_SSH_OPTS when using fakessh
Martin Schwenke [Fri, 7 Oct 2011 03:59:46 +0000 (14:59 +1100)]
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)

12 years agoWeb - add me as a developer. :-)
Martin Schwenke [Sun, 25 Sep 2011 04:48:25 +0000 (14:48 +1000)]
Web - add me as a developer.  :-)

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit c774e17c78f181833ca688aa48b42e7b90c822d8)

12 years agoMerge branch 'master' of ssh://git.samba.org/data/git/ctdb
Ronnie Sahlberg [Mon, 17 Oct 2011 04:08:39 +0000 (15:08 +1100)]
Merge branch 'master' of ssh://git.samba.org/data/git/ctdb

(This used to be ctdb commit dd9f82dbe2346c7143b0229e3611c402ee8c4025)

12 years agoMake ctdb_diagnostics more resilient to uncontactable nodes.
Martin Schwenke [Fri, 7 Oct 2011 04:00:42 +0000 (15:00 +1100)]
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)

12 years agodoc: update compiled manpages of ctdb.1 after change to xml
Michael Adam [Wed, 12 Oct 2011 20:36:38 +0000 (22:36 +0200)]
doc: update compiled manpages of ctdb.1 after change to xml

(This used to be ctdb commit 1198df0fd2c90cbca86d0499b43562fac4f25731)

12 years agoltdbtool: ignore empty (deleted) records per default.
Gregor Beck [Tue, 27 Sep 2011 09:41:29 +0000 (11:41 +0200)]
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)

12 years agoMerge branches 'master' and 'master' of 10.1.1.27:/shared/ctdb/ctdb-master
Ronnie Sahlberg [Wed, 12 Oct 2011 09:11:28 +0000 (20:11 +1100)]
Merge branches 'master' and 'master' of 10.1.1.27:/shared/ctdb/ctdb-master

(This used to be ctdb commit 137299fadd0537612701c5902517857028236ed7)

12 years agoFix bashism in 40.fs_use
Mathieu Parent [Wed, 21 Sep 2011 19:49:34 +0000 (21:49 +0200)]
Fix bashism in 40.fs_use

Also, add -P to df, to avoid multiline on Linux when device name is long (this is the case with LVM)

(This used to be ctdb commit f4d5a5810f1a840a41c3541a3b822fce44d41e9a)

12 years agoTypo deamon -> daemon
Mathieu Parent [Mon, 25 Jul 2011 22:08:59 +0000 (00:08 +0200)]
Typo deamon -> daemon

Thanks to lintian

(This used to be ctdb commit dd9e508c947613cc7a5046a35c80fbeced408803)

12 years agoapache's service name is not always httpd
Mathieu Parent [Mon, 25 Jul 2011 21:35:49 +0000 (23:35 +0200)]
apache's service name is not always httpd

Solution 2 of <https://bugzilla.samba.org/show_bug.cgi?id=8317>

(This used to be ctdb commit 8b9ac5cd8d867ff4866ac464c570d9293d03a91e)

12 years agoLess verbosity when there is no public addresses file
Mathieu Parent [Sat, 26 Mar 2011 20:32:34 +0000 (21:32 +0100)]
Less verbosity when there is no public addresses file

This partialy reverts 81eff51, but still avoid spam.

(This used to be ctdb commit e646142f4d28b5401235cd5edee325f7a29f8193)

12 years agoFix broken readdir
Mathieu Parent [Wed, 23 Mar 2011 21:20:15 +0000 (22:20 +0100)]
Fix broken readdir

Submited by Lorenzo De Liso on <http://bugs.debian.org/603155>
(originaly named 99-fix-broken-readdir-test.diff). Also reported as
<https://bugzilla.samba.org/show_bug.cgi?id=7032>.

(This used to be ctdb commit 29474420606e802c83b53ef5f8e372c8eeac83c1)

12 years agoTests - simple integration - do a "ctdb sync" after restarting the cluster
Martin Schwenke [Fri, 2 Sep 2011 03:20:50 +0000 (13:20 +1000)]
Tests - simple integration - do a "ctdb sync" after restarting the cluster

There looks to be a minor race where IPs haven't yet been reallocated
but the cluster is healthy.  This should fix it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 2d6a800a789ca59fdab92422f98a4e05ba55f34c)

12 years agoTests - IP allocation - initial unit tests
Martin Schwenke [Thu, 15 Sep 2011 07:09:36 +0000 (17:09 +1000)]
Tests - IP allocation - initial unit tests

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 3922225ddff90281189ebdab77620b560d233e04)

12 years agoTests - IP allocation - allow more interesting node states to be specified
Martin Schwenke [Thu, 15 Sep 2011 07:08:18 +0000 (17:08 +1000)]
Tests - IP allocation - allow more interesting node states to be specified

Node states on the command line are now comma-separated hex numbers,
so all flag states can be expressed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 1f1534435b9d5f464604e28a8cce2cd0a779ef68)

12 years agoOne of the entry points to release an ip reset the pnn field before invoking the...
Ronnie Sahlberg [Thu, 22 Sep 2011 05:13:26 +0000 (15:13 +1000)]
One of the entry points to release an ip reset the pnn field before invoking the eventscript.
this triggered a check for "only run the eventscript if we host the address" to trigger and shortcir=cuit calling the eventscript.

An effect of this would be that 'ctdb delip' would remove the ip from ctdb, but fail to delete it from the interface.

S1028798

(This used to be ctdb commit b82524f240bf21769dd7624ca6026763d38b9396)

12 years agoChange the 'This Node' column of the machinereadable output for 'ctdb status -Y'...
Ronnie Sahlberg [Wed, 21 Sep 2011 05:41:28 +0000 (15:41 +1000)]
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)

12 years agowhen checking that the interfaces exist in ctdb_add_public_address()
Ronnie Sahlberg [Wed, 21 Sep 2011 01:42:19 +0000 (11:42 +1000)]
when checking that the interfaces exist in ctdb_add_public_address()
cant talloc off vnn since it is not yet initialized and might not always be NULL

(This used to be ctdb commit 3d37be3e2bfb61ede824028aeebaa18ba304faae)

12 years agopmda: Use upstream assigned PCP domain id
David Disseldorp [Wed, 14 Sep 2011 10:54:04 +0000 (12:54 +0200)]
pmda: Use upstream assigned PCP domain id

Also use saner PMIDs in the pmns file.

(This used to be ctdb commit dcf150f8165316fefd53f9eecb1437195e631da6)

12 years agoReadOnly: revokechild_active is a list, not a context.
Ronnie Sahlberg [Tue, 13 Sep 2011 08:47:18 +0000 (18:47 +1000)]
ReadOnly: revokechild_active is a list, not a context.

Dont reset the pointer to NULL after deleting the first entry, loop deleting one entry
at a time until they are all gone or we will leak some memory and possibly a process.

(This used to be ctdb commit 8a86ac72088ad9f64ca83218c704f84c9abe00b6)

12 years agoDocument 'cattdb' more clearly that it dumps the content of the local TDB and not...
Ronnie Sahlberg [Tue, 13 Sep 2011 08:44:13 +0000 (18:44 +1000)]
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)

12 years agofix some compiler warnings for the test tools
Ronnie Sahlberg [Tue, 13 Sep 2011 08:41:34 +0000 (18:41 +1000)]
fix some compiler warnings for the test tools

(This used to be ctdb commit dbfd5abafbe66c20c413a4335b2cdbd9cc24052a)

12 years agoReadOnly: Rename the function ctdb_ltdb_fetch_readonly() to ctdb_ltdb_fetch_with_head...
Ronnie Sahlberg [Tue, 13 Sep 2011 08:38:20 +0000 (18:38 +1000)]
ReadOnly: Rename the function ctdb_ltdb_fetch_readonly() to ctdb_ltdb_fetch_with_header() since this is what it actually does.

(This used to be ctdb commit 94a5ce4e08e7891f07dbfe4c822ca4be5ab10965)

12 years agoFix a typo in a message in ctdb backupdb.
Michael Adam [Mon, 12 Sep 2011 13:04:46 +0000 (15:04 +0200)]
Fix a typo in a message in ctdb backupdb.

(This used to be ctdb commit f6a47197dbb64cc7705fc564fa8dc78e958226c4)

12 years agoFix additional breakage from the merge for change in signature for ctdb_cmdline_clien...
Ronnie Sahlberg [Sun, 11 Sep 2011 23:44:06 +0000 (09:44 +1000)]
Fix additional breakage from the merge for change in signature for ctdb_cmdline_client() and ctdb_attach()

(This used to be ctdb commit 14656eaa01a8951693fa146b3d35258f7daaafd5)

12 years agoMerge branch 'master-readonly-records' into foo
Ronnie Sahlberg [Sun, 11 Sep 2011 23:34:34 +0000 (09:34 +1000)]
Merge branch 'master-readonly-records' into foo

Conflicts:

Makefile.in
tools/ctdb.c

(This used to be ctdb commit 0fedef0ffba4178126eee9544c5e2db52f5db893)

12 years agoDrop loglevel for a tevent message from FATAL to ERROR
Ronnie Sahlberg [Wed, 7 Sep 2011 23:28:33 +0000 (09:28 +1000)]
Drop loglevel for a tevent message from FATAL to ERROR

CQ S1028400

(This used to be ctdb commit 3ce1d3d6c8b8fd3097b8efd2c75797ed7682a562)

12 years agoMerge remote branch 'ddiss/master_pmda_and_client_timeouts'
Ronnie Sahlberg [Thu, 8 Sep 2011 01:22:53 +0000 (11:22 +1000)]
Merge remote branch 'ddiss/master_pmda_and_client_timeouts'

(This used to be ctdb commit 7bebfc7bad8f36e54003b8e25372fdaf54836e21)

12 years agopmda: handle struct latency_counter and add num_recoveries
David Disseldorp [Fri, 2 Sep 2011 15:34:19 +0000 (17:34 +0200)]
pmda: handle struct latency_counter and add num_recoveries

Rebase the CTDB PMDA from 1.0.114 to master:
- Add tevent and ctdb_protocol includes
- Handle latency metrics now stored under struct latency_counter
- Add new metric for the num_recoveries counter

(This used to be ctdb commit 2165a6f5117a71f9f97f46be9708fa34c037e17c)

12 years agopmda: document in README how to add a new metric
David Disseldorp [Fri, 2 Sep 2011 15:43:13 +0000 (17:43 +0200)]
pmda: document in README how to add a new metric

(This used to be ctdb commit b63333fb81aadc451df47c0c3c038e6165f0eac2)

12 years agopmda: Use CTDB_PATH macro for default socket path
David Disseldorp [Fri, 2 Sep 2011 11:26:04 +0000 (13:26 +0200)]
pmda: Use CTDB_PATH macro for default socket path

Also includes some code cleanup changes.

(This used to be ctdb commit 80ad2979804f5bba29020ace46e114a45fa6cb66)

12 years agopmda: Pull ctdb statistics once per fetch
David Disseldorp [Mon, 8 Aug 2011 09:15:06 +0000 (11:15 +0200)]
pmda: Pull ctdb statistics once per fetch

Currently ctdb statistics are pulled in the PMDA fetch callback, which
results in a CTDB_CONTROL_STATISTICS call for each metric.
Do this once per fetch instead, and have the per-metric callbacks pull
data from the last counter cache.

(This used to be ctdb commit 137b498c75c55c966999cd788f12ed9010cfed3a)

12 years agopmda: Attempt reconnects while ctdbd is unavailable
David Disseldorp [Wed, 3 Aug 2011 08:38:27 +0000 (10:38 +0200)]
pmda: Attempt reconnects while ctdbd is unavailable

Attempt to reconnect to ctdbd on fetch while it is unreachable.

We must provide our own queue callback wrapper, as ctdb_client_read_cb()
exits on transport failure.

(This used to be ctdb commit 28df6fbf1273b8d095a2bc38dca6a6c35c5c31bd)

12 years agopmda: Initial ctdb pmda check-in
David Disseldorp [Wed, 13 Jul 2011 16:11:23 +0000 (18:11 +0200)]
pmda: Initial ctdb pmda check-in

The CTDB Performance Metrics Domain Agent (PMDA) is compiled when
Performance Co-Pilot (PCP) header files are present.

The CTDB PMDA periodically requests runtime counters from ctdbd (similar
to ctdb statistics) and exports these values via PCP for capture and
charting etc.

(This used to be ctdb commit fe7f69d6fc37661c2f1caa11de4ed3a7940d0a2f)

12 years agoclient: flag local node in ctdb -Y status output
David Disseldorp [Wed, 24 Aug 2011 09:34:56 +0000 (11:34 +0200)]
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)

12 years agoclient: add timeout argument to ctdb_attach
David Disseldorp [Mon, 8 Aug 2011 14:35:56 +0000 (16:35 +0200)]
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)

12 years agoclient: add req timeout argument to ctdb_cmdline_client
David Disseldorp [Mon, 8 Aug 2011 12:09:46 +0000 (14:09 +0200)]
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)

12 years agoMerge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master
Ronnie Sahlberg [Tue, 6 Sep 2011 07:29:30 +0000 (17:29 +1000)]
Merge branch 'master' of 10.1.1.27:/shared/ctdb/ctdb-master

(This used to be ctdb commit a3e8784bb107f7acd2a95913c1e6def52ce96105)