]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] Add down termination condition
authorSimon Horman <horms@verge.net.au>
Tue, 21 Jun 2011 05:34:59 +0000 (14:34 +0900)
committerWilly Tarreau <w@1wt.eu>
Tue, 21 Jun 2011 20:10:56 +0000 (22:10 +0200)
If a connection is closed by because the backend became unavailable
then log 'D' as the termination condition.

Signed-off-by: Simon Horman <horms@verge.net.au>
doc/configuration.txt
include/types/session.h
src/checks.c
src/log.c

index f397f411c6d872a06a22cde8bc7b35f7f72935a0..b28e85198151271b36b84af10b43b1012c8e0abe 100644 (file)
@@ -8725,6 +8725,9 @@ each of which has a special meaning :
             would be wise to preventively restart the process after such an
             event too, in case it would be caused by memory corruption.
 
+        D : the session was killed by haproxy because the server was detected
+            as down and was configured to kill all connections when going down.
+
         c : the client-side timeout expired while waiting for the client to
             send or receive data.
 
index 7fde0aa713c6d38f9dd2a9a1c2cb599b550cddff..605492489ccbb71456a6444c2986804ec1d5cd4a 100644 (file)
@@ -65,9 +65,9 @@
 #define SN_ERR_PRXCOND 0x00005000      /* the proxy decided to close (deny...) */
 #define SN_ERR_RESOURCE        0x00006000      /* the proxy encountered a lack of a local resources (fd, mem, ...) */
 #define SN_ERR_INTERNAL        0x00007000      /* the proxy encountered an internal error */
-#define SN_ERR_MASK    0x00007000      /* mask to get only session error flags */
+#define SN_ERR_DOWN    0x00008000      /* the proxy killed a session because the backend became unavailable */
+#define SN_ERR_MASK    0x0000f000      /* mask to get only session error flags */
 #define SN_ERR_SHIFT   12              /* bit shift */
-#define SN_BE_TRACK_SC1 0x00008000     /* backend tracks stick-counter 1 */
 
 /* session state at termination, bits values 0x10000 to 0x70000 (0-7 shift 16) */
 #define SN_FINST_R     0x00010000      /* session ended during client request */
 #define SN_FINST_T     0x00070000      /* session ended tarpitted */
 #define SN_FINST_MASK  0x00070000      /* mask to get only final session state flags */
 #define        SN_FINST_SHIFT  16              /* bit shift */
-#define SN_BE_TRACK_SC2 0x00080000     /* backend tracks stick-counter 2 */
 
-#define SN_IGNORE_PRST 0x00100000      /* ignore persistence */
+#define SN_IGNORE_PRST 0x00080000      /* ignore persistence */
+#define SN_BE_TRACK_SC1 0x00100000     /* backend tracks stick-counter 1 */
+#define SN_BE_TRACK_SC2 0x00200000     /* backend tracks stick-counter 2 */
 
 /* Termination sequence tracing.
  *
index 6b34a377bee79b5c67f23259af9d4bc5074fd82c..5bcf47c5d4666329ac7f203ec26ea7b8724e3271 100644 (file)
@@ -371,6 +371,8 @@ static void shutdown_sessions(struct server *srv)
                                buffer_shutw_now(session->req);
                                buffer_shutr_now(session->rep);
                                session->task->nice = 1024;
+                               if (!(session->flags & SN_ERR_MASK))
+                                       session->flags |= SN_ERR_DOWN;
                                task_wakeup(session->task, TASK_WOKEN_OTHER);
                }
        }
index 58d884a54aad1a9e708a7ee9e0948354c7ba2872..02b6b20eb924ed84d009073a4b8afaef5be707e5 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -52,7 +52,7 @@ const char *monthname[12] = {
        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
 };
 
-const char sess_term_cond[8]  = "-cCsSPRI";    /* normal, CliTo, CliErr, SrvTo, SrvErr, PxErr, Resource, Internal */
+const char sess_term_cond[9]  = "-cCsSPRID";   /* normal, CliTo, CliErr, SrvTo, SrvErr, PxErr, Resource, Internal, Down */
 const char sess_fin_state[8]  = "-RCHDLQT";    /* cliRequest, srvConnect, srvHeader, Data, Last, Queue, Tarpit */
 
 /*