[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.9.1-547-gc51154b

Ronnie Sahlberg sahlberg at samba.org
Thu Mar 1 17:21:34 MST 2012


The branch, 1.2.40 has been updated
       via  c51154b79be94198324c321aaaa037045bb85cd9 (commit)
      from  0a52799f85de9c9dc0ac8ae62e7f2829a30eb8bb (commit)

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


- Log -----------------------------------------------------------------
commit c51154b79be94198324c321aaaa037045bb85cd9
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Mar 2 10:52:00 2012 +1100

    READONLY: only send a control to schedule fast-vacuuming from child context iff we have a connection open to the main daemon
    
    there are some child processes where we do not create a connection to the main daemon (switch_from_server_to_client()) because it is expensive to set up and we normally might not need to talk to the daemon at all via a domainsocket.
    but we might want to still call to ctdb_ltdb_store() from such chil processes.

-----------------------------------------------------------------------

Summary of changes:
 client/ctdb_client.c   |    4 +++-
 common/ctdb_util.c     |    1 +
 include/ctdb_private.h |    3 +++
 server/ctdb_vacuum.c   |    8 ++++++++
 4 files changed, 15 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 487989c..8b9df42 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -4087,7 +4087,9 @@ int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt, ...
 		return -1;
 	}
 
-	 return 0;
+	ctdb->can_send_controls = true;
+
+	return 0;
 }
 
 /*
diff --git a/common/ctdb_util.c b/common/ctdb_util.c
index 1ff4c1f..061c16d 100644
--- a/common/ctdb_util.c
+++ b/common/ctdb_util.c
@@ -346,6 +346,7 @@ pid_t ctdb_fork(struct ctdb_context *ctdb)
 		if (ctdb->do_setsched) {
 			ctdb_restore_scheduler(ctdb);
 		}
+		ctdb->can_send_controls = false;
 	}
 	return pid;
 }
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 7d0a6d8..8180722 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -499,6 +499,9 @@ struct ctdb_context {
 
 	/* list of event script callback functions that are active */
 	struct event_script_callback *script_callbacks;
+
+	/* if we are a child process, do we have a domain socket to send controls on */
+	bool can_send_controls;
 };
 
 struct ctdb_db_context {
diff --git a/server/ctdb_vacuum.c b/server/ctdb_vacuum.c
index 181393b..bb71be7 100644
--- a/server/ctdb_vacuum.c
+++ b/server/ctdb_vacuum.c
@@ -1371,6 +1371,14 @@ int32_t ctdb_local_schedule_for_deletion(struct ctdb_db_context *ctdb_db,
 		return ret;
 	}
 
+	/* if we dont have a connection to the daemon we can not send
+	   a control. For example sometimes from update_record control child
+	   process.
+	*/
+	if (!ctdb_db->ctdb->can_send_controls) {
+		return -1;
+	}
+
 	/* child process: send the main daemon a control */
 
 	indata.dsize = offsetof(struct ctdb_control_schedule_for_deletion, key) + key.dsize;


-- 
CTDB repository


More information about the samba-cvs mailing list