[SCM] CTDB repository - branch master updated - ctdb-1.10-216-gdc0c585

Michael Adam obnox at samba.org
Thu Jun 23 07:57:57 MDT 2011


The branch, master has been updated
       via  dc0c58547cd4b20a8e2cd21f3c8363f34fd03e75 (commit)
       via  af75d3e37412e03d3978073edbe6dee78f265c3c (commit)
      from  66e89797c7866d207a5bbf1836f52d70dba7cea6 (commit)

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


- Log -----------------------------------------------------------------
commit dc0c58547cd4b20a8e2cd21f3c8363f34fd03e75
Author: David Disseldorp <ddiss at suse.de>
Date:   Tue Apr 5 13:26:29 2011 +0200

    client: handle transient connection errors
    
    Client connections to the ctdbd unix domain socket may fail
    intermittently while the server is under heavy load. This change
    introduces a client connect retry loop.
    
    During failure the client will retry for a maximum of 64 seconds, the
    ctdb --timelimit option can be used to cap client runtime.
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit af75d3e37412e03d3978073edbe6dee78f265c3c
Author: Mathieu Parent <math.parent at gmail.com>
Date:   Sat Mar 26 11:55:30 2011 +0100

    Manpage for ping_pong
    
    Signed-off-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 Makefile.in                |    4 +-
 client/ctdb_client.c       |   35 ++++++++++++--
 doc/ping_pong.1            |  110 ++++++++++++++++++++++++++++++++++++++++++++
 doc/ping_pong.1.html       |   37 +++++++++++++++
 doc/ping_pong.1.xml        |  110 ++++++++++++++++++++++++++++++++++++++++++++
 packaging/RPM/ctdb.spec.in |    1 +
 6 files changed, 291 insertions(+), 6 deletions(-)
 create mode 100644 doc/ping_pong.1
 create mode 100644 doc/ping_pong.1.html
 create mode 100644 doc/ping_pong.1.xml


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index aec64e1..8fb9ea7 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -203,7 +203,8 @@ tests/bin/ibwrapper_test: $(CTDB_CLIENT_OBJ) ib/ibwrapper_test.o
 doc: doc/ctdb.1 doc/ctdb.1.html \
 	doc/ctdbd.1 doc/ctdbd.1.html \
 	doc/onnode.1 doc/onnode.1.html \
-	doc/ltdbtool.1 doc/ltdbtool.1.html
+	doc/ltdbtool.1 doc/ltdbtool.1.html \
+	doc/ping_pong.1 doc/ping_pong.1.html
 
 clean:
 	rm -f *.o */*.o */*.a */*/*.o */*~
@@ -264,6 +265,7 @@ install: all
 	if [ -f doc/ctdbd.1 ];then ${INSTALLCMD} -m 644 doc/ctdbd.1 $(DESTDIR)$(mandir)/man1; fi
 	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 doc/ping_pong.1 ];then ${INSTALLCMD} -m 644 doc/ping_pong.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/ctdb-crash-cleanup.sh ];then ${INSTALLCMD} -m 755 config/ctdb-crash-cleanup.sh $(DESTDIR)$(etcdir)/ctdb; fi
 
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 5e06604..55c3273 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -246,16 +246,41 @@ done:
 }
 
 /*
-  connect to a unix domain socket
+  connect with exponential backoff, thanks Stevens
 */
