~ubuntu-branches/ubuntu/utopic/haproxy/utopic-proposed

« back to all changes in this revision

Viewing changes to debian/patches/dead-servers-queue.patch

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Cornet
  • Date: 2009-02-17 08:55:12 UTC
  • mfrom: (1.1.5 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090217085512-qmij51nun3rbxorz
Fix build without debian/patches directory (Closes: #515682) using
/usr/share/quilt/quilt.make.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: haproxy/include/proto/queue.h
2
 
===================================================================
3
 
--- haproxy.orig/include/proto/queue.h  2008-12-30 18:27:39.000000000 +0100
4
 
+++ haproxy/include/proto/queue.h       2008-12-30 18:29:16.000000000 +0100
5
 
@@ -64,10 +64,10 @@
6
 
 }
7
 
 
8
 
 /* returns 0 if nothing has to be done for server <s> regarding queued connections,
9
 
- * and non-zero otherwise. Suited for and if/else usage.
10
 
+ * and non-zero otherwise. If the server is down, we only check its own queue. Suited for and if/else usage.
11
 
  */
12
 
 static inline int may_dequeue_tasks(const struct server *s, const struct proxy *p) {
13
 
-       return (s && (s->nbpend || p->nbpend) &&
14
 
+       return (s && (s->nbpend || (p->nbpend && (s->state & SRV_RUNNING))) &&
15
 
                (!s->maxconn || s->cur_sess < srv_dynamic_maxconn(s)));
16
 
 }
17
 
 
18
 
Index: haproxy/src/queue.c
19
 
===================================================================
20
 
--- haproxy.orig/src/queue.c    2008-12-30 18:29:24.000000000 +0100
21
 
+++ haproxy/src/queue.c 2008-12-30 18:30:33.000000000 +0100
22
 
@@ -89,6 +89,10 @@
23
 
  * returned. Note that neither <srv> nor <px> may be NULL.
24
 
  * Priority is given to the oldest request in the queue if both <srv> and <px>
25
 
  * have pending requests. This ensures that no request will be left unserved.
26
 
+ * The <px> queue is not considered if the server is not RUNNING. The <srv>
27
 
+ * queue is still considered in this case, because if some connections remain
28
 
+ * there, it means that some requests have been forced there after it was seen
29
 
+ * down (eg: due to option persist).
30
 
  * The session is immediately marked as "assigned", and both its <srv> and
31
 
  * <srv_conn> are set to <srv>,
32
 
  */
33
 
@@ -100,7 +104,7 @@
34
 
        ps = pendconn_from_srv(srv);
35
 
        pp = pendconn_from_px(px);
36
 
        /* we want to get the definitive pendconn in <ps> */
37
 
-       if (!pp) {
38
 
+       if (!pp || !(srv->state & SRV_RUNNING)) {
39
 
                if (!ps)
40
 
                        return NULL;
41
 
        } else {
42
 
Index: haproxy/src/session.c
43
 
===================================================================
44
 
--- haproxy.orig/src/session.c  2008-12-30 18:30:52.000000000 +0100
45
 
+++ haproxy/src/session.c       2008-12-30 18:35:40.000000000 +0100
46
 
@@ -41,8 +41,10 @@
47
 
 
48
 
        if (s->pend_pos)
49
 
                pendconn_free(s->pend_pos);
50
 
-       if (s->srv)  /* there may be requests left pending in queue */
51
 
-               process_srv_queue(s->srv);
52
 
+       if (s->srv) {  /* there may be requests left pending in queue */
53
 
+               if (may_dequeue_tasks(s->srv, s->be))
54
 
+                       process_srv_queue(s->srv);
55
 
+       }
56
 
        if (unlikely(s->srv_conn)) {
57
 
                /* the session still has a reserved slot on a server, but
58
 
                 * it should normally be only the same as the one above,