[SCM] CTDB repository - branch master updated - ctdb-2.1-135-g0eb351f

2013-05-06 Thread Amitay Isaacs
The branch, master has been updated
   via  0eb351ff4c7ee096de7c5e0a59561067091fa32e (commit)
   via  7e792d6768d9ca420ce3713cb122e63afd594b15 (commit)
   via  d9775fcbd6e30eef8382bea68e2f9bad2309f2c1 (commit)
   via  9bc8fbee6550ed2814fb35c70d57fab21ef1b8fd (commit)
   via  5a717fd495ba5a2bfd481d69f38b68fa4576716f (commit)
   via  cc3bb42e48bbdabd19187c231846b98589b4f4f3 (commit)
   via  887733dd7be53158bfe07b30ef31b611d0f8122f (commit)
   via  77302dbfd85754e02559eccb2dd6c090db0b6b9f (commit)
   via  15b0f78cbf8d6ba481b7eba9e4fe3f4270214c72 (commit)
   via  4b4e7d8f0e8dcbab987e374d06ffaa21c06da0d3 (commit)
  from  a8ef00608e48a551a334aded206146807aeb4c5a (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 0eb351ff4c7ee096de7c5e0a59561067091fa32e
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 23 12:30:33 2013 +1000

eventscripts: NFS RPC checks no longer support knfsd

No longer used, support removed from test infrastructure.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 7e792d6768d9ca420ce3713cb122e63afd594b15
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 23 12:17:31 2013 +1000

eventscripts: 60.nfs uses nfs_check_rpc_services() to check NFS RPC services

* New directory nfs-rpc-checks.d/ replaces hardcoded rules in 60.nfs

* Installation and packaging additions to handle nfs-rpc-checks.d/

* Unit test updates, including deleting 1 test that sanity checked
  test infrastructure

* Test infrastructure changes to use nfs-rpc-checks.d/

Note that this removes support for $CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK in
60.nfs.  To get the equivalent behaviour, edit 20.nfsd.check and
remove/comment all lines.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit d9775fcbd6e30eef8382bea68e2f9bad2309f2c1
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 23 11:14:48 2013 +1000

eventscripts: NFS RPC checks allows nfsd in addition to knfsd

Want nfs_check_rpc_services() to support filenames without the 'k'.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 9bc8fbee6550ed2814fb35c70d57fab21ef1b8fd
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 23 06:42:54 2013 +1000

eventscripts: New function nfs_check_rpc_services()

This is intended to replace nfs_check_rpc_service(), which builds
configuration into eventscripts.

nfs_check_rpc_services() uses a directory of configuration checks that
can be edited by an administrator.  The files have one limit check and
a set of actions per line.  The program name is extracted from the
file name.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 5a717fd495ba5a2bfd481d69f38b68fa4576716f
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 23 06:28:27 2013 +1000

eventscripts: nfs_check_rpc_action() should be _nfs_check_rpc_action()

Signed-off-by: Martin Schwenke mar...@meltin.net

commit cc3bb42e48bbdabd19187c231846b98589b4f4f3
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 23 06:27:02 2013 +1000

eventscripts: Factor out common code from nfs_check_rpc_service()

This creates new function _nfs_check_rpc_common().

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 887733dd7be53158bfe07b30ef31b611d0f8122f
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 23 06:17:15 2013 +1000

eventscripts: Remove ganesha support from nfs_check_rpc_service()

This is unused so doesn't need to be maintained.  An attempt to use it
now will explicitly fail rather than implicitly fail via bitrot.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 77302dbfd85754e02559eccb2dd6c090db0b6b9f
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 23 06:14:43 2013 +1000

Revert Eventscript functions: add optional version to 
nfs_check_rpc_service()

This reverts commit 92f74fd589467b46c758e116e97417edfe8773d7.

This change is unused and is just complicating the function.

Conflicts:
config/functions

commit 15b0f78cbf8d6ba481b7eba9e4fe3f4270214c72
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 23 05:54:12 2013 +1000

eventscripts: Move rpc.statd existence check into nfs_check_rpc_service ()

The code in 60.nfs is going to be genericised, so make all the checks
look the same.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 4b4e7d8f0e8dcbab987e374d06ffaa21c06da0d3
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 22 15:45:13 2013 +1000

eventscripts: Factor NFS RPC check action code into nfs_check_rpc_action()

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 Makefile.in

[SCM] CTDB repository - branch master updated - ctdb-2.1-97-g05f785b

2013-05-05 Thread Amitay Isaacs
The branch, master has been updated
   via  05f785b51cfd8b22b3ae35bf034127fbc07005be (commit)
   via  0b7257642f62ebd83c05b6e2922f0dc2737f175c (commit)
  from  b5a8791268e938d7e017056e0e2bd2cbec1fa690 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 05f785b51cfd8b22b3ae35bf034127fbc07005be
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 30 17:22:23 2013 +1000

ctdbd: Avoid freeing non-monitor event callback when monitoring is disabled

When running a non-monitor event, check is made for any active monitor
events.  If there is an active monitor event, then the active monitor
event is cancelled.  This is done by freeing state-callback which is
allocated from monitor_context.

When CTDB is stopped or shutdown, monitoring is disabled by freeing
monitor_context, which frees callback and then stopped or shutdown event
is run.  This creates a new callback structure which is allocated at
the exact same memory location as the monitor callback which was freed.
So in the check for active monitor events, it frees the new callback
for non-monitor event.  Since the callback function flags successful
completion of that event, it is never marked complete and CTDB is stuck
in a loop waiting for completion.

Move the monitor cancellation to the top of the function so that this
can't happen.

Follow log snippest highlights the problem.

2013/04/30 16:54:10.673807 [21505]: Received SHUTDOWN command. Stopping 
CTDB daemon.
2013/04/30 16:54:10.673814 [21505]: Shutting down recovery daemon
2013/04/30 16:54:10.673852 [21505]: server/eventscript.c:696 in 
remove_callback 0x1c6d5c0
2013/04/30 16:54:10.673858 [21505]: Monitoring has been stopped
2013/04/30 16:54:10.673899 [21505]: server/eventscript.c:594 Sending 
SIGTERM to child pid:23847
2013/04/30 16:54:10.673913 [21505]: server/eventscript.c:629 searching for 
callback 0x1c6d5c0
2013/04/30 16:54:10.673932 [21505]: server/eventscript.c:641 running 
callback
2013/04/30 16:54:10.673939 [21505]: server/eventscript.c:866 in 
event_script_callback
2013/04/30 16:54:10.673946 [21505]: server/eventscript.c:696 in 
remove_callback 0x1c6d5c0

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

commit 0b7257642f62ebd83c05b6e2922f0dc2737f175c
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Feb 21 10:43:35 2013 +1100

recoverd: Interface reference count changes should not cause takeover runs

At the moment a naive compare of the all the interface data is done.
So, if any IPs move then the reference counts for the the relevant
interfaces change, interfaces appear to have changed and another
takeover run is initiated by each node that took/released IPs.

This change stops the spurious takeover runs by changing the interface
comparison to ignore the reference counts.

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 server/ctdb_recoverd.c |   70 ---
 server/eventscript.c   |   61 -
 2 files changed, 77 insertions(+), 54 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 2cfa9b9..c3a1852 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -2855,17 +2855,61 @@ static enum monitor_result verify_recmaster(struct 
ctdb_recoverd *rec, struct ct
return status;
 }
 
+static bool interfaces_have_changed(struct ctdb_context *ctdb,
+   struct ctdb_recoverd *rec)
+{
+   struct ctdb_control_get_ifaces *ifaces = NULL;
+   TALLOC_CTX *mem_ctx;
+   bool ret = false;
+
+   mem_ctx = talloc_new(NULL);
+
+   /* Read the interfaces from the local node */
+   if (ctdb_ctrl_get_ifaces(ctdb, CONTROL_TIMEOUT(),
+CTDB_CURRENT_NODE, mem_ctx, ifaces) != 0) {
+   DEBUG(DEBUG_ERR, (Unable to get interfaces from local node 
%u\n, ctdb-pnn));
+   /* We could return an error.  However, this will be
+* rare so we'll decide that the interfaces have
+* actually changed, just in case.
+*/
+   talloc_free(mem_ctx);
+   return true;
+   }
+
+   if (!rec-ifaces) {
+   /* We haven't been here before so things have changed */
+   ret = true;
+   } else if (rec-ifaces-num != ifaces-num) {
+   /* Number of interfaces has changed */
+   ret = true;
+   } else {
+   /* See if interface names or link states have changed */
+   int i;
+   for (i = 0

[SCM] CTDB repository - branch master updated - ctdb-2.1-101-gc2bb859

2013-05-05 Thread Amitay Isaacs
The branch, master has been updated
   via  c2bb8596a8af6406ef50e53953884df9d6246a96 (commit)
   via  978d4a0d6d8c9877b23f72e3a7b78c1245d16908 (commit)
   via  83b61f7414b1f7a3424497ac987ca0724fba9eaa (commit)
   via  27a44685f0d7a88804b61a1542bb42adc8f88cb1 (commit)
  from  05f785b51cfd8b22b3ae35bf034127fbc07005be (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit c2bb8596a8af6406ef50e53953884df9d6246a96
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Feb 21 14:28:13 2013 +1100

ctdbd: Remove the stopped event

It isn't used, superceded by ipreallocated.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 978d4a0d6d8c9877b23f72e3a7b78c1245d16908
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Feb 21 14:17:09 2013 +1100

eventscripts: Remove use of stopped event

Use ipreallocated instead.  The stopped event pre-dates the
ipreallocated event.  The only way of stopping a node is via the
ctdb tool, which explicitly causes a takeover run to occur after the
node is stopped.  The takeover run will generate an ipreallocated
event.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 83b61f7414b1f7a3424497ac987ca0724fba9eaa
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Feb 21 13:13:09 2013 +1100

recoverd: ctdb_takeover_run() uses CTDB_CONTROL_IPREALLOCATED

This means ipreallocated is now run on stopped nodes.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 27a44685f0d7a88804b61a1542bb42adc8f88cb1
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Apr 19 13:05:02 2013 +1000

ctdbd: New control CTDB_CONTROL_IPREALLOCATED

This is an alternative to using ctdb_run_eventscripts() that can be
used when in recovery.

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 config/events.d/11.natgw |2 +-
 config/events.d/91.lvs   |2 +-
 config/events.d/README   |   11 +++
 include/ctdb_private.h   |5 +++-
 include/ctdb_protocol.h  |3 +-
 server/ctdb_control.c|6 +++-
 server/ctdb_recover.c|   50 +
 server/ctdb_takeover.c   |   62 +++---
 server/eventscript.c |4 +--
 9 files changed, 78 insertions(+), 67 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw
index 12ba9ca..a6e0523 100755
--- a/config/events.d/11.natgw
+++ b/config/events.d/11.natgw
@@ -98,7 +98,7 @@ case $1 in
echo 1  /proc/sys/net/ipv4/route/flush
;;
 
-shutdown|stopped|removenatgw)
+shutdown|removenatgw)
delete_all
;;
 
diff --git a/config/events.d/91.lvs b/config/events.d/91.lvs
index c1e6d15..bdbcfa3 100755
--- a/config/events.d/91.lvs
+++ b/config/events.d/91.lvs
@@ -40,7 +40,7 @@ case $1 in
echo 1  /proc/sys/net/ipv4/route/flush
;;
 
- recovered|stopped|ipreallocated)
+ recovered|ipreallocated)
# kill off any tcp connections
ipvsadm -D -t $CTDB_LVS_PUBLIC_IP:0
ipvsadm -D -u $CTDB_LVS_PUBLIC_IP:0
diff --git a/config/events.d/README b/config/events.d/README
index 6075f39..ea9048f 100644
--- a/config/events.d/README
+++ b/config/events.d/README
@@ -146,12 +146,11 @@ recovered
service and also send out statd notifications to all registered 
clients.

-stopped
-   This event is called when a node is STOPPED and can be used to
-   perform additional cleanup that is required.
-   Note that a stopped node is considered inactive, so it will not
-   be issuing the recovered event once the cluster has recovered.
-   See 91.lvs for a use of this event.
+ipreallocated
+
+   This event is triggered after releaseip and takeip events in a
+   takeover run.  It can be used to reconfigure services, update
+   routing and many other things.
 
 Additional note for takeip, releaseip, recovered:
 
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 03e996b..e6cfa7f 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1102,6 +1102,9 @@ int32_t ctdb_control_release_ipv4(struct ctdb_context 
*ctdb,
 struct ctdb_req_control *c,
 TDB_DATA indata, 
 bool *async_reply);
+int32_t ctdb_control_ipreallocated(struct ctdb_context *ctdb, 
+struct ctdb_req_control *c,
+bool *async_reply);
 int32_t ctdb_control_start_recovery(struct ctdb_context *ctdb, 
 struct ctdb_req_control *c,
 bool *async_reply);
@@ -1412,7 +1415,7 @@ int32_t ctdb_control_get_event_script_status(struct 

[SCM] CTDB repository - annotated tag ctdb-1.2.62 created - ctdb-1.2.62

2013-04-28 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.62 has been created
at  348f09e54fa9ec189d734083b0d2360bd003 (tag)
   tagging  2cf0ceb20c87756cf2e012d67129c0205c6db9aa (commit)
  replaces  ctdb-1.2.61
 tagged by  Amitay Isaacs
on  Mon Apr 29 13:04:44 2013 +1000

- Log -
new version 1.2.62

Amitay Isaacs (3):
  ctdbd: Add --pidfile option
  ctdbd: Set num_clients statistic from ctdb-num_clients
  New version 1.2.62

Martin Schwenke (8):
  Logging: Fix breakage when freeing the log ringbuffer
  util: New functions ctdb_set_child_info() and ctdb_is_child_process()
  util: ctdb_fork() should call ctdb_set_child_info()
  ctdbd: Change some fork() calls to ctdb_fork()
  initscript: Use a PID file to implement the status option
  scripts: ctdb-crash-cleanup.sh uses initscript to see if ctdbd is running
  scripts: Crash cleanup script should pass a tag to logger
  ctdbd: Log PID file creation and removal at NOTICE level

Michael Adam (4):
  vacuum: add ctdb_local_remove_from_delete_queue()
  ctdb_ltdb_store_server: when storing a record that is not to be scheduled 
for deletion, remove it from the delete queue
  Fix a severe recovery bug that can lead to data corruption for SMB 
clients.
  ctdb_call: don't bump the rsn in ctdb_become_dmaster() any more

Ronnie Sahlberg (2):
  ReadOnly: Make sure we dont try to fast-vacuum records that are set for 
readonly delegation
  READONLY: dont schedule for fast vacuum deletion if any of the readonly 
record flags are set

---


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-95-gb5a8791

2013-04-24 Thread Amitay Isaacs
The branch, master has been updated
   via  b5a8791268e938d7e017056e0e2bd2cbec1fa690 (commit)
   via  c7eab97c7a939710b73aae2d75b404b235a998f5 (commit)
   via  f99eb2f56d8ca27110a45ae0e1c4bff40ac7a60e (commit)
   via  a62775334aa20d1d850d2df705eb70303b04ac5c (commit)
   via  61f17e53576197def46bc61fdf0cdb5282333a3e (commit)
   via  c7924ce6404bb18641b00d5fbd2fe9da9aaf7959 (commit)
   via  61264debba58355b9716ac1637fdedef5ed249c8 (commit)
   via  06de786c786f1cab4c6721adf47c2cb1e8a72adb (commit)
   via  eee23d44b6427be8ab49bbfcee3abb62f37dfcc7 (commit)
   via  e397702e271af38204fd99733bbeba7c1db3a999 (commit)
   via  e3740899c1af6962f93c85ad7d1cb71bddce45c6 (commit)
   via  b7c3b8cdf92c597e621e3dae28b110d321de5ea8 (commit)
   via  59a887e12469266e514ad7d4e34810e7ea888ba3 (commit)
   via  11d728465a9c635e1829abaae17e2f7720433b69 (commit)
   via  3710dd0f313f551f1b302b4961e0203243e3d661 (commit)
   via  4640979b526b6dac69a6a0555bfce75fe0206dac (commit)
   via  f3e6e7f8ef22bd70dd2f101d818e2e5ab5ed3cd8 (commit)
   via  817c77a3d0a3546bf46389cec5f6b54778dd1693 (commit)
   via  3f7e35ff0db740cdcb6d27c43a59bb6ca6066efb (commit)
   via  e72a5e11845fe445baaee4730bb0bea8588ee9e3 (commit)
  from  dc4ca816630ed44b419108da53421331243fb8c7 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit b5a8791268e938d7e017056e0e2bd2cbec1fa690
Author: Michael Adam ob...@samba.org
Date:   Fri Apr 19 16:24:32 2013 +0200

recover: use CTDB_REC_RO_FLAGS where appropriate

Signed-off-by: Michael Adam ob...@samba.org
Reviewed-By: Amitay Isaacs ami...@gmail.com

commit c7eab97c7a939710b73aae2d75b404b235a998f5
Author: Michael Adam ob...@samba.org
Date:   Fri Apr 19 16:23:16 2013 +0200

ctdb_daemon: use CTDB_REC_RO_FLAGS where appropriate

Signed-off-by: Michael Adam ob...@samba.org
Reviewed-By: Amitay Isaacs ami...@gmail.com

commit f99eb2f56d8ca27110a45ae0e1c4bff40ac7a60e
Author: Michael Adam ob...@samba.org
Date:   Fri Apr 19 16:22:49 2013 +0200

ctdb_call: use CTDB_REC_RO_FLAGS where appropriate

Signed-off-by: Michael Adam ob...@samba.org
Reviewed-By: Amitay Isaacs ami...@gmail.com

commit a62775334aa20d1d850d2df705eb70303b04ac5c
Author: Michael Adam ob...@samba.org
Date:   Fri Apr 19 16:09:34 2013 +0200

vacuum: use  CTDB_REC_RO_FLAGS in the vacuuming code

Signed-off-by: Michael Adam ob...@samba.org
Reviewed-By: Amitay Isaacs ami...@gmail.com

commit 61f17e53576197def46bc61fdf0cdb5282333a3e
Author: Michael Adam ob...@samba.org
Date:   Fri Apr 19 15:55:38 2013 +0200

ltdb_server: use CTDB_REC_RO_FLAGS where appropriate

Signed-off-by: Michael Adam ob...@samba.org
Reviewed-By: Amitay Isaacs ami...@gmail.com

commit c7924ce6404bb18641b00d5fbd2fe9da9aaf7959
Author: Michael Adam ob...@samba.org
Date:   Fri Apr 19 16:01:45 2013 +0200

include: define CTDB_REC_RO_FLAGS - all read-only related record flags

This is used for some checks

Signed-off-by: Michael Adam ob...@samba.org
Reviewed-By: Amitay Isaacs ami...@gmail.com

commit 61264debba58355b9716ac1637fdedef5ed249c8
Author: Michael Adam ob...@samba.org
Date:   Fri Feb 22 16:12:17 2013 +0100

vacuum: Update (C)

Signed-off-by: Michael Adam ob...@samba.org
Reviewed-By: Amitay Isaacs ami...@gmail.com

commit 06de786c786f1cab4c6721adf47c2cb1e8a72adb
Author: Michael Adam ob...@samba.org
Date:   Sat Dec 29 17:23:27 2012 +0100

vacuum: extend the header comment for ctdb_process_delete_list()

Describe the (new) process more precisely.
And mention that is the last step of the vacuuming process
that is performed on the lmaster.

Signed-off-by: Michael Adam ob...@samba.org
Reviewed-By: Amitay Isaacs ami...@gmail.com

commit eee23d44b6427be8ab49bbfcee3abb62f37dfcc7
Author: Michael Adam ob...@samba.org
Date:   Sat Jan 5 01:20:18 2013 +0100

vacuum: turn the vacuuming on lmaster into a three-phase process.

More precisely, before locally deleting an empty record, that has been
migrated with data and that we are dmaster and laster for, we now perform
the deletion on the other nodes in two steps instead of a single step.

- First send out the list of records to be deleted to all
  other nodes with the new RECEIVE_RECORDS control to store
  the lmaster's current empty copy.
- Then send those records that could be deleted on all nodes
  to all nodes again with the TRY_DELETE_RECORDS control
  as before for deletion.
- Finally delete those records locally that were successfully
  deleted remotely in the previous step.

This fixes an old race where a recovery that hits the vacuum process
square between the eyes can create gaps in the record's history and
hence let the records resurrect. In the case

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.61-17-g2cf0ceb

2013-04-22 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  2cf0ceb20c87756cf2e012d67129c0205c6db9aa (commit)
   via  02e349d158cfa5413e391066e098413f981c592b (commit)
   via  905a5a6fdf69a79574fcfff272aaa9b292eac159 (commit)
   via  5e157d829efff1bed94c1cc65a220148c769e559 (commit)
   via  57e520c86cd59776e6e850be6ae02b3345e6ab3a (commit)
   via  e71243dc514752bd19dfd8cdf1eda30809d67494 (commit)
   via  485b32d77972271dd0c5938ab5aa1d657484ae5e (commit)
   via  0f39c9bf47a5d84b1b5e3af19e6e8cd610dbfef6 (commit)
   via  f4c04ee072772450e269c71db3c6c0f4331537a8 (commit)
   via  b90249874c45c291e25515286a81c3cfe1b0ca6f (commit)
   via  764359b2081b7b6aad6af17e9b86b7df0e422416 (commit)
   via  64bbe9f35f58b5f2af23acfa6ded9751839b9ece (commit)
   via  63debc8aecd8ab626d827d508109fefa9503c101 (commit)
   via  dd465bfcf5bc8cffcae3abb58100b68d46ccda49 (commit)
   via  7dc9c1d3edcba5b61bdffb4ed213a216cd8ee809 (commit)
   via  859e72b1f6e7f438fe36e5ae303ef2ee713f5f41 (commit)
   via  4de7ec7931062e640665c91a53182bb34d6f55cc (commit)
  from  f7a21af8adc65c72326c0f955e5e1712467951ad (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 2cf0ceb20c87756cf2e012d67129c0205c6db9aa
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Apr 22 14:26:56 2013 +1000

New version 1.2.62

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 02e349d158cfa5413e391066e098413f981c592b
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Apr 19 13:29:04 2013 +1000

ctdbd: Set num_clients statistic from ctdb-num_clients

This fixes the problem of ctdb statisticsreset clearing the number of
clients even when there are active clients.

Values returned in statistics for frozen, recovering, memory_used are based 
on
the current state of CTDB and are not maintained as statistics.  This should
include num_clients as well.

Currently ctdb-num_clients is unused. So use that to track the number of
clients and fill in statistics field only when requested.

Signed-off-by: Amitay Isaacs ami...@gmail.com
(cherry picked from commit dc4ca816630ed44b419108da53421331243fb8c7)

commit 905a5a6fdf69a79574fcfff272aaa9b292eac159
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 22 13:52:04 2013 +1000

ctdbd: Log PID file creation and removal at NOTICE level

Unexpected removal of this file can have serious consequences, so it
is best if this is logged at the default level.

Signed-off-by: Martin Schwenke mar...@meltin.net
(cherry picked from commit bfed6a8d1771db3401d12b819204736c33acb312)

commit 5e157d829efff1bed94c1cc65a220148c769e559
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 16 16:10:04 2013 +1000

scripts: Crash cleanup script should pass a tag to logger

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 57e520c86cd59776e6e850be6ae02b3345e6ab3a
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 15 15:42:55 2013 +1000

scripts: ctdb-crash-cleanup.sh uses initscript to see if ctdbd is running

ctdb ping (or ctdb status) can time out.  How many times should we
try?

Instead, depend on the initscript to implement something sane.

Signed-off-by: Martin Schwenke mar...@meltin.net
Reviewed-by: Michael Adam ob...@samba.org
(cherry picked from commit 90cb337e5ccf397b69a64298559a428ff508f196)

Conflicts:
config/ctdb-crash-cleanup.sh

commit e71243dc514752bd19dfd8cdf1eda30809d67494
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 15 15:18:12 2013 +1000

initscript: Use a PID file to implement the status option

Using ctdb ping and ctdb status is fraught with danger.  These
commands can timeout when ctdbd is running, leading callers to believe
that ctdbd is not running.  Timeouts could be increased but we would
still have to handle potential timeouts.

Everything else in the world implements the status option by
checking if the relevant process is running.  This change makes CTDB
do the same thing and uses standard distro functions.

This change is backward compatible in sense that a missing
/var/run/ctdb/ directory means that we don't do a PID file check but
just depend on the distro's checking method.  Therefore, if CTDB was
started with an older version of this script then service ctdb
status will still work.

This script does not support changing the value of CTDB_VALGRIND
between calls.  If you start with CTDB_VALGRIND=yes then you need to
check status with the same setting.  CTDB_VALGRIND is a debug
variable, so this is acceptable.

This also adds sourcing of /lib/lsb/init-functions to make the Debian
function status_of_proc() available.

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed

[SCM] CTDB repository - branch master updated - ctdb-2.1-75-gdc4ca81

2013-04-21 Thread Amitay Isaacs
The branch, master has been updated
   via  dc4ca816630ed44b419108da53421331243fb8c7 (commit)
   via  bfed6a8d1771db3401d12b819204736c33acb312 (commit)
   via  5940a2494e9e43a83f2bca098bd04dfc1a8f2e93 (commit)
   via  0076cfc4666e5a96eb2c8affb59585b090840e00 (commit)
   via  700cf95a1f29b4b88460a00a55d57a9e397011e0 (commit)
   via  85efa446c7f5c5af1c3a960001aa75ae562f (commit)
   via  d254d03f69cbdc3e473202b759af6e1392cbb59c (commit)
  from  e7a4b7e35a1e4b826846e2494a3803abb57065ee (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit dc4ca816630ed44b419108da53421331243fb8c7
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Apr 19 13:29:04 2013 +1000

ctdbd: Set num_clients statistic from ctdb-num_clients

This fixes the problem of ctdb statisticsreset clearing the number of
clients even when there are active clients.

Values returned in statistics for frozen, recovering, memory_used are based 
on
the current state of CTDB and are not maintained as statistics.  This should
include num_clients as well.

Currently ctdb-num_clients is unused. So use that to track the number of
clients and fill in statistics field only when requested.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit bfed6a8d1771db3401d12b819204736c33acb312
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 22 13:52:04 2013 +1000

ctdbd: Log PID file creation and removal at NOTICE level

Unexpected removal of this file can have serious consequences, so it
is best if this is logged at the default level.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 5940a2494e9e43a83f2bca098bd04dfc1a8f2e93
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 22 13:48:06 2013 +1000

scripts: Ensure even external scripts get tagged in logs as ctdbd

Our practice is to search logs for ctdbd:.  We want to make sure we
find everything.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 0076cfc4666e5a96eb2c8affb59585b090840e00
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 22 06:52:49 2013 +1000

eventscripts: Ensure directories are created

Previous commits stopped the top level of the script from creating
certain directories but some functions assume that required
directories exist.

Create those directories instead.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 700cf95a1f29b4b88460a00a55d57a9e397011e0
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Apr 17 13:26:04 2013 +1000

scripts: Clean up update_tickles() and handling of associated directory

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 85efa446c7f5c5af1c3a960001aa75ae562f
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Apr 17 13:12:32 2013 +1000

scripts: Use $CTDB_SCRIPT_DEBUGLEVEL instead of something more complex

The current logic is horrible and creates an unnecessary file.  Let's
make the script debug level independent of ctddb's debug level.

* Have debug() use $CTDB_SCRIPT_DEBUGLEVEL directly

* Remove ctdb_set_current_debuglevel()

* Remove the getdebug command from ctdb stub in eventscript unit
  tests

* Update relevant eventscript unit tests to use
  $CTDB_SCRIPT_DEBUGLEVEL

Signed-off-by: Martin Schwenke mar...@meltin.net

commit d254d03f69cbdc3e473202b759af6e1392cbb59c
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Apr 19 13:10:27 2013 +1000

scripts: Ensure service command is in $PATH in ctdb-crash-cleanup.sh

Move the use of the service command below inclusion of functions file,
which sets $PATH.

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 config/ctdb-crash-cleanup.sh   |   14 
 config/ctdb.init   |2 +-
 config/events.d/00.ctdb|5 ---
 config/functions   |   55 +++-
 server/ctdb_control.c  |3 +-
 server/ctdb_daemon.c   |   10 +++---
 tests/eventscripts/50.samba.monitor.107.sh |3 +-
 tests/eventscripts/50.samba.monitor.109.sh |3 +-
 tests/eventscripts/50.samba.monitor.110.sh |3 +-
 tests/eventscripts/stubs/ctdb  |   18 -
 10 files changed, 31 insertions(+), 85 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/ctdb-crash-cleanup.sh b/config/ctdb-crash-cleanup.sh
index 7796223..d26838e 100755
--- a/config/ctdb-crash-cleanup.sh
+++ b/config/ctdb-crash-cleanup.sh
@@ -4,16 +4,16 @@
 # all public ip addresses if CTDBD has crashed or stopped running.
 #
 
-# If ctdb is running, just exit
-if service ctdb status /dev/null 21

[SCM] CTDB repository - branch master updated - ctdb-2.1-60-g06ac62f

2013-04-17 Thread Amitay Isaacs
The branch, master has been updated
   via  06ac62f890299021220214327f1b611c3cf00145 (commit)
   via  b1577a11d548479ff1a05702d106af9465921ad4 (commit)
   via  2438f3a4944f7adbcae4cc1b9d5452714244afe7 (commit)
   via  cad3107b12e8392f786f9a758ee38cf3a3d58538 (commit)
   via  feb1d40b21a160737aead22e398f3c34ff3be8de (commit)
  from  4c0cbfbe8b19f2e6fe17093b52c734bec63dd8b7 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 06ac62f890299021220214327f1b611c3cf00145
Author: Michael Adam ob...@samba.org
Date:   Wed Apr 17 13:08:49 2013 +0200

tests: add a comment to recovery db corruption test

The comment explains that we use ctdb stop and ctdb continue
but we should use ctdb setcrecmasterrole off.

Signed-off-by: Michael Adam ob...@samba.org

commit b1577a11d548479ff1a05702d106af9465921ad4
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Apr 11 16:59:36 2013 +1000

tests: Add a test for subsequent recoveries corrupting databases

Signed-off-by: Amitay Isaacs ami...@gmail.com
Reviewed-by: Michael Adam ob...@samba.org

commit 2438f3a4944f7adbcae4cc1b9d5452714244afe7
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Apr 11 16:58:34 2013 +1000

tests: Support waiting for recovered state in tests

Signed-off-by: Amitay Isaacs ami...@gmail.com
Reviewed-by: Michael Adam ob...@samba.org

commit cad3107b12e8392f786f9a758ee38cf3a3d58538
Author: Michael Adam ob...@samba.org
Date:   Wed Apr 3 12:02:59 2013 +0200

ctdb_call: don't bump the rsn in ctdb_become_dmaster() any more

This is now done in ctdb_ltdb_store_server(), so this
extra bump can be spared.

Signed-off-by: Michael Adam ob...@samba.org
Reviewed-By: Amitay Isaacs ami...@gmail.com

commit feb1d40b21a160737aead22e398f3c34ff3be8de
Author: Michael Adam ob...@samba.org
Date:   Wed Apr 3 11:40:25 2013 +0200

Fix a severe recovery bug that can lead to data corruption for SMB clients.

Problem:
Recovery can under certain circumstances lead to old record copies
resurrecting: Recovery selects the newest record copy purely by RSN. At
the end of the recovery, the recovery master is the dmaster for all
records in all (non-persistent) databases. And the other nodes locally
hold the complete copy of the databases. The bug is that the recovery
process does not increment the RSN on the recovery master at the end of
the recovery. Now clients acting directly on the Recovery master will
directly change a record's content on the recmaster without migration
and hence without RSN bump.  So a subsequent recovery can not tell that
the recmaster's copy is newer than the copies on the other nodes, since
their RSN is the same. Hence, if the recmaster is not node 0 (or more
precisely not the active node with the lowest node number), the recovery
will choose copies from nodes with lower number and stick to these.

Here is how to reproduce:

- assume we have a cluster with at least 2 nodes
- ensure that the recmaster is not node 0
  (maybe ensure with onnode 0 ctdb setrecmasterrole off)
  say recmaster is node 1
- choose a new database name, say test1.tdb
  (make sure it is not yet attached as persistent)
- choose a key name, say key1
- all clustere nodes should ok and no recovery running
- now do the following on node 1:

1. dbwrap_tool test1.tdb store key1 uint32 1
2. dbwrap_tool test1.tdb fetch key1 uint32
   == 1
3. ctdb recover
4. dbwrap_tool test1.tdb store key1 uint32 2
5. dbwrap_tool test1.tdb fetch key1 uint32
   == 2
4. ctdb recover
7. dbwrap_tool test1.tdb fetch key1 uint32
   == 1
   == BUG

This is a very severe bug, since when applied to Samba's locking.tdb
database, it means that for SMB clients on clustered Samba there is
the potential for locking out oneself from previously opened files
or even worse, data corruption:

Case 1: locking out

- client on recmaster opens file
- recovery propagates open file handle (entry in locking.tdb) to
  other nodes
- client closes file
- client opens the same file
- recovery resurrects old copy of open file record in locking.tdb
  from lower node
- client closes file but fails to delete entry in locking.tdb
- client tries to open same file again but fails, since
  the old record locks it out (since the client is still connected)

Case 2: data corruption

- clien1 on recmaster opens file
- recovery propagates open file info to other nodes
- client1 closes the file and disconnects
- client2 opens the same file
- recovery resurrects old copy of locking.tdb record,
  where client2 has no entry, but client1 has.
- but client2 believes it still has a handle
- client3

[SCM] CTDB repository - branch master updated - ctdb-2.1-68-ge7a4b7e

2013-04-17 Thread Amitay Isaacs
The branch, master has been updated
   via  e7a4b7e35a1e4b826846e2494a3803abb57065ee (commit)
   via  1e989894764e4cd1d551c44784d91cb295cd790d (commit)
   via  abb64f62efaa70df4b87c030b96300eafd98e6a3 (commit)
   via  90cb337e5ccf397b69a64298559a428ff508f196 (commit)
   via  687e2eace4f48400cf5029914f62b6ddabb85378 (commit)
   via  996e74d3db0c50f91b320af8ab7c43ea6b1136af (commit)
   via  ba8866d40125bab06391a17d48ff06a4a9f9da89 (commit)
   via  59b019a97aad9a731f9080ea5be14d0dbdfe03d6 (commit)
  from  06ac62f890299021220214327f1b611c3cf00145 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit e7a4b7e35a1e4b826846e2494a3803abb57065ee
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 15 19:15:22 2013 +1000

initscript: Remove duplicate setting of $ctdbd

Signed-off-by: Martin Schwenke mar...@meltin.net
Reviewed-by: Michael Adam ob...@samba.org

commit 1e989894764e4cd1d551c44784d91cb295cd790d
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 16 11:40:55 2013 +1000

util: Removed unused declaration of ctdbd_start()

Signed-off-by: Martin Schwenke mar...@meltin.net
Reviewed-by: Michael Adam ob...@samba.org

commit abb64f62efaa70df4b87c030b96300eafd98e6a3
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 15 13:31:42 2013 +1000

include: Move ctdb_start_daemon() from ctdb_client.h to ctdb_private.h

It really is internal.

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Reviewed-by: Michael Adam ob...@samba.org

commit 90cb337e5ccf397b69a64298559a428ff508f196
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 15 15:42:55 2013 +1000

scripts: ctdb-crash-cleanup.sh uses initscript to see if ctdbd is running

ctdb ping can time out.  How many times should we try?

Instead, depend on the initscript to implement something sane.

Signed-off-by: Martin Schwenke mar...@meltin.net
Reviewed-by: Michael Adam ob...@samba.org

commit 687e2eace4f48400cf5029914f62b6ddabb85378
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 15 15:18:12 2013 +1000

initscript: Use a PID file to implement the status option

Using ctdb ping and ctdb status is fraught with danger.  These
commands can timeout when ctdbd is running, leading callers to believe
that ctdbd is not running.  Timeouts could be increased but we would
still have to handle potential timeouts.

Everything else in the world implements the status option by
checking if the relevant process is running.  This change makes CTDB
do the same thing and uses standard distro functions.

This change is backward compatible in sense that a missing
/var/run/ctdb/ directory means that we don't do a PID file check but
just depend on the distro's checking method.  Therefore, if CTDB was
started with an older version of this script then service ctdb
status will still work.

This script does not support changing the value of CTDB_VALGRIND
between calls.  If you start with CTDB_VALGRIND=yes then you need to
check status with the same setting.  CTDB_VALGRIND is a debug
variable, so this is acceptable.

This also adds sourcing of /lib/lsb/init-functions to make the Debian
function status_of_proc() available.

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Reviewed-by: Michael Adam ob...@samba.org

commit 996e74d3db0c50f91b320af8ab7c43ea6b1136af
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 15 13:32:57 2013 +1000

ctdbd: Add --pidfile option

Default is not to create a pid file.

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Reviewed-by: Michael Adam ob...@samba.org

commit ba8866d40125bab06391a17d48ff06a4a9f9da89
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Apr 15 16:14:40 2013 +1000

util: ctdb_fork() should call ctdb_set_child_info()

For now we pass NULL as the child name.  Later we'll give ctdb_fork()
and friends an extra argument and pass that through.

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Reviewed-by: Michael Adam ob...@samba.org

commit 59b019a97aad9a731f9080ea5be14d0dbdfe03d6
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Apr 16 11:11:11 2013 +1000

util: New functions ctdb_set_child_info() and ctdb_is_child_process()

Must be called by all child processes.

Signed-off-by: Martin Schwenke mar...@meltin.net
Reviewed-by: Michael Adam ob...@samba.org

---

Summary of changes:
 common/ctdb_fork.c   |   24

[SCM] CTDB repository - branch master updated - ctdb-2.1-49-g043e18a

2013-04-14 Thread Amitay Isaacs
The branch, master has been updated
   via  043e18a8324ccb2c8ddd7b323ebedb5b0de1298d (commit)
  from  35264e42ade4676468cf7713fa339c784e932953 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 043e18a8324ccb2c8ddd7b323ebedb5b0de1298d
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Apr 11 16:58:59 2013 +1000

tests: Fix typo in variable name

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 tests/simple/76_ctdb_pdb_recovery.sh |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tests/simple/76_ctdb_pdb_recovery.sh 
b/tests/simple/76_ctdb_pdb_recovery.sh
index 2f21fdd..50f241e 100755
--- a/tests/simple/76_ctdb_pdb_recovery.sh
+++ b/tests/simple/76_ctdb_pdb_recovery.sh
@@ -86,7 +86,7 @@ wait_until_node_has_status 1 notstopped
 #
 TESTDB=persistent_test.tdb
 
-stauts=0
+status=0
 
 # Create a temporary persistent database to test with
 echo create persistent test database $TESTDB


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-48-g35264e4

2013-04-09 Thread Amitay Isaacs
The branch, master has been updated
   via  35264e42ade4676468cf7713fa339c784e932953 (commit)
  from  1c7adbccc69ac276d2b957ad16c3802fdb8868ca (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 35264e42ade4676468cf7713fa339c784e932953
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Mar 27 12:32:43 2013 +1100

tools/ltdbtool: Fix handling of -e option

Also, include description of -e option in usage.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 tools/ltdbtool.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tools/ltdbtool.c b/tools/ltdbtool.c
index b7ad5a5..add9c32 100644
--- a/tools/ltdbtool.c
+++ b/tools/ltdbtool.c
@@ -77,7 +77,9 @@ static int help(const char* cmd)
-O numthe number of bytes to interpret as ctdb record header\n
for the output database (beware!)\n
 \n
-   -p  print header (for the dump command), defaults ot off\n
+   -e  Include empty records, defaults to off\n
+\n
+   -p  print header (for the dump command), defaults to off\n
 \n
-h  print this help\n
 \n
@@ -91,8 +93,8 @@ static int help(const char* cmd)
 static int usage(const char* cmd)
 {
fprintf(stderr,
-   Usage: %s dump [-p] [-s{0|32|64}] idb\n
-  %s convert [-s{0|32|64}] [-o{0|32|64}] idb odb\n
+   Usage: %s dump [-e] [-p] [-s{0|32|64}] idb\n
+  %s convert [-e] [-s{0|32|64}] [-o{0|32|64}] idb 
odb\n
   %s {help|-h}\n
, cmd, cmd, cmd);
return -1;
@@ -229,6 +231,7 @@ int main(int argc, char* argv[])
break;
case 'e':
keep_empty = true;
+   break;
case 'h':
return help(argv[0]);
default:


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-47-g1c7adbc

2013-04-07 Thread Amitay Isaacs
The branch, master has been updated
   via  1c7adbccc69ac276d2b957ad16c3802fdb8868ca (commit)
   via  fe8c4880b371492a38554868d4ca10918c54e412 (commit)
   via  524ec206e6a5e8b11723f4d8d1251ed5d84063b0 (commit)
   via  74acc2c568300ef42740cf11299a1b2507047f60 (commit)
   via  f7f8bde2376f8180a0dca6d7b8d7d2a4a12f4bd8 (commit)
   via  c137531fae8f7f6392746ce1b9ac6f219775fc29 (commit)
   via  bf7296ce9b98563bcb8426cd035dbeab6d884f59 (commit)
   via  20be1f991dd75c2333c9ec9db226432a819f57ba (commit)
   via  4e1ec7412866f2d31c41de1bec0fbf788c03051b (commit)
  from  85b777196289646ca37e06ebbf1f7a684d0aabc5 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 1c7adbccc69ac276d2b957ad16c3802fdb8868ca
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Apr 5 13:34:06 2013 +1100

recoverd/takeover: Use IP-node mapping info from nodes hosting that IP

When collating IP information for IP layout, only trust the nodes that are
hosting an IP, to have correct information about that IP.  Ignore what all 
the
other nodes think.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit fe8c4880b371492a38554868d4ca10918c54e412
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Apr 3 14:44:08 2013 +1100

statd-callout: Make sure statd callout script always runs as root

In RHEL 6+, rpc.statd runs as rpcuser instead of root as on RHEL 5. This
prevents CTDB tool commands talking to daemon since rpcuser cannot access
CTDB socket.

Signed-off-by: Amitay Isaacs ami...@gmail.com
Pair-Programmed-With: Martin Schwenke mar...@meltin.net

commit 524ec206e6a5e8b11723f4d8d1251ed5d84063b0
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Mar 18 13:45:08 2013 +1100

client: Set the socket non-blocking only after connect succeeds

If the socket is set non-blocking before connect, then we should catch
EAGAIN errors and retry. Instead of adding a random number of retries,
better to wait for connect to succeed and then set the socket to
non-blocking.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 74acc2c568300ef42740cf11299a1b2507047f60
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Apr 5 13:19:34 2013 +1100

Revert client: handle transient connection errors

This reverts commit dc0c58547cd4b20a8e2cd21f3c8363f34fd03e75.

There is a simpler solution that retrying random number of times. Do not set
socket non-blocking till connect succeeds.

commit f7f8bde2376f8180a0dca6d7b8d7d2a4a12f4bd8
Author: Volker Lendecke v...@samba.org
Date:   Wed Apr 3 14:59:21 2013 +0200

common/messaging: Use the jenkins hash in ctdb_message

This give a better hash distribution

commit c137531fae8f7f6392746ce1b9ac6f219775fc29
Author: Volker Lendecke v...@samba.org
Date:   Fri Apr 5 13:11:31 2013 +1100

common/messaging: use tdb_parse_record in message_list_db_fetch

This avoids malloc/free in a hot code path.

commit bf7296ce9b98563bcb8426cd035dbeab6d884f59
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Apr 3 15:08:14 2013 +1100

common/messaging: Abstract db related operations inside db functions

This simplifies the use of message indexdb API and abstracts tdb related 
code
inside the API.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 20be1f991dd75c2333c9ec9db226432a819f57ba
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Apr 2 16:57:51 2013 +1100

common/messaging: Don't forget to free the result returned by tdb_fetch()

This fixes a memory leak in the messaging code.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 4e1ec7412866f2d31c41de1bec0fbf788c03051b
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Apr 2 12:08:39 2013 +1100

common/messaging: Free message list header if all message handlers are freed

This makes sure that even if the srvids are not deregistered, the header
structure is freed when the last message handler has been freed as a result 
of
client going away.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 Makefile.in|1 +
 client/ctdb_client.c   |   39 +++-
 common/ctdb_message.c  |  110 +---
 config/ctdb.sudoers|3 +
 config/statd-callout   |3 +
 libctdb/ctdb.c |6 +-
 packaging/RPM/ctdb.spec.in |4 +-
 server/ctdb_takeover.c |8 +++-
 8 files changed, 80 insertions(+), 94 deletions(-)
 create mode 100644 config/ctdb.sudoers


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 762f788..9511e90 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -330,6 +330,7 @@ install: all manpages $(PMDA_INSTALL)
${INSTALLCMD} -m 644 include

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.60-10-gf7a21af

2013-04-07 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  f7a21af8adc65c72326c0f955e5e1712467951ad (commit)
   via  1d7db16870c3e166f00669eb46c57fac765d0e1e (commit)
   via  34da547bd3534386e83056bc82b1ee7d9b2148f8 (commit)
   via  b9541b26ed16a141b6cf608feabb29409ebb7ef2 (commit)
   via  17e11263cae9602da04d9af69cad0083bc29476d (commit)
   via  184318ce3ec607af53c86ddf8e0e8f6d77313ea4 (commit)
   via  09f82b58b2ab367a1c4f5b2bc79ceb63ff66a3c4 (commit)
   via  12090590085c5a3e3b895896ea2668cb592a7e28 (commit)
   via  2ac73c1e00734aef5da8bc03704c0fa4b0956011 (commit)
   via  e1ba96d63b103bde841b634dc9c4c0eedabe72a9 (commit)
  from  0372e73b27b0193240aa0a020c8ab9f79abd262f (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit f7a21af8adc65c72326c0f955e5e1712467951ad
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Apr 5 16:26:24 2013 +1100

New version 1.2.61

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 1d7db16870c3e166f00669eb46c57fac765d0e1e
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Apr 5 15:31:26 2013 +1100

lockwait: Pass CTDB daemon PID on command line

In lockwait helper process we cannot rely on getppid() to find the pid
of CTDB daemon as CTDB daemon can go away before the helper executes. In
which case, ctdb helper process will hang around forever.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 34da547bd3534386e83056bc82b1ee7d9b2148f8
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Apr 5 13:34:06 2013 +1100

recoverd/takeover: Use IP-node mapping info from nodes hosting that IP

When collating IP information for IP layout, only trust the nodes that are
hosting an IP, to have correct information about that IP.  Ignore what all 
the
other nodes think.

Signed-off-by: Amitay Isaacs ami...@gmail.com
(cherry picked from commit 1c7adbccc69ac276d2b957ad16c3802fdb8868ca)

commit b9541b26ed16a141b6cf608feabb29409ebb7ef2
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Apr 3 14:44:08 2013 +1100

statd-callout: Make sure statd callout script always runs as root

In RHEL 6+, rpc.statd runs as rpcuser instead of root as on RHEL 5. This
prevents CTDB tool commands talking to daemon since rpcuser cannot access
CTDB socket.

Signed-off-by: Amitay Isaacs ami...@gmail.com
Pair-Programmed-With: Martin Schwenke mar...@meltin.net
(cherry picked from commit fe8c4880b371492a38554868d4ca10918c54e412)

Conflicts:
packaging/RPM/ctdb.spec.in

commit 17e11263cae9602da04d9af69cad0083bc29476d
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Mar 18 13:45:08 2013 +1100

client: Set the socket non-blocking only after connect succeeds

If the socket is set non-blocking before connect, then we should catch
EAGAIN errors and retry. Instead of adding a random number of retries,
better to wait for connect to succeed and then set the socket to
non-blocking.

Signed-off-by: Amitay Isaacs ami...@gmail.com
(cherry picked from commit 524ec206e6a5e8b11723f4d8d1251ed5d84063b0)

commit 184318ce3ec607af53c86ddf8e0e8f6d77313ea4
Author: Volker Lendecke v...@samba.org
Date:   Wed Apr 3 14:59:21 2013 +0200

common/messaging: Use the jenkins hash in ctdb_message

This give a better hash distribution
(cherry picked from commit f7f8bde2376f8180a0dca6d7b8d7d2a4a12f4bd8)

commit 09f82b58b2ab367a1c4f5b2bc79ceb63ff66a3c4
Author: Volker Lendecke v...@samba.org
Date:   Fri Apr 5 13:11:31 2013 +1100

common/messaging: use tdb_parse_record in message_list_db_fetch

This avoids malloc/free in a hot code path.
(cherry picked from commit c137531fae8f7f6392746ce1b9ac6f219775fc29)

commit 12090590085c5a3e3b895896ea2668cb592a7e28
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Apr 3 15:08:14 2013 +1100

common/messaging: Abstract db related operations inside db functions

This simplifies the use of message indexdb API and abstracts tdb related 
code
inside the API.

Signed-off-by: Amitay Isaacs ami...@gmail.com
(cherry picked from commit bf7296ce9b98563bcb8426cd035dbeab6d884f59)

commit 2ac73c1e00734aef5da8bc03704c0fa4b0956011
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Apr 2 16:57:51 2013 +1100

common/messaging: Don't forget to free the result returned by tdb_fetch()

This fixes a memory leak in the messaging code.

Signed-off-by: Amitay Isaacs ami...@gmail.com
(cherry picked from commit 20be1f991dd75c2333c9ec9db226432a819f57ba)

commit e1ba96d63b103bde841b634dc9c4c0eedabe72a9
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Apr 2 12:08:39 2013 +1100

common/messaging: Free message list header if all message handlers are freed

This makes sure that even if the srvids are not deregistered, the header
structure is freed when the last message

[SCM] CTDB repository - annotated tag ctdb-1.2.61 created - ctdb-1.2.61

2013-04-07 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.61 has been created
at  4083383045259c4b3d3b015bd0fb390cdae2d7d1 (tag)
   tagging  f7a21af8adc65c72326c0f955e5e1712467951ad (commit)
  replaces  ctdb-1.2.60
 tagged by  Amitay Isaacs
on  Mon Apr 8 14:42:44 2013 +1000

- Log -
new version 1.2.61

Amitay Isaacs (8):
  common/messaging: Free message list header if all message handlers are 
freed
  common/messaging: Don't forget to free the result returned by tdb_fetch()
  common/messaging: Abstract db related operations inside db functions
  client: Set the socket non-blocking only after connect succeeds
  statd-callout: Make sure statd callout script always runs as root
  recoverd/takeover: Use IP-node mapping info from nodes hosting that IP
  lockwait: Pass CTDB daemon PID on command line
  New version 1.2.61

Volker Lendecke (2):
  common/messaging: use tdb_parse_record in message_list_db_fetch
  common/messaging: Use the jenkins hash in ctdb_message

---


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-38-g85b7771

2013-03-26 Thread Amitay Isaacs
The branch, master has been updated
   via  85b777196289646ca37e06ebbf1f7a684d0aabc5 (commit)
  from  307416afda707b687f5e89e8438e45c154a4c806 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 85b777196289646ca37e06ebbf1f7a684d0aabc5
Author: Sumit Bose sb...@redhat.com
Date:   Mon Mar 25 12:28:31 2013 +0100

build: Fix for tevent autoconf check

The list of include files is the 4th argument of AC_CHECK_DECLS.

---

Summary of changes:
 lib/tevent/libtevent.m4 |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/libtevent.m4 b/lib/tevent/libtevent.m4
index 2141af6..fc06a9d 100644
--- a/lib/tevent/libtevent.m4
+++ b/lib/tevent/libtevent.m4
@@ -11,7 +11,7 @@ AC_SUBST(TEVENT_CFLAGS)
 if test x$INCLUDED_TEVENT != xyes ; then
 AC_CHECK_HEADERS(tevent.h)
 AC_CHECK_LIB(tevent, tevent_context_init, [ TEVENT_LIBS=-ltevent ])
-AC_CHECK_DECLS([TEVENT_TRACE_BEFORE_WAIT], [[#include tevent.h]])
+AC_CHECK_DECLS([TEVENT_TRACE_BEFORE_WAIT],,, [[#include tevent.h]])
 if test x$ac_cv_header_tevent_h = xno -o \
x$ac_cv_lib_tevent_tevent_context_init = xno -o \
x$ac_cv_have_decl_TEVENT_TRACE_BEFORE_WAIT = xno ; then


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-37-g307416a

2013-03-25 Thread Amitay Isaacs
The branch, master has been updated
   via  307416afda707b687f5e89e8438e45c154a4c806 (commit)
   via  08c53ee609b80f87450a7a1d7dd24fbcdf5ab7bc (commit)
  from  87c89b7c2a14e2ee79a3efc7e8125842bc04bf23 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 307416afda707b687f5e89e8438e45c154a4c806
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Mar 13 22:57:44 2013 +1100

util: Add hex_decode_talloc() to decode hex string into a binary blob

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 08c53ee609b80f87450a7a1d7dd24fbcdf5ab7bc
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Mar 13 11:46:18 2013 +1100

logging: Do not ignore stdout/stderr from the exec'd children

To log debugging information from child processes that are started
with vfork and exec, do not set close_on_exec on STDOUT and STDERR for
that process.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 include/includes.h|1 +
 lib/util/util_file.c  |   16 
 server/ctdb_logging.c |5 -
 3 files changed, 17 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/includes.h b/include/includes.h
index e0ce06b..3747198 100644
--- a/include/includes.h
+++ b/include/includes.h
@@ -58,6 +58,7 @@ double timeval_elapsed(struct timeval *tv);
 double timeval_delta(struct timeval *tv2, struct timeval *tv);
 char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx);
 char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, 
size_t len);
+uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx, const char *hex_in, size_t 
*len);
 _PUBLIC_ const char **str_list_add(const char **list, const char *s);
 _PUBLIC_ int set_blocking(int fd, bool set);
 
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 21d64b2..3a90201 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -114,3 +114,19 @@ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const 
unsigned char *buff_in, size_
 
return hex_buffer;
 }
+
+uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx, const char *hex_in, size_t 
*len)
+{
+   int i, num;
+   uint8_t *buffer;
+
+   *len = strlen(hex_in) / 2;
+   buffer = talloc_array(mem_ctx, unsigned char, *len);
+
+   for (i=0; i*len; i++) {
+   sscanf(hex_in[i*2], %02X, num);
+   buffer[i] = (uint8_t)num;
+   }
+
+   return buffer;
+}
diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index 7cf8b9f..dfb5063 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -538,11 +538,6 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
close(old_stdout);
close(old_stderr);
 
-   /* Is this correct for STDOUT and STDERR ? */
-   set_close_on_exec(STDOUT_FILENO);
-   set_close_on_exec(STDERR_FILENO);
-   set_close_on_exec(p[0]);
-
fde = event_add_fd(ctdb-ev, ctdb-log, p[0],
   EVENT_FD_READ, ctdb_log_handler, ctdb-log);
tevent_fd_set_auto_close(fde);


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.59-2-gbcaed71

2013-03-25 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  bcaed7181f6ce6f68cfd77d16a2b012c2d78466b (commit)
   via  90560d1f9def4f42af76a1db1e7effda330f90bd (commit)
  from  1520ec0262385894c086740f8486b18f29e3fb80 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit bcaed7181f6ce6f68cfd77d16a2b012c2d78466b
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Mar 13 22:57:44 2013 +1100

util: Add hex_decode_talloc() to decode hex string into a binary blob

Signed-off-by: Amitay Isaacs ami...@gmail.com
(cherry picked from commit 307416afda707b687f5e89e8438e45c154a4c806)

commit 90560d1f9def4f42af76a1db1e7effda330f90bd
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Mar 13 11:46:18 2013 +1100

logging: Do not ignore stdout/stderr from the exec'd children

To log debugging information from child processes that are started
with vfork and exec, do not set close_on_exec on STDOUT and STDERR for
that process.

Signed-off-by: Amitay Isaacs ami...@gmail.com
(cherry picked from commit 08c53ee609b80f87450a7a1d7dd24fbcdf5ab7bc)

---

Summary of changes:
 include/includes.h|1 +
 lib/util/util_file.c  |   16 
 server/ctdb_logging.c |5 -
 3 files changed, 17 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/includes.h b/include/includes.h
index b3f8eb9..d5e3095 100644
--- a/include/includes.h
+++ b/include/includes.h
@@ -53,6 +53,7 @@ double timeval_elapsed(struct timeval *tv);
 double timeval_delta(struct timeval *tv2, struct timeval *tv);
 char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx);
 char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, 
size_t len);
+uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx, const char *hex_in, size_t 
*len);
 _PUBLIC_ const char **str_list_add(const char **list, const char *s);
 _PUBLIC_ int set_blocking(int fd, BOOL set);
 
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 21d64b2..3a90201 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -114,3 +114,19 @@ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const 
unsigned char *buff_in, size_
 
return hex_buffer;
 }
+
+uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx, const char *hex_in, size_t 
*len)
+{
+   int i, num;
+   uint8_t *buffer;
+
+   *len = strlen(hex_in) / 2;
+   buffer = talloc_array(mem_ctx, unsigned char, *len);
+
+   for (i=0; i*len; i++) {
+   sscanf(hex_in[i*2], %02X, num);
+   buffer[i] = (uint8_t)num;
+   }
+
+   return buffer;
+}
diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index 19e8af7..583384b 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -530,11 +530,6 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
close(old_stdout);
close(old_stderr);
 
-   /* Is this correct for STDOUT and STDERR ? */
-   set_close_on_exec(STDOUT_FILENO);
-   set_close_on_exec(STDERR_FILENO);
-   set_close_on_exec(p[0]);
-
fde = event_add_fd(ctdb-ev, ctdb-log, p[0],
   EVENT_FD_READ, ctdb_log_handler, ctdb-log);
tevent_fd_set_auto_close(fde);


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.59-6-gda6be80

2013-03-25 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  da6be80bd8d82e318b68cc333abde0ff3fdf9249 (commit)
   via  534f7afb8e5b61c7c8f40a4764ff24a09de3008f (commit)
   via  81886163f76c6d285a64866a03ab1df076e45a3b (commit)
   via  f50b9106990602dcf9dff567b04da58e1c1a32dc (commit)
  from  bcaed7181f6ce6f68cfd77d16a2b012c2d78466b (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit da6be80bd8d82e318b68cc333abde0ff3fdf9249
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Mar 14 15:44:44 2013 +1100

lockwait: Allow for zero length key requests

Samba sends zero length key requests for notify database. To support older
Samba behaviour for now, allow zero length key requests. Zero length key is
encoded as NULL string.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 534f7afb8e5b61c7c8f40a4764ff24a09de3008f
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Mar 13 17:05:00 2013 +1100

lockwait: Pass all locking information on commandline to lockwait helper

Simplify lockwait code by getting rid of the communication between ctdbd
and ctdb lockwait helper child by passing all the locking information
on command line.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 81886163f76c6d285a64866a03ab1df076e45a3b
Author: Volker Lendecke v...@samba.org
Date:   Tue Mar 12 13:35:17 2013 +0100

lockwait: Check result of lockwait child

commit f50b9106990602dcf9dff567b04da58e1c1a32dc
Author: Michael Adam ob...@samba.org
Date:   Wed Mar 13 09:12:50 2013 +0100

lockwait: fix a comment typo

Signed-off-by: Michael Adam ob...@samba.org

---

Summary of changes:
 Makefile.in   |2 +-
 server/ctdb_lockwait.c|  114 +++-
 server/ctdb_lockwait_helper.c |  132 +---
 3 files changed, 52 insertions(+), 196 deletions(-)


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 9c4f555..1032349 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -112,7 +112,7 @@ bin/ctdbd: $(CTDB_SERVER_OBJ)
@echo Linking $@
@$(CC) $(CFLAGS) -o $@ $(CTDB_SERVER_OBJ) $(LIB_FLAGS)
 
-bin/ctdb_lockwait_helper: server/ctdb_lockwait_helper.o @TDB_OBJ@
+bin/ctdb_lockwait_helper: server/ctdb_lockwait_helper.o lib/util/util_file.o 
@TDB_OBJ@ @TALLOC_OBJ@
@echo Linking $@
@$(CC) $(CFLAGS) -o $@ $^ $(LIB_FLAGS)
 
diff --git a/server/ctdb_lockwait.c b/server/ctdb_lockwait.c
index ba7c6dc..cb5bc1c 100644
--- a/server/ctdb_lockwait.c
+++ b/server/ctdb_lockwait.c
@@ -89,6 +89,9 @@ static void lockwait_handler(struct event_context *ev, struct 
fd_event *fde,
TDB_DATA key = h-key;
struct tdb_context *tdb = h-ctdb_db-ltdb-tdb;
TALLOC_CTX *tmp_ctx = talloc_new(ev);
+   char result;
+   ssize_t nread;
+   char *msg;
 
key.dptr = talloc_memdup(tmp_ctx, key.dptr, key.dsize);
h-ctdb_db-pending_requests--;
@@ -106,6 +109,19 @@ static void lockwait_handler(struct event_context *ev, 
struct fd_event *fde,
}
}
 
+   nread = read(h-fd[0], result, sizeof(result));
+   if (nread == -1) {
+   asprintf(msg, lockwait child read failed: %s\n, 
strerror(errno));
+   ctdb_fatal(h-ctdb, msg);
+   }
+   if (nread == 0) {
+   ctdb_fatal(h-ctdb, lockwait child exited early\n);
+   }
+   if (result != 0) {
+   asprintf(msg, lockwait child wrote %d\n, (int)result);
+   ctdb_fatal(h-ctdb, msg);
+   }
+
tdb_chainlock_mark(tdb, key);
callback(p);
if (h-ctdb_db-lockwait_overflow) {
@@ -141,11 +157,8 @@ struct lockwait_handle *ctdb_lockwait(struct 
ctdb_db_context *ctdb_db,
 {
struct lockwait_handle *result, *i;
int ret;
-   int datafd[2];
-   TDB_DATA tmp_key, tmp_data;
-   struct ctdb_marshall_buffer *m;
const char *prog = BINDIR /ctdb_lockwait_helper;
-   char arg0[128], arg1[8], arg2[8], arg3[8];
+   char *arg0, *arg1, *arg2, *arg3;
 
CTDB_INCREMENT_STAT(ctdb_db-ctdb, lockwait_calls);
CTDB_INCREMENT_STAT(ctdb_db-ctdb, pending_lockwait_calls);
@@ -182,51 +195,6 @@ struct lockwait_handle *ctdb_lockwait(struct 
ctdb_db_context *ctdb_db,
return result;
}
 
-   /* Create data for the child process */
-   m = talloc_zero(result, struct ctdb_marshall_buffer);
-   if (m == NULL) {
-   talloc_free(result);
-   CTDB_DECREMENT_STAT(ctdb_db-ctdb, pending_lockwait_calls);
-   return NULL;
-   }
-
-   tmp_key.dptr = (uint8_t *)talloc_strdup(result, dbpath);
-   if (tmp_key.dptr == NULL) {
-   talloc_free(result);
-   CTDB_DECREMENT_STAT(ctdb_db-ctdb

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.59-7-g0372e73

2013-03-25 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  0372e73b27b0193240aa0a020c8ab9f79abd262f (commit)
  from  da6be80bd8d82e318b68cc333abde0ff3fdf9249 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 0372e73b27b0193240aa0a020c8ab9f79abd262f
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Mar 25 18:05:07 2013 +1100

New version 1.2.60

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 packaging/RPM/ctdb.spec.in |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 90209ae..edcc458 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -3,7 +3,7 @@ Name: ctdb
 Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team sa...@samba.org
-Version: 1.2.59
+Version: 1.2.60
 Release: 1GITHASH
 Epoch: 0
 License: GNU GPL version 3
@@ -149,6 +149,11 @@ development libraries for ctdb
 
 %changelog
 
+* Mon Mar 25 2013 : Version 1.2.60
+  - Do not set close_on_exec for stdio/stderr of child
+  - Check result from lockwait child
+  - Pass locking information on commandline to lockwait helper
+  - Allow for zero length key requests
 * Wed Mar 06 2013 : Version 1.2.59
   - Do not send ipreallocated event to stopped nodes
   - Do not fail ctdb delip command if IP cannot be moved


-- 
CTDB repository


[SCM] CTDB repository - annotated tag ctdb-1.2.60 created - ctdb-1.2.60

2013-03-25 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.60 has been created
at  fe00ba86baf895df90758146b73e7fc9c888f9ec (tag)
   tagging  0372e73b27b0193240aa0a020c8ab9f79abd262f (commit)
  replaces  ctdb-1.2.59
 tagged by  Amitay Isaacs
on  Tue Mar 26 15:54:41 2013 +1100

- Log -
new version 1.2.60

Amitay Isaacs (5):
  logging: Do not ignore stdout/stderr from the exec'd children
  util: Add hex_decode_talloc() to decode hex string into a binary blob
  lockwait: Pass all locking information on commandline to lockwait helper
  lockwait: Allow for zero length key requests
  New version 1.2.60

Michael Adam (1):
  lockwait: fix a comment typo

Volker Lendecke (1):
  lockwait: Check result of lockwait child

---


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-31-g5402f85

2013-03-05 Thread Amitay Isaacs
The branch, master has been updated
   via  5402f85dde045576cbaf64e01c68e28ed52204e8 (commit)
  from  6455ce5e4980a63d56ed30f7059869c8356c12ea (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 5402f85dde045576cbaf64e01c68e28ed52204e8
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Feb 27 16:01:55 2013 +1100

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 mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 tools/ctdb.c |  159 ++
 1 files changed, 83 insertions(+), 76 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tools/ctdb.c b/tools/ctdb.c
index fb3df8b..ff7dc44 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -1594,13 +1594,88 @@ static int move_ip(struct ctdb_context *ctdb, 
ctdb_sock_addr *addr, uint32_t pnn
return 0;
 }
 
+
+/* 
+ * scans all other nodes and returns a pnn for another node that can host this 
+ * ip address or -1
+ */
+static int
+find_other_host_for_public_ip(struct ctdb_context *ctdb, ctdb_sock_addr *addr)
+{
+   TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+   struct ctdb_all_public_ips *ips;
+   struct ctdb_node_map *nodemap=NULL;
+   int i, j, ret;
+
+   ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, 
tmp_ctx, nodemap);
+   if (ret != 0) {
+   DEBUG(DEBUG_ERR, (Unable to get nodemap from node %u\n, 
options.pnn));
+   talloc_free(tmp_ctx);
+   return ret;
+   }
+
+   for(i=0;inodemap-num;i++){
+   if (nodemap-nodes[i].flags  NODE_FLAGS_INACTIVE) {
+   continue;
+   }
+   if (nodemap-nodes[i].pnn == options.pnn) {
+   continue;
+   }
+
+   /* read the public ip list from this node */
+   ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), 
nodemap-nodes[i].pnn, tmp_ctx, ips);
+   if (ret != 0) {
+   DEBUG(DEBUG_ERR, (Unable to get public ip list from 
node %u\n, nodemap-nodes[i].pnn));
+   return -1;
+   }
+
+   for (j=0;jips-num;j++) {
+   if (ctdb_same_ip(addr, ips-ips[j].addr)) {
+   talloc_free(tmp_ctx);
+   return nodemap-nodes[i].pnn;
+   }
+   }
+   talloc_free(ips);
+   }
+
+   talloc_free(tmp_ctx);
+   return -1;
+}
+
+/* If pnn is -1 then try to find a node to move IP to... */
+static bool try_moveip(struct ctdb_context *ctdb, ctdb_sock_addr *addr, 
uint32_t pnn)
+{
+   bool pnn_specified = (pnn == -1 ? false : true);
+   int retries = 0;
+
+   while (retries  5) {
+   if (!pnn_specified) {
+   pnn = find_other_host_for_public_ip(ctdb, addr);
+   if (pnn == -1) {
+   return false;
+   }
+   DEBUG(DEBUG_NOTICE,
+ (Trying to move public IP to node %u\n, pnn));
+   }
+
+   if (move_ip(ctdb, addr, pnn) == 0) {
+   return true;
+   }
+
+   sleep(3);
+   retries++;
+   }
+
+   return false;
+}
+
+
 /*
   move/failover an ip address to a specific node
  */
 static int control_moveip(struct ctdb_context *ctdb, int argc, const char 
**argv)
 {
uint32_t pnn;
-   int ret, retries = 0;
ctdb_sock_addr addr;
 
if (argc  2) {
@@ -1619,16 +1694,8 @@ static int control_moveip(struct ctdb_context *ctdb, int 
argc, const char **argv
return -1;
}
 
-   do {
-   ret = move_ip(ctdb, addr, pnn);
-   if (ret != 0) {
-   DEBUG(DEBUG_ERR,(Failed to move ip to node %d. Wait 3 
second and try again.\n, pnn));
-   sleep(3);
-   retries++;
-   }
-   } while (retries  5  ret != 0);
-   if (ret != 0) {
-   DEBUG(DEBUG_ERR,(Failed to move ip to node %d. Giving up.\n, 
pnn));
+   if (!try_moveip(ctdb, addr, pnn)) {
+   DEBUG(DEBUG_ERR,(Failed to move IP to node %d.\n, pnn));
return -1;
}
 
@@ -1861,53 +1928,6 @@ control_get_all_public_ips(struct ctdb_context *ctdb, 
TALLOC_CTX *tmp_ctx, struc
 }
 
 
-/* 
- * scans all other nodes and returns a pnn for another node that can host this 
- * ip address or -1
- */
-static int
-find_other_host_for_public_ip

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.58-6-gd788857

2013-03-05 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  d788857b1c96f78b0ffa4d410a935ec59bef9148 (commit)
  from  49bab583f430b5c06178c2cd114d2362cf1d606c (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit d788857b1c96f78b0ffa4d410a935ec59bef9148
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Feb 27 16:01:55 2013 +1100

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 mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Cherry-pick-from: 5402f85dde045576cbaf64e01c68e28ed52204e8

---

Summary of changes:
 tools/ctdb.c |  159 ++
 1 files changed, 83 insertions(+), 76 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tools/ctdb.c b/tools/ctdb.c
index ce9ec29..b7b5e12 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -1286,13 +1286,88 @@ static int move_ip(struct ctdb_context *ctdb, 
ctdb_sock_addr *addr, uint32_t pnn
return 0;
 }
 
+
+/* 
+ * scans all other nodes and returns a pnn for another node that can host this 
+ * ip address or -1
+ */
+static int
+find_other_host_for_public_ip(struct ctdb_context *ctdb, ctdb_sock_addr *addr)
+{
+   TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+   struct ctdb_all_public_ips *ips;
+   struct ctdb_node_map *nodemap=NULL;
+   int i, j, ret;
+
+   ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, 
tmp_ctx, nodemap);
+   if (ret != 0) {
+   DEBUG(DEBUG_ERR, (Unable to get nodemap from node %u\n, 
options.pnn));
+   talloc_free(tmp_ctx);
+   return ret;
+   }
+
+   for(i=0;inodemap-num;i++){
+   if (nodemap-nodes[i].flags  NODE_FLAGS_INACTIVE) {
+   continue;
+   }
+   if (nodemap-nodes[i].pnn == options.pnn) {
+   continue;
+   }
+
+   /* read the public ip list from this node */
+   ret = ctdb_ctrl_get_public_ips(ctdb, TIMELIMIT(), 
nodemap-nodes[i].pnn, tmp_ctx, ips);
+   if (ret != 0) {
+   DEBUG(DEBUG_ERR, (Unable to get public ip list from 
node %u\n, nodemap-nodes[i].pnn));
+   return -1;
+   }
+
+   for (j=0;jips-num;j++) {
+   if (ctdb_same_ip(addr, ips-ips[j].addr)) {
+   talloc_free(tmp_ctx);
+   return nodemap-nodes[i].pnn;
+   }
+   }
+   talloc_free(ips);
+   }
+
+   talloc_free(tmp_ctx);
+   return -1;
+}
+
+/* If pnn is -1 then try to find a node to move IP to... */
+static bool try_moveip(struct ctdb_context *ctdb, ctdb_sock_addr *addr, 
uint32_t pnn)
+{
+   bool pnn_specified = (pnn == -1 ? false : true);
+   int retries = 0;
+
+   while (retries  5) {
+   if (!pnn_specified) {
+   pnn = find_other_host_for_public_ip(ctdb, addr);
+   if (pnn == -1) {
+   return false;
+   }
+   DEBUG(DEBUG_NOTICE,
+ (Trying to move public IP to node %u\n, pnn));
+   }
+
+   if (move_ip(ctdb, addr, pnn) == 0) {
+   return true;
+   }
+
+   sleep(3);
+   retries++;
+   }
+
+   return false;
+}
+
+
 /*
   move/failover an ip address to a specific node
  */
 static int control_moveip(struct ctdb_context *ctdb, int argc, const char 
**argv)
 {
uint32_t pnn;
-   int ret, retries = 0;
ctdb_sock_addr addr;
 
if (argc  2) {
@@ -1311,16 +1386,8 @@ static int control_moveip(struct ctdb_context *ctdb, int 
argc, const char **argv
return -1;
}
 
-   do {
-   ret = move_ip(ctdb, addr, pnn);
-   if (ret != 0) {
-   DEBUG(DEBUG_ERR,(Failed to move ip to node %d. Wait 3 
second and try again.\n, pnn));
-   sleep(3);
-   retries++;
-   }
-   } while (retries  5  ret != 0);
-   if (ret != 0) {
-   DEBUG(DEBUG_ERR,(Failed to move ip to node %d. Giving up.\n, 
pnn));
+   if (!try_moveip(ctdb, addr, pnn)) {
+   DEBUG(DEBUG_ERR,(Failed to move IP to node %d.\n, pnn));
return -1;
}
 
@@ -1549,53 +1616,6 @@ control_get_all_public_ips(struct ctdb_context *ctdb, 
TALLOC_CTX *tmp_ctx, struc
 }
 
 
-/* 
- * scans all other nodes and returns a pnn for another node that can host this 
- * ip

[SCM] CTDB repository - branch master updated - ctdb-2.1-33-g11734be

2013-03-05 Thread Amitay Isaacs
The branch, master has been updated
   via  11734be353a1e246163eda631d35dfe55d1d6fb1 (commit)
   via  3e09f25d419635f6dd679b48fa65370f7860be7d (commit)
  from  5402f85dde045576cbaf64e01c68e28ed52204e8 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 11734be353a1e246163eda631d35dfe55d1d6fb1
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Feb 22 12:59:39 2013 +1100

common/io: For scheduling immediate events use tevent_schedule_immediate

tevent_schedule_immediate() is much more efficient at handling events that 
need
to be processed immediately rather than creating timed events with
timeval_zero().

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 3e09f25d419635f6dd679b48fa65370f7860be7d
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Feb 21 13:16:15 2013 +1100

ctdbd: Add an index db for message list for faster searches

When CTDB is busy with lots of smbd, CTDB was spending too much time in
daemon_check_srvids() which searches a list of srvids in the registered
message handlers.  Using a hash based index significantly improves the
performance of search in a linked list.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 common/ctdb_io.c   |   26 ---
 common/ctdb_message.c  |  205 +---
 include/ctdb_private.h |   13 +++-
 server/ctdb_daemon.c   |8 +--
 4 files changed, 218 insertions(+), 34 deletions(-)


Changeset truncated at 500 lines:

diff --git a/common/ctdb_io.c b/common/ctdb_io.c
index b4224c4..4e592b9 100644
--- a/common/ctdb_io.c
+++ b/common/ctdb_io.c
@@ -45,6 +45,7 @@ struct ctdb_queue_pkt {
 
 struct ctdb_queue {
struct ctdb_context *ctdb;
+   struct tevent_immediate *im;
struct ctdb_buffer buffer; /* input buffer */
struct ctdb_queue_pkt *out_queue, *out_queue_tail;
uint32_t out_queue_length;
@@ -66,8 +67,8 @@ int ctdb_queue_length(struct ctdb_queue *queue)
 
 static void queue_process(struct ctdb_queue *queue);
 
-static void queue_process_event(struct event_context *ev, struct timed_event 
*te,
-   struct timeval t, void *private_data)
+static void queue_process_event(struct tevent_context *ev, struct 
tevent_immediate *im,
+   void *private_data)
 {
struct ctdb_queue *queue = talloc_get_type(private_data, struct 
ctdb_queue);
 
@@ -118,9 +119,9 @@ static void queue_process(struct ctdb_queue *queue)
queue-buffer.length -= pkt_size;
 
if (queue-buffer.length  0) {
-   /* There is more data to be processed, setup timed event */
-   event_add_timed(queue-ctdb-ev, queue, timeval_zero(),
-   queue_process_event, queue);
+   /* There is more data to be processed, schedule an event */
+   tevent_schedule_immediate(queue-im, queue-ctdb-ev,
+ queue_process_event, queue);
}
 
/* It is the responsibility of the callback to free 'data' */
@@ -192,8 +193,8 @@ failed:
 
 
 /* used when an event triggers a dead queue */
-static void queue_dead(struct event_context *ev, struct timed_event *te, 
-  struct timeval t, void *private_data)
+static void queue_dead(struct event_context *ev, struct tevent_immediate *im,
+  void *private_data)
 {
struct ctdb_queue *queue = talloc_get_type(private_data, struct 
ctdb_queue);
queue-callback(NULL, 0, queue-private_data);
@@ -224,8 +225,8 @@ static void queue_io_write(struct ctdb_queue *queue)
talloc_free(queue-fde);
queue-fde = NULL;
queue-fd = -1;
-   event_add_timed(queue-ctdb-ev, queue, timeval_zero(), 
-   queue_dead, queue);
+   tevent_schedule_immediate(queue-im, queue-ctdb-ev,
+ queue_dead, queue);
return;
}
if (n = 0) return;
@@ -291,8 +292,8 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t 
*data, uint32_t length)
talloc_free(queue-fde);
queue-fde = NULL;
queue-fd = -1;
-   event_add_timed(queue-ctdb-ev, queue, timeval_zero(), 
-   queue_dead, queue);
+   tevent_schedule_immediate(queue-im, queue-ctdb-ev,
+ queue_dead, queue);
/* yes, we report success, as the dead node is 
   handled via a separate event */
return 0

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.58-12-g1520ec0

2013-03-05 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  1520ec0262385894c086740f8486b18f29e3fb80 (commit)
   via  c9a55cacc0c41ba95360849a13b987d96cd03731 (commit)
   via  59b9d58655319b515bc20de2529bfec127b4c3ab (commit)
   via  28602eeb613030c49d32156f57614c059b136105 (commit)
   via  8909931f7dd067e5319a0db15fcb6cb0c335f903 (commit)
   via  865fec8f04a6b8f7416903c4d02c188bd39b9683 (commit)
  from  d788857b1c96f78b0ffa4d410a935ec59bef9148 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 1520ec0262385894c086740f8486b18f29e3fb80
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Mar 6 17:48:44 2013 +1100

New Version 1.2.59

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit c9a55cacc0c41ba95360849a13b987d96cd03731
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Feb 18 18:05:28 2013 +1100

ctdbd: Exec lockwait helper for locking a record

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 59b9d58655319b515bc20de2529bfec127b4c3ab
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Feb 18 18:04:07 2013 +1100

ctdbd: Create a standalone helper for record locking

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 28602eeb613030c49d32156f57614c059b136105
Author: Stefan Metzmacher me...@samba.org
Date:   Fri Feb 22 12:45:39 2013 +0100

tevent: optimize adding new timer events

There're two cases:

1. Adding a timer with a zero timestamp.
   Such events were used before we had immediate events.
   It's likely that there're a lot of this events
   and we need to add new ones in fifo order.

2. Adding a timer with a real timestamp.
   As this timestamps typically get higher:-)
   it's better to traverse the existing list from
   the tail.

This is not completely optimal, but it should be better
than before.

Signed-off-by: Stefan Metzmacher me...@samba.org

commit 8909931f7dd067e5319a0db15fcb6cb0c335f903
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Feb 22 12:59:39 2013 +1100

common/io: For scheduling immediate events use tevent_schedule_immediate

tevent_schedule_immediate() is much more efficient at handling events that 
need
to be processed immediately rather than creating timed events with
timeval_zero().

Signed-off-by: Amitay Isaacs ami...@gmail.com

Cherry-pick-from: 11734be353a1e246163eda631d35dfe55d1d6fb1

commit 865fec8f04a6b8f7416903c4d02c188bd39b9683
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Feb 21 13:16:15 2013 +1100

ctdbd: Add an index db for message list for faster searches

When CTDB is busy with lots of smbd, CTDB was spending too much time in
daemon_check_srvids() which searches a list of srvids in the registered
message handlers.  Using a hash based index significantly improves the
performance of search in a linked list.

Signed-off-by: Amitay Isaacs ami...@gmail.com

Cherry-pick-from: 3e09f25d419635f6dd679b48fa65370f7860be7d

---

Summary of changes:
 Makefile.in   |9 ++-
 common/ctdb_io.c  |   26 +++--
 common/ctdb_message.c |  205 ++---
 include/ctdb_private.h|   13 ++-
 lib/tevent/tevent.c   |1 +
 lib/tevent/tevent_internal.h  |1 +
 lib/tevent/tevent_timed.c |   62 +++--
 packaging/RPM/ctdb.spec.in|   10 ++-
 server/ctdb_daemon.c  |8 +--
 server/ctdb_lockwait.c|  105 +++---
 server/ctdb_lockwait_helper.c |  177 +++
 11 files changed, 559 insertions(+), 58 deletions(-)
 create mode 100644 server/ctdb_lockwait_helper.c


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 849abd7..9c4f555 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -32,7 +32,7 @@ POPT_OBJ = @POPT_OBJ@
 CFLAGS=-g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \
-I@tallocdir@ -I@tdbdir@/include -I@libreplacedir@ \
-DVARDIR=\$(localstatedir)\ -DETCDIR=\$(etcdir)\ \
-   -DLOGDIR=\$(logdir)\ \
+   -DLOGDIR=\$(logdir)\ -DBINDIR=\$(bindir)\ \
-DUSE_MMAP=1 @CFLAGS@ $(POPT_CFLAGS)
 
 LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) @INFINIBAND_LIBS@ 
@CTDB_PCAP_LDFLAGS@
@@ -75,7 +75,7 @@ TEST_BINS=tests/bin/ctdb_bench tests/bin/ctdb_fetch 
tests/bin/ctdb_fetch_one \
tests/bin/ctdb_takeover_tests tests/bin/ctdb_update_record \
@INFINIBAND_BINS@
 
-BINS = bin/ctdb @CTDB_SCSI_IO@ bin/smnotify bin/ping_pong bin/ltdbtool
+BINS = bin/ctdb @CTDB_SCSI_IO@ bin/smnotify bin/ping_pong bin/ltdbtool 
bin/ctdb_lockwait_helper
 SBINS = bin/ctdbd
 
 DIRS = lib bin tests/bin
@@ -112,6 +112,10 @@ bin/ctdbd: $(CTDB_SERVER_OBJ)
@echo Linking $@
@$(CC) $(CFLAGS) -o $@ $(CTDB_SERVER_OBJ

[SCM] CTDB repository - annotated tag ctdb-1.2.59 created - ctdb-1.2.59

2013-03-05 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.59 has been created
at  bc0110710fe623b50df855a10649ea7e71365edc (tag)
   tagging  1520ec0262385894c086740f8486b18f29e3fb80 (commit)
  replaces  ctdb-1.2.58
 tagged by  Amitay Isaacs
on  Wed Mar 6 18:18:47 2013 +1100

- Log -
new version 1.2.59

Amitay Isaacs (7):
  ctdbd: Use the correct local variable to check status
  ctdbd: Remove the variable declaration shadowing earlier declaration
  ctdbd: Add an index db for message list for faster searches
  common/io: For scheduling immediate events use tevent_schedule_immediate
  ctdbd: Create a standalone helper for record locking
  ctdbd: Exec lockwait helper for locking a record
  New Version 1.2.59

Martin Schwenke (3):
  client: New generic node listing function list_of_nodes()
  recoverd: Do not send ipreallocated event to stopped nodes
  tools/ctdb: delip no longer fails if IP can not be moved

Stefan Metzmacher (1):
  tevent: optimize adding new timer events

Volker Lendecke (1):
  ctdbd: Fix a struct initializer

---


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.58-5-g49bab58

2013-02-27 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  49bab583f430b5c06178c2cd114d2362cf1d606c (commit)
   via  b129e5223eb77a08b8ee3d36aa59d36957699971 (commit)
  from  158a1e8d045c4b65dd3f52eb70535e446ec4fb48 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 49bab583f430b5c06178c2cd114d2362cf1d606c
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Feb 18 16:32:14 2013 +1100

recoverd: Do not send ipreallocated event to stopped nodes

Stopped nodes will reject ipreallocated because they are in
recovery, so they will eventually be banned.

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Cherry-pick-from: c270381ee81903ff459a8b23fd57c997d038cf14

commit b129e5223eb77a08b8ee3d36aa59d36957699971
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 19 14:29:06 2013 +1100

client: New generic node listing function list_of_nodes()

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Cherry-pick-from: a73bb56991b8c07ed0e9517ffcf0dc264be30487

---

Summary of changes:
 client/ctdb_client.c   |   38 ++
 include/ctdb_client.h  |5 +
 server/ctdb_takeover.c |   13 ++---
 3 files changed, 53 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 739c21b..4a02ae5 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -3408,6 +3408,44 @@ uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb,
return nodes;
 }
 
+/* Get list of nodes not including those with flags specified by mask.
+ * If exclude_pnn is not -1 then exclude that pnn from the list.
+ */
+uint32_t *list_of_nodes(struct ctdb_context *ctdb,
+   struct ctdb_node_map *node_map,
+   TALLOC_CTX *mem_ctx,
+   uint32_t mask,
+   int exclude_pnn)
+{
+   int i, j, num_nodes;
+   uint32_t *nodes;
+
+   for (i=num_nodes=0;inode_map-num;i++) {
+   if (node_map-nodes[i].flags  mask) {
+   continue;
+   }
+   if (node_map-nodes[i].pnn == exclude_pnn) {
+   continue;
+   }
+   num_nodes++;
+   } 
+
+   nodes = talloc_array(mem_ctx, uint32_t, num_nodes);
+   CTDB_NO_MEMORY_FATAL(ctdb, nodes);
+
+   for (i=j=0;inode_map-num;i++) {
+   if (node_map-nodes[i].flags  mask) {
+   continue;
+   }
+   if (node_map-nodes[i].pnn == exclude_pnn) {
+   continue;
+   }
+   nodes[j++] = node_map-nodes[i].pnn;
+   } 
+
+   return nodes;
+}
+
 uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
struct ctdb_node_map *node_map,
TALLOC_CTX *mem_ctx,
diff --git a/include/ctdb_client.h b/include/ctdb_client.h
index ad31d24..69467c5 100644
--- a/include/ctdb_client.h
+++ b/include/ctdb_client.h
@@ -490,6 +490,11 @@ int ctdb_ctrl_setreclock(struct ctdb_context *ctdb,
const char *reclock);
 
 
+uint32_t *list_of_nodes(struct ctdb_context *ctdb,
+   struct ctdb_node_map *node_map,
+   TALLOC_CTX *mem_ctx,
+   uint32_t mask,
+   int exclude_pnn);
 uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
struct ctdb_node_map *node_map,
TALLOC_CTX *mem_ctx,
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 83b9347..5704b09 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -2125,11 +2125,18 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct 
ctdb_node_map *nodemap,
}
 
 ipreallocated:
-   /* tell all nodes to update natwg */
-   /* send the flags update natgw on all connected nodes */
+   /*
+* Tell all connected, but not stopped (since they are in
+* recovery and will reject the event), nodes to run
+* eventscripts to process the ipreallocated event.  This
+* can do a lot of things, including restarting services to
+* reconfigure them if public IPs have moved.  Once upon a
+* time this event only used to update natwg.
+*/
data.dptr  = discard_const(ipreallocated);
data.dsize = strlen((char *)data.dptr) + 1; 
-   nodes = list_of_connected_nodes(ctdb, nodemap, tmp_ctx, true);
+   nodes = list_of_nodes(ctdb, nodemap, tmp_ctx,
+ NODE_FLAGS_DISCONNECTED|NODE_FLAGS_STOPPED, -1);
if (ctdb_client_async_control(ctdb

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.58-3-g158a1e8

2013-02-21 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  158a1e8d045c4b65dd3f52eb70535e446ec4fb48 (commit)
   via  9db4a482ac8910a3dd1d4109d156420ced3551b3 (commit)
   via  c668d5d2d3111bd0e89159c432d191e09661435f (commit)
  from  44558223c2f83cafbe4ee63b4ce3d508dc7f0a02 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 158a1e8d045c4b65dd3f52eb70535e446ec4fb48
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Feb 22 12:28:56 2013 +1100

ctdbd: Remove the variable declaration shadowing earlier declaration

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 9db4a482ac8910a3dd1d4109d156420ced3551b3
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Feb 22 12:28:25 2013 +1100

ctdbd: Use the correct local variable to check status

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit c668d5d2d3111bd0e89159c432d191e09661435f
Author: Volker Lendecke v...@samba.org
Date:   Wed Feb 20 10:46:47 2013 +0100

ctdbd: Fix a struct initializer

---

Summary of changes:
 server/ctdb_ltdb_server.c |2 +-
 server/ctdb_persistent.c  |8 
 server/ctdb_tunables.c|2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index dc93c3f..c9cf021 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
@@ -257,7 +257,7 @@ store:
if (schedule_for_deletion) {
int ret2;
ret2 = ctdb_local_schedule_for_deletion(ctdb_db, header, key);
-   if (ret != 0) {
+   if (ret2 != 0) {
DEBUG(DEBUG_ERR, (__location__  
ctdb_local_schedule_for_deletion failed.\n));
}
}
diff --git a/server/ctdb_persistent.c b/server/ctdb_persistent.c
index 5a31101..eb7f65d 100644
--- a/server/ctdb_persistent.c
+++ b/server/ctdb_persistent.c
@@ -477,13 +477,13 @@ static int ctdb_persistent_store(struct 
ctdb_persistent_write_state *state)
   ctdb_ltdb_fetch will unconditionally create a record
 */
if (state-flags  UPDATE_FLAGS_REPLACE_ONLY) {
-   TDB_DATA rec;
-   rec = tdb_fetch(state-ctdb_db-ltdb-tdb, key);
-   if (rec.dsize == 0) {
+   TDB_DATA rec2;
+   rec2 = tdb_fetch(state-ctdb_db-ltdb-tdb, key);
+   if (rec2.dsize == 0) {
talloc_free(tmp_ctx);
continue;
}
-   free(rec.dptr);
+   free(rec2.dptr);
}
 
/* fetch the old header and ensure the rsn is less than the new 
rsn */
diff --git a/server/ctdb_tunables.c b/server/ctdb_tunables.c
index 4c7146e..a8e8e23 100644
--- a/server/ctdb_tunables.c
+++ b/server/ctdb_tunables.c
@@ -73,7 +73,7 @@ static const struct {
{ DeferredRebalanceOnNodeAdd, 300, offsetof(struct ctdb_tunable, 
deferred_rebalance_on_node_add) },
{ RecoverPDBBySeqNum,  1, offsetof(struct ctdb_tunable, 
recover_pdb_by_seqnum) },
{ FetchCollapse,   1, offsetof(struct ctdb_tunable, 
fetch_collapse) },
-   { PullDBPreallocation, 10*1024*1024,  offsetof(struct ctdb_tunable, 
pulldb_preallocation_size), false },
+   { PullDBPreallocation, 10*1024*1024,  offsetof(struct ctdb_tunable, 
pulldb_preallocation_size) },
 };
 
 /*


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-29-g4f71dca

2013-02-19 Thread Amitay Isaacs
The branch, master has been updated
   via  4f71dca8df19a63f198e2d6d59e605b49ec5e803 (commit)
   via  f505020a5720faa4ecc6414e0bfaa6b3c0e47291 (commit)
   via  a73bb56991b8c07ed0e9517ffcf0dc264be30487 (commit)
  from  d788bc8f7212b7dc1587ae592242dc8c876f4053 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 4f71dca8df19a63f198e2d6d59e605b49ec5e803
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Feb 18 16:39:00 2013 +1100

recoverd: update_capabilities() should use connected nodes

... as the comment says... not just active nodes.

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

commit f505020a5720faa4ecc6414e0bfaa6b3c0e47291
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 19 14:30:50 2013 +1100

client: Refactor node listing functions to use list_of_nodes()

This reduces repetition.

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

commit a73bb56991b8c07ed0e9517ffcf0dc264be30487
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 19 14:29:06 2013 +1100

client: New generic node listing function list_of_nodes()

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 client/ctdb_client.c   |   86 +--
 include/ctdb_client.h  |5 +++
 server/ctdb_recoverd.c |2 +-
 3 files changed, 30 insertions(+), 63 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index d7c3031..d2cf0f6 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -3451,19 +3451,23 @@ uint32_t *list_of_vnnmap_nodes(struct ctdb_context 
*ctdb,
return nodes;
 }
 
-uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
-   struct ctdb_node_map *node_map,
-   TALLOC_CTX *mem_ctx,
-   bool include_self)
+/* Get list of nodes not including those with flags specified by mask.
+ * If exclude_pnn is not -1 then exclude that pnn from the list.
+ */
+uint32_t *list_of_nodes(struct ctdb_context *ctdb,
+   struct ctdb_node_map *node_map,
+   TALLOC_CTX *mem_ctx,
+   uint32_t mask,
+   int exclude_pnn)
 {
int i, j, num_nodes;
uint32_t *nodes;
 
for (i=num_nodes=0;inode_map-num;i++) {
-   if (node_map-nodes[i].flags  NODE_FLAGS_INACTIVE) {
+   if (node_map-nodes[i].flags  mask) {
continue;
}
-   if (node_map-nodes[i].pnn == ctdb-pnn  !include_self) {
+   if (node_map-nodes[i].pnn == exclude_pnn) {
continue;
}
num_nodes++;
@@ -3473,10 +3477,10 @@ uint32_t *list_of_active_nodes(struct ctdb_context 
*ctdb,
CTDB_NO_MEMORY_FATAL(ctdb, nodes);
 
for (i=j=0;inode_map-num;i++) {
-   if (node_map-nodes[i].flags  NODE_FLAGS_INACTIVE) {
+   if (node_map-nodes[i].flags  mask) {
continue;
}
-   if (node_map-nodes[i].pnn == ctdb-pnn  !include_self) {
+   if (node_map-nodes[i].pnn == exclude_pnn) {
continue;
}
nodes[j++] = node_map-nodes[i].pnn;
@@ -3485,38 +3489,21 @@ uint32_t *list_of_active_nodes(struct ctdb_context 
*ctdb,
return nodes;
 }
 
+uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
+   struct ctdb_node_map *node_map,
+   TALLOC_CTX *mem_ctx,
+   bool include_self)
+{
+   return list_of_nodes(ctdb, node_map, mem_ctx, NODE_FLAGS_INACTIVE,
+include_self ? -1 : ctdb-pnn);
+}
+
 uint32_t *list_of_active_nodes_except_pnn(struct ctdb_context *ctdb,
struct ctdb_node_map *node_map,
TALLOC_CTX *mem_ctx,
uint32_t pnn)
 {
-   int i, j, num_nodes;
-   uint32_t *nodes;
-
-   for (i=num_nodes=0;inode_map-num;i++) {
-   if (node_map-nodes[i].flags  NODE_FLAGS_INACTIVE) {
-   continue;
-   }
-   if (node_map-nodes[i].pnn == pnn) {
-   continue;
-   }
-   num_nodes++;
-   } 
-
-   nodes = talloc_array(mem_ctx, uint32_t, num_nodes);
-   CTDB_NO_MEMORY_FATAL(ctdb, nodes);
-
-   for (i=j=0;inode_map-num;i++) {
-   if (node_map-nodes[i].flags  NODE_FLAGS_INACTIVE

[SCM] CTDB repository - annotated tag ctdb-1.2.39-7 created - ctdb-1.2.39-7

2013-02-19 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.39-7 has been created
at  09046ea2675b187b95c6e604952bafb629e6c4bd (tag)
   tagging  12c9737e00f548599ea88b644b625be72466bb8b (commit)
  replaces  ctdb-1.9.1
 tagged by  Amitay Isaacs
on  Wed Dec 5 11:32:26 2012 +1100

- Log -
new version 1.2.39-7

Amitay Isaacs (7):
  New version 1.2.39-4
  Revert Add a tunable variable to control how long we defer after a ctdb 
addip until we force a rebalance and try to failback addresses onto this node
  Revert 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.
  New version 1.2.39-5
  daemon: Do not ignore timed out monitor events
  recoverd: Track the nodes that fail takeover run and set culprit count
  New version 1.2.39-7

Andrew Tridgell (1):
  tdb: added TDB_NO_FSYNC env variable

Chandra Seetharaman (1):
  make changes to ctdb event scripts to support NFS-Ganesha.

Christian Ambach (1):
  improve timing issue detections

David Disseldorp (1):
  io: Make queue_io_read() safe for reentry

Evan Kinney (1):
  ctdb: Fixed use of reserved word private in typedefs

Gregor Beck (4):
  ctdb catdb: fix escaping of '' and '\'
  add ltdbtool - a standalone ltdb tool
  ltdbtool: add manpage
  ltdbtool: add manpage html + roff

Günther Deschner (1):
  lib/tdb: fix c++ build warning in tdb_header_hash().

Harald Klatte (1):
  AIX bind wants the correct addrsize

Jelmer Vernooij (3):
  pytdb: Make filename argument optional.
  pytdb: Include Python.h first to prevent warning.
  pytdb: Add __version__ attribute.

Kirill Smelkov (9):
  pytdb: Add support for tdb_add_flags()  tdb_remove_flags()
  pytdb: Fix repr segfault for internal db
  pytdb: Update open flags to match those for tdb_open() in tdb.h
  pytdb: Add support for tdb_enable_seqnum, tdb_get_seqnum and 
tdb_increment_seqnum_nonblock
  pytdb: Add support for tdb_transaction_prepare_commit()
  pytdb: Add support for tdb_freelist_size()
  pytdb: Add TDB_INCOMPATIBLE_HASH open flag
  pytdb: Add support for tdb_repack()
  pytdb: Check errors after PyObject_New() calls

Martin Schwenke (89):
  Test suite: handle change to disconnected node error message.
  Test suite: handle extra lines in statistics output.
  Optimise 61.nfstickle to write the tickles more efficiently.
  Testing: Add Python IP allocation simulation.
  Test suite: handle change to disconnected node error message.
  Test suite: handle extra lines in statistics output.
  Optimise 61.nfstickle to write the tickles more efficiently.
  Testing: Add Python IP allocation simulation.
  Merge branch 'master' of git://git.samba.org/sahlberg/ctdb
  Testing: Add imbalance information to IP allocation simulation.
  Testing: In IP allocation simulation count total number of events.
  Testing: IP allocation simulation prints final imbalance in statistics.
  Testing: IP allocation simulation - save some warnings for verbose mode.
  Testing: IP allocation simulation - add command line option for random 
seed.
  Testing: IP allocation simulation - update copyright message.
  Testing: IP allocation simulation - Tweak options handling and 
Cluster.diff().
  Testing: IP allocation simulation - fix nondeterminism in 
do_something_random().
  Testing: IP allocation simulation - Update README.
  Testing: IP allocation simulation - update options processing in examples.
  Testing: IP allocation simulation - add general node group example.
  Testing: IP allocation simulation - rename an example to 
node_group_simple.py.
  Testing: IP allocation simulation - rename an example to 
node_group_extra.py.
  Testing: IP allocation simulation - make usage/failure more obvious.
  Testing: IP allocation simulation - improve help for options.
  Testing: IP allocation simulation - print maximum number of unhealthy 
nodes.
  Testing: IP allocation simulation - clean up usage message.
  Testing: IP allocation simulation - add option to change odds of a 
failure.
  Test suite - try to make addip test more reliable and add some debugging.
  Merge remote branch 'martins/master'
  Test suite - fix addip test.
  Test suite: remove thaw/freeze tests.
  Test suite - make the ctdb_fetch test cope with Reqid wrap! messages.
  initscript: wait until we can ping ctdbd before setting tunables.
  Test suite: weaken ctdb continue/enable tests for non-deterministic IPs.
  Test suite: Fix typo in continue test.
  Test suite: remove unnecessary verbosity from enable/continue tests.
  Add some command-line options to ctdb_diagnostics.
  Test suite: make addip test use $CTDB rather than ctdb in debug code.
  Test

[SCM] CTDB repository - branch 1.2.39 updated - ctdb-1.2.39-7-3-ga1c04ba

2013-02-19 Thread Amitay Isaacs
The branch, 1.2.39 has been updated
   via  a1c04ba95aa21837b8388f91480122e3349d3e92 (commit)
   via  c270381ee81903ff459a8b23fd57c997d038cf14 (commit)
   via  61ac25e266d101c1ac979a4f3c765d4536cd7ccb (commit)
  from  12c9737e00f548599ea88b644b625be72466bb8b (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.39


- Log -
commit a1c04ba95aa21837b8388f91480122e3349d3e92
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Feb 20 15:53:17 2013 +1100

New version 1.2.39-8

Signed-off-by: Martin Schwenke mar...@meltin.net

commit c270381ee81903ff459a8b23fd57c997d038cf14
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Feb 18 16:32:14 2013 +1100

recoverd: Do not send ipreallocated event to stopped nodes

Stopped nodes will reject ipreallocated because they are in
recovery, so they will eventually be banned.

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

commit 61ac25e266d101c1ac979a4f3c765d4536cd7ccb
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 19 14:29:06 2013 +1100

client: New generic node listing function list_of_nodes()

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Cherry-pick-from: a73bb56991b8c07ed0e9517ffcf0dc264be30487

---

Summary of changes:
 client/ctdb_client.c   |   38 ++
 include/ctdb_client.h  |5 +
 packaging/RPM/ctdb.spec.in |4 +++-
 server/ctdb_takeover.c |   13 ++---
 4 files changed, 56 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 5e06604..7e2dd4a 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -3176,6 +3176,44 @@ uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb,
return nodes;
 }
 
+/* Get list of nodes not including those with flags specified by mask.
+ * If exclude_pnn is not -1 then exclude that pnn from the list.
+ */
+uint32_t *list_of_nodes(struct ctdb_context *ctdb,
+   struct ctdb_node_map *node_map,
+   TALLOC_CTX *mem_ctx,
+   uint32_t mask,
+   int exclude_pnn)
+{
+   int i, j, num_nodes;
+   uint32_t *nodes;
+
+   for (i=num_nodes=0;inode_map-num;i++) {
+   if (node_map-nodes[i].flags  mask) {
+   continue;
+   }
+   if (node_map-nodes[i].pnn == exclude_pnn) {
+   continue;
+   }
+   num_nodes++;
+   } 
+
+   nodes = talloc_array(mem_ctx, uint32_t, num_nodes);
+   CTDB_NO_MEMORY_FATAL(ctdb, nodes);
+
+   for (i=j=0;inode_map-num;i++) {
+   if (node_map-nodes[i].flags  mask) {
+   continue;
+   }
+   if (node_map-nodes[i].pnn == exclude_pnn) {
+   continue;
+   }
+   nodes[j++] = node_map-nodes[i].pnn;
+   } 
+
+   return nodes;
+}
+
 uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
struct ctdb_node_map *node_map,
TALLOC_CTX *mem_ctx,
diff --git a/include/ctdb_client.h b/include/ctdb_client.h
index 3dc115f..9498791 100644
--- a/include/ctdb_client.h
+++ b/include/ctdb_client.h
@@ -486,6 +486,11 @@ int ctdb_ctrl_setreclock(struct ctdb_context *ctdb,
const char *reclock);
 
 
+uint32_t *list_of_nodes(struct ctdb_context *ctdb,
+   struct ctdb_node_map *node_map,
+   TALLOC_CTX *mem_ctx,
+   uint32_t mask,
+   int exclude_pnn);
 uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
struct ctdb_node_map *node_map,
TALLOC_CTX *mem_ctx,
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 5165c5c..1d9781d 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -4,7 +4,7 @@ Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team sa...@samba.org
 Version: 1.2.39
-Release: 7GITHASH
+Release: 8GITHASH
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
@@ -144,6 +144,8 @@ development libraries for ctdb
 %{_libdir}/libctdb.a
 
 %changelog
+* Wed Feb 20 2013 : version 1.2.39-8
+  - Don't send ipreallocate events to stopped nodes
 * Fri Nov 30 2012 : version 1.2.39-7
   - Do not ignore timed out monitor events
   - Track the nodes that fail takeover run and set culprit count
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index e17b481..1e8dc75 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -2074,11 +2074,18 @@ int

[SCM] CTDB repository - annotated tag ctdb-1.2.39-8 created - ctdb-1.2.39-8

2013-02-19 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.39-8 has been created
at  ffaede0198a519f8ab3c0c0f03458edf9f1d08eb (tag)
   tagging  a1c04ba95aa21837b8388f91480122e3349d3e92 (commit)
  replaces  ctdb-1.2.39-7
 tagged by  Martin Schwenke
on  Wed Feb 20 15:57:31 2013 +1100

- Log -
new version 1.2.39-8

Martin Schwenke (3):
  client: New generic node listing function list_of_nodes()
  recoverd: Do not send ipreallocated event to stopped nodes
  New version 1.2.39-8

---


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-26-gd788bc8

2013-02-18 Thread Amitay Isaacs
The branch, master has been updated
   via  d788bc8f7212b7dc1587ae592242dc8c876f4053 (commit)
  from  855ab348901edb3ec1327499a43f509d279b8182 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit d788bc8f7212b7dc1587ae592242dc8c876f4053
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Jan 18 10:42:14 2013 +1100

common/io: Rewrite socket handling code to read all available data

This improves the processing of packets considerably.  It has been
observed that there can be as many as 10 packets in the socket buffer and
the current code of reading a single packet from a socket at a time is
not very optimal.  This change reads all the bytes from socket buffer and
then parses to extract multiple packets.  If there are multiple packets,
set up a timed event to process next packet.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 common/ctdb_io.c |  160 +++---
 1 files changed, 92 insertions(+), 68 deletions(-)


Changeset truncated at 500 lines:

diff --git a/common/ctdb_io.c b/common/ctdb_io.c
index 3ac1b63..b4224c4 100644
--- a/common/ctdb_io.c
+++ b/common/ctdb_io.c
@@ -30,9 +30,10 @@
 #include stdarg.h
 
 /* structures for packet queueing - see common/ctdb_io.c */
-struct ctdb_partial {
+struct ctdb_buffer {
uint8_t *data;
uint32_t length;
+   uint32_t size;
 };
 
 struct ctdb_queue_pkt {
@@ -44,7 +45,7 @@ struct ctdb_queue_pkt {
 
 struct ctdb_queue {
struct ctdb_context *ctdb;
-   struct ctdb_partial partial; /* partial input packet */
+   struct ctdb_buffer buffer; /* input buffer */
struct ctdb_queue_pkt *out_queue, *out_queue_tail;
uint32_t out_queue_length;
struct fd_event *fde;
@@ -63,6 +64,75 @@ int ctdb_queue_length(struct ctdb_queue *queue)
return queue-out_queue_length;
 }
 
+static void queue_process(struct ctdb_queue *queue);
+
+static void queue_process_event(struct event_context *ev, struct timed_event 
*te,
+   struct timeval t, void *private_data)
+{
+   struct ctdb_queue *queue = talloc_get_type(private_data, struct 
ctdb_queue);
+
+   queue_process(queue);
+}
+
+/*
+ * This function is used to process data in queue buffer.
+ *
+ * Queue callback function can end up freeing the queue, there should not be a
+ * loop processing packets from queue buffer.  Instead set up a timed event for
+ * immediate run to process remaining packets from buffer.
+ */
+static void queue_process(struct ctdb_queue *queue)
+{
+   uint32_t pkt_size;
+   uint8_t *data;
+
+   if (queue-buffer.length  sizeof(pkt_size)) {
+   return;
+   }
+
+   pkt_size = *(uint32_t *)queue-buffer.data;
+   if (pkt_size == 0) {
+   DEBUG(DEBUG_CRIT, (Invalid packet of length 0\n));
+   goto failed;
+   }
+
+   if (queue-buffer.length  pkt_size) {
+   DEBUG(DEBUG_DEBUG, (Partial packet data read\n));
+   return;
+   }
+
+   /* Extract complete packet */
+   data = talloc_size(queue, pkt_size);
+   if (data == NULL) {
+   DEBUG(DEBUG_ERR, (read error alloc failed for %u\n, 
pkt_size));
+   return;
+   }
+   memcpy(data, queue-buffer.data, pkt_size);
+
+   /* Shift packet out from buffer */
+   if (queue-buffer.length  pkt_size) {
+   memmove(queue-buffer.data,
+   queue-buffer.data + pkt_size,
+   queue-buffer.length - pkt_size);
+   }
+   queue-buffer.length -= pkt_size;
+
+   if (queue-buffer.length  0) {
+   /* There is more data to be processed, setup timed event */
+   event_add_timed(queue-ctdb-ev, queue, timeval_zero(),
+   queue_process_event, queue);
+   }
+
+   /* It is the responsibility of the callback to free 'data' */
+   queue-callback(data, pkt_size, queue-private_data);
+   return;
+
+failed:
+   queue-callback(NULL, 0, queue-private_data);
+
+}
+
+
 /*
   called when an incoming connection is readable
   This function MUST be safe for reentry via the queue callback!
@@ -70,10 +140,6 @@ int ctdb_queue_length(struct ctdb_queue *queue)
 static void queue_io_read(struct ctdb_queue *queue)
 {
int num_ready = 0;
-   uint32_t sz_bytes_req;
-   uint32_t pkt_size;
-   uint32_t pkt_bytes_remaining;
-   uint32_t to_read;
ssize_t nread;
uint8_t *data;
 
@@ -91,77 +157,33 @@ static void queue_io_read(struct ctdb_queue *queue)
goto failed;
}
 
-   if (queue-partial.data == NULL) {
-   /* starting fresh, allocate buf for size bytes */
-   sz_bytes_req = sizeof(pkt_size

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.57-7-g4455822

2013-02-18 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  44558223c2f83cafbe4ee63b4ce3d508dc7f0a02 (commit)
   via  9d8338fc14cfa5f4d8236eccb90ffdd4cdc11343 (commit)
   via  c6e1b84595039edb5c49a5851b440710dc0e2ac1 (commit)
   via  aae948c3c2ce1d2678ce57b4219674bafda5008e (commit)
   via  4697a83866a04357d386473a50685f677a730daf (commit)
   via  1cbdb44d604461509676b903a9e9515e7cab2598 (commit)
   via  537bed11c339a10faf45a6ede778f7c8e26e4f91 (commit)
  from  584e8c25971219614f3f2bfd5be233b04de7e0af (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 44558223c2f83cafbe4ee63b4ce3d508dc7f0a02
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Feb 19 18:09:05 2013 +1100

New Version 1.2.58

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 9d8338fc14cfa5f4d8236eccb90ffdd4cdc11343
Author: Ronnie Sahlberg ronniesahlb...@gmail.com
Date:   Fri May 25 12:27:59 2012 +1000

RECOVER: When we pull databases during recovery, we used to reallocate the 
databuffer for each entry added. This would normally not be an issue, but for 
cases where memory is fragmented, this could start to cost significant cpu if 
we need to reallocate and move to a different region.

Change this to instead preallocate , by default, 10MByte chunks to the data 
buffer.
This significantly reduces the number of potential reallocate and move  
operations that may be required.

Create a tunable to override/change how much preallocation should be used.

Conflicts:
include/ctdb_private.h
server/ctdb_tunables.c

Cherry-pick-from: 1f262deaad0818f159f9c68330f7fec121679023

Also, make sure the preallocation size is 10MB and not 100MB.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit c6e1b84595039edb5c49a5851b440710dc0e2ac1
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 12:09:36 2013 +1100

Logging: Free the ringbuffer in child processes created with ctdb_fork()

At the moment the log ringbuffer is duplicated in every child process.
Althought it is copy-on-write we want to see if it is contributing to
out-of-memory situations when there are a lot of children.

The ringbuffer isn't accessible from any of the children anyway...

Signed-off-by: Martin Schwenke mar...@meltin.net

Conflicts:
common/ctdb_fork.c

Cherry-pick-from: a82d3ec12f0fda16d6bfa8442a07595de897c10e

commit aae948c3c2ce1d2678ce57b4219674bafda5008e
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 12:08:11 2013 +1100

Logging: New function ctdb_log_ringbuffer_free()

Signed-off-by: Martin Schwenke mar...@meltin.net

Cherry-pick-from: a4f622e85168f59417c11705f1734e0352e1d44a

commit 4697a83866a04357d386473a50685f677a730daf
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Feb 11 11:25:49 2013 +1100

eventscripts: Remove calls to smbstatus -np for samba cleanup

This is an artifact from older versions of Samba. In the newer versions of
Samba, smbstatus -np command does not do anything useful, but causes a
traverse in CTDB which is expensive and causes CPU utilization to shoot up.

Signed-off-by: Amitay Isaacs ami...@gmail.com

Conflicts:
config/events.d/50.samba

Cherry-pick-from: 053b89c6dbce47001505524606889334559d2ec4

commit 1cbdb44d604461509676b903a9e9515e7cab2598
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Jan 18 10:42:14 2013 +1100

common/io: Rewrite socket handling code to read all available data

This improves the processing of packets considerably.  It has been
observed that there can be as many as 10 packets in the socket buffer and
the current code of reading a single packet from a socket at a time is
not very optimal.  This change reads all the bytes from socket buffer and
then parses to extract multiple packets.  If there are multiple packets,
set up a timed event to process next packet.

Signed-off-by: Amitay Isaacs ami...@gmail.com

Cherry-pick-from: d788bc8f7212b7dc1587ae592242dc8c876f4053

Conflicts:
common/ctdb_io.c

commit 537bed11c339a10faf45a6ede778f7c8e26e4f91
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Jan 22 13:27:20 2013 +1100

daemon: Make sure all the traverse children are terminated if traverse 
times out

When traverse times out, callback function is called with key and data set 
to
tdb_null.  This is also the way to signal end of traverse.  So if the 
traverse
times out, callback function treats it as traverse ended and frees state 
without
calling the destructor.

Keep track if the traverse timed out, so callback function can take 
appropriate
action for traverse timeout and traverse end.

Signed-off-by: Amitay Isaacs ami...@gmail.com

Cherry-pick-from

[SCM] CTDB repository - annotated tag ctdb-1.2.58 created - ctdb-1.2.58

2013-02-18 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.58 has been created
at  347a504424435225d8829edb9e04d24349bfee77 (tag)
   tagging  44558223c2f83cafbe4ee63b4ce3d508dc7f0a02 (commit)
  replaces  ctdb-1.2.57
 tagged by  Amitay Isaacs
on  Tue Feb 19 18:10:12 2013 +1100

- Log -
new version 1.2.58

Amitay Isaacs (4):
  daemon: Make sure all the traverse children are terminated if traverse 
times out
  common/io: Rewrite socket handling code to read all available data
  eventscripts: Remove calls to smbstatus -np for samba cleanup
  New Version 1.2.58

Martin Schwenke (2):
  Logging: New function ctdb_log_ringbuffer_free()
  Logging: Free the ringbuffer in child processes created with ctdb_fork()

Ronnie Sahlberg (1):
  RECOVER: When we pull databases during recovery, we used to reallocate 
the databuffer for each entry added. This would normally not be an issue, but 
for cases where memory is fragmented, this could start to cost significant cpu 
if we need to reallocate and move to a different region.

---


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-25-g855ab34

2013-02-14 Thread Amitay Isaacs
The branch, master has been updated
   via  855ab348901edb3ec1327499a43f509d279b8182 (commit)
  from  e204fac03412520e877ab04363b3ece02667c55b (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 855ab348901edb3ec1327499a43f509d279b8182
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Feb 15 11:18:45 2013 +1100

doc: Fix typo in ctdbd manpage

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 doc/ctdbd.1.xml |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/doc/ctdbd.1.xml b/doc/ctdbd.1.xml
index accc154..18fddc2 100644
--- a/doc/ctdbd.1.xml
+++ b/doc/ctdbd.1.xml
@@ -1099,7 +1099,7 @@
 /para
 /refsect2
 
-refsect2titleSamba3AvoidDeadlock/title
+refsect2titleSamba3AvoidDeadlocks/title
 paraDefault: 0/para
 para
 Enable code that prevents deadlocks with Samba (only for Samba 3.x).


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-24-ge204fac

2013-02-13 Thread Amitay Isaacs
The branch, master has been updated
   via  e204fac03412520e877ab04363b3ece02667c55b (commit)
   via  053b89c6dbce47001505524606889334559d2ec4 (commit)
  from  00db5fa00474f8a83f1aa3b603fd756cc9b49ff4 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit e204fac03412520e877ab04363b3ece02667c55b
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Feb 11 13:23:47 2013 +1100

ctdbd: Fix the PullDBPreallocation size to 10MB as intended

In 1f262deaad0818f159f9c68330f7fec121679023, Ronnie changed recovery code
to allocate chunks of 10MB in traverse_pulldb() and traverse_recdb().  The
tunable PullDBPreallocation size was set to 100MB.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 053b89c6dbce47001505524606889334559d2ec4
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Feb 11 11:25:49 2013 +1100

eventscripts: Remove calls to smbstatus -np for samba cleanup

This is an artifact from older versions of Samba. In the newer versions of
Samba, smbstatus -np command does not do anything useful, but causes a
traverse in CTDB which is expensive and causes CPU utilization to shoot up.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 config/events.d/50.samba |   32 +++-
 server/ctdb_tunables.c   |2 +-
 2 files changed, 4 insertions(+), 30 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/50.samba b/config/events.d/50.samba
index ecbe05e..ccc6864 100755
--- a/config/events.d/50.samba
+++ b/config/events.d/50.samba
@@ -68,11 +68,6 @@ service_stop ()
 fi
 }
 
-# set default samba cleanup period - in minutes
-[ -z $SAMBA_CLEANUP_PERIOD ]  {
-SAMBA_CLEANUP_PERIOD=10
-}
-
 # we keep a cached copy of smb.conf here
 smbconf_cache=$service_state_dir/smb.conf.cache
 
@@ -152,15 +147,6 @@ list_samba_shares ()
 
 
 ###
-# periodic cleanup function
-periodic_cleanup() {
-# running smbstatus scrubs any dead entries from the connections
-# and sessionid database
-# echo Running periodic cleanup of samba databases
-smbstatus -np  /dev/null 21 
-}
-
-###
 
 ctdb_start_stop_service
 
@@ -170,28 +156,16 @@ ctdb_service_check_reconfigure
 
 ###
 
-case $1 in 
+case $1 in
  startup)
ctdb_service_start
;;
-   
+
  shutdown)
ctdb_service_stop
;;
 
  monitor)
-   # Create a dummy file to track when we need to do periodic cleanup
-   # of samba databases
-   periodic_cleanup_file=$service_state_dir/periodic_cleanup
-   [ -f $periodic_cleanup_file ] || {
-   touch $periodic_cleanup_file
-   }
-   [ `find $periodic_cleanup_file -mmin +$SAMBA_CLEANUP_PERIOD | wc -l` 
-eq 1 ]  {
-   # Cleanup the databases
-   periodic_cleanup
-   touch $periodic_cleanup_file
-   }
-
if [ $CTDB_SAMBA_SKIP_SHARE_CHECK != yes ] ; then
testparm_background_update
 
@@ -200,7 +174,7 @@ case $1 in
testparm_cat | egrep '^WARNING|^ERROR|^Unknown'  \
die ERROR: testparm shows smb.conf is not clean
}
-   
+
list_samba_shares | ctdb_check_directories_probe || {
testparm_foreground_update
list_samba_shares |
diff --git a/server/ctdb_tunables.c b/server/ctdb_tunables.c
index b86d6d2..aa3115d 100644
--- a/server/ctdb_tunables.c
+++ b/server/ctdb_tunables.c
@@ -83,7 +83,7 @@ static const struct {
{ DBRecordCountWarn,10,  offsetof(struct ctdb_tunable, 
db_record_count_warn), false },
{ DBRecordSizeWarn,   1000,  offsetof(struct ctdb_tunable, 
db_record_size_warn), false },
{ DBSizeWarn,1,  offsetof(struct ctdb_tunable, 
db_size_warn), false },
-   { PullDBPreallocation, 10*1024*10240,  offsetof(struct ctdb_tunable, 
pulldb_preallocation_size), false },
+   { PullDBPreallocation, 10*1024*1024,  offsetof(struct ctdb_tunable, 
pulldb_preallocation_size), false },
{ NoIPTakeoverOnDisabled,0,  offsetof(struct ctdb_tunable, 
no_ip_takeover_on_disabled), false },
{ DeadlockTimeout,300, offsetof(struct ctdb_tunable, 
deadlock_timeout), false },
{ Samba3AvoidDeadlocks, 0, offsetof(struct ctdb_tunable, 
samba3_hack), false },


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-22-g00db5fa

2013-02-10 Thread Amitay Isaacs
The branch, master has been updated
   via  00db5fa00474f8a83f1aa3b603fd756cc9b49ff4 (commit)
  from  b940e3a24daa73ca9b2896b7a449240136442b53 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 00db5fa00474f8a83f1aa3b603fd756cc9b49ff4
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Feb 6 14:15:11 2013 +1100

Logging: Fix breakage when freeing the log ringbuffer

Commit a82d3ec12f0fda16d6bfa8442a07595de897c10e broke fetching from
the log ringbuffer.  The solution there is still generally good: there
is no need to keep the ringbuffer in children created by
ctdb_fork()... except for those special children that are created to
fetch data from the ringbuffer!

Introduce a new function ctdb_fork_no_free_ringbuffer() that does
everything ctdb_fork() needs to do except free the ringbuffer (i.e. it
is the old ctdb_fork() function).  The new ctdb_fork() function just
calls that function and then frees the ringbuffer in the child.

This means all callers of ctdb_fork() have the convenience of having
the ringbuffer freed.  There are 3 special cases:

* Forking the recovery daemon.  We want to be able to fetch from the
  ringbuffer there.

* The ringbuffer fetching code.  Change the 2 calls in this code (main
  daemon, recovery daemon) to call ctdb_fork_no_free_ringbuffer()
  instead.

While we're here, clear the log ringbuffer when the recovery deamon is
forked, since it will contain a copy of the messages from the main
daemon.

Note to self: always test... even the most obvious patches...  ;-)

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 common/ctdb_fork.c |   15 ---
 common/ctdb_logging.c  |2 +-
 include/ctdb_private.h |1 +
 server/ctdb_recoverd.c |7 +--
 4 files changed, 19 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/common/ctdb_fork.c b/common/ctdb_fork.c
index a11f75a..9e3a06d 100644
--- a/common/ctdb_fork.c
+++ b/common/ctdb_fork.c
@@ -27,7 +27,7 @@
  * This function forks a child process and drops the realtime 
  * scheduler for the child process.
  */
-pid_t ctdb_fork(struct ctdb_context *ctdb)
+pid_t ctdb_fork_no_free_ringbuffer(struct ctdb_context *ctdb)
 {
pid_t pid;
char *process;
@@ -60,8 +60,6 @@ pid_t ctdb_fork(struct ctdb_context *ctdb)
}
ctdb-can_send_controls = false;
 
-   ctdb_log_ringbuffer_free();
-
return 0;
}
 
@@ -75,6 +73,17 @@ pid_t ctdb_fork(struct ctdb_context *ctdb)
return pid;
 }
 
+pid_t ctdb_fork(struct ctdb_context *ctdb)
+{
+   pid_t pid;
+
+   pid = ctdb_fork_no_free_ringbuffer(ctdb);
+   if (pid == 0) {
+   ctdb_log_ringbuffer_free();
+   }
+
+   return pid;
+}
 
 
 static void ctdb_sigchld_handler(struct tevent_context *ev,
diff --git a/common/ctdb_logging.c b/common/ctdb_logging.c
index 105b4df..de5ca6e 100644
--- a/common/ctdb_logging.c
+++ b/common/ctdb_logging.c
@@ -163,7 +163,7 @@ int32_t ctdb_control_get_log(struct ctdb_context *ctdb, 
TDB_DATA addr)
/* spawn a child process to marshall the huge log blob and send it back
   to the ctdb tool using a MESSAGE
*/
-   child = ctdb_fork(ctdb);
+   child = ctdb_fork_no_free_ringbuffer(ctdb);
if (child == (pid_t)-1) {
DEBUG(DEBUG_ERR,(Failed to fork a log collector child\n));
return -1;
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index cf850aa..7794c4c 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1072,6 +1072,7 @@ void ctdb_restore_scheduler(struct ctdb_context *ctdb);
 
 struct tevent_signal *ctdb_init_sigchld(struct ctdb_context *ctdb);
 pid_t ctdb_fork(struct ctdb_context *ctdb);
+pid_t ctdb_fork_no_free_ringbuffer(struct ctdb_context *ctdb);
 int ctdb_kill(struct ctdb_context *ctdb, pid_t pid, int signum);
 
 int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb, 
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index bffe2be..95172a1 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -2126,7 +2126,7 @@ static void getlog_handler(struct ctdb_context *ctdb, 
uint64_t srvid,
}
log_addr = (struct ctdb_get_log_addr *)data.dptr;
 
-   child = ctdb_fork(ctdb);
+   child = ctdb_fork_no_free_ringbuffer(ctdb);
if (child == (pid_t)-1) {
DEBUG(DEBUG_ERR,(Failed to fork a log collector child\n));
return;
@@ -4014,7 +4014,7 @@ int ctdb_start_recoverd(struct ctdb_context *ctdb)
 
ctdb-ctdbd_pid = getpid();
 
-   ctdb-recoverd_pid = ctdb_fork(ctdb);
+   ctdb-recoverd_pid = ctdb_fork_no_free_ringbuffer(ctdb);
 

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.56-9-g584e8c2

2013-02-06 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  584e8c25971219614f3f2bfd5be233b04de7e0af (commit)
  from  055234ceb7d71cc8d2bba4f15749006ce1b67176 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 584e8c25971219614f3f2bfd5be233b04de7e0af
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Feb 6 14:33:51 2013 +1100

New version 1.2.57

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 packaging/RPM/ctdb.spec.in |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index e66ce37..9337095 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -3,7 +3,7 @@ Name: ctdb
 Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team sa...@samba.org
-Version: 1.2.56
+Version: 1.2.57
 Release: 1GITHASH
 Epoch: 0
 License: GNU GPL version 3
@@ -148,7 +148,10 @@ development libraries for ctdb
 
 %changelog
 
-* Wed Dec 02 2013 : Version 1.2.56
+* Thu Feb 07 2013 : Version 1.2.57
+  - Backport fetch lock collapse patches
+  - Backport debugging of hung eventscripts via external script
+* Wed Dec 02 2012 : Version 1.2.56
   - When deadlock condition is detected, run extrnal script to log debugging 
information
   - Use __db_sequence_number based recovery of persistent databases by default
 * Tue Nov 27 2012 : Version 1.2.55


-- 
CTDB repository


[SCM] CTDB repository - annotated tag ctdb-1.2.57 created - ctdb-1.2.57

2013-02-06 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.57 has been created
at  390bc045a4507edadd99a1c1d51c24bacb905611 (tag)
   tagging  584e8c25971219614f3f2bfd5be233b04de7e0af (commit)
  replaces  ctdb-1.2.56
 tagged by  Amitay Isaacs
on  Thu Feb 7 11:13:44 2013 +1100

- Log -
new version 1.2.57

Amitay Isaacs (3):
  scripts: Fix the variable name for sed expressions
  doc: Rebuild all documentation
  New version 1.2.57

Martin Schwenke (3):
  ctdbd: Backport use of external script to debug hung eventscript
  initscript: export CTDB_EXTERNAL_TRACE
  initscript: export CTDB_DEBUG_LOCKS

Ronnie Sahlberg (3):
  Record Fetch Collapse: Collapse multiple fetch request into one single 
request.
  FETCH COLLAPSE : Change the fetch-lock collapse to collapse ALL fetches, 
including fetch-locks into a single command in flight per record. Also add a 
tunable to enable/disable this optimization for hot records
  DOC document the FetchCollapse tunable

---


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.56-8-g055234c

2013-02-05 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  055234ceb7d71cc8d2bba4f15749006ce1b67176 (commit)
   via  35a003d6c3135e61f86d4d5acd46a46bf1bc1a57 (commit)
   via  b86270fae7fd9f8a7a718e15d8c7436a918f28c4 (commit)
  from  2c203bbad887dff6f38e9e47e640c05fad95a7be (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 055234ceb7d71cc8d2bba4f15749006ce1b67176
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 16:40:39 2013 +1100

initscript: export CTDB_DEBUG_LOCKS

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 35a003d6c3135e61f86d4d5acd46a46bf1bc1a57
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 13:16:46 2013 +1100

initscript: export CTDB_EXTERNAL_TRACE

This means it can be set like any other configuration option in the
configuration file, without needing to export it there.

Cherry-pick-from: a0ef73e197dc9147f7718e0813fe803ff0b3d54d
Signed-off-by: Martin Schwenke mar...@meltin.net

commit b86270fae7fd9f8a7a718e15d8c7436a918f28c4
Author: Martin Schwenke mar...@meltin.net
Date:   Thu May 17 10:17:51 2012 +1000

ctdbd: Backport use of external script to debug hung eventscript

This is a cherry-pick from 6e68797af67bee36f2bad045f94806e7e98f27e9,
combined with several recent fixes:

  8507303b525d20c74e8ec4e7c4f5f275945cd3b6
scripts: debug-hung-script.sh doesn't need functions/loadconfig
  501461cc3e132d4adee9e91b5d4513a26bae2846
ctdbd: Remove debug_hung_script_ctx
  0581f9a84e58764d194f4e04064c2c5b393c348b
ctdbd: Remove command-line option --debug-hung-script
  3400b2ed34b6eb9496eb55f1aab6f89d2952060d
ctdbd: Complain loudly if CTDB_DEBUG_HUNG_SCRIPT script isn't executable
  9b0d56b16775aa16f33bdfdf831256e085fa3339
ctdbd: Don't use a fixed length buffer for the hung script command

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 Makefile.in |1 +
 config/ctdb.init|7 ++
 config/ctdb.sysconfig   |3 ++
 config/debug-hung-script.sh |4 +++
 packaging/RPM/ctdb.spec.in  |1 +
 server/eventscript.c|   48 ++-
 6 files changed, 45 insertions(+), 19 deletions(-)
 create mode 100644 config/debug-hung-script.sh


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 136ae30..849abd7 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -291,6 +291,7 @@ install: all
if [ -f doc/onnode.1 ];then ${INSTALLCMD} -m 644 doc/onnode.1 
$(DESTDIR)$(mandir)/man1; fi
if [ -f doc/ltdbtool.1 ]; then ${INSTALLCMD} -m 644 doc/ltdbtool.1 
$(DESTDIR)$(mandir)/man1; fi
if [ ! -f $(DESTDIR)$(etcdir)/ctdb/notify.sh ];then ${INSTALLCMD} -m 
755 config/notify.sh $(DESTDIR)$(etcdir)/ctdb; fi
+   if [ ! -f $(DESTDIR)$(etcdir)/ctdb/debug-hung-script.sh ];then 
${INSTALLCMD} -m 755 config/debug-hung-script.sh $(DESTDIR)$(etcdir)/ctdb; fi
if [ ! -f $(DESTDIR)$(etcdir)/ctdb/ctdb-crash-cleanup.sh ];then 
${INSTALLCMD} -m 755 config/ctdb-crash-cleanup.sh $(DESTDIR)$(etcdir)/ctdb; fi
if [ ! -f $(DESTDIR)$(etcdir)/ctdb/gcore_trace.sh ];then ${INSTALLCMD} 
-m 755 config/gcore_trace.sh $(DESTDIR)$(etcdir)/ctdb; fi
 
diff --git a/config/ctdb.init b/config/ctdb.init
index 4fe01e3..3c2412d 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -111,6 +111,11 @@ build_ctdb_options () {
 maybe_set --max-persistent-check-errors 
$CTDB_MAX_PERSISTENT_CHECK_ERRORS
 }
 
+export_debug_variables ()
+{
+export CTDB_DEBUG_HUNG_SCRIPT CTDB_EXTERNAL_TRACE CTDB_DEBUG_LOCKS
+}
+
 # Log given message or stdin to either syslog or a CTDB log file
 do_log ()
 {
@@ -262,6 +267,8 @@ start() {
 
 build_ctdb_options
 
+export_debug_variables
+
 # make sure we drop any ips that might still be held if previous
 # instance of ctdb got killed with -9 or similar
 drop_all_public_ips
diff --git a/config/ctdb.sysconfig b/config/ctdb.sysconfig
index 1f2edc4..08a550f 100644
--- a/config/ctdb.sysconfig
+++ b/config/ctdb.sysconfig
@@ -92,6 +92,9 @@ CTDB_RECOVERY_LOCK=/some/place/on/shared/storage
 # a script to run when node health changes
 # CTDB_NOTIFY_SCRIPT=/etc/ctdb/notify.sh
 
+# a script to collect data when an eventscript has hung
+# CTDB_DEBUG_HUNG_SCRIPT=/etc/ctdb/debug-hung-script.sh
+
 # the directory to put the local ctdb database files in
 # defaults to /var/ctdb
 # CTDB_DBDIR=/var/ctdb
diff --git a/config/debug-hung-script.sh b/config/debug-hung-script.sh
new file mode 100644
index 000..dcf68ba
--- /dev/null
+++ b/config/debug-hung-script.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+echo Pstree output for the hung script:
+pstree -p -a $1
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 43c2c3b..e66ce37 100644
--- 

[SCM] CTDB repository - branch master updated - ctdb-2.1-11-g25a2040

2013-02-04 Thread Amitay Isaacs
The branch, master has been updated
   via  25a20409fb39a94b64c13990c0eba4f75d482ecd (commit)
   via  d1ec06d30148e6fd344625a2fbf1c22391bd908a (commit)
  from  124e2a471aeda9c900fd898178a30522d7d74221 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 25a20409fb39a94b64c13990c0eba4f75d482ecd
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 12:13:57 2013 +1100

build: Fix a Makefile.in typo

Objects are named *.o  ;-)

Signed-off-by: Martin Schwenke mar...@meltin.net

commit d1ec06d30148e6fd344625a2fbf1c22391bd908a
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Jan 11 12:39:37 2013 +1100

tools/ctdb: Fix a compiler warning

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 Makefile.in  |2 +-
 tools/ctdb.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index e704d63..762f788 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -72,7 +72,7 @@ UTIL_OBJ = lib/util/idtree.o lib/util/db_wrap.o 
lib/util/strlist.o lib/util/util
 CTDB_COMMON_OBJ =  common/ctdb_io.o common/ctdb_util.o \
common/ctdb_ltdb.o common/ctdb_message.o common/cmdline.o  \
lib/util/debug.o common/rb_tree.o @CTDB_SYSTEM_OBJ@ 
common/system_common.o \
-   common/ctdb_logging.c common/ctdb_fork.o
+   common/ctdb_logging.o common/ctdb_fork.o
 
 CTDB_LIB_OBJ = libctdb/ctdb.o libctdb/io_elem.o libctdb/local_tdb.o \
libctdb/messages.o libctdb/sync.o libctdb/control.o \
diff --git a/tools/ctdb.c b/tools/ctdb.c
index 678b555..fb3df8b 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -4935,7 +4935,7 @@ static int control_setdbseqnum(struct ctdb_context *ctdb, 
int argc, const char *
}
 
key.dptr  = (uint8_t *)discard_const(CTDB_DB_SEQNUM_KEY);
-   key.dsize = strlen(key.dptr) + 1;
+   key.dsize = strlen(CTDB_DB_SEQNUM_KEY) + 1;
 
data.dsize = sizeof(new_seqnum);
data.dptr = talloc_size(tmp_ctx, data.dsize);


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-13-ga82d3ec

2013-02-04 Thread Amitay Isaacs
The branch, master has been updated
   via  a82d3ec12f0fda16d6bfa8442a07595de897c10e (commit)
   via  a4f622e85168f59417c11705f1734e0352e1d44a (commit)
  from  25a20409fb39a94b64c13990c0eba4f75d482ecd (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit a82d3ec12f0fda16d6bfa8442a07595de897c10e
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 12:09:36 2013 +1100

Logging: Free the ringbuffer in child processes created with ctdb_fork()

At the moment the log ringbuffer is duplicated in every child process.
Althought it is copy-on-write we want to see if it is contributing to
out-of-memory situations when there are a lot of children.

The ringbuffer isn't accessible from any of the children anyway...

Signed-off-by: Martin Schwenke mar...@meltin.net

commit a4f622e85168f59417c11705f1734e0352e1d44a
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 12:08:11 2013 +1100

Logging: New function ctdb_log_ringbuffer_free()

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 common/ctdb_fork.c |3 +++
 common/ctdb_logging.c  |9 -
 include/ctdb_private.h |2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/common/ctdb_fork.c b/common/ctdb_fork.c
index 24534e6..a11f75a 100644
--- a/common/ctdb_fork.c
+++ b/common/ctdb_fork.c
@@ -59,6 +59,9 @@ pid_t ctdb_fork(struct ctdb_context *ctdb)
ctdb_restore_scheduler(ctdb);
}
ctdb-can_send_controls = false;
+
+   ctdb_log_ringbuffer_free();
+
return 0;
}
 
diff --git a/common/ctdb_logging.c b/common/ctdb_logging.c
index 09b1df2..105b4df 100644
--- a/common/ctdb_logging.c
+++ b/common/ctdb_logging.c
@@ -85,7 +85,14 @@ void log_ringbuffer(const char *format, ...)
va_end(ap);
 }
 
-
+void ctdb_log_ringbuffer_free(void)
+{
+   if (log_entries != NULL) {
+   free(log_entries);
+   log_entries = NULL;
+   }
+   log_ringbuf_size = 0;
+}
 
 void ctdb_collect_log(struct ctdb_context *ctdb, struct ctdb_get_log_addr 
*log_addr)
 {
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 5b519fb..cd0feaa 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1435,7 +1435,7 @@ void ctdb_collect_log(struct ctdb_context *ctdb, struct 
ctdb_get_log_addr *log_a
 void ctdb_clear_log(struct ctdb_context *ctdb);
 int32_t ctdb_control_get_log(struct ctdb_context *ctdb, TDB_DATA addr);
 int32_t ctdb_control_clear_log(struct ctdb_context *ctdb);
-
+void ctdb_log_ringbuffer_free(void);
 
 struct ctdb_log_state *ctdb_fork_with_logging(TALLOC_CTX *mem_ctx,
  struct ctdb_context *ctdb,


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-14-g35da9a7

2013-02-04 Thread Amitay Isaacs
The branch, master has been updated
   via  35da9a7c2a0f5e54e61588c3c3455f06ebc66822 (commit)
  from  a82d3ec12f0fda16d6bfa8442a07595de897c10e (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 35da9a7c2a0f5e54e61588c3c3455f06ebc66822
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Jan 22 13:27:20 2013 +1100

daemon: Make sure all the traverse children are terminated if traverse 
times out

When traverse times out, callback function is called with key and data set 
to
tdb_null.  This is also the way to signal end of traverse.  So if the 
traverse
times out, callback function treats it as traverse ended and frees state 
without
calling the destructor.

Keep track if the traverse timed out, so callback function can take 
appropriate
action for traverse timeout and traverse end.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 server/ctdb_traverse.c |   14 +++---
 1 files changed, 11 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_traverse.c b/server/ctdb_traverse.c
index 54ee70f..5b709dc 100644
--- a/server/ctdb_traverse.c
+++ b/server/ctdb_traverse.c
@@ -214,6 +214,7 @@ struct ctdb_traverse_all_handle {
ctdb_traverse_fn_t callback;
void *private_data;
uint32_t null_count;
+   bool timedout;
 };
 
 /*
@@ -243,6 +244,7 @@ static void ctdb_traverse_all_timeout(struct event_context 
*ev, struct timed_eve
DEBUG(DEBUG_ERR,(__location__  Traverse all timeout on database:%s\n, 
state-ctdb_db-db_name));
CTDB_INCREMENT_STAT(state-ctdb, timeouts.traverse);
 
+   state-timedout = true;
state-callback(state-private_data, tdb_null, tdb_null);
 }
 
@@ -288,6 +290,7 @@ static struct ctdb_traverse_all_handle 
*ctdb_daemon_traverse_all(struct ctdb_db_
state-callback = callback;
state-private_data = start_state;
state-null_count   = 0;
+   state-timedout = false;

talloc_set_destructor(state, ctdb_traverse_all_destructor);
 
@@ -549,9 +552,14 @@ static void traverse_start_callback(void *p, TDB_DATA key, 
TDB_DATA data)
 
ctdb_dispatch_message(state-ctdb, state-srvid, cdata);
if (key.dsize == 0  data.dsize == 0) {
-   /* end of traverse */
-   talloc_set_destructor(state, NULL);
-   talloc_free(state);
+   if (state-h-timedout) {
+   /* timed out, send TRAVERSE_KILL control */
+   talloc_free(state);
+   } else {
+   /* end of traverse */
+   talloc_set_destructor(state, NULL);
+   talloc_free(state);
+   }
}
 }
 


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.56-5-g2c203bb

2013-02-04 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  2c203bbad887dff6f38e9e47e640c05fad95a7be (commit)
   via  6b8ccd1d77ba33563c442d780ce75f2bbfae6f62 (commit)
   via  967549ecf79448a43cead227074e6376441b2fb9 (commit)
   via  b0fbd82cae11fca243cf454cb46d9bb62fdabaf0 (commit)
  from  9fbd13ea7d3da5e297827e7763f336f484262f47 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 2c203bbad887dff6f38e9e47e640c05fad95a7be
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Feb 5 12:59:53 2013 +1100

doc: Rebuild all documentation

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 6b8ccd1d77ba33563c442d780ce75f2bbfae6f62
Author: Ronnie Sahlberg ronniesahlb...@gmail.com
Date:   Tue Mar 20 11:38:20 2012 +1100

DOC document the FetchCollapse tunable

Cherry-pick-from: c37aa6f3738693653f64c2fa015ace061da38b5a

commit 967549ecf79448a43cead227074e6376441b2fb9
Author: Ronnie Sahlberg ronniesahlb...@gmail.com
Date:   Tue Mar 20 11:31:59 2012 +1100

FETCH COLLAPSE : Change the fetch-lock collapse to collapse ALL fetches, 
including fetch-locks into a single command in flight per record. Also add a 
tunable to enable/disable this optimization for hot records

Conflicts:
server/ctdb_tunables.c

Cherry-pick-from: eafd7bbaaa5931546a96c8beae3cf9a39a49c925

commit b0fbd82cae11fca243cf454cb46d9bb62fdabaf0
Author: Ronnie Sahlberg ronniesahlb...@gmail.com
Date:   Tue Nov 8 06:55:46 2011 +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.

Conflicts:
server/ctdb_ltdb_server.c

Cherry-pick-from: 82d6946ad8b3348e8b9d3d971f24925ade02d1be

---

Summary of changes:
 doc/ctdb.1|4 +-
 doc/ctdb.1.html   |  158 --
 doc/ctdbd.1   |   13 +++-
 doc/ctdbd.1.html  |   98 -
 doc/ctdbd.1.xml   |   23 +
 doc/onnode.1  |   21 +++--
 doc/onnode.1.html |   16 ++--
 include/ctdb_private.h|5 +
 server/ctdb_daemon.c  |  208 +
 server/ctdb_ltdb_server.c |   10 ++
 server/ctdb_tunables.c|1 +
 11 files changed, 415 insertions(+), 142 deletions(-)


Changeset truncated at 500 lines:

diff --git a/doc/ctdb.1 b/doc/ctdb.1
index 3b15032..dd2866e 100644
--- a/doc/ctdb.1
+++ b/doc/ctdb.1
@@ -2,12 +2,12 @@
 .\ Title: ctdb
 .\Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 .\ Generator: DocBook XSL Stylesheets v1.76.1 http://docbook.sf.net/
-.\  Date: 01/02/2013
+.\  Date: 02/05/2013
 .\Manual: CTDB - clustered TDB database
 .\Source: ctdb
 .\  Language: English
 .\
-.TH CTDB 1 01/02/2013 ctdb CTDB \- clustered TDB database
+.TH CTDB 1 02/05/2013 ctdb CTDB \- clustered TDB database
 .\ -
 .\ * Define some portability stuff
 .\ -
diff --git a/doc/ctdb.1.html b/doc/ctdb.1.html
index 701b0dd..7e2cae7 100644
--- a/doc/ctdb.1.html
+++ b/doc/ctdb.1.html
@@ -1,6 +1,6 @@
-htmlheadmeta http-equiv=Content-Type content=text/html; 
charset=ISO-8859-1titlectdb/titlemeta name=generator content=DocBook 
XSL Stylesheets V1.75.2/headbody bgcolor=white text=black 
link=#FF vlink=#840084 alink=#FFdiv class=refentry 
title=ctdba name=ctdb.1/adiv class=titlepage/divdiv 
class=refnamedivh2Name/h2pctdb #8212; clustered tdb database 
management utility/p/divdiv class=refsynopsisdiv 
title=Synopsish2Synopsis/h2div class=cmdsynopsispcode 
class=commandctdb [ OPTIONS ] COMMAND .../code /p/divdiv 
class=cmdsynopsispcode class=commandctdb/code  [-n lt;nodegt;] 
[-Y] [-t lt;timeoutgt;] [-T lt;timelimitgt;] [-? --help] [--usage] [-d 
--debug=lt;INTEGERgt;] [--socket=lt;filenamegt;]/p/div/divdiv 
class=refsect1 title=DESCRIPTIONa 
name=id2485540/ah2DESCRIPTION/h2p
+htmlheadmeta http-equiv=Content-Type content=text/html; 
charset=ISO-8859-1titlectdb/titlemeta name=generator content=DocBook 
XSL Stylesheets V1.76.1/headbody bgcolor=white text=black 
link=#FF vlink=#840084 alink=#FFdiv class=refentry 
title=ctdba name=ctdb.1/adiv class=titlepage/divdiv 
class=refnamedivh2Name/h2pctdb #8212; clustered tdb database 
management utility/p/divdiv class=refsynopsisdiv 
title=Synopsish2Synopsis/h2div class=cmdsynopsispcode 
class=commandctdb [ OPTIONS ] COMMAND .../code /p/divdiv 
class=cmdsynopsispcode class=commandctdb/code  [-n lt;nodegt;] 
[-Y] [-t lt;timeoutgt;] [-T lt;timelimitgt;] [-? --help] [--usage] [-d

[SCM] CTDB repository - branch master updated - ctdb-2.1-15-gf1ffe11

2013-02-04 Thread Amitay Isaacs
The branch, master has been updated
   via  f1ffe1112b7e342d7f1228ca816a8e5918f893cf (commit)
  from  35da9a7c2a0f5e54e61588c3c3455f06ebc66822 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit f1ffe1112b7e342d7f1228ca816a8e5918f893cf
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Jan 10 14:39:09 2013 +1100

ctdbd: Message logged at exit should be different for different processes

Some subprocesses print CTDB daemon shutting down when they exit and
this can be confusing.

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 server/ctdb_daemon.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index fdfd5de..0550fab 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -40,7 +40,11 @@ static void daemon_incoming_packet(void *, struct 
ctdb_req_header *);
 
 static void print_exit_message(void)
 {
-   DEBUG(DEBUG_NOTICE,(CTDB daemon shutting down\n));
+   if (debug_extra != NULL  debug_extra[0] != '\0') {
+   DEBUG(DEBUG_NOTICE,(CTDB %s shutting down\n, debug_extra));
+   } else {
+   DEBUG(DEBUG_NOTICE,(CTDB daemon shutting down\n));
+   }
 }
 
 


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.1-20-ga0ef73e

2013-02-04 Thread Amitay Isaacs
The branch, master has been updated
   via  a0ef73e197dc9147f7718e0813fe803ff0b3d54d (commit)
   via  9b0d56b16775aa16f33bdfdf831256e085fa3339 (commit)
   via  3400b2ed34b6eb9496eb55f1aab6f89d2952060d (commit)
   via  0581f9a84e58764d194f4e04064c2c5b393c348b (commit)
   via  501461cc3e132d4adee9e91b5d4513a26bae2846 (commit)
  from  f1ffe1112b7e342d7f1228ca816a8e5918f893cf (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit a0ef73e197dc9147f7718e0813fe803ff0b3d54d
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 13:16:46 2013 +1100

initscript: export CTDB_EXTERNAL_TRACE

This means it can be set like any other configuration option in the
configuration file, without needing to export it there.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 9b0d56b16775aa16f33bdfdf831256e085fa3339
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 14:36:29 2013 +1100

ctdbd: Don't use a fixed length buffer for the hung script command

The amount of data to write into the buffer wasn't constrained
anywhere...

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 3400b2ed34b6eb9496eb55f1aab6f89d2952060d
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 14:25:01 2013 +1100

ctdbd: Complain loudly if CTDB_DEBUG_HUNG_SCRIPT script isn't executable

This is quite easy to misconfigure by failing to set the execute bit
on the script.  Better to complain loudly.

This is a debugging facilty rather than core CTDB functionality, so it
doesn't need a subtle mechanism to disable it at run-time.  To disable
the designated script at run-time either edit it to put an exit 0 at
the top or move it aside and symlink to /bin/true.

This is implemented by actually removing the code that checks that the
file exists and is executable.  The output from the shell when the
system() function fails is just as useful.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 0581f9a84e58764d194f4e04064c2c5b393c348b
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 15:49:52 2013 +1100

ctdbd: Remove command-line option --debug-hung-script

Use an environment variable instead.  This just means that the
initscript exports CTDB_DEBUG_HUNG_SCRIPT and the code checks for the
environment variable.

The justification for this simplification is that more debug options
will be arriving soon and we want to handle them consistently without
needing to add a command-line option for each.  So, the convention
will be to use an environment variable for each debug option.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 501461cc3e132d4adee9e91b5d4513a26bae2846
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Feb 5 13:08:55 2013 +1100

ctdbd: Remove debug_hung_script_ctx

The only allocation against this context is by
ctdb_fork_with_logging().  This memory is freed by ctdb_log_handler()
anyway.  There should be no memory leak.

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 config/ctdb.init   |8 +++-
 include/ctdb_private.h |3 ---
 server/ctdbd.c |   11 ---
 server/eventscript.c   |   35 +--
 4 files changed, 16 insertions(+), 41 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/ctdb.init b/config/ctdb.init
index 9f9b686..dafe8f7 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -95,7 +95,6 @@ build_ctdb_options () {
 maybe_set --event-script-dir   $CTDB_EVENT_SCRIPT_DIR
 maybe_set --transport  $CTDB_TRANSPORT
 maybe_set -d   $CTDB_DEBUGLEVEL
-maybe_set --debug-hung-script  $CTDB_DEBUG_HUNG_SCRIPT
 maybe_set --notification-script$CTDB_NOTIFY_SCRIPT
 maybe_set --start-as-disabled  $CTDB_START_AS_DISABLEDyes
 maybe_set --start-as-stopped   $CTDB_START_AS_STOPPED yes
@@ -108,6 +107,11 @@ build_ctdb_options () {
 maybe_set --max-persistent-check-errors 
$CTDB_MAX_PERSISTENT_CHECK_ERRORS
 }
 
+export_debug_variables ()
+{
+export CTDB_DEBUG_HUNG_SCRIPT CTDB_EXTERNAL_TRACE
+}
+
 # Log given message or stdin to either syslog or a CTDB log file
 do_log ()
 {
@@ -235,6 +239,8 @@ start() {
 
 build_ctdb_options
 
+export_debug_variables
+
 # make sure we drop any ips that might still be held if previous
 # instance of ctdb got killed with -9 or similar
 drop_all_public_ips
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index cd0feaa..cf850aa 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -494,7 +494,6 @@ struct ctdb_context {
bool do_setsched;
void 

[SCM] CTDB repository - branch master updated - ctdb-2.1-8-gb054193

2013-01-22 Thread Amitay Isaacs
The branch, master has been updated
   via  b054193d1d19a8eef998fa690899501f79badb8a (commit)
   via  109f428aa34f8f4cc0329880d2f4a5593a6cc6f3 (commit)
   via  258092aaf6b7a9bdc14f0fb35e8bd7f7dc742b3f (commit)
   via  d202b2fdd4fd70172e5e44583627b57a1b7ad2ed (commit)
   via  3c6a9b73364c9543366fa033c778145dc7a152a9 (commit)
   via  95fc493a7d4145f976cb3fe928d9e92faec4dd71 (commit)
   via  506ecd186759675a1cf50a0a05a285fee03fc51e (commit)
  from  0e651e9da0f1f3c836b4474612ab13d0ccd272d9 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit b054193d1d19a8eef998fa690899501f79badb8a
Author: Mathieu Parent math.par...@gmail.com
Date:   Mon Jan 14 17:48:01 2013 +0100

common: Don't lie on unimplemented gratuitous arp

Signed-off-by: Mathieu Parent math.par...@gmail.com

commit 109f428aa34f8f4cc0329880d2f4a5593a6cc6f3
Author: Mathieu Parent math.par...@gmail.com
Date:   Mon Jan 14 17:21:01 2013 +0100

tests: Test portability

Curiously test_ctdb_sys_check_iface_exists fails on Linux

Signed-off-by: Mathieu Parent math.par...@gmail.com

commit 258092aaf6b7a9bdc14f0fb35e8bd7f7dc742b3f
Author: Mathieu Parent math.par...@gmail.com
Date:   Mon Jan 14 12:13:24 2013 +0100

common: FreeBSD+kFreeBSD: Implement get_process_name (same as in Linux)

Signed-off-by: Mathieu Parent math.par...@gmail.com

commit d202b2fdd4fd70172e5e44583627b57a1b7ad2ed
Author: Mathieu Parent math.par...@gmail.com
Date:   Mon Jan 14 11:23:46 2013 +0100

common: Detailed platform-specific FIXME

Signed-off-by: Mathieu Parent math.par...@gmail.com

commit 3c6a9b73364c9543366fa033c778145dc7a152a9
Author: Mathieu Parent math.par...@gmail.com
Date:   Sun Jan 13 14:15:20 2013 +0100

build: Update config.guess 2012-12-30 and config.sub to 2013-01-11

Signed-off-by: Mathieu Parent math.par...@gmail.com

commit 95fc493a7d4145f976cb3fe928d9e92faec4dd71
Author: Mathieu Parent math.par...@gmail.com
Date:   Sat Jan 12 16:43:03 2013 +0100

doc: allows to - allows one to

Signed-off-by: Mathieu Parent math.par...@gmail.com

commit 506ecd186759675a1cf50a0a05a285fee03fc51e
Author: Mathieu Parent math.par...@gmail.com
Date:   Sat Jan 12 15:14:48 2013 +0100

build: Add missing LDFLAGS

Original Author: Simon Ruderich si...@ruderich.org

Signed-off-by: Mathieu Parent math.par...@gmail.com

---

Summary of changes:
 Makefile.in|9 +-
 common/system_aix.c|   11 +-
 common/system_freebsd.c|   27 ++-
 common/system_gnu.c|   13 +-
 common/system_kfreebsd.c   |   28 ++-
 config.guess   |  426 
 config.sub |  274 +-
 config/ctdb.sysconfig  |2 +-
 doc/ctdbd.1.xml|2 +-
 tests/src/ctdb_porting_tests.c |  305 
 10 files changed, 768 insertions(+), 329 deletions(-)
 mode change 100755 = 100644 config.guess
 mode change 100755 = 100644 config.sub
 create mode 100644 tests/src/ctdb_porting_tests.c


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index fef2e45..e704d63 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -104,6 +104,7 @@ TEST_BINS=tests/bin/ctdb_bench tests/bin/ctdb_fetch 
tests/bin/ctdb_fetch_one \
tests/bin/ctdb_takeover_tests tests/bin/ctdb_update_record \
tests/bin/ctdb_update_record_persistent \
tests/bin/ctdb_tool_libctdb tests/bin/ctdb_tool_stubby \
+   tests/bin/ctdb_porting_tests \
@INFINIBAND_BINS@
 
 BINS = bin/ctdb @CTDB_SCSI_IO@ bin/smnotify bin/ping_pong bin/ltdbtool 
@CTDB_PMDA@
@@ -173,7 +174,7 @@ bin/ctdb: $(CTDB_CLIENT_OBJ) tools/ctdb.o 
tools/ctdb_vacuum.o libctdb/libctdb.a
 
 bin/ltdbtool: tools/ltdbtool.o $(TDB_OBJ)
@echo Linking $@
-   @$(CC) $(CFLAGS) -o $@ $+ $(TDB_LIBS)
+   @$(CC) $(CFLAGS) -o $@ $+ $(TDB_LIBS) $(LIB_FLAGS)
 
 bin/smnotify: utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o 
utils/smnotify/smnotify.o $(POPT_OBJ)
@echo Linking $@
@@ -195,7 +196,7 @@ utils/smnotify/gen_smnotify.c: utils/smnotify/smnotify.x 
utils/smnotify/smnotify
 
 bin/ping_pong: utils/ping_pong/ping_pong.o
@echo Linking $@
-   @$(CC) $(CFLAGS) -o $@ utils/ping_pong/ping_pong.o
+   @$(CC) $(CFLAGS) -o $@ utils/ping_pong/ping_pong.o $(LIB_FLAGS)
 
 bin/pmdactdb: $(CTDB_CLIENT_OBJ) utils/pmda/pmda_ctdb.o
@echo Linking $@
@@ -257,6 +258,10 @@ tests/bin/ctdb_persistent: $(CTDB_CLIENT_OBJ) 
tests/src/ctdb_persistent.o
@echo Linking $@
@$(CC) $(CFLAGS) -o $@ tests/src/ctdb_persistent.o $(CTDB_CLIENT_OBJ) 
$(LIB_FLAGS)
 
+tests/bin/ctdb_porting_tests: $(CTDB_CLIENT_OBJ) tests/src/ctdb_porting_tests.o
+   @echo Linking $@
+   $(CC) 

[SCM] CTDB repository - branch master updated - ctdb-2.1-9-g124e2a4

2013-01-22 Thread Amitay Isaacs
The branch, master has been updated
   via  124e2a471aeda9c900fd898178a30522d7d74221 (commit)
  from  b054193d1d19a8eef998fa690899501f79badb8a (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 124e2a471aeda9c900fd898178a30522d7d74221
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Jan 23 14:35:47 2013 +1100

recoverd: Fix printing of node flags from local information

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 server/ctdb_recoverd.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 0f8aa91..bffe2be 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -3699,7 +3699,7 @@ static void main_loop(struct ctdb_context *ctdb, struct 
ctdb_recoverd *rec,
  nodemap-nodes[j].pnn, 
  nodemap-nodes[i].pnn, 
  remote_nodemaps[j]-nodes[i].flags,
- nodemap-nodes[j].flags));
+ nodemap-nodes[i].flags));
if (i == j) {
DEBUG(DEBUG_ERR,(Use flags 0x%02x from 
remote node %d for cluster update of its own flags\n, 
remote_nodemaps[j]-nodes[i].flags, j));
update_flags_on_all_nodes(ctdb, 
nodemap, nodemap-nodes[i].pnn, remote_nodemaps[j]-nodes[i].flags);


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.56-1-g9fbd13e

2013-01-10 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  9fbd13ea7d3da5e297827e7763f336f484262f47 (commit)
  from  143ec438d9281a11fc7800921c2859a242037775 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 9fbd13ea7d3da5e297827e7763f336f484262f47
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Jan 9 11:03:18 2013 +1100

scripts: Fix the variable name for sed expressions

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 config/debug_locks.sh |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/debug_locks.sh b/config/debug_locks.sh
index 5b9efed..91cb405 100755
--- a/config/debug_locks.sh
+++ b/config/debug_locks.sh
@@ -13,7 +13,7 @@ out=$( cat /proc/locks |
 while read pid rest ; do
pname=$(readlink /proc/$pid/exe)
echo $pid $pname $rest
-done | sed -e $sed_fu | grep \.tdb )
+done | sed -e $sed_cmd | grep \.tdb )
 
 if [ -n $out ]; then
 # Log information about locks


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.0-53-g735ec99

2013-01-08 Thread Amitay Isaacs
The branch, master has been updated
   via  735ec99b99c7bb579851ce8293011aaf1dcc552a (commit)
  from  50abf597cefe6f8ea2a2ff7694bf84641344a9b1 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 735ec99b99c7bb579851ce8293011aaf1dcc552a
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Jan 8 16:49:56 2013 +1100

eventscripts: Fail the setup event if CTDB does not become ready

Currently it silently continues without attempting to set tunables.

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 config/events.d/00.ctdb |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index 847805b..0261353 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
@@ -79,10 +79,9 @@ case $1 in
 
  setup)
 # Make sure CTDB daemon is ready to process requests
-if wait_until_ready ; then
-   # set any tunables from the config file
-   set_ctdb_variables
-   fi || exit 1
+   wait_until_ready || die CTDB did not become ready for setup
+   # Set any tunables from the config file
+   set_ctdb_variables || die Failed to set CTDB tunables
;;
 
 startup)


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.0-59-g746168d

2013-01-08 Thread Amitay Isaacs
The branch, master has been updated
   via  746168df2e691058e601016110fae818c6a265c3 (commit)
   via  45d439a1ab093b420c27b1502ef109021833c7af (commit)
   via  efaac27a9ed52ed0f436c7e194013fd06e8b02b3 (commit)
   via  ca6e7eccc90f2869c220231666bf284798342bce (commit)
   via  d23adec89b69e7c6f96c8e1417ef4ca4c9edc57e (commit)
   via  9a70a4d23d00f6cb996c061ba3dfb7c47b4f6a4f (commit)
  from  735ec99b99c7bb579851ce8293011aaf1dcc552a (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 746168df2e691058e601016110fae818c6a265c3
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Dec 4 15:05:44 2012 +1100

daemon: On shutdown, destroy timed events that check if recoverd is active

When CTDB is shutting down, recovery daemon is stopped, but the
event that checks if recovery daemon is still alive is not destroyed.
So recovery master is restarted during shutdown if CTDB daemon takes
longer to shutdown.

There are two processes that check if recovery daemon is working.

1. ctdb_check_recd() - which checks every 30 seconds if the recovery
   daemon process exists.

2. ctdb_recd_ping_timeout() - which is triggered when recovery daemon
   fails to ping CTDB daemon.

Both the events are periodic and need to be destroyed when shutting down.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 45d439a1ab093b420c27b1502ef109021833c7af
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Dec 18 12:52:39 2012 +1100

tests: Add a test for recovery of persistent databases

Ensure that RSN based recovery and __db_sequence_number__ based recovery
methods for persistent databases work correctly.  They should not cause
corruption of the database.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit efaac27a9ed52ed0f436c7e194013fd06e8b02b3
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Dec 19 15:14:42 2012 +1100

tools/ctdb: Add setdbseqnum command to set __db_sequence_number__

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit ca6e7eccc90f2869c220231666bf284798342bce
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Dec 19 14:43:26 2012 +1100

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 ami...@gmail.com

commit d23adec89b69e7c6f96c8e1417ef4ca4c9edc57e
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Dec 17 14:46:14 2012 +1100

tools/ctdb: Add pdelete command to delete a record from persistent database

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 9a70a4d23d00f6cb996c061ba3dfb7c47b4f6a4f
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Dec 4 14:58:30 2012 +1100

daemon: Update the comment and remove redundant check in 
ctdb_start_transport()

ctdb_start_transport() is called just before setup event, when CTDB
is ready to process the requests. startup event happens much later
after a successful recovery.

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

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 include/ctdb_private.h   |1 +
 server/ctdb_daemon.c |7 +-
 server/ctdb_recover.c|8 +-
 server/ctdb_recoverd.c   |   13 +-
 tests/simple/76_ctdb_pdb_recovery.sh |  119 +
 tools/ctdb.c |  469 +++---
 6 files changed, 395 insertions(+), 222 deletions(-)
 create mode 100755 tests/simple/76_ctdb_pdb_recovery.sh


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 152af64..fb54195 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -508,6 +508,7 @@ struct ctdb_context {
bool valgrinding;
uint32_t event_script_timeouts; /* counting how many consecutive times 
an eventscript has timedout */
uint32_t *recd_ping_count;
+   TALLOC_CTX *recd_ctx; /* a context used to track recoverd monitoring 
events */
TALLOC_CTX *release_ips_ctx; /* a context used to automatically drop 
all IPs if we fail to recover the node */
 
TALLOC_CTX *event_script_ctx;
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index 623e623..fdfd5de 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -70,14 +70,9 @@ static void ctdb_start_time_tickd(struct ctdb_context *ctdb)
 }
 
 
-/* called when the startup event script has finished

[SCM] CTDB repository - branch master updated - ctdb-2.0-60-g7d8546e

2013-01-08 Thread Amitay Isaacs
The branch, master has been updated
   via  7d8546ee4353851f0543d0ca2c4c67cb0cc75aea (commit)
  from  746168df2e691058e601016110fae818c6a265c3 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 7d8546ee4353851f0543d0ca2c4c67cb0cc75aea
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Oct 29 14:56:10 2012 +1100

daemon: Protect against double free of callback state while shutting down

When CTDB is shut down and monitoring has been stopped, monitor_context
gets freed and all the callback states hanging off it.  This includes
callback state for current_monitor, if the current monitor event has
not yet finished.  As a result, when the shutdown event is called,
current_monitor-callback state is not NULL, but it's actually freed
and it's a dangling reference.

So before executing callback function and freeing callback state check
if ctdb-monitor-monitor_context is not NULL.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 include/ctdb_private.h |1 +
 server/ctdb_monitor.c  |7 +++
 server/eventscript.c   |5 +++--
 3 files changed, 11 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index fb54195..5b519fb 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1343,6 +1343,7 @@ int ctdb_repack(struct ctdb_context *ctdb, int argc, 
const char **argv);
 void ctdb_block_signal(int signum);
 void ctdb_unblock_signal(int signum);
 int32_t ctdb_monitoring_mode(struct ctdb_context *ctdb);
+bool ctdb_stopped_monitoring(struct ctdb_context *ctdb);
 int ctdb_set_child_logging(struct ctdb_context *ctdb);
 void ctdb_lockdown_memory(struct ctdb_context *ctdb);
 
diff --git a/server/ctdb_monitor.c b/server/ctdb_monitor.c
index bc21e5b..984f947 100644
--- a/server/ctdb_monitor.c
+++ b/server/ctdb_monitor.c
@@ -506,3 +506,10 @@ int32_t ctdb_monitoring_mode(struct ctdb_context *ctdb)
return ctdb-monitor-monitoring_mode;
 }
 
+/*
+ * Check if monitoring has been stopped
+ */
+bool ctdb_stopped_monitoring(struct ctdb_context *ctdb)
+{
+   return (ctdb-monitor-monitor_context == NULL ? true : false);
+}
diff --git a/server/eventscript.c b/server/eventscript.c
index 6a75877..762f950 100644
--- a/server/eventscript.c
+++ b/server/eventscript.c
@@ -781,8 +781,9 @@ static int ctdb_event_script_callback_v(struct ctdb_context 
*ctdb,
if (ctdb-current_monitor) {
struct ctdb_event_script_state *ms = 
talloc_get_type(ctdb-current_monitor, struct ctdb_event_script_state);
 
-   /* cancel it */
-   if (ms-callback != NULL) {
+   /* Cancel current monitor callback state only if monitoring
+* context ctdb-monitor-monitor_context has not been freed */
+   if (ms-callback != NULL  !ctdb_stopped_monitoring(ctdb)) {
ms-callback-fn(ctdb, -ECANCELED, 
ms-callback-private_data);
talloc_free(ms-callback);
}


-- 
CTDB repository


[SCM] CTDB repository - annotated tag ctdb-2.1 created - ctdb-2.1

2013-01-08 Thread Amitay Isaacs
The annotated tag, ctdb-2.1 has been created
at  7406d21936dbf26167782fd4f336c10dcad3f405 (tag)
   tagging  7d8546ee4353851f0543d0ca2c4c67cb0cc75aea (commit)
  replaces  ctdb-2.0
 tagged by  Amitay Isaacs
on  Wed Jan 9 15:47:18 2013 +1100

- Log -
New version 2.1

Amitay Isaacs (14):
  recoverd: Track the nodes that fail takeover run and set culprit count
  tools/ctdb: Do not use function return value as pnn
  locking: Do not use RECLOCK for tracking DB locks and latencies
  doc: Update ping_pong documentation to add -c option
  daemon: Check if log_latency_ms is set before using it
  daemon: Add a tunable to enable automatic database priority setting
  tests/complex: Add NFS test when CTDB is killed on one of the nodes
  daemon: Update the comment and remove redundant check in 
ctdb_start_transport()
  tools/ctdb: Add pdelete command to delete a record from persistent 
database
  tools/ctdb: Re-factor code to check if db exists given name or id
  tools/ctdb: Add setdbseqnum command to set __db_sequence_number__
  tests: Add a test for recovery of persistent databases
  daemon: On shutdown, destroy timed events that check if recoverd is active
  daemon: Protect against double free of callback state while shutting down

Martin Schwenke (38):
  Eventscripts: 10.interface startup event should only process interfaces 
once
  ctdbd: Make the link status of new interfaces more flexible
  Eventscripts: 10.interface should list configured interfaces
  Git should ignore generated include/version.h file
  Initscript: when checking status, print output of ctdb ping if it fails
  tests: Local daemons should use --listen instead of --node-ip
  ctdbd: Remove debug option --node-ip, use --listen instead
  ctdbd: Initialise the node flags in just one place
  Eventscripts: Do not restart NFS on reconfigure
  Eventscripts: Change the default reconfigure action to do nothing
  ctdbd: Clean up orphaned interfaces when an IP is deleted
  tests: new function ip2ipmask() for integration testing
  tests: new simple integration test for delip interface garbage collection
  tests/takeover: Support valgrinding the takeover code
  tests/takeover: IP allocation now selected via $CTDB_IP_ALGORITHM
  tests/takeover: Support testing of NoIPTakeoverOnDisabled
  tests/takeover: Do output filtering for deterministic IPs algorithm too
  tests/takeover: Initial tests for deterministic IPs
  tests/takeover: Add some LCP2 tests for case when no node are healthy
  recoverd: Fix a memory leak in IP allocation
  recoverd: Move the test for both 'DeterministicIPs' and 'NoIPFailback' set
  recoverd: Don't do failback at all when deterministic IPs are in use
  recoverd: basic_failback() can call find_takeover_node() directly
  recoverd: Trying to failback more IPs no longer allocates unassigned IPs
  recoverd: Move failback retry loop into basic_failback() and 
lcp2_failback()
  recoverd: New function unassign_unsuitable_ips()
  recoverd: Separate each IP allocation algorithm into its own function
  tests/eventscripts: Ratchet down debug level for ctdb_takeover_tests
  tests/simple: Add test to check recovery daemon IP verification
  scripts: Move drop_all_public_ips() to the functions file
  eventscripts: Each script should set CTDB_BASE if it is not set
  scripts: statd-callout should calculate CTDB_BASE if it is not set
  scripts: debug-hung-script.sh doesn't need functions/loadconfig
  ctdbd: Default value for debug_hung_script should use ETCDIR
  scripts: Make drop_all_public_ips() more robust
  scripts: Rework ctdb-crash-cleanup.sh so that it uses existing functions
  scripts: Make script_log() use supplied message, stop logger from hanging
  eventscripts: Fail the setup event if CTDB does not become ready

Michael Adam (6):
  vacuum: fix a comment typo
  recoverd: fix a comment typo
  recovery: data corruption of persistent DBs after recoveries: don't 
delete emtpy records
  utils:ping_pong: add a -c switch to check the lock before reading/writing
  events/50.samba: fix testparm background update
  ctdb:recover: fix a comment typo

Volker Lendecke (2):
  build: Fix the build with old system-installed tevent
  vacuum: Avoid some tallocs in ctdb recovery

---


-- 
CTDB repository


[SCM] CTDB repository - annotated tag ctdb-2.1 deleted - ctdb-2.0-60-g7d8546e

2013-01-08 Thread Amitay Isaacs
The annotated tag, ctdb-2.1 has been deleted
   was  7406d21936dbf26167782fd4f336c10dcad3f405

---
tag ctdb-2.1

New version 2.1
7d8546ee4353851f0543d0ca2c4c67cb0cc75aea daemon: Protect against double free of 
callback state while shutting down
---


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.0-61-g7393e2b

2013-01-08 Thread Amitay Isaacs
The branch, master has been updated
   via  7393e2b290f9879ff72d5c5a9ce933034129f0e8 (commit)
  from  7d8546ee4353851f0543d0ca2c4c67cb0cc75aea (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 7393e2b290f9879ff72d5c5a9ce933034129f0e8
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Jan 9 16:22:39 2013 +1100

recoverd: Create recoverd monitoring timed events off recoverd context

This ensures that when shutting down CTDB, all the timed events
associated with monitoring recoverd are destroyed and recoverd
is not restarted.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 server/ctdb_recoverd.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 5f83044..0f8aa91 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -3971,7 +3971,7 @@ static void ctdb_check_recd(struct event_context *ev, 
struct timed_event *te,
return;
}
 
-   event_add_timed(ctdb-ev, ctdb, 
+   event_add_timed(ctdb-ev, ctdb-recd_ctx,
timeval_current_ofs(30, 0),
ctdb_check_recd, ctdb);
 }


-- 
CTDB repository


[SCM] CTDB repository - annotated tag ctdb-2.1 created - ctdb-2.1

2013-01-08 Thread Amitay Isaacs
The annotated tag, ctdb-2.1 has been created
at  8348dcc46f716ff96b639f4afca676d272eb842f (tag)
   tagging  7393e2b290f9879ff72d5c5a9ce933034129f0e8 (commit)
  replaces  ctdb-2.0
 tagged by  Amitay Isaacs
on  Wed Jan 9 16:31:30 2013 +1100

- Log -
New version 2.1

Amitay Isaacs (15):
  recoverd: Track the nodes that fail takeover run and set culprit count
  tools/ctdb: Do not use function return value as pnn
  locking: Do not use RECLOCK for tracking DB locks and latencies
  doc: Update ping_pong documentation to add -c option
  daemon: Check if log_latency_ms is set before using it
  daemon: Add a tunable to enable automatic database priority setting
  tests/complex: Add NFS test when CTDB is killed on one of the nodes
  daemon: Update the comment and remove redundant check in 
ctdb_start_transport()
  tools/ctdb: Add pdelete command to delete a record from persistent 
database
  tools/ctdb: Re-factor code to check if db exists given name or id
  tools/ctdb: Add setdbseqnum command to set __db_sequence_number__
  tests: Add a test for recovery of persistent databases
  daemon: On shutdown, destroy timed events that check if recoverd is active
  daemon: Protect against double free of callback state while shutting down
  recoverd: Create recoverd monitoring timed events off recoverd context

Martin Schwenke (38):
  Eventscripts: 10.interface startup event should only process interfaces 
once
  ctdbd: Make the link status of new interfaces more flexible
  Eventscripts: 10.interface should list configured interfaces
  Git should ignore generated include/version.h file
  Initscript: when checking status, print output of ctdb ping if it fails
  tests: Local daemons should use --listen instead of --node-ip
  ctdbd: Remove debug option --node-ip, use --listen instead
  ctdbd: Initialise the node flags in just one place
  Eventscripts: Do not restart NFS on reconfigure
  Eventscripts: Change the default reconfigure action to do nothing
  ctdbd: Clean up orphaned interfaces when an IP is deleted
  tests: new function ip2ipmask() for integration testing
  tests: new simple integration test for delip interface garbage collection
  tests/takeover: Support valgrinding the takeover code
  tests/takeover: IP allocation now selected via $CTDB_IP_ALGORITHM
  tests/takeover: Support testing of NoIPTakeoverOnDisabled
  tests/takeover: Do output filtering for deterministic IPs algorithm too
  tests/takeover: Initial tests for deterministic IPs
  tests/takeover: Add some LCP2 tests for case when no node are healthy
  recoverd: Fix a memory leak in IP allocation
  recoverd: Move the test for both 'DeterministicIPs' and 'NoIPFailback' set
  recoverd: Don't do failback at all when deterministic IPs are in use
  recoverd: basic_failback() can call find_takeover_node() directly
  recoverd: Trying to failback more IPs no longer allocates unassigned IPs
  recoverd: Move failback retry loop into basic_failback() and 
lcp2_failback()
  recoverd: New function unassign_unsuitable_ips()
  recoverd: Separate each IP allocation algorithm into its own function
  tests/eventscripts: Ratchet down debug level for ctdb_takeover_tests
  tests/simple: Add test to check recovery daemon IP verification
  scripts: Move drop_all_public_ips() to the functions file
  eventscripts: Each script should set CTDB_BASE if it is not set
  scripts: statd-callout should calculate CTDB_BASE if it is not set
  scripts: debug-hung-script.sh doesn't need functions/loadconfig
  ctdbd: Default value for debug_hung_script should use ETCDIR
  scripts: Make drop_all_public_ips() more robust
  scripts: Rework ctdb-crash-cleanup.sh so that it uses existing functions
  scripts: Make script_log() use supplied message, stop logger from hanging
  eventscripts: Fail the setup event if CTDB does not become ready

Michael Adam (6):
  vacuum: fix a comment typo
  recoverd: fix a comment typo
  recovery: data corruption of persistent DBs after recoveries: don't 
delete emtpy records
  utils:ping_pong: add a -c switch to check the lock before reading/writing
  events/50.samba: fix testparm background update
  ctdb:recover: fix a comment typo

Volker Lendecke (2):
  build: Fix the build with old system-installed tevent
  vacuum: Avoid some tallocs in ctdb recovery

---


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.0-43-g3cc596d

2013-01-07 Thread Amitay Isaacs
The branch, master has been updated
   via  3cc596d2b459d834f9785b3a98027e46431ff2b9 (commit)
   via  6a1d88a17321f7e1dc84b4823d5e7588516a6904 (commit)
   via  8adb255e62dbe60d1e983047acd7b9c941231d11 (commit)
   via  f6ce18d011dd9043b04256690d826deb2640cd89 (commit)
   via  c09aeaecad7d3232b1c07bab826b96818756f5e0 (commit)
   via  4dc08e37dec464c8785a2ddae15c7c69d3c81ac3 (commit)
   via  4c87e7cb3fa2cf2e034fa8454364e0a7fe0c8f81 (commit)
   via  e06476e07197b7327b8bdac9c0b2e7281798ffec (commit)
   via  bcd5f587aff3ba536cb0b5ef00d2d802352bae25 (commit)
   via  edda58a45915494027785608126b5da7c98fee85 (commit)
   via  5c820b2398a42af0e94bc524854a1ad144a63f7b (commit)
   via  98bd58a98d34ecca89c9042417d7527a18a5ecf9 (commit)
   via  d357d52dbd533444a4af6151d04ba119a1533068 (commit)
   via  20631f5f29859920844dd8f410e24917aabd3dfd (commit)
   via  06ad6b8a19f830472b0ed65cb52e7c3ea74ed1dc (commit)
  from  1a5410e8349cdb96fdc51aa5ecd4f5734f6798a5 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 3cc596d2b459d834f9785b3a98027e46431ff2b9
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Jan 8 10:21:49 2013 +1100

tests/eventscripts: Ratchet down debug level for ctdb_takeover_tests

The default IP allocation algorithm used by ctdb_takeover_tests
changed from non-deterministic IPs to LCP2.  The latter generates
a lot more debug output.  ctdb_takeover_tests is used by the ctdb tool
stub to calculate IP address changes for failovers.  This resulted in
unexpected debug output that caused tests to fail.  Since eventscript
tests don't care how IP allocations are arrived at, the best solution
is to turn down the debug level.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 6a1d88a17321f7e1dc84b4823d5e7588516a6904
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Dec 14 17:12:01 2012 +1100

recoverd: Separate each IP allocation algorithm into its own function

This makes the code much more readable and maintainable.

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

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 8adb255e62dbe60d1e983047acd7b9c941231d11
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Dec 13 13:23:32 2012 +1100

recoverd: New function unassign_unsuitable_ips()

Move the code into a new function so it can be called from a number of
places.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit f6ce18d011dd9043b04256690d826deb2640cd89
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Dec 13 12:15:32 2012 +1100

recoverd: Move failback retry loop into basic_failback() and lcp2_failback()

The retry loop is currently in ctdb_takeover_run_core().  Pushing it
into each function will make it possible to put each algorithm into a
separate top-level function.  This will make the code much clearer and
more maintainable.

Also keep associated test code compatible.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit c09aeaecad7d3232b1c07bab826b96818756f5e0
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Dec 11 15:49:17 2012 +1100

recoverd: Trying to failback more IPs no longer allocates unassigned IPs

Neither basic_failback() nor lcp2_failback() unassign IPs anymore, so
there's no point looping back that far.

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

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 4dc08e37dec464c8785a2ddae15c7c69d3c81ac3
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Dec 11 15:43:36 2012 +1100

recoverd: basic_failback() can call find_takeover_node() directly

Instead of unassigning, looping back and depending on
basic_allocate_unassigned.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 4c87e7cb3fa2cf2e034fa8454364e0a7fe0c8f81
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Dec 11 15:01:12 2012 +1100

recoverd: Don't do failback at all when deterministic IPs are in use

This seems to be the right thing to do instead of calling into the
failback code and continually skipping the release of an IP.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit e06476e07197b7327b8bdac9c0b2e7281798ffec
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Dec 14 17:10:41 2012 +1100

recoverd: Move the test for both 'DeterministicIPs' and 'NoIPFailback' set

If this is done earlier then some other logic can be improved.  Also,
this should be a warning since no error condition is set.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit bcd5f587aff3ba536cb0b5ef00d2d802352bae25
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Dec 14 17:10:05 2012 +1100


[SCM] CTDB repository - branch master updated - ctdb-2.0-44-g13a5944

2013-01-07 Thread Amitay Isaacs
The branch, master has been updated
   via  13a5944f8a27d43006acfffba76958693cae7702 (commit)
  from  3cc596d2b459d834f9785b3a98027e46431ff2b9 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 13a5944f8a27d43006acfffba76958693cae7702
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Oct 12 16:12:38 2012 +1100

tests/simple: Add test to check recovery daemon IP verification

Also update ips_are_on_nodeglob() to handle negation.

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 tests/scripts/integration.bash |   24 ++--
 tests/simple/60_recoverd_missing_ip.sh |  103 
 2 files changed, 121 insertions(+), 6 deletions(-)
 create mode 100755 tests/simple/60_recoverd_missing_ip.sh


Changeset truncated at 500 lines:

diff --git a/tests/scripts/integration.bash b/tests/scripts/integration.bash
index 07e764e..2e5fb37 100644
--- a/tests/scripts/integration.bash
+++ b/tests/scripts/integration.bash
@@ -438,8 +438,14 @@ wait_until_node_has_status ()
 
 # Useful for superficially testing IP failover.
 # IPs must be on nodes matching nodeglob.
+# If the first argument is '!' then the IPs must not be on nodes
+# matching nodeglob.
 ips_are_on_nodeglob ()
 {
+local negating=false
+if [ $1 = ! ] ; then
+   negating=true ; shift
+fi
 local nodeglob=$1 ; shift
 local ips=$*
 
@@ -447,17 +453,23 @@ ips_are_on_nodeglob ()
 
 all_ips_on_node 1
 
-while read ip pnn ; do
-   for check in $ips ; do
+for check in $ips ; do
+   while read ip pnn ; do
if [ $check = $ip ] ; then
case $pnn in
-   ($nodeglob) : ;;
-   (*) return 1  ;;
+   ($nodeglob) if $negating ; then return 1 ; fi ;;
+   (*) if ! $negating ; then return 1 ; fi  ;;
esac
ips=${ips/${ip}} # Remove from list
+   break
fi
-   done
-done $out # bashism to avoid problem setting variable in pipeline.
+   # If we're negating and we didn't see the address then it
+   # isn't hosted by anyone!
+   if $negating ; then
+   ips=${ips/${check}}
+   fi
+   done $out # bashism to avoid problem setting variable in pipeline.
+done
 
 ips=${ips// } # Remove any spaces.
 [ -z $ips ]
diff --git a/tests/simple/60_recoverd_missing_ip.sh 
b/tests/simple/60_recoverd_missing_ip.sh
new file mode 100755
index 000..fc12e4c
--- /dev/null
+++ b/tests/simple/60_recoverd_missing_ip.sh
@@ -0,0 +1,103 @@
+#!/bin/bash
+
+test_info()
+{
+cat EOF
+Verify that the reconvery daemon handles unhosted IPs properly.
+EOF
+}
+
+. ${TEST_SCRIPTS_DIR}/integration.bash
+
+ctdb_test_init $@
+
+set -e
+
+cluster_is_healthy
+
+# Reset configuration
+ctdb_restart_when_done
+
+select_test_node_and_ips
+
+echo Running test against node $test_node and IP $test_ip
+
+# Find the interface
+try_command_on_node $test_node $CTDB ip -v -Y | awk -F: -v ip=$test_ip '\$2 
== ip { print \$4 }'
+iface=$out
+
+if [ -z $TEST_LOCAL_DAEMONS ] ; then
+# Find the netmask
+try_command_on_node $test_node ip addr show to $test_ip
+mask=${out##*/}
+mask=${mask%% *}
+else
+mask=24
+fi
+
+echo $test_ip/$mask is on $iface
+
+echo Deleting IP $test_ip from all nodes
+try_command_on_node -v $test_node $CTDB delip -n all $test_ip
+
+wait_until_ips_are_on_nodeglob '!' $test_node $test_ip
+
+try_command_on_node -v all $CTDB ip
+
+my_exit_hook ()
+{
+if [ -z $TEST_LOCAL_DAEMONS ] ; then
+   onnode -q all $CTDB enablescript 10.interface
+fi
+}
+
+ctdb_test_exit_hook_add my_exit_hook
+
+if [ -z $TEST_LOCAL_DAEMONS ] ; then
+# Stop monitor events from bringing up the link status of an interface
+try_command_on_node $test_node $CTDB disablescript 10.interface
+fi
+
+# This effectively cancels any monitor event that is in progress and
+# runs a new one
+try_command_on_node $test_node $CTDB eventscript monitor
+
+echo Marking interface $iface down on node $test_node
+try_command_on_node $test_node $CTDB setifacelink $iface down
+
+try_command_on_node $test_node $CTDB clearlog recoverd
+
+echo Adding IP $test_ip to node $test_node
+try_command_on_node $test_node $CTDB addip $test_ip/$mask $iface
+
+# Give the recovery daemon enough time to start doing IP verification
+sleep_for 15
+
+try_command_on_node $test_node $CTDB getlog recoverd
+
+msg=Public IP '$test_ip' is not assigned and we could serve it
+
+echo $msg
+
+if grep $msg  $out ; then
+echo BAD: the recovery daemon noticed that the IP was unhosted
+exit 1
+else
+echo GOOD: the recovery daemon did not notice that the IP was unhosted
+fi
+
+try_command_on_node $test_node $CTDB clearlog recoverd
+
+echo Marking interface 

[SCM] CTDB repository - branch master updated - ctdb-2.0-52-g50abf59

2013-01-07 Thread Amitay Isaacs
The branch, master has been updated
   via  50abf597cefe6f8ea2a2ff7694bf84641344a9b1 (commit)
   via  e2aaa64925cca359c71520e01a18fc9461b0da4d (commit)
   via  03356fd5ae7a3ac35fde0289cbea7c71ecf07367 (commit)
   via  13e5e609b262847b607e7af7e0685f44e7cb8e36 (commit)
   via  8507303b525d20c74e8ec4e7c4f5f275945cd3b6 (commit)
   via  376015ba5ad6b7703ae9949a1d40a0c72dfaba0c (commit)
   via  740ea8ea5084149c8b552a01ee1c98c558b12384 (commit)
   via  b23c30253cc9eb274b895cac0f8c65245ba0a200 (commit)
  from  13a5944f8a27d43006acfffba76958693cae7702 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 50abf597cefe6f8ea2a2ff7694bf84641344a9b1
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Jan 4 13:52:01 2013 +1100

scripts: Make script_log() use supplied message, stop logger from hanging

When using syslog any provided message arguments are ignored and not
passed to logger.  This means that logger blocks waiting on stdin.
That's bad.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit e2aaa64925cca359c71520e01a18fc9461b0da4d
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Jan 4 11:41:03 2013 +1100

scripts: Rework ctdb-crash-cleanup.sh so that it uses existing functions

This improves maintainability.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 03356fd5ae7a3ac35fde0289cbea7c71ecf07367
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Jan 4 11:23:29 2013 +1100

scripts: Make drop_all_public_ips() more robust

Incorporate some of the logic from ctdb-crash-cleanup.sh that ensures
IPs are deleted even if they have the wrong netmask or are on the
wrong interface.

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

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 13e5e609b262847b607e7af7e0685f44e7cb8e36
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Jan 3 16:02:52 2013 +1100

ctdbd: Default value for debug_hung_script should use ETCDIR

That is, it should use whatever was specified in ./configure and
should not hardcode /etc.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 8507303b525d20c74e8ec4e7c4f5f275945cd3b6
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Jan 3 15:33:57 2013 +1100

scripts: debug-hung-script.sh doesn't need functions/loadconfig

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 376015ba5ad6b7703ae9949a1d40a0c72dfaba0c
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Jan 3 15:33:10 2013 +1100

scripts: statd-callout should calculate CTDB_BASE if it is not set

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 740ea8ea5084149c8b552a01ee1c98c558b12384
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Jan 3 15:26:12 2013 +1100

eventscripts: Each script should set CTDB_BASE if it is not set

This makes it easier to run the scripts externally.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit b23c30253cc9eb274b895cac0f8c65245ba0a200
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Jan 3 15:07:07 2013 +1100

scripts: Move drop_all_public_ips() to the functions file

... so it can be improved and used elsewhere.

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 config/ctdb-crash-cleanup.sh  |   49 +
 config/ctdb.init  |6 
 config/debug-hung-script.sh   |3 --
 config/events.d/00.ctdb   |3 ++
 config/events.d/01.reclock|3 ++
 config/events.d/10.interface  |3 ++
 config/events.d/11.natgw  |3 ++
 config/events.d/11.routing|3 ++
 config/events.d/13.per_ip_routing |3 ++
 config/events.d/20.multipathd |3 ++
 config/events.d/31.clamd  |3 ++
 config/events.d/40.fs_use |3 ++
 config/events.d/40.vsftpd |3 ++
 config/events.d/41.httpd  |3 ++
 config/events.d/49.winbind|3 ++
 config/events.d/50.samba  |3 ++
 config/events.d/60.ganesha|3 ++
 config/events.d/60.nfs|3 ++
 config/events.d/62.cnfs   |3 ++
 config/events.d/70.iscsi  |3 ++
 config/events.d/91.lvs|3 ++
 config/events.d/99.timeout|3 ++
 config/functions  |   37 +++-
 config/statd-callout  |5 +--
 server/ctdbd.c|2 +-
 25 files changed, 113 insertions(+), 46 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/ctdb-crash-cleanup.sh b/config/ctdb-crash-cleanup.sh
index e176518..f426056 100755
--- a/config/ctdb-crash-cleanup.sh
+++ b/config/ctdb-crash-cleanup.sh
@@ -4,41 

[SCM] CTDB repository - branch master updated - ctdb-2.0-18-g5067392

2013-01-06 Thread Amitay Isaacs
The branch, master has been updated
   via  5067392d2e06795559f25828b65c129608b65c0b (commit)
   via  81788cfabe960497b050c5ee4e4e487ee061012a (commit)
   via  4a9e96ad3d8fc46da1cd44cd82309c1b54301eb7 (commit)
  from  f81e9add466b1d9b2796c09c6ba63b77296ea149 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 5067392d2e06795559f25828b65c129608b65c0b
Author: Michael Adam ob...@samba.org
Date:   Tue Nov 20 11:20:34 2012 +0100

ctdb:recover: fix a comment typo

Signed-off-by: Michael Adam ob...@samba.org

commit 81788cfabe960497b050c5ee4e4e487ee061012a
Author: Michael Adam ob...@samba.org
Date:   Fri Dec 21 11:52:57 2012 -0500

events/50.samba: fix testparm background update

creating the smb.conf cache with -v results in a cache file
that fails to load with testparm -s ... later on due to
copy =  not being processable. (Copying the empty service name fails).

Signed-off-by: Michael Adam ob...@samba.org

commit 4a9e96ad3d8fc46da1cd44cd82309c1b54301eb7
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Jan 4 14:32:55 2013 +1100

daemon: Add a tunable to enable automatic database priority setting

Samba versions 3.6.x and older do not set the database priority.
This can cause deadlock between Samba and CTDB since the locking order
of database will be different. A hack was added for automatic promotion
of priority for specific databases to avoid deadlock.  This code should
not be invoked with Samba version 4.x which correctly specifies the
priority for each database.

Signed-off-by: Amitay Isaacs ami...@gmail.com
Reviewed-by: Michael Adam ob...@samba.org

---

Summary of changes:
 config/events.d/50.samba |2 +-
 doc/ctdbd.1.xml  |   13 +
 include/ctdb_private.h   |1 +
 server/ctdb_lock.c   |   14 +-
 server/ctdb_recover.c|2 +-
 server/ctdb_tunables.c   |1 +
 6 files changed, 26 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/50.samba b/config/events.d/50.samba
index 4d9f121..a4d50fe 100755
--- a/config/events.d/50.samba
+++ b/config/events.d/50.samba
@@ -96,7 +96,7 @@ testparm_background_update() {
 # otherwise do a background update
 (
tmpfile=${smbconf_cache}.$$
-   testparm -v -s  $tmpfile 2 /dev/null 
+   testparm -s  $tmpfile 2 /dev/null 
# remember the pid of the teamparm process
pid=$!
# give it 10 seconds to run
diff --git a/doc/ctdbd.1.xml b/doc/ctdbd.1.xml
index d192feb..a0cba99 100644
--- a/doc/ctdbd.1.xml
+++ b/doc/ctdbd.1.xml
@@ -1098,6 +1098,19 @@
 detection.
 /para
 /refsect2
+
+refsect2titleSamba3AvoidDeadlock/title
+paraDefault: 0/para
+para
+Enable code that prevents deadlocks with Samba (only for Samba 3.x).
+/para
+para
+This should be set to 1 when using Samba version 3.x to enable special
+code in CTDB to avoid deadlock with Samba version 3.x.  This code
+is not required for Samba version 4.x and must not be enabled for
+Samba 4.x.
+/para
+/refsect2
   /refsect1
 
   refsect1titleLVS/title
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 348df09..582a767 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -137,6 +137,7 @@ struct ctdb_tunable {
uint32_t pulldb_preallocation_size;
uint32_t no_ip_takeover_on_disabled;
uint32_t deadlock_timeout;
+   uint32_t samba3_hack;
 };
 
 /*
diff --git a/server/ctdb_lock.c b/server/ctdb_lock.c
index e78f3fc..8a2ba5c 100644
--- a/server/ctdb_lock.c
+++ b/server/ctdb_lock.c
@@ -96,8 +96,12 @@ struct lock_request {
  * By default, all databases are set to priority 1. So only when priority
  * is set to 1, check for databases that need higher priority.
  */
-static bool later_db(const char *name)
+static bool later_db(struct ctdb_context *ctdb, const char *name)
 {
+   if (ctdb-tunable.samba3_hack == 0) {
+   return false;
+   }
+
if (strstr(name, brlock) ||
strstr(name, g_lock) ||
strstr(name, notify_onelevel) ||
@@ -120,7 +124,7 @@ int ctdb_lockall_prio(struct ctdb_context *ctdb, uint32_t 
priority)
if (ctdb_db-priority != priority) {
continue;
}
-   if (later_db(ctdb_db-db_name)) {
+   if (later_db(ctdb, ctdb_db-db_name)) {
continue;
}
DEBUG(DEBUG_INFO, (locking database %s, priority:%u\n,
@@ -138,7 +142,7 @@ int ctdb_lockall_prio(struct ctdb_context *ctdb, uint32_t 
priority)
}
 
for (ctdb_db = ctdb-db_list; ctdb_db; ctdb_db = ctdb_db-next) {
-   if (!later_db(ctdb_db-db_name)) {
+   if (!later_db(ctdb

[SCM] CTDB repository - branch master updated - ctdb-2.0-25-gb849fb4

2013-01-06 Thread Amitay Isaacs
The branch, master has been updated
   via  b849fb4923d6a34141fe19006a974de81508ceda (commit)
   via  c75b5e5b4d000f5c7dab403df8238ceed390c1c0 (commit)
   via  2629de72e1f37b5e46772c2ef8d8d0012fc4ed37 (commit)
   via  2bbee8ac23ad5b7adf7122d8c91d5f0d54582507 (commit)
   via  496387a585b2c5778c808cf02b8e1435abde4c3e (commit)
   via  3221fce9ee2f6fdd3bb17a5e1629ad52a32f90d6 (commit)
   via  776590bf84d221092298346a28d7fc0552a67c9d (commit)
  from  5067392d2e06795559f25828b65c129608b65c0b (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit b849fb4923d6a34141fe19006a974de81508ceda
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Jan 7 12:00:34 2013 +1100

tests/complex: Add NFS test when CTDB is killed on one of the nodes

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit c75b5e5b4d000f5c7dab403df8238ceed390c1c0
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Dec 4 15:00:44 2012 +1100

Eventscripts: Change the default reconfigure action to do nothing

A default action of restarting the service doesn't obey the principle
of least surprise.  It cause the NFS service to be implicitly
reintroduced.

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

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 2629de72e1f37b5e46772c2ef8d8d0012fc4ed37
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Dec 4 14:52:25 2012 +1100

Eventscripts: Do not restart NFS on reconfigure

It looks like this restart was accidentally reintroduced in commit
fc0678d351187cfa4c71123f97c0f493aacd5d16 when $service_reconfigure
became unset so the default action of restarting the service would
occur.  From there cleanups have explicitly reintroduced it and
carried it through the code.

Also update the unit tests affected by this change.

The restart was originally removed in commit
bc481c3f1a44c50648488c4f8a7f15ec395d446f.

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

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 2bbee8ac23ad5b7adf7122d8c91d5f0d54582507
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Dec 4 14:28:06 2012 +1100

ctdbd: Initialise the node flags in just one place

Currently flags are initialised in 2 places.  One of them is in
ctdb_tcp_listen_automatic(), which just seems wrong.  This makes the
code easier to follow by just doing it in ctdb_start_daemon().

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

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

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

commit 496387a585b2c5778c808cf02b8e1435abde4c3e
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Dec 3 15:44:12 2012 +1100

ctdbd: Remove debug option --node-ip, use --listen instead

This effectively reverts d96cb02c2c24f9eabbc53d3d38e90dea49cff3e0

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

commit 3221fce9ee2f6fdd3bb17a5e1629ad52a32f90d6
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Dec 3 15:32:49 2012 +1100

tests: Local daemons should use --listen instead of --node-ip

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

commit 776590bf84d221092298346a28d7fc0552a67c9d
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Nov 30 12:59:35 2012 +1100

Initscript: when checking status, print output of ctdb ping if it fails

At the moment the caller has no idea why it thinks CTDB isn't running
and we can't debug failures...

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 config/ctdb.init   |5 +-
 config/events.d/40.vsftpd  |5 ++
 config/events.d/41.httpd   |5 ++
 config/events.d/49.winbind |6 --
 config/events.d/50.samba   |6 --
 config/events.d/60.nfs |2 -
 config/functions   |4 +-
 include/ctdb_private.h |1 -
 server/ctdb_daemon.c   |   23 +++
 server/ctdb_server.c   |   12 
 server/ctdbd.c

[SCM] CTDB repository - branch master updated - ctdb-2.0-28-g1a5410e

2013-01-06 Thread Amitay Isaacs
The branch, master has been updated
   via  1a5410e8349cdb96fdc51aa5ecd4f5734f6798a5 (commit)
   via  8164d9b29bf9080ccc76b1305fb6c07f1ed61d55 (commit)
   via  cc1a3ae911d3fee8b87fda5de5ab6d9499d7510a (commit)
  from  b849fb4923d6a34141fe19006a974de81508ceda (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 1a5410e8349cdb96fdc51aa5ecd4f5734f6798a5
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Nov 30 16:38:08 2012 +1100

tests: new simple integration test for delip interface garbage collection

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 8164d9b29bf9080ccc76b1305fb6c07f1ed61d55
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Nov 30 16:37:28 2012 +1100

tests: new function ip2ipmask() for integration testing

Signed-off-by: Martin Schwenke mar...@meltin.net

commit cc1a3ae911d3fee8b87fda5de5ab6d9499d7510a
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Nov 23 20:09:07 2012 +1100

ctdbd: Clean up orphaned interfaces when an IP is deleted

Add a new function ctdb_remove_orphaned_ifaces() and call it in
ctdb_control_del_public_address().

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

Signed-off-by: Martin Schwenke mar...@meltin.net
Pair-programmed-with: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 server/ctdb_takeover.c|   76 +++--
 tests/scripts/integration.bash|7 +++
 tests/simple/20_delip_iface_gc.sh |   62 ++
 3 files changed, 141 insertions(+), 4 deletions(-)
 create mode 100755 tests/simple/20_delip_iface_gc.sh


Changeset truncated at 500 lines:

diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 5345251..df543fe 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -85,6 +85,74 @@ static int ctdb_add_local_iface(struct ctdb_context *ctdb, 
const char *iface)
return 0;
 }
 
+static bool vnn_has_interface_with_name(struct ctdb_vnn *vnn,
+   const char *name)
+{
+   int n;
+
+   for (n = 0; vnn-ifaces[n] != NULL; n++) {
+   if (strcmp(name, vnn-ifaces[n]) == 0) {
+   return true;
+   }
+   }
+
+   return false;
+}
+
+/* If any interfaces now have no possible IPs then delete them.  This
+ * implementation is naive (i.e. simple) rather than clever
+ * (i.e. complex).  Given that this is run on delip and that operation
+ * is rare, this doesn't need to be efficient - it needs to be
+ * foolproof.  One alternative is reference counting, where the logic
+ * is distributed and can, therefore, be broken in multiple places.
+ * Another alternative is to build a red-black tree of interfaces that
+ * can have addresses (by walking ctdb-vnn and ctdb-single_ip_vnn
+ * once) and then walking ctdb-ifaces once and deleting those not in
+ * the tree.  Let's go to one of those if the naive implementation
+ * causes problems...  :-)
+ */
+static void ctdb_remove_orphaned_ifaces(struct ctdb_context *ctdb,
+   struct ctdb_vnn *vnn,
+   TALLOC_CTX *mem_ctx)
+{
+   struct ctdb_iface *i;
+
+   /* For each interface, check if there's an IP using it. */
+   for(i=ctdb-ifaces; i; i=i-next) {
+   struct ctdb_vnn *tv;
+   bool found;
+
+   /* Only consider interfaces named in the given VNN. */
+   if (!vnn_has_interface_with_name(vnn, i-name)) {
+   continue;
+   }
+
+   /* Is the single IP on this interface? */
+   if ((ctdb-single_ip_vnn != NULL) 
+   (ctdb-single_ip_vnn-ifaces[0] != NULL) 
+   (strcmp(i-name, ctdb-single_ip_vnn-ifaces[0]) == 0)) {
+   /* Found, next interface please... */
+   continue;
+   }
+   /* Search for a vnn with this interface. */
+   found = false;
+   for (tv=ctdb-vnn; tv; tv=tv-next) {
+   if (vnn_has_interface_with_name(tv, i-name)) {
+   found = true;
+   break;
+   }
+   }
+
+   if (!found) {
+   /* None of the VNNs are using this interface. */
+   DLIST_REMOVE(ctdb-ifaces, i);
+   /* Caller will free

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.55-7-g699aaf7

2013-01-01 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  699aaf7b3e65e9e31dd45bf407236d86c86782cc (commit)
   via  8647b27d58e8ef3323a58269c911c8dbfe100164 (commit)
   via  2395b2013972bdc8621978e26f92a8181742037b (commit)
   via  f5944ff7d78c0cd3e2ee010c72f5b3f5e20cb013 (commit)
   via  8e6171b5355041a7062d8fd877569a85e7c14301 (commit)
  from  0e99ca1cdf28a7043554afb78bd439f727ab4f95 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 699aaf7b3e65e9e31dd45bf407236d86c86782cc
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Jan 2 15:49:39 2013 +1100

daemon: Change the default recovery method for persistent databases

Use sequence numbers to do the recovery for persistent databases instead
of RSNs.  This fixes the problem of registry corrpution during recovery.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 8647b27d58e8ef3323a58269c911c8dbfe100164
Author: Ronnie Sahlberg ronniesahlb...@gmail.com
Date:   Wed Nov 30 08:59:03 2011 +1100

DOC: describe the RecoverPDBBySeqNum tunable

Conflicts:
doc/ctdbd.1
doc/ctdbd.1.html

Cherry-pick-from: 86d956170d4806065f1470fc44710c085c57f17a

commit 2395b2013972bdc8621978e26f92a8181742037b
Author: Ronnie Sahlberg ronniesahlb...@gmail.com
Date:   Mon Nov 28 13:56:30 2011 +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.

Conflicts:
include/ctdb_private.h
server/ctdb_tunables.c

Cherry-pick-from: 502150c764298a9fa8c4d8aa445bf7d85d4ee9dc

commit f5944ff7d78c0cd3e2ee010c72f5b3f5e20cb013
Author: Ronnie Sahlberg ronniesahlb...@gmail.com
Date:   Mon Nov 28 16:30:46 2011 +1100

LibCTDB: add get persistent db seqnum control

Conflicts:
tools/ctdb.c

Cherry-pick-from: 6e96a62494bbb2c7b0682ebf0c2115dd2f44f7af

commit 8e6171b5355041a7062d8fd877569a85e7c14301
Author: Ronnie Sahlberg ronniesahlb...@gmail.com
Date:   Mon Nov 28 10:41:17 2011 +1100

DB Seqnum: must provide a ctdb_ltdb_header when calling ctdb_ltdb_fetch()

Cherry-pick-from: 1fea9ef55a6a9d201ad1b49583451ac3e6b1c66d

---

Summary of changes:
 doc/ctdb.1   |   37 -
 doc/ctdbd.1  |   13 -
 doc/ctdbd.1.html |   92 +++---
 doc/ctdbd.1.xml  |   21 
 include/ctdb.h   |   52 +++
 include/ctdb_private.h   |1 +
 libctdb/control.c|   40 +++
 libctdb/sync.c   |   18 +++
 server/ctdb_persistent.c |3 +-
 server/ctdb_recoverd.c   |  126 -
 server/ctdb_tunables.c   |3 +-
 tools/ctdb.c |   27 ++
 12 files changed, 372 insertions(+), 61 deletions(-)


Changeset truncated at 500 lines:

diff --git a/doc/ctdb.1 b/doc/ctdb.1
index 70e150c..3b15032 100644
--- a/doc/ctdb.1
+++ b/doc/ctdb.1
@@ -1,13 +1,22 @@
 '\ t
 .\ Title: ctdb
 .\Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\ Generator: DocBook XSL Stylesheets v1.75.1 http://docbook.sf.net/
-.\  Date: 08/05/2010
+.\ Generator: DocBook XSL Stylesheets v1.76.1 http://docbook.sf.net/
+.\  Date: 01/02/2013
 .\Manual: CTDB - clustered TDB database
 .\Source: ctdb
 .\  Language: English
 .\
-.TH CTDB 1 08/05/2010 ctdb CTDB \- clustered TDB database
+.TH CTDB 1 01/02/2013 ctdb CTDB \- clustered TDB database
+.\ -
+.\ * Define some portability stuff
+.\ -
+.\ ~
+.\ http://bugs.debian.org/507673
+.\ http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\ ~
+.ie \n(.g .ds Aq \(aq
+.el   .ds Aq '
 .\ -
 .\ * set default formatting

[SCM] CTDB repository - annotated tag ctdb-1.2.56 created - ctdb-1.2.56

2013-01-01 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.56 has been created
at  44e8501ff831b968029d61876c6487d81956f530 (tag)
   tagging  699aaf7b3e65e9e31dd45bf407236d86c86782cc (commit)
  replaces  ctdb-1.2.55
 tagged by  Amitay Isaacs
on  Wed Jan 2 16:10:30 2013 +1100

- Log -
New version 1.2.56

Amitay Isaacs (3):
  daemon: Run an external script if freeze locks were not obtained during 
recovery
  scripts: Add helper script to log locking information using /proc/locks
  daemon: Change the default recovery method for persistent databases

Ronnie Sahlberg (4):
  DB Seqnum: must provide a ctdb_ltdb_header when calling ctdb_ltdb_fetch()
  LibCTDB: add get persistent db seqnum control
  Recover Persistent database DB by DB and not record by record
  DOC: describe the RecoverPDBBySeqNum tunable

---


-- 
CTDB repository


[SCM] CTDB repository - annotated tag ctdb-1.2.56 deleted - ctdb-1.2.55-7-g699aaf7

2013-01-01 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.56 has been deleted
   was  44e8501ff831b968029d61876c6487d81956f530

---
tag ctdb-1.2.56

New version 1.2.56
699aaf7b3e65e9e31dd45bf407236d86c86782cc daemon: Change the default recovery 
method for persistent databases
---


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.55-8-g143ec43

2013-01-01 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  143ec438d9281a11fc7800921c2859a242037775 (commit)
  from  699aaf7b3e65e9e31dd45bf407236d86c86782cc (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 143ec438d9281a11fc7800921c2859a242037775
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Jan 2 16:17:58 2013 +1100

New version 1.2.56

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 packaging/RPM/ctdb.spec.in |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 39a5df9..43c2c3b 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -3,7 +3,7 @@ Name: ctdb
 Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team sa...@samba.org
-Version: 1.2.55
+Version: 1.2.56
 Release: 1GITHASH
 Epoch: 0
 License: GNU GPL version 3
@@ -147,6 +147,9 @@ development libraries for ctdb
 
 %changelog
 
+* Wed Dec 02 2013 : Version 1.2.56
+  - When deadlock condition is detected, run extrnal script to log debugging 
information
+  - Use __db_sequence_number based recovery of persistent databases by default
 * Tue Nov 27 2012 : Version 1.2.55
   - Do not ignore timed out monitor events
   - Track nodes that fail takeover run and ban them


-- 
CTDB repository


[SCM] CTDB repository - annotated tag ctdb-1.2.56 created - ctdb-1.2.56

2013-01-01 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.56 has been created
at  bc949d3ecf002adfb742ac66e1e4bb26d7a25f15 (tag)
   tagging  143ec438d9281a11fc7800921c2859a242037775 (commit)
  replaces  ctdb-1.2.55
 tagged by  Amitay Isaacs
on  Wed Jan 2 16:20:37 2013 +1100

- Log -
new version 1.2.56

Amitay Isaacs (4):
  daemon: Run an external script if freeze locks were not obtained during 
recovery
  scripts: Add helper script to log locking information using /proc/locks
  daemon: Change the default recovery method for persistent databases
  New version 1.2.56

Ronnie Sahlberg (4):
  DB Seqnum: must provide a ctdb_ltdb_header when calling ctdb_ltdb_fetch()
  LibCTDB: add get persistent db seqnum control
  Recover Persistent database DB by DB and not record by record
  DOC: describe the RecoverPDBBySeqNum tunable

---


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.55-2-g0e99ca1

2012-12-21 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  0e99ca1cdf28a7043554afb78bd439f727ab4f95 (commit)
   via  e80b2c15bf8c8fb5c3793acfebbe09d3cdd617b7 (commit)
  from  8b2d84482bacd3b31db013496ce82c2e7b730e86 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 0e99ca1cdf28a7043554afb78bd439f727ab4f95
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Dec 5 11:38:42 2012 +1100

scripts: Add helper script to log locking information using /proc/locks

This finds any processes locking tdb databases used by CTDB and logs
stack trace for each process.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit e80b2c15bf8c8fb5c3793acfebbe09d3cdd617b7
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Dec 5 11:37:26 2012 +1100

daemon: Run an external script if freeze locks were not obtained during 
recovery

If the freeze child is already created in ctdb_start_freeze(), then it 
indicates
that the child process has not yet obtained the locks.  This may be because
another process has locked the databases and has not yet released the locks.

In this case, invoke a helper script defined by environmental variable
CTDB_DEBUG_LOCKS, to log information about locks.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 Makefile.in|1 +
 config/debug_locks.sh  |   38 ++
 packaging/RPM/ctdb.spec.in |1 +
 server/ctdb_freeze.c   |   24 
 4 files changed, 64 insertions(+), 0 deletions(-)
 create mode 100755 config/debug_locks.sh


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index e3d6d5b..136ae30 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -264,6 +264,7 @@ install: all
${INSTALLCMD} -m 644 config/functions $(DESTDIR)$(etcdir)/ctdb
${INSTALLCMD} -m 755 config/statd-callout $(DESTDIR)$(etcdir)/ctdb
${INSTALLCMD} -m 755 config/interface_modify.sh $(DESTDIR)$(etcdir)/ctdb
+   ${INSTALLCMD} -m 755 config/debug_locks.sh $(DESTDIR)$(etcdir)/ctdb
${INSTALLCMD} -m 644 config/events.d/README 
$(DESTDIR)$(docdir)/ctdb/README.eventscripts
${INSTALLCMD} -m 644 doc/recovery-process.txt 
$(DESTDIR)$(docdir)/ctdb/recovery-process.txt
${INSTALLCMD} -m 755 config/events.d/00.ctdb 
$(DESTDIR)$(etcdir)/ctdb/events.d
diff --git a/config/debug_locks.sh b/config/debug_locks.sh
new file mode 100755
index 000..5b9efed
--- /dev/null
+++ b/config/debug_locks.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Create sed expression to convert inodes to names
+sed_cmd=$( ls -li /var/ctdb/*.tdb.* /var/ctdb/persistent/*.tdb.* |
+  sed -e s#/var/ctdb[/persistent]*/\(.*\)#\1# |
+  awk '{printf s#[0-9]*:[0-9]*:%s #%s #\n, $1, $10}' )
+
+# Parse /proc/locks and extract following information
+#pid process_name tdb_name offsets [W]
+out=$( cat /proc/locks |
+grep -F POSIX  ADVISORY  WRITE |
+awk '{ if($2 == -) { print $6, $7, $8, $9, W } else { print $5, $6, 
$7, $8 } }' |
+while read pid rest ; do
+   pname=$(readlink /proc/$pid/exe)
+   echo $pid $pname $rest
+done | sed -e $sed_fu | grep \.tdb )
+
+if [ -n $out ]; then
+# Log information about locks
+echo $out | logger -t debug-lock
+
+# Find processes that are waiting for locks
+dbs=$(echo $out | grep W$ | awk '{print $3}')
+all_pids=
+for db in $dbs ; do
+   pids=$(echo $out | grep -v W$ | grep $db | grep -v ctdbd | awk 
'{print $1}')
+   all_pids=$all_pids $pids
+done
+pids=$(echo $all_pids | sort -u)
+
+# For each process waiting, log stack trace
+for pid in $pids ; do
+   gstack $pid | logger -t debug-lock $pid
+#  gcore -o /var/log/core-deadlock-ctdb $pid
+done
+fi
+
+exit 0
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index de8193d..39a5df9 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -113,6 +113,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_sysconfdir}/ctdb/events.d/91.lvs
 %{_sysconfdir}/ctdb/statd-callout
 %{_sysconfdir}/ctdb/interface_modify.sh
+%{_sysconfdir}/ctdb/debug_locks.sh
 %{_sbindir}/ctdbd
 %{_bindir}/ctdb
 %{_bindir}/smnotify
diff --git a/server/ctdb_freeze.c b/server/ctdb_freeze.c
index 0f70fd3..f422e6d 100644
--- a/server/ctdb_freeze.c
+++ b/server/ctdb_freeze.c
@@ -256,6 +256,26 @@ static int ctdb_freeze_waiter_destructor(struct 
ctdb_freeze_waiter *w)
 }
 
 /*
+ * Run an external script to check if there is a deadlock situation
+ */
+static void ctdb_debug_locks(void)
+{
+   const char *cmd = getenv(CTDB_DEBUG_LOCKS);
+   int pid;
+
+   if (cmd == NULL) {
+   return;
+   }
+
+   pid = fork();
+
+   /* Execute only in child process */
+   if (pid == 0) {
+   execl(cmd, cmd, NULL

[SCM] CTDB repository - branch master updated - ctdb-2.0-15-gf81e9ad

2012-11-29 Thread Amitay Isaacs
The branch, master has been updated
   via  f81e9add466b1d9b2796c09c6ba63b77296ea149 (commit)
  from  905cd1293aa97dc7839a59b4f68eca02981f0891 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit f81e9add466b1d9b2796c09c6ba63b77296ea149
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Nov 30 12:21:30 2012 +1100

daemon: Check if log_latency_ms is set before using it

This fixes a bug where wrong variable is checked.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 include/ctdb_private.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index f06a1f1..348df09 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -376,7 +376,7 @@ struct ctdb_daemon_data {
ctdb_db-statistics.counter.total += value; 
\
ctdb_db-statistics.counter.num++;  
\

\
-   if (ctdb_db-ctdb-tunable.reclock_latency_ms != 0) {   
\
+   if (ctdb_db-ctdb-tunable.log_latency_ms != 0) {   
\
if (value*1000  ctdb_db-ctdb-tunable.log_latency_ms) 
{   \
DEBUG(DEBUG_ERR,
\
  (High latency %.6fs for operation %s on 
database %s\n,\


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.39 updated - ctdb-1.9.1-506-g12c9737

2012-11-29 Thread Amitay Isaacs
The branch, 1.2.39 has been updated
   via  12c9737e00f548599ea88b644b625be72466bb8b (commit)
   via  dbf5e73e54a1df613707837959d33a72a6c3118b (commit)
   via  a630c2f4e201e1b17d5873e8a45231f92b019278 (commit)
  from  0491fdec7b11b0e79750c92977c6cc776d5f88bf (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.39


- Log -
commit 12c9737e00f548599ea88b644b625be72466bb8b
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Nov 30 14:16:21 2012 +1100

New version 1.2.39-7

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit dbf5e73e54a1df613707837959d33a72a6c3118b
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 23 16:23:12 2012 +1100

recoverd: Track the nodes that fail takeover run and set culprit count

If any of the nodes fail takeover run (either due to timeout or failure
to complete within takeover_timeout interval) from main loop, recovery
master will give up trying takeover run with following message:

  Unable to setup public takeover addresses. Try again later

And as a side-effect the monitoring is disabled on all the nodes. Before
ctdb_takeover_run() is called from main loop, monitoring get disabled via
startrecovery event. Since ctdb_takeover_run() fails, it never runs
recovered event and monitoring does not get re-enabled.

In main_loop, ctdb_takeover_run() is called with a takeover_fail_callback.
This callback will get called if any of the nodes fail in handling
takeip/releaseip/ipreallocated events in ctdb_takeover_run().

Signed-off-by: Amitay Isaacs ami...@gmail.com

Cherry-pick-from: cbe68821180e04988edf186dcf6d042edcab81de

Conflicts:
server/ctdb_recoverd.c

commit a630c2f4e201e1b17d5873e8a45231f92b019278
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 23 15:06:33 2012 +1100

daemon: Do not ignore timed out monitor events

If an eventscript times out for monitor event, it is considered successful
and the remaining eventscripts are not run. This can make a node prematurely
healthy, cause healthy node to fail over IPs to this node and this node will
not be able to host those IPs. Thus causing loss of access and in case of 
NAT-GW
configuration, loss of a default route.

Cherry-pick-from: 5205d545e8d8c72d73b9d5fd148df6de30392fc8

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 include/ctdb_private.h |6 +++---
 packaging/RPM/ctdb.spec.in |5 -
 server/ctdb_recoverd.c |   32 
 server/ctdb_takeover.c |   14 +++---
 server/ctdb_tunables.c |2 +-
 server/eventscript.c   |1 -
 6 files changed, 47 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index e3a9a15..32e8c68 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1118,6 +1118,8 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
  const ctdb_sock_addr *src,
  uint32_t seq, uint32_t ack, int rst);
 
+typedef void (*client_async_callback)(struct ctdb_context *ctdb, uint32_t 
node_pnn, int32_t res, TDB_DATA outdata, void *callback_data);
+
 int ctdb_set_public_addresses(struct ctdb_context *ctdb, const char *alist);
 int ctdb_set_single_public_ip(struct ctdb_context *ctdb,
  const char *iface,
@@ -1125,7 +1127,7 @@ int ctdb_set_single_public_ip(struct ctdb_context *ctdb,
 int ctdb_set_event_script(struct ctdb_context *ctdb, const char *script);
 int ctdb_set_event_script_dir(struct ctdb_context *ctdb, const char 
*script_dir);
 int ctdb_set_notification_script(struct ctdb_context *ctdb, const char 
*script);
-int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map 
*nodemap);
+int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map 
*nodemap, client_async_callback fail_callback, void *callback_data);
 
 int32_t ctdb_control_tcp_client(struct ctdb_context *ctdb, uint32_t client_id, 
TDB_DATA indata);
@@ -1264,8 +1266,6 @@ int32_t ctdb_monitoring_mode(struct ctdb_context *ctdb);
 int ctdb_set_child_logging(struct ctdb_context *ctdb);
 void ctdb_lockdown_memory(struct ctdb_context *ctdb);
 
-typedef void (*client_async_callback)(struct ctdb_context *ctdb, uint32_t 
node_pnn, int32_t res, TDB_DATA outdata, void *callback_data);
-
 struct client_async_data {
enum ctdb_controls opcode;
bool dont_log_errors;
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 12a9e0b..5165c5c 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -4,7 +4,7 @@ Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team sa...@samba.org
 Version: 1.2.39
-Release

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.54-7-g8b2d844

2012-11-26 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  8b2d84482bacd3b31db013496ce82c2e7b730e86 (commit)
   via  e78e37205308e1507a2cf86a655a95893a7cd413 (commit)
   via  cfb85046e6ed87bf01c3abe8cc908a6d2be741e1 (commit)
   via  5c44156d1aea799f1d6655dd0237e01c49027b82 (commit)
   via  bde1c733fc8c4009202bf185452914f17631c1e7 (commit)
   via  6479566a0a104b903f499979db594541ffc00a1f (commit)
   via  5205d545e8d8c72d73b9d5fd148df6de30392fc8 (commit)
  from  b7467294465b6225982c90315df20a8699ccf812 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 8b2d84482bacd3b31db013496ce82c2e7b730e86
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Nov 27 15:50:54 2012 +1100

New version 1.2.55

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit e78e37205308e1507a2cf86a655a95893a7cd413
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Nov 22 14:37:45 2012 +1100

Revert when creating/adding a public ip, set the initial interface to be 
the first interface specified

This reverts commit 4308935ba48ac7a29e7523315acf580019715f0f.

When IP is added to a node on a new interface for the first time,
vnn-iface gets set to the first interface defined for that IP.  This
actually causes problem in ctdb_vnn_assign_iface().  Since vnn-iface
is set it takes an early exit without updating vnn-pnn.  This results
in IP being hosted on the node, but CTDB still thinks it's unassigned.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit cfb85046e6ed87bf01c3abe8cc908a6d2be741e1
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Nov 16 20:21:15 2012 +1100

Eventscripts: 10.interface should list configured interfaces

The current code lists available interfaces.  If IPs are configured in
some other way than the public addresses file (e.g. ctdb addip) and their
interfaces default to being marked down then, since down interfaces are
not available, these interfaces can never be marked up.

The configured interfaces should be listed instead.

Signed-off-by: Martin Schwenke mar...@meltin.net

Cherry-pick-from: d8f010355b715e49709836e057a5d0f110919897

Conflicts:
config/events.d/10.interface

commit 5c44156d1aea799f1d6655dd0237e01c49027b82
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Nov 16 19:43:14 2012 +1100

ctdbd: Make the link status of new interfaces more flexible

Neither up nor down is a good default value for the link status of a
new interface.  Up means that IPs can be assigned to interfaces before
the true state is known and they can move away quickly if the interface
is actually down.  Down means that IPs can't be assigned to an interface
for a variable amount of time - until a monitor cycle occurs - and this
can result in imbalanced IPs.

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

Signed-off-by: Martin Schwenke mar...@meltin.net

Cherry-pick-from: 9275a69a414482f1053ae14528d5972575b9214e

commit bde1c733fc8c4009202bf185452914f17631c1e7
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Nov 6 17:06:54 2012 +1100

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 ami...@gmail.com

Cherry-pick-from: 718233c445cd6627ab3962b6565c2655f1f8efd0

commit 6479566a0a104b903f499979db594541ffc00a1f
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 23 16:23:12 2012 +1100

recoverd: Track the nodes that fail takeover run and set culprit count

If any of the nodes fail takeover run (either due to timeout or failure
to complete within takeover_timeout interval) from main loop, recovery
master will give up trying takeover run with following message:

  Unable to setup public takeover addresses. Try again later

And as a side-effect the monitoring is disabled on all the nodes. Before
ctdb_takeover_run() is called from main loop, monitoring get disabled via
startrecovery event. Since ctdb_takeover_run() fails, it never runs
recovered event and monitoring does not get re-enabled.

In main_loop, ctdb_takeover_run() is called with a takeover_fail_callback.
This callback will get called if any of the nodes fail in handling

[SCM] CTDB repository - annotated tag ctdb-1.2.55 created - ctdb-1.2.55

2012-11-26 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.55 has been created
at  76b3981cd47807b493ff3f10cc681846b57ea32e (tag)
   tagging  8b2d84482bacd3b31db013496ce82c2e7b730e86 (commit)
  replaces  ctdb-1.2.54
 tagged by  Amitay Isaacs
on  Tue Nov 27 15:51:18 2012 +1100

- Log -
new version 1.2.55

Amitay Isaacs (5):
  daemon: Do not ignore timed out monitor events
  recoverd: Track the nodes that fail takeover run and set culprit count
  tools/ctdb: Do not use function return value as pnn
  Revert when creating/adding a public ip, set the initial interface to be 
the first interface specified
  New version 1.2.55

Martin Schwenke (2):
  ctdbd: Make the link status of new interfaces more flexible
  Eventscripts: 10.interface should list configured interfaces

---


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.0-13-g9a02f61

2012-11-26 Thread Amitay Isaacs
The branch, master has been updated
   via  9a02f61547ddf74629aca21639d8fb61c1df7cbb (commit)
  from  d05faf294e58e22ae3fbc76162258f1ae8178129 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 9a02f61547ddf74629aca21639d8fb61c1df7cbb
Author: Volker Lendecke v...@samba.org
Date:   Thu Nov 22 15:27:51 2012 +0100

vacuum: Avoid some tallocs in ctdb recovery

In a heavily loaded and volatile database a lot of SCHEDULE_FOR_DELETION
requests can come in between fast vacuuming runs. This can lead to
significant ctdb cpu load due to the cost of doing talloc_free. This
reduces the number of objects a bit by coalescing the two objects
of delete_record_data into one. It will also avoid having to allocate
another talloc header for a SCHEDULE_FOR_DELETION key. Not the full fix
for this problem, but it might contribute a bit.

---

Summary of changes:
 server/ctdb_vacuum.c |   14 --
 1 files changed, 8 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_vacuum.c b/server/ctdb_vacuum.c
index 7f6a8f5..4a000b0 100644
--- a/server/ctdb_vacuum.c
+++ b/server/ctdb_vacuum.c
@@ -91,6 +91,7 @@ struct delete_record_data {
struct ctdb_db_context *ctdb_db;
struct ctdb_ltdb_header hdr;
TDB_DATA key;
+   uint8_t keydata[1];
 };
 
 struct delete_records_list {
@@ -108,21 +109,22 @@ static int insert_delete_record_data_into_tree(struct 
ctdb_context *ctdb,
 {
struct delete_record_data *dd;
uint32_t hash;
+   size_t len;
 
-   dd = talloc_zero(tree, struct delete_record_data);
+   len = offsetof(struct delete_record_data, keydata) + key.dsize;
+
+   dd = (struct delete_record_data *)talloc_size(tree, len);
if (dd == NULL) {
DEBUG(DEBUG_ERR,(__location__  Out of memory\n));
return -1;
}
+   talloc_set_name_const(dd, struct delete_record_data);
 
dd-ctdb  = ctdb;
dd-ctdb_db   = ctdb_db;
dd-key.dsize = key.dsize;
-   dd-key.dptr  = talloc_memdup(dd, key.dptr, key.dsize);
-   if (dd-key.dptr == NULL) {
-   DEBUG(DEBUG_ERR,(__location__  Out of memory\n));
-   return -1;
-   }
+   dd-key.dptr  = dd-keydata;
+   memcpy(dd-keydata, key.dptr, key.dsize);
 
dd-hdr = *hdr;
 


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.0-14-g905cd12

2012-11-26 Thread Amitay Isaacs
The branch, master has been updated
   via  905cd1293aa97dc7839a59b4f68eca02981f0891 (commit)
  from  9a02f61547ddf74629aca21639d8fb61c1df7cbb (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 905cd1293aa97dc7839a59b4f68eca02981f0891
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Nov 23 12:51:47 2012 +1100

Git should ignore generated include/version.h file

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 .gitignore |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.gitignore b/.gitignore
index 77ffc3b..6a71e4d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,4 @@ tests/takeover/ctdb_takeover.pyc
 tests/eventscripts/var
 tests/eventscripts/etc/iproute2
 tests/eventscripts/etc-ctdb/policy_routing
+include/version.h


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.0-12-gd05faf2

2012-11-22 Thread Amitay Isaacs
The branch, master has been updated
   via  d05faf294e58e22ae3fbc76162258f1ae8178129 (commit)
  from  4f42d17b74ce891691eee1cead498959cc8e4837 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit d05faf294e58e22ae3fbc76162258f1ae8178129
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Nov 21 17:03:37 2012 +1100

doc: Update ping_pong documentation to add -c option

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 doc/ping_pong.1.xml |   17 +
 1 files changed, 17 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/doc/ping_pong.1.xml b/doc/ping_pong.1.xml
index 0b67e8f..f4148ae 100644
--- a/doc/ping_pong.1.xml
+++ b/doc/ping_pong.1.xml
@@ -25,6 +25,7 @@
arg choice=opt-r/arg
arg choice=opt-w/arg
arg choice=opt-m/arg
+   arg choice=opt-c/arg
/cmdsynopsis

 /refsynopsisdiv
@@ -65,6 +66,15 @@
  /para
 /listitem
   /varlistentry
+
+  varlistentryterm-c/term
+listitem
+  para
+   validate the locks
+ /para
+/listitem
+  /varlistentry
+
 /variablelist
   /refsect1
 
@@ -77,6 +87,13 @@
 /screen
 
 para
+  Testing lock coherence with lock validation
+/para
+screen format=linespecific
+  ping_pong -c test.dat N
+/screen
+
+para
   Testing IO coherence
 /para
 screen format=linespecific


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.0-5-g54e24a1

2012-11-18 Thread Amitay Isaacs
The branch, master has been updated
   via  54e24a151d2163954e5a2a1c0f41a2b5c19ae44b (commit)
   via  718233c445cd6627ab3962b6565c2655f1f8efd0 (commit)
   via  a5c6bb1fffb8dc3960af113957a1fd080cc7c245 (commit)
  from  f243a916ee71013f7402b9c396c2ead88eb3aab0 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 54e24a151d2163954e5a2a1c0f41a2b5c19ae44b
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Nov 14 15:51:59 2012 +1100

locking: Do not use RECLOCK for tracking DB locks and latencies

RECLOCK is for recovery lock in CTDB. Do not override the meaning for
tracking locks on databases.  Database lock latency has nothing to do
with recovery lock latency.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 718233c445cd6627ab3962b6565c2655f1f8efd0
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Nov 6 17:06:54 2012 +1100

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 ami...@gmail.com

commit a5c6bb1fffb8dc3960af113957a1fd080cc7c245
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 23 16:23:12 2012 +1100

recoverd: Track the nodes that fail takeover run and set culprit count

If any of the nodes fail takeover run (either due to timeout or failure
to complete within takeover_timeout interval) from main loop, recovery
master will give up trying takeover run with following message:

  Unable to setup public takeover addresses. Try again later

And as a side-effect the monitoring is disabled on all the nodes. Before
ctdb_takeover_run() is called from main loop, monitoring get disabled via
startrecovery event. Since ctdb_takeover_run() fails, it never runs
recovered event and monitoring does not get re-enabled.

In main_loop, ctdb_takeover_run() is called with a takeover_fail_callback.
This callback will get called if any of the nodes fail in handling
takeip/releaseip/ipreallocated events in ctdb_takeover_run().

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 include/ctdb_private.h |   14 +++---
 server/ctdb_lock.c |   10 --
 server/ctdb_recoverd.c |   34 +-
 server/ctdb_takeover.c |   14 +++---
 tools/ctdb.c   |8 +---
 5 files changed, 60 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 2da9c50..f06a1f1 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -365,7 +365,7 @@ struct ctdb_daemon_data {
}   
\
}
 
-#define CTDB_UPDATE_DB_RECLOCK_LATENCY(ctdb_db, name, counter, value) \
+#define CTDB_UPDATE_DB_LATENCY(ctdb_db, operation, counter, value) 
\
{   
\
if (value  ctdb_db-statistics.counter.max)
\
ctdb_db-statistics.counter.max = value;
\
@@ -377,10 +377,10 @@ struct ctdb_daemon_data {
ctdb_db-statistics.counter.num++;  
\

\
if (ctdb_db-ctdb-tunable.reclock_latency_ms != 0) {   
\
-   if (value*1000  
ctdb_db-ctdb-tunable.reclock_latency_ms) {   \
+   if (value*1000  ctdb_db-ctdb-tunable.log_latency_ms) 
{   \
DEBUG(DEBUG_ERR,
\
- (High RECLOCK latency %fs for operation 
%s\n,   \
-  value, name));   
\
+ (High latency %.6fs for operation %s on 
database %s\n,\
+  value, operation, ctdb_db-db_name));
\
}   
\
}   
\
}
@@ -1195,6 +1195,8 @@ char *ctdb_get_process_name(pid_t pid);
 bool ctdb_get_lock_info(pid_t req_pid, struct ctdb_lock_info *lock_info);
 bool ctdb_get_blocker_pid(struct ctdb_lock_info *reqlock, pid_t *blocker_pid);
 
+typedef void (*client_async_callback)(struct ctdb_context *ctdb, uint32_t 
node_pnn, int32_t res, TDB_DATA outdata, void *callback_data);
+
 int ctdb_set_public_addresses(struct ctdb_context *ctdb

[SCM] CTDB repository - branch master updated - ctdb-2.0-7-gd8f0103

2012-11-18 Thread Amitay Isaacs
The branch, master has been updated
   via  d8f010355b715e49709836e057a5d0f110919897 (commit)
   via  9275a69a414482f1053ae14528d5972575b9214e (commit)
  from  54e24a151d2163954e5a2a1c0f41a2b5c19ae44b (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit d8f010355b715e49709836e057a5d0f110919897
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Nov 16 20:21:15 2012 +1100

Eventscripts: 10.interface should list configured interfaces

The current code lists available interfaces.  If IPs are configured in
some other way than the public addresses file (e.g. ctdb addip) and their
interfaces default to being marked down then, since down interfaces are
not available, these interfaces can never be marked up.

The configured interfaces should be listed instead.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 9275a69a414482f1053ae14528d5972575b9214e
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Nov 16 19:43:14 2012 +1100

ctdbd: Make the link status of new interfaces more flexible

Neither up nor down is a good default value for the link status of a
new interface.  Up means that IPs can be assigned to interfaces before
the true state is known and they can move away quickly if the interface
is actually down.  Down means that IPs can't be assigned to an interface
for a variable amount of time - until a monitor cycle occurs - and this
can result in imbalanced IPs.

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

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 config/events.d/10.interface |6 +++---
 server/ctdb_takeover.c   |   15 ++-
 2 files changed, 17 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index 80b1368..7a85892 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -41,9 +41,9 @@ get_all_interfaces ()
 [ $CTDB_PUBLIC_INTERFACE ]  all_interfaces=$CTDB_PUBLIC_INTERFACE 
$all_interfaces
 [ $CTDB_NATGW_PUBLIC_IFACE ]  all_interfaces=$CTDB_NATGW_PUBLIC_IFACE 
$all_interfaces
 
-# For all but the 1st line, get the 2nd last field with commas
-# changes to spaces.
-ctdb_ifaces=$(ctdb -Y ip -v | sed -e '1d' -e 's/:[^:]*:$//' -e 's/^.*://' 
-e 's/,/ /g')
+# Get the configured interfaces for each IP.  That is, for all but
+# the 1st line, get the last field with commas changed to spaces.
+ctdb_ifaces=$(ctdb -Y ip -v | sed -e '1d' -e 's/:$//' -e 's/^.*://' -e 
's/,/ /g')
 
 # Add $ctdb_interfaces and uniquify
 all_interfaces=$(echo $all_interfaces $ctdb_ifaces | tr ' ' '\n' | sort -u)
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index d324e3f..5345251 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -65,7 +65,20 @@ static int ctdb_add_local_iface(struct ctdb_context *ctdb, 
const char *iface)
CTDB_NO_MEMORY_FATAL(ctdb, i);
i-name = talloc_strdup(i, iface);
CTDB_NO_MEMORY(ctdb, i-name);
-   i-link_up = false;
+   /*
+* If link_up defaults to true then IPs can be allocated to a
+* node during the first recovery.  However, then an interface
+* could have its link marked down during the startup event,
+* causing the IP to move almost immediately.  If link_up
+* defaults to false then, during normal operation, IPs added
+* to a new interface can't be assigned until a monitor cycle
+* has occurred and marked the new interfaces up.  This makes
+* IP allocation unpredictable.  The following is a neat
+* compromise: early in startup link_up defaults to false, so
+* IPs can't be assigned, and after startup IPs can be
+* assigned immediately.
+*/
+   i-link_up = ctdb-done_startup;
 
DLIST_ADD(ctdb-ifaces, i);
 


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.0-2-gf243a91

2012-11-13 Thread Amitay Isaacs
The branch, master has been updated
   via  f243a916ee71013f7402b9c396c2ead88eb3aab0 (commit)
  from  5f58c811127a89f162b6a41ddcd6e944801740a5 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit f243a916ee71013f7402b9c396c2ead88eb3aab0
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Nov 14 10:37:15 2012 +1100

Eventscripts: 10.interface startup event should only process interfaces once

Provided that monitor_interfaces() sets the state of each interface,
there's no need to mark all interfaces as up before running
monitor_interfaces() in the startup event.  monitor_interfaces() will
set the true status of each interface anyway.  The duplication is
unnecessary and may cause extra action in the recovery daemon because
the state of some interfaces is changed an extra time.

Instead, add a comment at the top of the loop in monitor_interfaces()
to warn against early loop exits.

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 config/events.d/10.interface |   11 ---
 1 files changed, 4 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index dd54f1e..80b1368 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -56,6 +56,10 @@ monitor_interfaces()
fail=false
up_interfaces_found=false
 
+   # Note that this loop must not exit early.  It must process
+   # all interfaces so that the correct state for each interface
+   # is set in CTDB using mark_up/mark_down.  If there is a
+   # problem with an interface then set fail=true and continue.
for iface in $all_interfaces ; do
 
ip addr show $iface 2/dev/null /dev/null || {
@@ -149,14 +153,7 @@ case $1 in
  # called after ctdbd has done its initial recovery
  # and we start the services to become healthy
  startup)
-   # Assume all links are good initially
-   get_all_interfaces
-   for iface in $all_interfaces ; do
-   ctdb setifacelink $iface up /dev/null 2/dev/null
-   done
-   
monitor_interfaces
-
;;
 
 


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-2.0-1-g5f58c81

2012-11-07 Thread Amitay Isaacs
The branch, master has been updated
   via  5f58c811127a89f162b6a41ddcd6e944801740a5 (commit)
  from  cd64035d71ddff6aebe6c15a49e09527283425d2 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 5f58c811127a89f162b6a41ddcd6e944801740a5
Author: Volker Lendecke v...@samba.org
Date:   Tue Nov 6 16:17:22 2012 +0100

build: Fix the build with old system-installed tevent

We depend on the tracing callback mechanism in ctdb.

---

Summary of changes:
 lib/tevent/libtevent.m4 |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/libtevent.m4 b/lib/tevent/libtevent.m4
index 409232a..2141af6 100644
--- a/lib/tevent/libtevent.m4
+++ b/lib/tevent/libtevent.m4
@@ -11,7 +11,10 @@ AC_SUBST(TEVENT_CFLAGS)
 if test x$INCLUDED_TEVENT != xyes ; then
 AC_CHECK_HEADERS(tevent.h)
 AC_CHECK_LIB(tevent, tevent_context_init, [ TEVENT_LIBS=-ltevent ])
-if test x$ac_cv_header_tevent_h = xno -o 
x$ac_cv_lib_tevent_tevent_context_init = xno ; then
+AC_CHECK_DECLS([TEVENT_TRACE_BEFORE_WAIT], [[#include tevent.h]])
+if test x$ac_cv_header_tevent_h = xno -o \
+   x$ac_cv_lib_tevent_tevent_context_init = xno -o \
+   x$ac_cv_have_decl_TEVENT_TRACE_BEFORE_WAIT = xno ; then
 INCLUDED_TEVENT=yes
 TEVENT_CFLAGS=
 else


-- 
CTDB repository


[SCM] Samba Shared Repository - branch master updated

2012-11-04 Thread Amitay Isaacs
The branch, master has been updated
   via  1f55865 s4-dns: Fix format string vulnerability in an error message 
(bug #9354)
  from  60cf4cb vfs_acl_common: In add_directory_inheritable_components 
allocate on psd as parent

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 1f55865f2830d0fa36a3f4eeb846f66940b133cd
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Nov 5 01:09:28 2012 +1100

s4-dns: Fix format string vulnerability in an error message (bug #9354)

Also, fixes few comments.

Thanks to Bruno Rohée br...@rohee.org for reporting and patch fix.

Signed-off-by: Amitay Isaacs ami...@gmail.com
Reviewed-By: Kai Blin k...@samba.org

Autobuild-User(master): Amitay Isaacs ami...@samba.org
Autobuild-Date(master): Sun Nov  4 16:58:13 CET 2012 on sn-devel-104

---

Summary of changes:
 source4/dns_server/dlz_bind9.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c
index bea8361..689ed45 100644
--- a/source4/dns_server/dlz_bind9.c
+++ b/source4/dns_server/dlz_bind9.c
@@ -379,7 +379,8 @@ static bool b9_parse(struct dlz_bind9_data *state,
 
/* we should be at the end of the buffer now */
if (strtok_r(NULL, \t , saveptr) != NULL) {
-   state-log(ISC_LOG_ERROR, samba b9_parse: expected data at end 
of string for '%s');
+   state-log(ISC_LOG_ERROR, samba b9_parse: unexpected data at 
end of string for '%s',
+  rdatastr);
return false;
}
 
@@ -387,7 +388,7 @@ static bool b9_parse(struct dlz_bind9_data *state,
 }
 
 /*
-  send a resource recond to bind9
+  send a resource record to bind9
  */
 static isc_result_t b9_putrr(struct dlz_bind9_data *state,
 void *handle, struct dnsp_DnssrvRpcRecord *rec,
@@ -427,7 +428,7 @@ static isc_result_t b9_putrr(struct dlz_bind9_data *state,
 
 
 /*
-  send a named resource recond to bind9
+  send a named resource record to bind9
  */
 static isc_result_t b9_putnamedrr(struct dlz_bind9_data *state,
  void *handle, const char *name,
@@ -1456,7 +1457,7 @@ static bool b9_set_session_info(struct dlz_bind9_data 
*state, const char *name)
return false;
}
 
-   /* Do not use client credentials, if we not updating the client 
specified name */
+   /* Do not use client credentials, if we're not updating the client 
specified name */
if (strcmp(state-update_name, name) != 0) {
return true;
}


-- 
Samba Shared Repository


[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.53-3-gb746729

2012-10-30 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  b7467294465b6225982c90315df20a8699ccf812 (commit)
   via  c116d0b107873d679fd6246ef3dd2fbcdbe46b56 (commit)
   via  49e66cf4009c8f8816baa83a4bd4408c540b389c (commit)
  from  046f8799361794997cedae3d4ff812216661e04e (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit b7467294465b6225982c90315df20a8699ccf812
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 30 12:39:00 2012 +1100

New Version 1.2.54

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit c116d0b107873d679fd6246ef3dd2fbcdbe46b56
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Sep 3 12:39:36 2012 +1000

scripts: Remove duplicate code from init script to set tunables

The tunable variables defined in CTDB configuration file are currently
set up from init script as well as part of setup event in 00.ctdb
eventscript.  Remove the duplication of this code and set tunable
variables only from setup event.  During the setup event, it's possible
that ctdb tool commands can timeout if CTDB daemon is not ready.  To guard
against such eventuality, wait till ctdb ping command succeeds before
executing any other ctdb tool commands.

Signed-off-by: Amitay Isaacs ami...@gmail.com

Cherry-picked-from: 632c1b9c1cc2e242376358ce49fd2022b3f27aa2

Conflicts:
config/events.d/00.ctdb

commit 49e66cf4009c8f8816baa83a4bd4408c540b389c
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Oct 29 14:56:10 2012 +1100

daemon: Protect against double free of callback state while shutting down

When CTDB is shut down and monitoring has been stopped, monitor_context
gets freed and all the callback states hanging off it.  This includes
callback state for current_monitor, if the current monitor event has
not yet finished.  As a result, when the shutdown event is called,
current_monitor-callback state is not NULL, but it's actually freed
and it's a dangling reference.

So before executing callback function and freeing callback state check
if ctdb-monitor-monitor_context is not NULL.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 config/ctdb.init   |   14 +-
 config/events.d/00.ctdb|   39 +++
 include/ctdb_private.h |1 +
 packaging/RPM/ctdb.spec.in |5 -
 server/ctdb_monitor.c  |7 +++
 server/eventscript.c   |5 +++--
 6 files changed, 47 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/ctdb.init b/config/ctdb.init
index 7c75726..4fe01e3 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -217,16 +217,6 @@ EOF
 done
 }
 
-set_ctdb_variables () {
-# set any tunables from the config file
-set | grep ^CTDB_SET_ | cut -d_ -f3- | 
-while read v; do
-   varname=`echo $v | cut -d= -f1`
-   value=`echo $v | cut -d= -f2`
-   ctdb setvar $varname $value || RETVAL=1
-done || exit 1
-}
-
 set_retval() {
 return $1
 }
@@ -311,9 +301,7 @@ start() {
 esac
 
 if [ $RETVAL -eq 0 ] ; then
-   if wait_until_ready ; then
-   set_ctdb_variables
-   else
+   if ! wait_until_ready ; then
RETVAL=1
pkill -9 -f $ctdbd /dev/null 21
fi
diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index 4f97185..5ad74bf 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
@@ -30,6 +30,32 @@ update_config_from_tdb() {
}
 }
 
+set_ctdb_variables () {
+# set any tunables from the config file
+set | grep ^CTDB_SET_ | cut -d_ -f3- | 
+while read v; do
+   varname=`echo $v | cut -d= -f1`
+   value=`echo $v | cut -d= -f2`
+   ctdb setvar $varname $value || return 1
+   echo Set $varname to $value
+done
+}
+
+wait_until_ready () {
+_timeout=${1:-10} # default is 10 seconds
+
+_count=0
+while ! ctdb ping /dev/null 21 ; do
+   if [ $_count -ge $_timeout ] ; then
+   return 1
+   fi
+   sleep 1
+   _count=$(($_count + 1))
+done
+}
+
+ctdb_check_args $@
+
 case $1 in 
  init)
 # make sure we have a blank state directory for the scripts to work 
with
@@ -42,14 +68,11 @@ case $1 in
;;
 
  setup)
-   # set any tunables from the config file
-   set | grep ^CTDB_SET_ | cut -d_ -f3- | 
-   while read v; do
-   varname=`echo $v | cut -d= -f1`
-   value=`echo $v | cut -d= -f2`
-   ctdb setvar $varname $value || exit 1
-   echo Set $varname to $value
-   done || exit 1
+# Make sure CTDB daemon is ready to process requests
+if wait_until_ready ; then
+   # set any tunables from the config file
+   set_ctdb_variables
+   fi

[SCM] CTDB repository - annotated tag ctdb-1.2.54 created - ctdb-1.2.54

2012-10-30 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.54 has been created
at  519a63ef7aa002e62cae0518ed03ba9fde2e139f (tag)
   tagging  b7467294465b6225982c90315df20a8699ccf812 (commit)
  replaces  ctdb-1.2.53
 tagged by  Amitay Isaacs
on  Tue Oct 30 16:39:15 2012 +1100

- Log -
new version 1.2.54

Amitay Isaacs (3):
  daemon: Protect against double free of callback state while shutting down
  scripts: Remove duplicate code from init script to set tunables
  New Version 1.2.54

---


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-1.13-338-g16a91c2

2012-10-30 Thread Amitay Isaacs
The branch, master has been updated
   via  16a91c2a4d03b46743611e2fe844bb2cef95e46a (commit)
   via  3d4838db51dd8199b9c29aebb6e7bfbd2a27b8bb (commit)
   via  f8af7d8de76e68e5c4bde15f832a31ce9107e8c7 (commit)
   via  8df7ea6b20417833792932487a082b3c71bb6837 (commit)
   via  b151f9b62299ec5b887c62cef780547a39c0ba9d (commit)
  from  9be3b23adbfc844b71bf1d4ddf0fbc3b269f15fa (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 16a91c2a4d03b46743611e2fe844bb2cef95e46a
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 30 11:54:52 2012 +1100

packaging: Use maketarball.sh script to create tarball for RPM

This removes the duplicate code for building tarball and reuses existing
script.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 3d4838db51dd8199b9c29aebb6e7bfbd2a27b8bb
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 30 11:52:19 2012 +1100

packaging: Use optional argument as targetdir when creating tarball

In addition, do not modify CTDB version string with extra suffix.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit f8af7d8de76e68e5c4bde15f832a31ce9107e8c7
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 30 11:49:28 2012 +1100

tool/ctdb: Always support ctdb version command, don't make it optional

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 8df7ea6b20417833792932487a082b3c71bb6837
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 30 11:48:23 2012 +1100

build: Add rules to create include/version.h when building from git tree

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit b151f9b62299ec5b887c62cef780547a39c0ba9d
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 30 11:47:24 2012 +1100

packaging: Create include/version.h to define CTDB_VERSION_STRING

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 Makefile.in|8 +++-
 packaging/RPM/ctdb.spec.in |2 +-
 packaging/RPM/makerpms.sh  |   23 +--
 packaging/maketarball.sh   |   28 ++--
 packaging/mkversion.sh |   14 ++
 tools/ctdb.c   |   11 +++
 6 files changed, 44 insertions(+), 42 deletions(-)


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 3294503..fef2e45 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -63,6 +63,8 @@ SHLD=${CC} ${CFLAGS} ${LDSHFLAGS} -o $@
 LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) $(TALLOC_LIBS) $(TEVENT_LIBS) 
$(TDB_LIBS) \
  @INFINIBAND_LIBS@ @CTDB_PCAP_LDFLAGS@
 
+CTDB_VERSION_H = include/version.h
+
 UTIL_OBJ = lib/util/idtree.o lib/util/db_wrap.o lib/util/strlist.o 
lib/util/util.o \
lib/util/util_time.o lib/util/util_file.o lib/util/fault.o 
lib/util/substitute.o \
lib/util/signal.o
@@ -112,7 +114,7 @@ DIRS = lib bin tests/bin
 
 .SUFFIXES: .c .o .h
 
-all: showflags dirs $(CTDB_SERVER_OBJ) $(CTDB_CLIENT_OBJ) $(CTDB_LIB_OBJ) 
$(BINS) $(SBINS) $(TEST_BINS)
+all: showflags dirs $(CTDB_VERSION_H) $(CTDB_SERVER_OBJ) $(CTDB_CLIENT_OBJ) 
$(CTDB_LIB_OBJ) $(BINS) $(SBINS) $(TEST_BINS)
 
 showflags:
@echo 'ctdb will be compiled with flags:'
@@ -138,6 +140,10 @@ showlayout::
 dirs:
@mkdir -p $(DIRS)
 
+$(CTDB_VERSION_H):
+   @echo Generating $@
+   @./packaging/mkversion.sh
+
 bin/ctdbd: $(CTDB_SERVER_OBJ)
@echo Linking $@
@$(CC) $(CFLAGS) -o $@ $(CTDB_SERVER_OBJ) $(LIB_FLAGS)
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index b0555c7..50287ab 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -71,7 +71,7 @@ export CC
 ## always run autogen.sh
 ./autogen.sh
 
-CFLAGS=$RPM_OPT_FLAGS $EXTRA -O0 -D_GNU_SOURCE 
-DCTDB_VERS=\%{version}-%{release}\ ./configure \
+CFLAGS=$RPM_OPT_FLAGS $EXTRA -O0 -D_GNU_SOURCE ./configure \
 %if %with_included_talloc
--with-included-talloc \
 %endif
diff --git a/packaging/RPM/makerpms.sh b/packaging/RPM/makerpms.sh
index 254abde..c216185 100755
--- a/packaging/RPM/makerpms.sh
+++ b/packaging/RPM/makerpms.sh
@@ -52,7 +52,7 @@ mkdir -p `rpm --eval %_rpmdir`/noarch
 mkdir -p `rpm --eval %_rpmdir`/i386
 mkdir -p `rpm --eval %_rpmdir`/x86_64
 
-VERSION=$(${TOPDIR}/packaging/mkversion.sh)
+VERSION=$(${TOPDIR}/packaging/mkversion.sh ${TOPDIR}/include/version.h)
 if [ -z $VERSION ]; then
 exit 1
 fi
@@ -61,23 +61,10 @@ sed -e s/@VERSION@/$VERSION/g \
 ${DIRNAME}/${SPECFILE_IN} \
 ${DIRNAME}/${SPECFILE}
 
-VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
-
-if echo | gzip -c --rsyncable -  /dev/null 21 ; then
-   GZIP=gzip -9 --rsyncable
-else
-   GZIP=gzip -9
-fi
-
-pushd ${TOPDIR}
-echo -n Creating ctdb-${VERSION}.tar.gz ... 
-git archive --prefix=ctdb

[SCM] CTDB repository - branch master updated - ctdb-1.13-340-gceac026

2012-10-30 Thread Amitay Isaacs
The branch, master has been updated
   via  ceac026713a7ee30ea865ed4a9422900ed76fdf6 (commit)
   via  aad1584da8a8425bc6f5163c95810e9d2390dc91 (commit)
  from  16a91c2a4d03b46743611e2fe844bb2cef95e46a (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit ceac026713a7ee30ea865ed4a9422900ed76fdf6
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Oct 31 12:17:27 2012 +1100

web: Update instructions for building from tarball

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit aad1584da8a8425bc6f5163c95810e9d2390dc91
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Oct 31 12:10:22 2012 +1100

tests: Do not check release suffix in ctdb version test

release suffix added by RPM is to track packaging changes. Core CTDB
version does not include the release suffix.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 tests/simple/01_ctdb_version.sh |3 ++-
 web/building.html   |   10 +-
 2 files changed, 11 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tests/simple/01_ctdb_version.sh b/tests/simple/01_ctdb_version.sh
index 5a36ea4..3e1ed3e 100755
--- a/tests/simple/01_ctdb_version.sh
+++ b/tests/simple/01_ctdb_version.sh
@@ -39,8 +39,9 @@ if ! try_command_on_node -v 0 rpm -q ctdb ; then
 fi
 rpm_ver=${out#ctdb-}
 # Some version of RPM append the architecture to the version.
+# And also remove the release suffix.
 arch=$(uname -m)
-rpm_ver=${rpm_ver%.${arch}}
+rpm_ver=${rpm_ver%-*.${arch}}
 
 try_command_on_node -v 0 $CTDB version
 ctdb_ver=${out#CTDB version: }
diff --git a/web/building.html b/web/building.html
index fc4789c..7475078 100644
--- a/web/building.html
+++ b/web/building.html
@@ -4,7 +4,7 @@
 H2 align=centerBuilding CTDB and Samba/h2
 
 h2CTDB/h2
-To build a copy of the CTDB code you should do this:
+To build a copy of CTDB code from a git tree you should do this:
 pre
cd ctdb
./autogen.sh
@@ -13,6 +13,14 @@ To build a copy of the CTDB code you should do this:
make install
 /pre
 
+To build a copy of CTDB code from a tarball you should do this:
+pre
+   tar xf ctdb-x.y.tar.gz
+   cd ctdb-x.y
+   ./configure
+   make
+   make install
+/pre
 You need to install ctdb on all nodes of your cluster.
 
 


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-1.13-341-gcd64035

2012-10-30 Thread Amitay Isaacs
The branch, master has been updated
   via  cd64035d71ddff6aebe6c15a49e09527283425d2 (commit)
  from  ceac026713a7ee30ea865ed4a9422900ed76fdf6 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit cd64035d71ddff6aebe6c15a49e09527283425d2
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Oct 31 12:33:25 2012 +1100

ctdbd: Fix compilation warning in locking code

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 server/ctdb_lock.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_lock.c b/server/ctdb_lock.c
index 8097e84..81f0eb3 100644
--- a/server/ctdb_lock.c
+++ b/server/ctdb_lock.c
@@ -1039,13 +1039,13 @@ void ctdb_lock_blocked_handler(struct tevent_context 
*ev,
DEBUG(DEBUG_WARNING,
  (Process %s (pid=%d) locked database %s (inode %lu) for 
%.0lf seconds\n,
   (process_name ? process_name : unknown),
-  blocker_pid, db_name, inode,
+  blocker_pid, db_name, (unsigned long)inode,
   timeval_elapsed(lock_ctx-start_time)));
} else {
DEBUG(DEBUG_WARNING,
  (Process %s (pid=%d) locked database (inode %lu) for 
%.0lf seconds\n,
   (process_name ? process_name : unknown),
-  blocker_pid, inode,
+  blocker_pid, (unsigned long)inode,
   timeval_elapsed(lock_ctx-start_time)));
}
 


-- 
CTDB repository


[SCM] CTDB repository - annotated tag ctdb-2.0 created - ctdb-2.0

2012-10-30 Thread Amitay Isaacs
The annotated tag, ctdb-2.0 has been created
at  23282c5c861fe5674960ad38ca635350937c6758 (tag)
   tagging  cd64035d71ddff6aebe6c15a49e09527283425d2 (commit)
  replaces  ctdb-1.13
 tagged by  Amitay Isaacs
on  Wed Oct 31 12:36:10 2012 +1100

- Log -
New version 2.0

Amitay Isaacs (89):
  build: Add rules to create ctags/etags
  packaging: Setup directories for rpmbuild
  build: Remove re-definition of same variable
  build: Display correct LIB_FLAGS while building
  build: Use system talloc library if available
  build: Use system tevent library if available
  build: Use system tdb library if available
  recovery: Add prototypes for tdb internal functions
  build: Substitute POPT macros once and reuse variables
  tests/tool: Fix the nodestatus test
  tests/tool: New nodestatus test
  tests: exportfs always outputs with options in brackets
  tests: Add a script to run cluster tests and make target test_cluster
  tests: Add regular expression parsing for hop_count_buckets
  tests: Fix the error messages in test event script
  ctdbd: Fix the error message string
  tests: Check for assigned IP addresses only if we are on real cluster
  tests: Check assigned IPs from ctdb output
  tests: Set the debug level = 3 when running local tests
  tests: Use CTDB_TEST_REAL_CLUSTER to decide if tests use local daemons
  recoverd: Fix spurious warnings when running with --nopublicipcheck
  ctdbd: Fix spurious warnings when running with --nopublicipcheck
  includes: Move special tevent defines from tevent.h to includes.h
  Remove explicit include of lib/tevent/tevent.h.
  ctdb_test: Remove faked wrappers for tevent functions in stub testing
  lib/tevent: Remove local modifications to tevent
  lib/tevent: Remove the files required to build tevent as a library
  lib/tevent: Sync tevent from samba git tree
  lib/talloc: Remove the files required to build talloc as a library
  lib/talloc: Sync talloc from samba git tree
  lib/tdb: Remove the files required to build tdb as a library
  lib/tdb: Sync tdb from samba git tree
  tests/tool: Fix the nodestatus test
  tests/tool: New nodestatus test
  tests: Fix wrapper scripts
  tests: CTDB_TEST_WRAPPER has to be an absolute path on a real cluster
  tests: test_wrap needs to set TEST_SCRIPTS_DIR
  tests/simple: Fix typo in the test message
  server: locking: Provide a common API for non-blocking locking of TDBs
  Revert server: locking: Provide a common API for non-blocking locking of 
TDBs
  tests: Use per node log files when running tests with local daemons
  packaging: make ctdb-tests package depend on nc
  server: Replace BOOL datatype with bool, True/False with true/false
  tests: Fix flakey behavior of ctdb_fetch test
  tests: Fix ctdb_fetch test (parse extra lines of output)
  tests: Increment RSN always in ctdb_update_record_persistent test
  Fix compiler warnings.
  util: Do not try to lockdown memory when running in local daemons mode
  ctdbd: Return explicit boolean values for function returning bool
  Remove tevent_loop_allow_nesting()
  web: Add my name to the developer list.
  util: Do not lock down memory when running with local daemons
  doc: Fix path string of /etc/sysconfig/ctdb file
  Revert when creating/adding a public ip, set the initial interface to be 
the first interface specified
  doc: Fix the hyperlink for Testing CTDB page
  scripts: Remove duplicate code from init script to set tunables
  doc: Fix documentation for setup event
  doc: Add info about execute permissions on event scripts
  header: Added DB statistics update macros
  common: Add routines to get process and lock information
  ctdbd: locking: Provide non-blocking API for locking of TDB 
record/db/alldb
  tools/ctdb: Display the locking statistics
  tests: Fix statistics test for new output lines from locking API
  ctdbd_test: Include ctdb_lock.c code for test stubs
  ctdb_freeze: Replace locking functions with locking API
  ctdb_recover: Replace static locking functions with locking API
  ctdbd: Replace lockwait with locking API and remove ctdb_lockwait.c
  locking: Schedule a new lock request everytime a lock is released
  locking: Add database priority handling for older versions of samba
  locking: Do not use ctdb_kill() to kill smbd processes
  build: Set CTDB_PATH to /tmp/ctdb.socket if SOCKPATH is not defined
  web: Remove reference to non-existent config files
  web: Add the links to ftp/http ctdb download area
  web: Add posix locking information to prerequisites
  doc: README - add information about CTDB, license and website
  build: Extract building of manpages in a separate Makefile
  packaging: Build

[SCM] CTDB repository - branch master updated - ctdb-1.13-333-g9be3b23

2012-10-25 Thread Amitay Isaacs
The branch, master has been updated
   via  9be3b23adbfc844b71bf1d4ddf0fbc3b269f15fa (commit)
  from  e2213db479129ce9c2b2fb88ec8c53cbd33d54b3 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 9be3b23adbfc844b71bf1d4ddf0fbc3b269f15fa
Author: Volker Lendecke v...@samba.org
Date:   Tue Oct 23 21:49:34 2012 +0200

Add a \n to an error message

---

Summary of changes:
 server/ctdb_ltdb_server.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index e012067..0432e49 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
@@ -1117,7 +1117,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, 
TDB_DATA indata,
if (db) {
if (db-persistent != persistent) {
DEBUG(DEBUG_ERR, (ERROR: DB Attach %spersistent to 
%spersistent 
- database %s, persistent ?  : 
non-,
+ database %s\n, persistent ?  : 
non-,
  db- persistent ?  : non-, 
db_name));
return -1;
}


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.52-2-g046f879

2012-10-25 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  046f8799361794997cedae3d4ff812216661e04e (commit)
   via  f1f2a3b74674120993bf7a51ecb1437095eb9318 (commit)
  from  39196986c69f3a7751f2b3a69f242263d6864514 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 046f8799361794997cedae3d4ff812216661e04e
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Oct 26 16:19:35 2012 +1100

New version 1.2.53

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit f1f2a3b74674120993bf7a51ecb1437095eb9318
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Mar 28 14:50:36 2012 +1100

Initscript - add backup of corrupt non-persistent databases

Corrupt non-persistent databases never get analysed because ctdbd
zeroes them at startup.

Modify the initscript so that corrupt non-persistent databases are
moved aside to a backup.  If the number of backups for a particular
database exceeds $CTDB_MAX_CORRUPT_DB_BACKUPS (default 10) then the
oldest excess backups are garbage collected.

Abstracts from and cleans up the code for checking persistent
databases.

Logging of related messages is done to syslog or a log file as
specified.

Signed-off-by: Martin Schwenke mar...@meltin.net

Cherry-picked-from: 00cd75595685dae829758abf1a4cb644af7ed50e

Conflicts:
config/ctdb.init

---

Summary of changes:
 config/ctdb.init   |  156 ++--
 packaging/RPM/ctdb.spec.in |4 +-
 2 files changed, 96 insertions(+), 64 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/ctdb.init b/config/ctdb.init
index 68850c0..7c75726 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -111,85 +111,112 @@ build_ctdb_options () {
 maybe_set --max-persistent-check-errors 
$CTDB_MAX_PERSISTENT_CHECK_ERRORS
 }
 
-check_tdb () {
-   local PDBASE=$1
-
-   test x$TDBTOOL_HAS_CHECK = x1  {
-   #
-   # Note tdbtool always exits with 0
-   #
-   local OK=`/usr/bin/tdbtool $PDBASE check | grep Database 
integrity is OK | wc -l`
-   test x$OK = x1 || {
-   return 1;
-   }
-
-   return 0;
-   }
-
-   /usr/bin/tdbdump $PDBASE /dev/null 2/dev/null || {
-   return $?;
-   }
-
-   return 0;
-}
-
-check_persistent_databases () {
-PERSISTENT_DB_DIR=${CTDB_DBDIR:-/var/ctdb}/persistent
-mkdir -p $PERSISTENT_DB_DIR 2/dev/null
-local ERRCOUNT=$CTDB_MAX_PERSISTENT_CHECK_ERRORS
+# Log given message or stdin to either syslog or a CTDB log file
+do_log ()
+{
+if [ $CTDB_SYSLOG = yes -o \
+   ${CTDB_OPTIONS#*--syslog} != $CTDB_OPTIONS ] ; then
 
-test -z $ERRCOUNT  {
-   ERRCOUNT=0
-}
-test x$ERRCOUNT != x0  {
-   return 0;
-}
-
-if test -x /usr/bin/tdbtool ; then
-HAVE_TDBTOOL=1
+   logger -t ctdb.init $@
 else
-HAVE_TDBTOOL=0
+   _l=${CTDB_LOGFILE:-/var/log/log.ctdb}
+   {
+   date
+   if [ -n $* ] ; then
+   echo $*
+   else
+   cat
+   fi
+   } $_l
 fi
+}
 
-if test x$HAVE_TDBTOOL = x1 ; then
-TDBTOOL_HAS_CHECK=`echo help | /usr/bin/tdbtool | grep check | wc -l`
+select_tdb_checker ()
+{
+# Find the best TDB consistency check available.
+use_tdb_tool_check=false
+if [ -x /usr/bin/tdbtool ]  \
+   echo help | /usr/bin/tdbtool | grep -q check ; then
+
+   use_tdb_tool_check=true
+elif [ -x /usr/bin/tdbtool -a -x /usr/bin/tdbdump ] ; then
+   do_log EOF
+WARNING: The installed 'tdbtool' does not offer the 'check' subcommand.
+ Using 'tdbdump' for database checks.
+ Consider updating 'tdbtool' for better checks!
+EOF
+elif [ -x /usr/bin/tdbdump ] ; then
+   do_log EOF
+WARNING: 'tdbtool' is not available.
+ Using 'tdbdump' to check the databases.
+ Consider installing a recent 'tdbtool' for better checks!
+EOF
 else
-TDBTOOL_HAS_CHECK=0
+   do_log EOF
+WARNING: Cannot check databases since neither
+ 'tdbdump' nor 'tdbtool check' is available.
+ Consider installing tdbtool or at least tdbdump!
+EOF
+return 1
 fi
+}
+
+check_tdb ()
+{
+_db=$1
 
-if test -x /usr/bin/tdbdump ; then
-HAVE_TDBDUMP=1
+if $use_tdb_tool_check ; then
+   # tdbtool always exits with 0  :-(
+   if tdbtool $_db check 2/dev/null |
+   grep -q Database integrity is OK ; then
+   return 0
+   else
+   return 1
+   fi
 else
-HAVE_TDBDUMP=0
+   tdbdump $_db /dev/null 2/dev/null
+   return $?
 fi
+}
 
-if test x$HAVE_TDBDUMP = x0 -a x$TDBTOOL_HAS_CHECK = x0 ; then
-echo WARNING: Cannot check persistent databases since
-echo

[SCM] CTDB repository - annotated tag ctdb-1.2.53 created - ctdb-1.2.53

2012-10-25 Thread Amitay Isaacs
The annotated tag, ctdb-1.2.53 has been created
at  bb30317d1e132a7cce2664b1225340902554cc2a (tag)
   tagging  046f8799361794997cedae3d4ff812216661e04e (commit)
  replaces  ctdb-1.2.52
 tagged by  Amitay Isaacs
on  Fri Oct 26 16:19:53 2012 +1100

- Log -
new version 1.2.53

Amitay Isaacs (1):
  New version 1.2.53

Martin Schwenke (1):
  Initscript - add backup of corrupt non-persistent databases

---


-- 
CTDB repository


[SCM] CTDB repository - annotated tag ctdb-2.0.0 created - ctdb-2.0.0

2012-10-25 Thread Amitay Isaacs
The annotated tag, ctdb-2.0.0 has been created
at  e29f936515e60dd057627d3fc72ae67b3075305b (tag)
   tagging  e2213db479129ce9c2b2fb88ec8c53cbd33d54b3 (commit)
  replaces  ctdb-1.13
 tagged by  Amitay Isaacs
on  Wed Oct 24 19:04:42 2012 +1100

- Log -
CTDB version 2.0.0

Amitay Isaacs (82):
  build: Add rules to create ctags/etags
  packaging: Setup directories for rpmbuild
  build: Remove re-definition of same variable
  build: Display correct LIB_FLAGS while building
  build: Use system talloc library if available
  build: Use system tevent library if available
  build: Use system tdb library if available
  recovery: Add prototypes for tdb internal functions
  build: Substitute POPT macros once and reuse variables
  tests/tool: Fix the nodestatus test
  tests/tool: New nodestatus test
  tests: exportfs always outputs with options in brackets
  tests: Add a script to run cluster tests and make target test_cluster
  tests: Add regular expression parsing for hop_count_buckets
  tests: Fix the error messages in test event script
  ctdbd: Fix the error message string
  tests: Check for assigned IP addresses only if we are on real cluster
  tests: Check assigned IPs from ctdb output
  tests: Set the debug level = 3 when running local tests
  tests: Use CTDB_TEST_REAL_CLUSTER to decide if tests use local daemons
  recoverd: Fix spurious warnings when running with --nopublicipcheck
  ctdbd: Fix spurious warnings when running with --nopublicipcheck
  includes: Move special tevent defines from tevent.h to includes.h
  Remove explicit include of lib/tevent/tevent.h.
  ctdb_test: Remove faked wrappers for tevent functions in stub testing
  lib/tevent: Remove local modifications to tevent
  lib/tevent: Remove the files required to build tevent as a library
  lib/tevent: Sync tevent from samba git tree
  lib/talloc: Remove the files required to build talloc as a library
  lib/talloc: Sync talloc from samba git tree
  lib/tdb: Remove the files required to build tdb as a library
  lib/tdb: Sync tdb from samba git tree
  tests/tool: Fix the nodestatus test
  tests/tool: New nodestatus test
  tests: Fix wrapper scripts
  tests: CTDB_TEST_WRAPPER has to be an absolute path on a real cluster
  tests: test_wrap needs to set TEST_SCRIPTS_DIR
  tests/simple: Fix typo in the test message
  server: locking: Provide a common API for non-blocking locking of TDBs
  Revert server: locking: Provide a common API for non-blocking locking of 
TDBs
  tests: Use per node log files when running tests with local daemons
  packaging: make ctdb-tests package depend on nc
  server: Replace BOOL datatype with bool, True/False with true/false
  tests: Fix flakey behavior of ctdb_fetch test
  tests: Fix ctdb_fetch test (parse extra lines of output)
  tests: Increment RSN always in ctdb_update_record_persistent test
  Fix compiler warnings.
  util: Do not try to lockdown memory when running in local daemons mode
  ctdbd: Return explicit boolean values for function returning bool
  Remove tevent_loop_allow_nesting()
  web: Add my name to the developer list.
  util: Do not lock down memory when running with local daemons
  doc: Fix path string of /etc/sysconfig/ctdb file
  Revert when creating/adding a public ip, set the initial interface to be 
the first interface specified
  doc: Fix the hyperlink for Testing CTDB page
  scripts: Remove duplicate code from init script to set tunables
  doc: Fix documentation for setup event
  doc: Add info about execute permissions on event scripts
  header: Added DB statistics update macros
  common: Add routines to get process and lock information
  ctdbd: locking: Provide non-blocking API for locking of TDB 
record/db/alldb
  tools/ctdb: Display the locking statistics
  tests: Fix statistics test for new output lines from locking API
  ctdbd_test: Include ctdb_lock.c code for test stubs
  ctdb_freeze: Replace locking functions with locking API
  ctdb_recover: Replace static locking functions with locking API
  ctdbd: Replace lockwait with locking API and remove ctdb_lockwait.c
  locking: Schedule a new lock request everytime a lock is released
  locking: Add database priority handling for older versions of samba
  locking: Do not use ctdb_kill() to kill smbd processes
  build: Set CTDB_PATH to /tmp/ctdb.socket if SOCKPATH is not defined
  web: Remove reference to non-existent config files
  web: Add the links to ftp/http ctdb download area
  web: Add posix locking information to prerequisites
  doc: README - add information about CTDB, license and website
  build: Extract building of manpages in a separate Makefile
  packaging

[SCM] CTDB repository - annotated tag ctdb-2.0.0 deleted - ctdb-1.13-332-ge2213db

2012-10-25 Thread Amitay Isaacs
The annotated tag, ctdb-2.0.0 has been deleted
   was  e29f936515e60dd057627d3fc72ae67b3075305b

---
tag ctdb-2.0.0

CTDB version 2.0.0
e2213db479129ce9c2b2fb88ec8c53cbd33d54b3 Avoid a bashism in 60.ganesha
---


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-1.13-332-ge2213db

2012-10-24 Thread Amitay Isaacs
The branch, master has been updated
   via  e2213db479129ce9c2b2fb88ec8c53cbd33d54b3 (commit)
  from  e94070de52232d6cefae0c6276df88b8fc380a4e (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit e2213db479129ce9c2b2fb88ec8c53cbd33d54b3
Author: Volker Lendecke v...@samba.org
Date:   Tue Oct 23 13:45:42 2012 +0200

Avoid a bashism in 60.ganesha

This file is #!/bin/sh. On sn-devel at least, with this /bin/sh the
shell does not like == for string equality.

---

Summary of changes:
 config/events.d/60.ganesha |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/60.ganesha b/config/events.d/60.ganesha
index cee7792..a685013 100755
--- a/config/events.d/60.ganesha
+++ b/config/events.d/60.ganesha
@@ -28,7 +28,7 @@ service_reconfigure ()
 }
 loadconfig nfs
 
-[ $NFS_SERVER_MODE == ganesha ] || exit 0
+[ $NFS_SERVER_MODE = ganesha ] || exit 0
 
 ctdb_setup_service_state_dir
 


-- 
CTDB repository


[SCM] CTDB repository - branch 1.2.39 updated - ctdb-1.9.1-503-g0491fde

2012-10-24 Thread Amitay Isaacs
The branch, 1.2.39 has been updated
   via  0491fdec7b11b0e79750c92977c6cc776d5f88bf (commit)
   via  a3ad2d631ebbee1beb8c4ce6bc1d50e5e8dee68b (commit)
   via  4478fd041647029240703493d84290402fa05bdb (commit)
   via  374cc28b910334b6f989e7bdbc2e9c62ca735787 (commit)
  from  f053a6d2948a1933d38d6cdd4cae55349e71b7d4 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.39


- Log -
commit 0491fdec7b11b0e79750c92977c6cc776d5f88bf
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Oct 25 12:09:07 2012 +1100

New version 1.2.39-5

(Re-creating the tags for releases not tagged in git)

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit a3ad2d631ebbee1beb8c4ce6bc1d50e5e8dee68b
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Oct 25 12:08:13 2012 +1100

Revert 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 reverts commit abd73b5494906c915c3379852524495957a1bf50.

commit 4478fd041647029240703493d84290402fa05bdb
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Oct 25 12:07:54 2012 +1100

Revert Add a tunable variable to control how long we defer after a ctdb 
addip until we force a rebalance and try to failback addresses onto this node

This reverts commit e86e0e8547593eb8ea2d5c65892de81eac694783.

commit 374cc28b910334b6f989e7bdbc2e9c62ca735787
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Oct 25 11:57:14 2012 +1100

New version 1.2.39-4

(Re-creating the tags for releases not tagged in git)

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 include/ctdb_private.h |2 -
 include/ctdb_protocol.h|5 
 packaging/RPM/ctdb.spec.in |6 -
 server/ctdb_recoverd.c |   56 
 server/ctdb_takeover.c |   40 ---
 server/ctdb_tunables.c |3 +-
 tools/ctdb.c   |   45 ++-
 7 files changed, 9 insertions(+), 148 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index b490b4d..e3a9a15 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -122,7 +122,6 @@ struct ctdb_tunable {
uint32_t vacuum_fast_path_count;
uint32_t lcp2_public_ip_assignment;
uint32_t allow_client_db_attach;
-   uint32_t deferred_rebalance_on_node_add;
 };
 
 /*
@@ -1443,7 +1442,6 @@ bool lcp2_failback(struct ctdb_context *ctdb,
   struct ctdb_public_ip_list *all_ips,
   uint32_t *lcp2_imbalances,
   bool *newly_healthy);
-void lcp2_forcerebalance(struct ctdb_context *ctdb, uint32_t pnn);
 void ctdb_takeover_run_core(struct ctdb_context *ctdb,
struct ctdb_node_map *nodemap,
struct ctdb_public_ip_list **all_ips_p);
diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h
index 1a116c1..0422afe 100644
--- a/include/ctdb_protocol.h
+++ b/include/ctdb_protocol.h
@@ -127,11 +127,6 @@ struct ctdb_call_info {
  */
 #define CTDB_SRVID_TAKEOVER_RUN 0xFB00LL
 
-/* request recovery daemon to rebalance ips for a node.
-   input is uint32_t for the node id.
-*/
-#define CTDB_SRVID_REBALANCE_NODE 0xFB01LL
-
 /* A message id to ask the recovery daemon to temporarily disable the
public ip checks
 */
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 4f46827..12a9e0b 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -4,7 +4,7 @@ Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team sa...@samba.org
 Version: 1.2.39
-Release: 3GITHASH
+Release: 5GITHASH
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
@@ -144,6 +144,10 @@ development libraries for ctdb
 %{_libdir}/libctdb.a
 
 %changelog
+* Mon Mar 5 2012 : version 1.2.39-5
+ - remove change for 35306
+* Wed Feb 29 2012 : version 1.2.39-4
+ - change default vacuuming timeout to 120 seconds
 * Tue Feb 28 2012 : version 1.2.39-3
  - fix for memory corruption S1034147
  - fix for imbalance after addip S1035305
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index d206d3d..4963c3f 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -65,7 +65,6 @@ struct ctdb_recoverd {
struct ip_reallocate_list *reallocate_callers;
TALLOC_CTX *ip_check_disable_ctx;
struct ctdb_control_get_ifaces *ifaces;
-   TALLOC_CTX *deferred_rebalance_ctx;
 };
 
 #define CONTROL_TIMEOUT() timeval_current_ofs(ctdb-tunable.recover_timeout, 0)
@@ -1942,57 +1941,6 @@ static void reenable_ip_check(struct event_context *ev, 
struct timed_event *te

[SCM] CTDB repository - branch master updated - ctdb-1.13-320-gc18ec8e

2012-10-22 Thread Amitay Isaacs
The branch, master has been updated
   via  c18ec8ec234cb71da6cc77b1aadc398f57187947 (commit)
   via  7547e011005f0dd5bd38e67572280126cf16e229 (commit)
   via  7197e600f46f2d1638f6c45c0149f109ea25a47c (commit)
   via  ef55e06192819d840c09b65741bab737223ac34c (commit)
   via  cbca233d1e03b2410e0bb63b936328d4a8b3c7b4 (commit)
  from  a9511cf5ecd5bc39b0070f0afa8ac4d4926c6cab (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit c18ec8ec234cb71da6cc77b1aadc398f57187947
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Oct 22 12:19:07 2012 +1100

doc: getlog and clearlog changes for recovery daemon logs

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 7547e011005f0dd5bd38e67572280126cf16e229
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Oct 18 14:15:09 2012 +1100

tests: Local daemons should use the logging ringbuffer

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 7197e600f46f2d1638f6c45c0149f109ea25a47c
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Oct 18 14:13:30 2012 +1100

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 mar...@meltin.net

commit ef55e06192819d840c09b65741bab737223ac34c
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Oct 16 20:57:31 2012 +1100

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 mar...@meltin.net

commit cbca233d1e03b2410e0bb63b936328d4a8b3c7b4
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Oct 16 20:54:39 2012 +1100

recoverd: Add CTDB_SRVID_GETLOG and CTDB_SRVID_CLEARLOG

These support getting and clearing logs from the ring-buffer in the
recovery daemon.

Signed-off-by: Martin Schwenke mar...@meltin.net

---

Summary of changes:
 common/ctdb_logging.c  |   11 +-
 doc/ctdb.1 |  693 +---
 doc/ctdb.1.html|  175 ++-
 doc/ctdb.1.xml |   27 ++-
 include/ctdb_private.h |2 +
 include/ctdb_protocol.h|8 +
 server/ctdb_recoverd.c |   46 +++
 tests/scripts/integration.bash |2 +-
 tools/ctdb.c   |   98 --
 9 files changed, 685 insertions(+), 377 deletions(-)


Changeset truncated at 500 lines:

diff --git a/common/ctdb_logging.c b/common/ctdb_logging.c
index e3299d3..09b1df2 100644
--- a/common/ctdb_logging.c
+++ b/common/ctdb_logging.c
@@ -87,7 +87,7 @@ void log_ringbuffer(const char *format, ...)
 
 
 
-static void ctdb_collect_log(struct ctdb_context *ctdb, struct 
ctdb_get_log_addr *log_addr)
+void ctdb_collect_log(struct ctdb_context *ctdb, struct ctdb_get_log_addr 
*log_addr)
 {
TDB_DATA data;
FILE *f;
@@ -174,12 +174,15 @@ int32_t ctdb_control_get_log(struct ctdb_context *ctdb, 
TDB_DATA addr)
return 0;
 }
 
-
-int32_t ctdb_control_clear_log(struct ctdb_context *ctdb)
+void ctdb_clear_log(struct ctdb_context *ctdb)
 {
first_entry = 0;
last_entry  = 0;
+}
+
+int32_t ctdb_control_clear_log(struct ctdb_context *ctdb)
+{
+   ctdb_clear_log(ctdb);
 
return 0;
 }
-
diff --git a/doc/ctdb.1 b/doc/ctdb.1
index 2a0ec62..74086fa 100644
--- a/doc/ctdb.1
+++ b/doc/ctdb.1
@@ -1,164 +1,218 @@
-.\ ** You probably do not want to edit this file directly **
-.\ It was generated using the DocBook XSL Stylesheets (version 1.69.1).
-.\ Instead of manually editing it, you probably should edit the DocBook XML
-.\ source for it and then use the DocBook XSL Stylesheets to regenerate it.
-.TH CTDB 1 05/03/2012 ctdb CTDB \- clustered TDB database
+'\ t
+.\ Title: ctdb
+.\Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\ Generator: DocBook XSL Stylesheets v1.76.1 http://docbook.sf.net/
+.\  Date: 10/22/2012
+.\Manual: CTDB - clustered TDB database
+.\Source: ctdb
+.\  Language: English
+.\
+.TH CTDB 1 10/22/2012 ctdb CTDB \- clustered TDB database
+.\ -
+.\ * Define some portability stuff
+.\ -
+.\ ~
+.\ http://bugs.debian.org/507673
+.\ http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\ ~
+.ie \n(.g .ds Aq \(aq
+.el   .ds Aq '
+.\ -
+.\ * set default formatting
+.\ 

[SCM] CTDB repository - branch master updated - ctdb-1.13-315-ga9511cf

2012-10-21 Thread Amitay Isaacs
The branch, master has been updated
   via  a9511cf5ecd5bc39b0070f0afa8ac4d4926c6cab (commit)
  from  f92b9c83a2f39fba9a141417a88de96fc8c592ff (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit a9511cf5ecd5bc39b0070f0afa8ac4d4926c6cab
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Oct 22 09:01:27 2012 +1100

build: Set CTDB_PATH to /tmp/ctdb.socket if SOCKPATH is not defined

When building samba with CTDB, if samba configure/waf does not support
setting of SOCKPATH, fallback to /tmp/ctdb.socket.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 include/ctdb_protocol.h |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h
index 022a8fe..327ca92 100644
--- a/include/ctdb_protocol.h
+++ b/include/ctdb_protocol.h
@@ -21,7 +21,11 @@
 #define _CTDB_PROTOCOL_H
 
 /* location of daemon socket, set at configure time */
-#define CTDB_PATH SOCKPATH
+#ifdef SOCKPATH
+#define CTDB_PATH  SOCKPATH
+#else
+#define CTDB_PATH  /tmp/ctdb.socket
+#endif
 
 /* default ctdb port number */
 #define CTDB_PORT 4379


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-1.13-314-gf92b9c8

2012-10-20 Thread Amitay Isaacs
The branch, master has been updated
   via  f92b9c83a2f39fba9a141417a88de96fc8c592ff (commit)
  from  7d025281ee70c91ebcd4d9a908de1045a689786b (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit f92b9c83a2f39fba9a141417a88de96fc8c592ff
Author: David Disseldorp dd...@samba.org
Date:   Thu Oct 18 16:55:19 2012 +0200

Build: Set the default ctdb socket path at configure time

The ctdb socket path currently defaults to /tmp/ctdb.socket and can be
modified at runtime using the --socket=filename option, common to both
ctdb and ctdbd binaries.

This change allows the default path to be set at configure time using
the --with-socketpath=FILE argument. When not specified, the default
path remains /tmp/ctdb.socket, documentation remains unchanged as a
result.

Signed-off-by: David Disseldorp dd...@samba.org

---

Summary of changes:
 Makefile.in |2 ++
 configure.ac|   11 +++
 include/ctdb_protocol.h |4 ++--
 3 files changed, 15 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 0e365f6..efc6622 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -16,6 +16,7 @@ sbindir = @sbindir@
 mandir = @mandir@
 localstatedir = @localstatedir@
 logdir = @LOGDIR@
+sockpath = @SOCKPATH@
 VPATH = @srcdir@:@tdbdir@:@tallocdir@:@libreplacedir@:@poptdir@:@teventdir@:
 srcdir = @srcdir@
 etcdir = @sysconfdir@
@@ -51,6 +52,7 @@ CFLAGS=@CPPFLAGS@ -g -I$(srcdir)/include -Iinclude -Ilib 
-Ilib/util -I$(srcdir)
$(TALLOC_CFLAGS) $(TEVENT_CFLAGS) $(TDB_CFLAGS) -I@libreplacedir@ \
-DVARDIR=\$(localstatedir)\ -DETCDIR=\$(etcdir)\ \
-DLOGDIR=\$(logdir)\ \
+   -DSOCKPATH=\$(sockpath)\ \
-DUSE_MMAP=1 -DTEVENT_DEPRECATED_QUIET=1 @CFLAGS@ 
-Wno-format-zero-length $(POPT_CFLAGS) \
-fPIC
 
diff --git a/configure.ac b/configure.ac
index 50d20a0..85934a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,17 @@ if test ! -z $LOGDIR; then
 fi
 AC_SUBST(LOGDIR)
 
+SOCKPATH='/tmp/ctdb.socket'
+AC_ARG_WITH([socketpath],
+   [  --with-socketpath=FILE   path to CTDB daemon socket 
[[/tmp/ctdb.socket]]],
+   SOCKPATH=$withval)
+if test ! -z $SOCKPATH; then
+  if test $SOCKPATH = yes -o $SOCKPATH = no; then
+ AC_MSG_ERROR([--with-socketpath must specify a file path])
+  fi
+fi
+AC_SUBST(SOCKPATH)
+
 AC_CONFIG_HEADER(config.h)
 
 EXTRA_OBJ=
diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h
index 14b44d5..022a8fe 100644
--- a/include/ctdb_protocol.h
+++ b/include/ctdb_protocol.h
@@ -20,8 +20,8 @@
 #ifndef _CTDB_PROTOCOL_H
 #define _CTDB_PROTOCOL_H
 
-/* location of daemon socket */
-#define CTDB_PATH  /tmp/ctdb.socket
+/* location of daemon socket, set at configure time */
+#define CTDB_PATH SOCKPATH
 
 /* default ctdb port number */
 #define CTDB_PORT 4379


-- 
CTDB repository


[SCM] CTDB repository - branch master updated - ctdb-1.13-301-g5ee242c

2012-10-19 Thread Amitay Isaacs
The branch, master has been updated
   via  5ee242c949a98bb7397e0f7368b20d44c06fe772 (commit)
   via  2d75a04ba9a2e87a0dcb9bf778c58e335af1871c (commit)
   via  59a47c0674bacfebc17a1b44f0244727bf2fa7a4 (commit)
   via  440892d75ef73c0aca22f47c0c01712be00cf5b7 (commit)
   via  14589bf7c16ba017fe00d4e8bea8cc501546c60f (commit)
   via  59520c9785d113ad5063eb5fbe42a9efc7e30076 (commit)
   via  3cc878bc97fdac764a60ed805f64d649eaab06e8 (commit)
   via  16aba4eb620844626a1c71c58b51658caf44dea6 (commit)
   via  eaa7c165f58abd7e259c37d76b7dd37c91e13d9f (commit)
   via  0e56e2dad1861892aa8ba59494ad244f2498314e (commit)
   via  7895bc003f087ab2f3181df3c464386f59bfcc39 (commit)
  from  af540ef728303b4a0a188b17c695e9aefab34489 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 5ee242c949a98bb7397e0f7368b20d44c06fe772
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Oct 16 17:04:48 2012 +1100

scripts: Refactor logging code in initscript and functions file

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 2d75a04ba9a2e87a0dcb9bf778c58e335af1871c
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Oct 11 16:21:02 2012 +1100

tools/ctdb_diagnostics: Add ctdb listvars output

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 59a47c0674bacfebc17a1b44f0244727bf2fa7a4
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Oct 11 16:18:26 2012 +1100

initscript: Check that rc.ctdb is executable before running it

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 440892d75ef73c0aca22f47c0c01712be00cf5b7
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Oct 11 16:10:19 2012 +1100

ctdbd: Remove references to forcing running of eventscripts from log 
messages

Running of eventscripts can be initiated from many places, including
the recovery daemon.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 14589bf7c16ba017fe00d4e8bea8cc501546c60f
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Oct 11 15:59:00 2012 +1100

recoverd: Clarify some misleading log messages

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 59520c9785d113ad5063eb5fbe42a9efc7e30076
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Oct 11 15:49:13 2012 +1100

tools/ctdb: Remove extra header from natgwlist -Y output

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 3cc878bc97fdac764a60ed805f64d649eaab06e8
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Oct 11 15:17:54 2012 +1100

recoverd: Verifying local IPs should only check for unhosted available IPs

Currently it checks for unhosted IPs among the known IPs rather than
available IPs.  This means that a takeover run can be flagged even
when that takeover run will be unable to assign a known, unhosted IP.

Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Signed-off-by: Martin Schwenke mar...@meltin.net

commit 16aba4eb620844626a1c71c58b51658caf44dea6
Author: Martin Schwenke mar...@meltin.net
Date:   Thu Oct 11 14:34:37 2012 +1100

Revert Eventscripts - add facility to 10.interface to delete unmanaged IPs

This reverts commit 88f88d86b0d08240f749fb721b8c401c2eeb1099.

This is dangerous and, on reflection, I can't see it being useful.
There are often permanent IPs on interfaces that CTDB shares with its
public IPs.

commit eaa7c165f58abd7e259c37d76b7dd37c91e13d9f
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Sep 26 14:37:49 2012 +1000

Eventscripts: recovered event should not fail on NATGW failure

The recovery process has no protection against the recovered event
failing, so this can cause a recovery loop.

Instead of failing the recovered event, add a monitor event and
fail that instead.  In this case the failure semantics are well
defined.

A separate patch should ban nodes if the recovered event fails for
an unknown reason.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 0e56e2dad1861892aa8ba59494ad244f2498314e
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Sep 28 09:39:12 2012 +1000

Logging: Map TEVENT_DEBUG_FATAL to DEBUG_CRIT

This is currently mapped to DEBUG_EMERG.  CTDB really has no business
logging anything at EMERG level since the whole system is not about to
abort or catch fire.  EMERG causes the message to appear on the
console and on every terminal.  That's a bit overzealous!

There would be very few situations where logs are being filtered at
level below ERROR, so CRIT should certainly suffice.

The trigger for this was curious messages saying No event for n
seconds! logged in a user's terminal.

Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Signed-off-by: Martin Schwenke mar...@meltin.net

commit

[SCM] CTDB repository - branch master updated - ctdb-1.13-313-g7d02528

2012-10-19 Thread Amitay Isaacs
The branch, master has been updated
   via  7d025281ee70c91ebcd4d9a908de1045a689786b (commit)
   via  edbc8a6669b594d3c413d603e1c9fada9244c2ee (commit)
   via  c8eb4a3170ab8524e638047053831ba547e9cce8 (commit)
   via  2126795153dacb255e441abcb36ee05107b6282a (commit)
   via  4456a01d8f54ca6c771d7488048de5f638477d21 (commit)
   via  01ee86d2aafbcda658ef6acc2bba6d6781ae4047 (commit)
   via  caff197edf6f928494028ac6c993901954aaa36f (commit)
   via  1ee55c511b99e9f8a6fa4e34207267e953f09bae (commit)
   via  e24b5bf283736624b387b0364d7200212bb3054b (commit)
   via  1af99cf0de9919dd89af1feab6d1bd18b95d82ff (commit)
   via  be4051326b0c6a0fd301561af10fd15a0e90023b (commit)
   via  a0cdfae7438092f5c605f0608daa536be860b7fe (commit)
  from  5ee242c949a98bb7397e0f7368b20d44c06fe772 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 7d025281ee70c91ebcd4d9a908de1045a689786b
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Sep 25 17:29:50 2012 +1000

locking: Do not use ctdb_kill() to kill smbd processes

ctdb_kill() is used to terminate processes spawned by CTDB.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit edbc8a6669b594d3c413d603e1c9fada9244c2ee
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Jul 11 15:15:41 2012 +1000

locking: Add database priority handling for older versions of samba

In samba versions 3.6.x and older, database priorities are not set.
later_db() function implements higher database priority (locking order)
for these databases -
   brlock, g_lock, notify_onelevel, serverid, xattr_tdb

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit c8eb4a3170ab8524e638047053831ba547e9cce8
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Jul 9 17:37:35 2012 +1000

locking: Schedule a new lock request everytime a lock is released

Since the number of active lock requests is limited to
MAX_LOCK_PROCESSES_PER_DB (= 100), any new requests won't get scheduled
when they are created. So schedule a pending request once current active
request is done.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 2126795153dacb255e441abcb36ee05107b6282a
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Jun 14 16:12:48 2012 +1000

ctdbd: Replace lockwait with locking API and remove ctdb_lockwait.c

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 4456a01d8f54ca6c771d7488048de5f638477d21
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed May 9 15:17:21 2012 +1000

ctdb_recover: Replace static locking functions with locking API

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 01ee86d2aafbcda658ef6acc2bba6d6781ae4047
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed May 9 15:09:51 2012 +1000

ctdb_freeze: Replace locking functions with locking API

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit caff197edf6f928494028ac6c993901954aaa36f
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed May 9 15:10:20 2012 +1000

ctdbd_test: Include ctdb_lock.c code for test stubs

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 1ee55c511b99e9f8a6fa4e34207267e953f09bae
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu May 17 15:25:46 2012 +1000

tests: Fix statistics test for new output lines from locking API

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit e24b5bf283736624b387b0364d7200212bb3054b
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed May 9 12:58:19 2012 +1000

tools/ctdb: Display the locking statistics

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 1af99cf0de9919dd89af1feab6d1bd18b95d82ff
Author: Amitay Isaacs ami...@gmail.com
Date:   Thu Oct 11 11:29:29 2012 +1100

ctdbd: locking: Provide non-blocking API for locking of TDB record/db/alldb

This introduces a consistent API for handling locks on single record, 
complete
db or all dbs. The locks are taken out in a child process. In cases of 
timeout,
find the processes that currently hold the lock and log.

Callback functions for locking requests take locked boolean to indicate
whether the lock was successfully obtained or not.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit be4051326b0c6a0fd301561af10fd15a0e90023b
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Jun 6 11:50:25 2012 +1000

common: Add routines to get process and lock information

Currently these functions are implemented only for Linux.

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit a0cdfae7438092f5c605f0608daa536be860b7fe
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed May 9 12:56:53 2012 +1000

header: Added DB statistics update macros

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes

[SCM] CTDB repository - branch master updated - ctdb-1.13-289-g25d8860

2012-10-16 Thread Amitay Isaacs
The branch, master has been updated
   via  25d886060b138bc5e78fe93d7bebe3990264f29d (commit)
   via  36d25e96a2f8ae1461c5a708a2922f0475a39900 (commit)
   via  632c1b9c1cc2e242376358ce49fd2022b3f27aa2 (commit)
  from  08dbd9c7958f9a0ee3de314d49523d32e4be135c (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit 25d886060b138bc5e78fe93d7bebe3990264f29d
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Oct 17 11:38:37 2012 +1100

doc: Add info about execute permissions on event scripts

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 36d25e96a2f8ae1461c5a708a2922f0475a39900
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Oct 17 11:38:59 2012 +1100

doc: Fix documentation for setup event

Signed-off-by: Amitay Isaacs ami...@gmail.com

commit 632c1b9c1cc2e242376358ce49fd2022b3f27aa2
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Sep 3 12:39:36 2012 +1000

scripts: Remove duplicate code from init script to set tunables

The tunable variables defined in CTDB configuration file are currently
set up from init script as well as part of setup event in 00.ctdb
eventscript.  Remove the duplication of this code and set tunable
variables only from setup event.  During the setup event, it's possible
that ctdb tool commands can timeout if CTDB daemon is not ready.  To guard
against such eventuality, wait till ctdb ping command succeeds before
executing any other ctdb tool commands.

Signed-off-by: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 config/ctdb.init|   14 +-
 config/events.d/00.ctdb |   37 +
 config/events.d/README  |   10 +-
 3 files changed, 35 insertions(+), 26 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/ctdb.init b/config/ctdb.init
index 581844d..372affb 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -214,16 +214,6 @@ EOF
 done
 }
 
-set_ctdb_variables () {
-# set any tunables from the config file
-set | grep ^CTDB_SET_ | cut -d_ -f3- | 
-while read v; do
-   varname=`echo $v | cut -d= -f1`
-   value=`echo $v | cut -d= -f2`
-   ctdb setvar $varname $value || RETVAL=1
-done || exit 1
-}
-
 set_retval() {
 return $1
 }
@@ -304,9 +294,7 @@ start() {
 esac
 
 if [ $RETVAL -eq 0 ] ; then
-   if wait_until_ready ; then
-   set_ctdb_variables
-   else
+   if ! wait_until_ready ; then
RETVAL=1
pkill -9 -f $ctdbd /dev/null 21
fi
diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index 2a48afb..2f2116d 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
@@ -35,6 +35,30 @@ update_config_from_tdb() {
 fi
 }
 
+set_ctdb_variables () {
+# set any tunables from the config file
+set | grep ^CTDB_SET_ | cut -d_ -f3- | 
+while read v; do
+   varname=`echo $v | cut -d= -f1`
+   value=`echo $v | cut -d= -f2`
+   ctdb setvar $varname $value || return 1
+   echo Set $varname to $value
+done
+}
+
+wait_until_ready () {
+_timeout=${1:-10} # default is 10 seconds
+
+_count=0
+while ! ctdb ping /dev/null 21 ; do
+   if [ $_count -ge $_timeout ] ; then
+   return 1
+   fi
+   sleep 1
+   _count=$(($_count + 1))
+done
+}
+
 ctdb_check_args $@
 
 case $1 in 
@@ -51,14 +75,11 @@ case $1 in
;;
 
  setup)
-   # set any tunables from the config file
-   set | grep ^CTDB_SET_ | cut -d_ -f3- | 
-   while read v; do
-   varname=`echo $v | cut -d= -f1`
-   value=`echo $v | cut -d= -f2`
-   ctdb setvar $varname $value || exit 1
-   echo Set $varname to $value
-   done || exit 1
+# Make sure CTDB daemon is ready to process requests
+if wait_until_ready ; then
+   # set any tunables from the config file
+   set_ctdb_variables
+   fi || exit 1
;;
 
 startup)
diff --git a/config/events.d/README b/config/events.d/README
index 024af24..6075f39 100644
--- a/config/events.d/README
+++ b/config/events.d/README
@@ -13,6 +13,8 @@ As a special case, any eventscript that ends with a '~' 
character will be
 ignored since this is a common postfix that some editors will append to 
 older versions of a file.
 
+Only event scripts with executable permissions are run from CTDB. Any event
+script that does not have executable permission is ignored.
 
 The eventscripts are called with varying number of arguments.
 The first argument is the event and the rest of the arguments depend
@@ -33,11 +35,9 @@ init
 
 setup
This event does not take any additional arguments.
-   This event is only invoked once, when ctdb is starting up.
-   This event is used to do some cleanup work from earlier

[SCM] CTDB repository - branch master updated - ctdb-1.13-285-gbd4ff17

2012-10-10 Thread Amitay Isaacs
The branch, master has been updated
   via  bd4ff176387372b1c233373c0bc8ced523fc9670 (commit)
   via  7d4b8cce96f33fff647a0c9d259c121dfc8403e9 (commit)
   via  c185ffd2822fcee26d07398464c59b66c61f53fa (commit)
   via  9550c497e6d6ef5ee44826c4bd9ed5ad65174263 (commit)
   via  56fcee3c7730cb12fa666072d5400949af6e5f7c (commit)
   via  bfe16cf69bf2eee93c0d831f76d88bba0c2b96c2 (commit)
   via  a555940fb5c914b7581667a05153256ad7d17774 (commit)
   via  be4ad110ede9981b181ac28f31ffd855a879d5df (commit)
   via  7054e4ded59c6b8f254dcfefaef64da05f25aecd (commit)
  from  c4f5a58471b206e2287c7958c7f29c1f1c0626ac (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -
commit bd4ff176387372b1c233373c0bc8ced523fc9670
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Oct 10 15:03:06 2012 +1100

tests/eventscripts: add unit tests for policy routing reconfigure

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 7d4b8cce96f33fff647a0c9d259c121dfc8403e9
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Oct 10 14:48:59 2012 +1100

tests/eventscripts: add extra infrastructure for policy routing tests

Less copying and pasting is a good thing...

Signed-off-by: Martin Schwenke mar...@meltin.net

commit c185ffd2822fcee26d07398464c59b66c61f53fa
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Aug 3 10:54:30 2012 +1000

Eventscripts: Add support for reconfigure pseudo-event for policy routing

This rebuilds all policy routes and can be used if the configuration
changes.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit 9550c497e6d6ef5ee44826c4bd9ed5ad65174263
Author: Martin Schwenke mar...@meltin.net
Date:   Mon Sep 24 14:32:04 2012 +1000

recoverd: Track failure of recovered event, banning culprits

Pair-programmed-with: Amitay Isaacs ami...@gmail.com
Signed-off-by: Martin Schwenke mar...@meltin.net

commit 56fcee3c7730cb12fa666072d5400949af6e5f7c
Author: Martin Schwenke mar...@meltin.net
Date:   Fri Aug 31 09:34:17 2012 +1000

recoverd: When starting a takeover run disable IP verification

Disable for TakeoverTimeout seconds.

Otherwise the the recovery daemon can get overzealous and start trying
to add/delete addresses that it thinks are missing but where the
eventscript just hasn't finished.  This didn't used to matter so much
but it is more important now that concurrent takeip/releaseip/updateip
generate error - we want to avoid spamming the log.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit bfe16cf69bf2eee93c0d831f76d88bba0c2b96c2
Author: Martin Schwenke mar...@meltin.net
Date:   Wed Jul 11 14:46:07 2012 +1000

ctdbd: Stop takeovers and releases from colliding in mid-air

There's a race here where release and takeover events for an IP can
run at the same time.  For example, a ctdb deleteip and a takeover
initiated by the recovery daemon.  The timeline is as follows:

1. The release code registers a callback to update the VNN.  The
   callback is executed *after* the eventscripts run the releaseip
   event.

2. The release code calls the eventscripts for the releaseip event,
   removing IP from its interface.

   The takeover code updates the VNN saying that IP is on some
   iface even if/though the address is already there.

3. The release callback runs, removing the iface associated with IP in
   the VNN.

   The takeover code calls the eventscripts for the takeip event,
   adding IP to an interface.

As a result, CTDB doesn't think it should be hosting IP but IP is on
an interface.  The recovery daemon fixes this later... but it
shouldn't happen.

This patch can cause some additional noise in the logs:

  Release of IP 10.0.2.133/24 on interface eth2  node:2
  recoverd:We are still serving a public address '10.0.2.133' that we 
should not be serving. Removing it.
  Release of IP 10.0.2.133/24 rejected update for this IP already in flight
  recoverd:client/ctdb_client.c:2455 ctdb_control for release_ip failed
  recoverd:Failed to release local ip address

In this case the node has started releasing an IP when the recovery
daemon notices the addresses is still hosted and initiates another
release.  This noise is harmless but annoying.

Signed-off-by: Martin Schwenke mar...@meltin.net

commit a555940fb5c914b7581667a05153256ad7d17774
Author: Martin Schwenke mar...@meltin.net
Date:   Tue Aug 28 15:17:29 2012 +1000

ctdbd: New tunable NoIPTakeoverOnDisabled

Stops the behaviour where unhealthy nodes can host IPs when there are
no healthy nodes.  Set this to 1 when an immediate complete outage is
preferred when all nodes are unhealthy.  The alternative
(i.e. default) can lead

<    1   2   3   4   5   6   >