View | Details | Raw Unified | Return to bug 208380 | Differences between
and this patch

Collapse All | Expand All

(-)/home/tsgan/nginx-devel-new/Makefile (+19 lines)
Lines 89-94 Link Here
89
	HTTP_TARANTOOL \
89
	HTTP_TARANTOOL \
90
	HTTP_UPLOAD \
90
	HTTP_UPLOAD \
91
	HTTP_UPLOAD_PROGRESS \
91
	HTTP_UPLOAD_PROGRESS \
92
	HTTP_UPSTREAM_CHECK \
92
	HTTP_UPSTREAM_FAIR \
93
	HTTP_UPSTREAM_FAIR \
93
	HTTP_UPSTREAM_STICKY \
94
	HTTP_UPSTREAM_STICKY \
94
	HTTP_VIDEO_THUMBEXTRACTOR \
95
	HTTP_VIDEO_THUMBEXTRACTOR \
Lines 193-198 Link Here
193
HTTP_TARANTOOL_DESC=		3rd party tarantool upstream module
194
HTTP_TARANTOOL_DESC=		3rd party tarantool upstream module
194
HTTP_UPLOAD_DESC=		3rd party upload module
195
HTTP_UPLOAD_DESC=		3rd party upload module
195
HTTP_UPLOAD_PROGRESS_DESC=	3rd party uploadprogress module
196
HTTP_UPLOAD_PROGRESS_DESC=	3rd party uploadprogress module
197
HTTP_UPSTREAM_CHECK_DESC=	3rd party upstream check module
196
HTTP_UPSTREAM_FAIR_DESC=	3rd party upstream fair module
198
HTTP_UPSTREAM_FAIR_DESC=	3rd party upstream fair module
197
HTTP_UPSTREAM_STICKY_DESC=	3rd party upstream sticky module
199
HTTP_UPSTREAM_STICKY_DESC=	3rd party upstream sticky module
198
HTTP_VIDEO_THUMBEXTRACTOR_DESC=	3rd party video_thumbextractor module
200
HTTP_VIDEO_THUMBEXTRACTOR_DESC=	3rd party video_thumbextractor module
Lines 622-632 Link Here
622
CONFIGURE_ARGS+=--add-module=${WRKSRC_uploadprogress}
624
CONFIGURE_ARGS+=--add-module=${WRKSRC_uploadprogress}
623
.endif
625
.endif
624
626
627
.if !empty(PORT_OPTIONS:MHTTP_UPSTREAM_CHECK)
628
# WWW: https://github.com/yaoweibin/nginx_upstream_check_module
629
NGINX_UPSTREAM_CHECK_VERSION=  10782ea
630
GH_ACCOUNT+=   yaoweibin:upstreamcheck
631
GH_PROJECT+=   nginx_upstream_check_module:upstreamcheck
632
GH_TAGNAME+=   ${NGINX_UPSTREAM_CHECK_VERSION}:upstreamcheck
633
CONFIGURE_ARGS+=--add-module=${WRKSRC_upstreamcheck}
634
EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-src_http_modules_ngx__http__upstream__hash__module.c \
635
                ${PATCHDIR}/extra-patch-src_http_modules_ngx__http__upstream__ip__hash__module.c \
636
                ${PATCHDIR}/extra-patch-src_http_modules_ngx__http__upstream__least__conn__module.c \
637
                ${PATCHDIR}/extra-patch-src_http_ngx__http__upstream__round__robin.c \
638
                ${PATCHDIR}/extra-patch-src_http_ngx__http__upstream__round__robin.h
