git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
798a7ff
)
Cheap method to follow redis cluster MOVED replies
author
Graeme Fowler
<graemef@exim.org>
Tue, 6 Mar 2018 11:24:10 +0000
(11:24 +0000)
committer
Graeme Fowler
<graemef@exim.org>
Tue, 6 Mar 2018 11:24:10 +0000
(11:24 +0000)
src/src/lookups/redis.c
patch
|
blob
|
history
diff --git
a/src/src/lookups/redis.c
b/src/src/lookups/redis.c
index db408d993a86b1d77f12ab065b38d40a892e9dd0..c36b1bda72f51603644d5e9996612c1419b08b24 100644
(file)
--- a/
src/src/lookups/redis.c
+++ b/
src/src/lookups/redis.c
@@
-241,7
+241,20
@@
switch (redis_reply->type)
{
case REDIS_REPLY_ERROR:
*errmsg = string_sprintf("REDIS: lookup result failed: %s\n", redis_reply->str);
{
case REDIS_REPLY_ERROR:
*errmsg = string_sprintf("REDIS: lookup result failed: %s\n", redis_reply->str);
- *defer_break = FALSE;
+
+ /* trap MOVED cluster responses and follow them */
+ if (Ustrncmp(redis_reply->str, "MOVED", 5))
+ {
+ DEBUG(D_lookup)
+ debug_printf("REDIS: cluster redirect %s\n", redis_reply->str);
+ /* follow redirect
+ This is cheating, we simply set defer_break = TRUE to move on to
+ the next server in the redis_servers list */
+ *defer_break = TRUE;
+ return DEFER;
+ } else {
+ *defer_break = FALSE;
+ }
*do_cache = 0;
goto REDIS_EXIT;
/* NOTREACHED */
*do_cache = 0;
goto REDIS_EXIT;
/* NOTREACHED */