-int ctdb_socket_connect(struct ctdb_context *ctdb)
+#define CONNECT_MAXSLEEP 64
+static int ctdb_connect_retry(struct ctdb_context *ctdb)
 {
 	struct sockaddr_un addr;
+	int secs;
+	int ret = 0;
 
 	memset(&addr, 0, sizeof(addr));
 	addr.sun_family = AF_UNIX;
 	strncpy(addr.sun_path, ctdb->daemon.name, sizeof(addr.sun_path));
 
+	for (secs = 1; secs <= CONNECT_MAXSLEEP; secs *= 2) {
+		ret = connect(ctdb->daemon.sd, (struct sockaddr *)&addr,
+			      sizeof(addr));
+		if ((ret == 0) || (errno != EAGAIN)) {
+			break;
+		}
+
+		if (secs <= (CONNECT_MAXSLEEP / 2)) {
+			DEBUG(DEBUG_ERR,("connect failed: %s, retry in %d second(s)\n",
+					 strerror(errno), secs));
+			sleep(secs);
+		}
+	}
+
+	return ret;
+}
+
+/*
+  connect to a unix domain socket
+*/
+int ctdb_socket_connect(struct ctdb_context *ctdb)
+{
 	ctdb->daemon.sd = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (ctdb->daemon.sd == -1) {
 		DEBUG(DEBUG_ERR,(__location__ " Failed to open client socket. Errno:%s(%d)\n", strerror(errno), errno));
@@ -264,11 +289,11 @@ int ctdb_socket_connect(struct ctdb_context *ctdb)
 
 	set_nonblocking(ctdb->daemon.sd);
 	set_close_on_exec(ctdb->daemon.sd);
-	
-	if (connect(ctdb->daemon.sd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
+
+	if (ctdb_connect_retry(ctdb) == -1) {
+		DEBUG(DEBUG_ERR,(__location__ " Failed to connect client socket to daemon. Errno:%s(%d)\n", strerror(errno), errno));
 		close(ctdb->daemon.sd);
 		ctdb->daemon.sd = -1;
-		DEBUG(DEBUG_ERR,(__location__ " Failed to connect client socket to daemon. Errno:%s(%d)\n", strerror(errno), errno));
 		return -1;
 	}
 
diff --git a/doc/ping_pong.1 b/doc/ping_pong.1
new file mode 100644
index 0000000..3448faa
--- /dev/null
+++ b/doc/ping_pong.1
@@ -0,0 +1,110 @@
+'\" t
+.\"     Title: ping_pong
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\"      Date: 03/26/2011
+.\"    Manual:  
+.\"    Source:  
+.\"  Language: English
+.\"
+.TH "PING_PONG" "1" "03/26/2011" "" ""
+.\" -----------------------------------------------------------------
+.\" * 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
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+ping_pong \- measures the ping\-pong byte range lock latency
+.SH "SYNOPSIS"
+.HP \w'\fBping_pong\ [options]\ <file>\ <num_locks>\fR\ 'u
+\fBping_pong [options] <file> <num_locks>\fR
+.HP \w'\fBping_pong\fR\ 'u
+\fBping_pong\fR [\-r] [\-w] [\-m]
+.SH "DESCRIPTION"
+.PP
+This measures the ping\-pong byte range lock latency\&. It is especially useful on a cluster of nodes sharing a common lock manager as it will give some indication of the lock managers performance under stress\&.
+.SH "OPTIONS"
+.PP
+\-r
+.RS 4
+do reads
+.RE
+.PP
+\-w
+.RS 4
+do writes
+.RE
+.PP
+\-m
+.RS 4
+use mmap
+.RE
+.SH "EXAMPLES"
+.PP
+Testing lock coherence
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+      ping_pong test\&.dat N
+    
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+Testing IO coherence
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+      ping_pong \-rw test\&.dat N
+    
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.PP
+
+\m[blue]\fB\%https://wiki.samba.org/index.php/Ping_pong\fR\m[], ctdb(1), ctdbd(1)
+.SH "COPYRIGHT/LICENSE"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Copyright (C) Andrew Tridgell 2002
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at
+your option) any later version\&.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\&.  See the GNU
+General Public License for more details\&.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, see http://www\&.gnu\&.org/licenses/\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/doc/ping_pong.1.html b/doc/ping_pong.1.html
new file mode 100644
index 0000000..e7e6973
--- /dev/null
+++ b/doc/ping_pong.1.html
@@ -0,0 +1,37 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>ping_pong</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="ping_pong"><a name="ping_pong.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ping_pong — measures the ping-pong byte range lock latency</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">ping_pong [options] <file> <num_locks></code> </p></div><div class="cmdsynopsis"><p><code class="command">ping_pong</code>  [-r] [-w] [-m]</p></div></div><div class="refsect1" title="DESCRIPTION"><a name="id2949769"></a><h2>DESCRIPTION</h2><p>
+      This measures the ping-pong byte range lock latency. It is
+      especially useful on a cluster of nodes sharing a common lock
+      manager as it will give some indication of the lock managers
+      performance under stress.
+    </p></div><div class="refsect1" title="OPTIONS"><a name="id2949782"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-r</span></dt><dd><p>
+	    do reads
+	  </p></dd><dt><span class="term">-w</span></dt><dd><p>
+	    do writes
+	  </p></dd><dt><span class="term">-m</span></dt><dd><p>
+	    use mmap
+	  </p></dd></dl></div></div><div class="refsect1" title="EXAMPLES"><a name="id2949828"></a><h2>EXAMPLES</h2><p>
+      Testing lock coherence
+    </p><pre class="screen">
+      ping_pong test.dat N
+    </pre><p>
+      Testing IO coherence
+    </p><pre class="screen">
+      ping_pong -rw test.dat N
+    </pre></div><div class="refsect1" title="SEE ALSO"><a name="id2949852"></a><h2>SEE ALSO</h2><p>
+      <a class="ulink" href="https://wiki.samba.org/index.php/Ping_pong" target="_top">https://wiki.samba.org/index.php/Ping_pong</a>, ctdb(1), ctdbd(1)
+    </p></div><div class="refsect1" title="COPYRIGHT/LICENSE"><a name="id2949866"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
+Copyright (C) Andrew Tridgell 2002<br>
+<br>
+This program is free software; you can redistribute it and/or modify<br>
+it under the terms of the GNU General Public License as published by<br>
+the Free Software Foundation; either version 3 of the License, or (at<br>
+your option) any later version.<br>
+<br>
+This program is distributed in the hope that it will be useful, but<br>
+WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU<br>
+General Public License for more details.<br>
+<br>
+You should have received a copy of the GNU General Public License<br>
+along with this program; if not, see http://www.gnu.org/licenses/.<br>
+</p></div></div></div></body></html>
diff --git a/doc/ping_pong.1.xml b/doc/ping_pong.1.xml
new file mode 100644
index 0000000..0b67e8f
--- /dev/null
+++ b/doc/ping_pong.1.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+<refentry id="ping_pong.1">
+
+<refmeta>
+	<refentrytitle>ping_pong</refentrytitle>
+	<manvolnum>1</manvolnum>
+	<refmiscinfo class="source"> </refmiscinfo>
+	<refmiscinfo class="manual"> </refmiscinfo>
+</refmeta>
+
+
+<refnamediv>
+	<refname>ping_pong</refname>
+        <refpurpose>measures the ping-pong byte range lock latency</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+	<cmdsynopsis>
+		<command>ping_pong [options] <file> <num_locks></command>
+	</cmdsynopsis>
+
+	<cmdsynopsis>
+		<command>ping_pong</command>
+		<arg choice="opt">-r</arg>
+		<arg choice="opt">-w</arg>
+		<arg choice="opt">-m</arg>
+	</cmdsynopsis>
+	
+</refsynopsisdiv>
+
+  <refsect1><title>DESCRIPTION</title>
+    <para>
+      This measures the ping-pong byte range lock latency. It is
+      especially useful on a cluster of nodes sharing a common lock
+      manager as it will give some indication of the lock managers
+      performance under stress.
+    </para>
+
+  </refsect1>
+
+  <refsect1><title>OPTIONS</title>
+
+    <variablelist>
+      <varlistentry><term>-r</term>
+        <listitem>
+          <para>
+	    do reads
+	  </para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry><term>-w</term>
+        <listitem>
+          <para>
+	    do writes
+	  </para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry><term>-m</term>
+        <listitem>
+          <para>
+	    use mmap
+	  </para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+
+  <refsect1><title>EXAMPLES</title>
+    <para>
+      Testing lock coherence
+    </para>
+    <screen format="linespecific">
+      ping_pong test.dat N
+    </screen>
+
+    <para>
+      Testing IO coherence
+    </para>
+    <screen format="linespecific">
+      ping_pong -rw test.dat N
+    </screen>
+  </refsect1>
+
+  <refsect1><title>SEE ALSO</title>
+    <para>
+      <ulink url="https://wiki.samba.org/index.php/Ping_pong"/>, ctdb(1), ctdbd(1)
+    </para>
+  </refsect1>
+  <refsect1><title>COPYRIGHT/LICENSE</title>
+<literallayout>
+Copyright (C) Andrew Tridgell 2002
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at
+your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, see http://www.gnu.org/licenses/.
+</literallayout>
+  </refsect1>
+</refentry>
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index b914594..c006b51 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -123,6 +123,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/ctdbd.1.gz
 %{_mandir}/man1/onnode.1.gz
 %{_mandir}/man1/ltdbtool.1.gz
+%{_mandir}/man1/ping_pong.1.gz
 %{_libdir}/pkgconfig/ctdb.pc
 
 %{_docdir}/ctdb/tests/bin/ctdb_transaction


-- 
CTDB repository


More information about the samba-cvs mailing list