639
.endif
640
625
.if !empty(PORT_OPTIONS:MHTTP_UPSTREAM_FAIR)
641
.if !empty(PORT_OPTIONS:MHTTP_UPSTREAM_FAIR)
626
NGINX_UPSTREAM_FAIR_VERSION=	20090923
642
NGINX_UPSTREAM_FAIR_VERSION=	20090923
627
MASTER_SITES+=	LOCAL/osa:upstreamfair
643
MASTER_SITES+=	LOCAL/osa:upstreamfair
628
DISTFILES+=	nginx_upstream_fair-${NGINX_UPSTREAM_FAIR_VERSION}.tar.gz:upstreamfair
644
DISTFILES+=	nginx_upstream_fair-${NGINX_UPSTREAM_FAIR_VERSION}.tar.gz:upstreamfair
629
CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_upstream_fair-${NGINX_UPSTREAM_FAIR_VERSION}
645
CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_upstream_fair-${NGINX_UPSTREAM_FAIR_VERSION}
646
.if !empty(PORT_OPTIONS:MHTTP_UPSTREAM_CHECK)
647
EXTRA_PATCHES+=        ${PATCHDIR}/extra-patch-ngx_http_upstream_fair_module.c
648
.endif
630
.endif
649
.endif
631
650
632
.if ${PORT_OPTIONS:MHTTP_UPSTREAM_STICKY}
651
.if ${PORT_OPTIONS:MHTTP_UPSTREAM_STICKY}
(-)/home/tsgan/nginx-devel-new/distinfo (+2 lines)
Lines 74-79 Link Here
74
SIZE (vkholodkov-nginx-upload-module-aba1e3f34c_GH0.tar.gz) = 28296
74
SIZE (vkholodkov-nginx-upload-module-aba1e3f34c_GH0.tar.gz) = 28296
75
SHA256 (masterzen-nginx-upload-progress-module-v0.9.0_GH0.tar.gz) = 93e29b9b437a2e34713de54c2861ea51151624aca09f73f9f44d1caaff01a6b1
75
SHA256 (masterzen-nginx-upload-progress-module-v0.9.0_GH0.tar.gz) = 93e29b9b437a2e34713de54c2861ea51151624aca09f73f9f44d1caaff01a6b1
76
SIZE (masterzen-nginx-upload-progress-module-v0.9.0_GH0.tar.gz) = 16990
76
SIZE (masterzen-nginx-upload-progress-module-v0.9.0_GH0.tar.gz) = 16990
77
SHA256 (yaoweibin-nginx_upstream_check_module-10782ea_GH0.tar.gz) = 52e6acd8c0264a59c5c948271015a59acd3cbcf91377456b7c8dc6f9feecef4a
78
SIZE (yaoweibin-nginx_upstream_check_module-10782ea_GH0.tar.gz) = 128281
77
SHA256 (wandenberg-nginx-video-thumbextractor-module-0.7.0_GH0.tar.gz) = 382bb41fa739f471fdab9fbabc5384d8ec7f25b5bb0c45c153f5cc01d428abe2
79
SHA256 (wandenberg-nginx-video-thumbextractor-module-0.7.0_GH0.tar.gz) = 382bb41fa739f471fdab9fbabc5384d8ec7f25b5bb0c45c153f5cc01d428abe2
78
SIZE (wandenberg-nginx-video-thumbextractor-module-0.7.0_GH0.tar.gz) = 2709351
80
SIZE (wandenberg-nginx-video-thumbextractor-module-0.7.0_GH0.tar.gz) = 2709351
79
SHA256 (openresty-drizzle-nginx-module-v0.1.9_GH0.tar.gz) = aafb79d87273eec023025333c34d6d0108026a1ce2e09b20a53e8e2d9bf65080
81
SHA256 (openresty-drizzle-nginx-module-v0.1.9_GH0.tar.gz) = aafb79d87273eec023025333c34d6d0108026a1ce2e09b20a53e8e2d9bf65080
(-)/home/tsgan/nginx-devel-new/files/extra-patch-ngx_http_upstream_fair_module.c (+89 lines)
Line 0 Link Here
1
--- ../nginx_upstream_fair-20090923/ngx_http_upstream_fair_module.c.orig	2009-09-24 01:38:16.000000000 +0800
2
+++ ../nginx_upstream_fair-20090923/ngx_http_upstream_fair_module.c	2016-03-24 13:56:02.990728000 +0800
3
@@ -9,6 +9,10 @@
4
 #include <ngx_core.h>
5
 #include <ngx_http.h>
6
 
7
+#if (NGX_HTTP_UPSTREAM_CHECK)
8
+#include "ngx_http_upstream_check_module.h"
9
+#endif
10
+
11
 typedef struct {
12
     ngx_uint_t                          nreq;
13
     ngx_uint_t                          total_req;
14
@@ -42,6 +46,10 @@
15
     ngx_uint_t                          max_fails;
16
     time_t                              fail_timeout;
17
 
18
+#if (NGX_HTTP_UPSTREAM_CHECK)
19
+    ngx_uint_t                          check_index;
20
+#endif
21
+
22
     time_t                              accessed;
23
     ngx_uint_t                          down:1;
24
 
25
@@ -474,6 +482,15 @@
26
                 peers->peer[n].fail_timeout = server[i].fail_timeout;
27
                 peers->peer[n].down = server[i].down;
28
                 peers->peer[n].weight = server[i].down ? 0 : server[i].weight;
29
+#if (NGX_HTTP_UPSTREAM_CHECK)
30
+                if (!server[i].down) {
31
+                    peers->peer[n].check_index =
32
+                        ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
33
+                }
34
+                else {
35
+                    peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
36
+                }
37
+#endif
38
                 n++;
39
             }
40
         }
41
@@ -524,6 +541,15 @@
42
                 backup->peer[n].max_fails = server[i].max_fails;
43
                 backup->peer[n].fail_timeout = server[i].fail_timeout;
44
                 backup->peer[n].down = server[i].down;
45
+#if (NGX_HTTP_UPSTREAM_CHECK)
46
+                if (!server[i].down) {
47
+                    backup->peer[n].check_index =
48
+                        ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
49
+                }
50
+                else {
51
+                    backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
52
+                }
53
+#endif
54
                 n++;
55
             }
56
         }
57
@@ -580,6 +606,9 @@
58
         peers->peer[i].weight = 1;
59
         peers->peer[i].max_fails = 1;
60
         peers->peer[i].fail_timeout = 10;
61
+#if (NGX_HTTP_UPSTREAM_CHECK)
62
+        peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
63
+#endif
64
     }
65
 
66
     us->peer.data = peers;
67
@@ -721,6 +750,12 @@
68
     peer = &fp->peers->peer[peer_id];
69
 
70
     if (!peer->down) {
71
+#if (NGX_HTTP_UPSTREAM_CHECK)
72
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
73
+                       "[upstream_fair] get fair peer, check_index: %ui",
74
+                       peer->check_index);
75
+        if (!ngx_http_upstream_check_peer_down(peer->check_index)) {
76
+#endif
77
         if (peer->max_fails == 0 || peer->shared->fails < peer->max_fails) {
78
             return NGX_OK;
79
         }
80
@@ -731,6 +766,9 @@
81
             peer->shared->fails = 0;
82
             return NGX_OK;
83
         }
84
+#if (NGX_HTTP_UPSTREAM_CHECK)
85
+        }
86
+#endif
87
     }
88
 
89
     return NGX_BUSY;
(-)/home/tsgan/nginx-devel-new/files/extra-patch-src_http_modules_ngx__http__upstream__hash__module.c (+44 lines)
Line 0 Link Here
1
--- src/http/modules/ngx_http_upstream_hash_module.c.orig	2016-02-24 14:53:24 UTC
2
+++ src/http/modules/ngx_http_upstream_hash_module.c
3
@@ -9,6 +9,9 @@
4
 #include <ngx_core.h>
5
 #include <ngx_http.h>
6
 
7
+#if (NGX_HTTP_UPSTREAM_CHECK)
8
+#include "ngx_http_upstream_check_module.h"
9
+#endif
10
 
11
 typedef struct {
12
     uint32_t                            hash;
13
@@ -235,6 +238,15 @@ ngx_http_upstream_get_hash_peer(ngx_peer
14
             goto next;
15
         }
16
 
17
+#if (NGX_HTTP_UPSTREAM_CHECK)
18
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
19
+            "get hash peer, check_index: %ui",
20
+             peer->check_index);
21
+        if (ngx_http_upstream_check_peer_down(peer->check_index)) {
22
+            goto next;
23
+        }
24
+#endif
25
+
26
         if (peer->max_fails
27
             && peer->fails >= peer->max_fails
28
             && now - peer->checked <= peer->fail_timeout)
29
@@ -535,6 +547,15 @@ ngx_http_upstream_get_chash_peer(ngx_pee
30
                 continue;
31
             }
32
 
33
+#if (NGX_HTTP_UPSTREAM_CHECK)
34
+            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
35
+                "get consistent_hash peer, check_index: %ui",
36
+                 peer->check_index);
37
+            if (ngx_http_upstream_check_peer_down(peer->check_index)) {
38
+                continue;
39
+            }
40
+#endif
41
+
42
             if (peer->server.len != server->len
43
                 || ngx_strncmp(peer->server.data, server->data, server->len)
44
                    != 0)
(-)/home/tsgan/nginx-devel-new/files/extra-patch-src_http_modules_ngx__http__upstream__ip__hash__module.c (+28 lines)
Line 0 Link Here
1
--- src/http/modules/ngx_http_upstream_ip_hash_module.c.orig	2016-02-24 14:53:24 UTC
2
+++ src/http/modules/ngx_http_upstream_ip_hash_module.c
3
@@ -9,6 +9,9 @@
4
 #include <ngx_core.h>
5
 #include <ngx_http.h>
6
 
7
+#if (NGX_HTTP_UPSTREAM_CHECK)
8
+#include "ngx_http_upstream_check_module.h"
9
+#endif
10
 
11
 typedef struct {
12
     /* the round robin data must be first */
13
@@ -205,6 +208,15 @@ ngx_http_upstream_get_ip_hash_peer(ngx_p
14
             goto next;
15
         }
16
 
17
+#if (NGX_HTTP_UPSTREAM_CHECK)
18
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
19
+            "get ip_hash peer, check_index: %ui",
20
+             peer->check_index);
21
+        if (ngx_http_upstream_check_peer_down(peer->check_index)) {
22
+            goto next;
23
+        }
24
+#endif
25
+
26
         if (peer->max_fails
27
             && peer->fails >= peer->max_fails
28
             && now - peer->checked <= peer->fail_timeout)
(-)/home/tsgan/nginx-devel-new/files/extra-patch-src_http_modules_ngx__http__upstream__least__conn__module.c (+46 lines)
Line 0 Link Here
1
--- src/http/modules/ngx_http_upstream_least_conn_module.c.orig	2016-02-24 14:53:24 UTC
2
+++ src/http/modules/ngx_http_upstream_least_conn_module.c
3
@@ -9,6 +9,9 @@
4
 #include <ngx_core.h>
5
 #include <ngx_http.h>
6
 
7
+#if (NGX_HTTP_UPSTREAM_CHECK)
8
+#include "ngx_http_upstream_check_module.h"
9
+#endif
10
 
11
 static ngx_int_t ngx_http_upstream_init_least_conn_peer(ngx_http_request_t *r,
12
     ngx_http_upstream_srv_conf_t *us);
13
@@ -148,6 +151,16 @@ ngx_http_upstream_get_least_conn_peer(ng
14
             continue;
15
         }
16
 
17
+#if (NGX_HTTP_UPSTREAM_CHECK)
18
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
19
+                "get least_conn peer, check_index: %ui",
20
+                peer->check_index);
21
+
22
+        if (ngx_http_upstream_check_peer_down(peer->check_index)) {
23
+            continue;
24
+        }
25
+#endif
26
+
27
         if (peer->max_fails
28
             && peer->fails >= peer->max_fails
29
             && now - peer->checked <= peer->fail_timeout)
30
@@ -199,6 +212,16 @@ ngx_http_upstream_get_least_conn_peer(ng
31
                 continue;
32
             }
33
 
34
+#if (NGX_HTTP_UPSTREAM_CHECK)
35
+            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
36
+                    "get least_conn peer, check_index: %ui",
37
+                    peer->check_index);
38
+
39
+            if (ngx_http_upstream_check_peer_down(peer->check_index)) {
40
+                continue;
41
+            }
42
+#endif
43
+
44
             if (peer->conns * best->weight != best->conns * peer->weight) {
45
                 continue;
46
             }
(-)/home/tsgan/nginx-devel-new/files/extra-patch-src_http_ngx__http__upstream__round__robin.c (+101 lines)
Line 0 Link Here
1
--- src/http/ngx_http_upstream_round_robin.c.orig	2016-02-24 14:53:24 UTC
2
+++ src/http/ngx_http_upstream_round_robin.c
3
@@ -9,6 +9,9 @@
4
 #include <ngx_core.h>
5
 #include <ngx_http.h>
6
 
7
+#if (NGX_HTTP_UPSTREAM_CHECK)
8
+#include "ngx_http_upstream_check_module.h"
9
+#endif
10
 
11
 #define ngx_http_upstream_tries(p) ((p)->number                               \
12
                                     + ((p)->next ? (p)->next->number : 0))
13
@@ -96,7 +99,14 @@ ngx_http_upstream_init_round_robin(ngx_c
14
                 peer[n].fail_timeout = server[i].fail_timeout;
15
                 peer[n].down = server[i].down;
16
                 peer[n].server = server[i].name;
17
-
18
+#if (NGX_HTTP_UPSTREAM_CHECK)
19
+                if (!server[i].down) {
20
+                    peer[n].check_index =
21
+                        ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
22
+                } else {
23
+                    peer[n].check_index = (ngx_uint_t) NGX_ERROR;
24
+                }
25
+#endif
26
                 *peerp = &peer[n];
27
                 peerp = &peer[n].next;
28
                 n++;
29
@@ -159,7 +169,15 @@ ngx_http_upstream_init_round_robin(ngx_c
30
                 peer[n].fail_timeout = server[i].fail_timeout;
31
                 peer[n].down = server[i].down;
32
                 peer[n].server = server[i].name;
33
-
34
+#if (NGX_HTTP_UPSTREAM_CHECK)
35
+                if (!server[i].down) {
36
+                    peer[n].check_index =
37
+                        ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
38
+                }
39
+                else {
40
+                    peer[n].check_index = (ngx_uint_t) NGX_ERROR;
41
+                }
42
+#endif
43
                 *peerp = &peer[n];
44
                 peerp = &peer[n].next;
45
                 n++;
46
@@ -225,6 +243,9 @@ ngx_http_upstream_init_round_robin(ngx_c
47
         peer[i].current_weight = 0;
48
         peer[i].max_fails = 1;
49
         peer[i].fail_timeout = 10;
50
+#if (NGX_HTTP_UPSTREAM_CHECK)
51
+        peer[i].check_index = (ngx_uint_t) NGX_ERROR;
52
+#endif
53
         *peerp = &peer[i];
54
         peerp = &peer[i].next;
55
     }
56
@@ -339,6 +360,9 @@ ngx_http_upstream_create_round_robin_pee
57
         peer[0].current_weight = 0;
58
         peer[0].max_fails = 1;
59
         peer[0].fail_timeout = 10;
60
+#if (NGX_HTTP_UPSTREAM_CHECK)
61
+        peer[0].check_index = (ngx_uint_t) NGX_ERROR;
62
+#endif
63
         peers->peer = peer;
64
 
65
     } else {
66
@@ -381,6 +405,9 @@ ngx_http_upstream_create_round_robin_pee
67
             peer[i].current_weight = 0;
68
             peer[i].max_fails = 1;
69
             peer[i].fail_timeout = 10;
70
+#if (NGX_HTTP_UPSTREAM_CHECK)
71
+            peer[i].check_index = (ngx_uint_t) NGX_ERROR;
72
+#endif
73
             *peerp = &peer[i];
74
             peerp = &peer[i].next;
75
         }
76
@@ -441,6 +468,12 @@ ngx_http_upstream_get_round_robin_peer(n
77
             goto failed;
78
         }
79
 
80
+#if (NGX_HTTP_UPSTREAM_CHECK)
81
+        if (ngx_http_upstream_check_peer_down(peer->check_index)) {
82
+            goto failed;
83
+        }
84
+#endif
85
+
86
         rrp->current = peer;
87
 
88
     } else {
89
@@ -542,6 +575,12 @@ ngx_http_upstream_get_peer(ngx_http_upst
90
             continue;
91
         }
92
 
93
+#if (NGX_HTTP_UPSTREAM_CHECK)
94
+        if (ngx_http_upstream_check_peer_down(peer->check_index)) {
95
+            continue;
96
+        }
97
+#endif
98
+
99
         if (peer->max_fails
100
             && peer->fails >= peer->max_fails
101
             && now - peer->checked <= peer->fail_timeout)
(-)/home/tsgan/nginx-devel-new/files/extra-patch-src_http_ngx__http__upstream__round__robin.h (+13 lines)
Line 0 Link Here
1
--- src/http/ngx_http_upstream_round_robin.h.orig	2016-02-24 14:53:24 UTC
2
+++ src/http/ngx_http_upstream_round_robin.h
3
@@ -35,6 +35,10 @@ struct ngx_http_upstream_rr_peer_s {
4
     ngx_uint_t                      max_fails;
5
     time_t                          fail_timeout;
6
 
7
+#if (NGX_HTTP_UPSTREAM_CHECK)
8
+    ngx_uint_t                      check_index;
9
+#endif
10
+
11
     ngx_uint_t                      down;          /* unsigned  down:1; */
12
 
13
 #if (NGX_HTTP_SSL)

Return to bug 208380