5955 Commits

Author SHA1 Message Date
Salvatore Sanfilippo
4a4a87408b Merge pull request #2529 from gnethercutt/issue_2517
Issue #2517, smove contract violation
2015-05-15 17:36:18 +02:00
Salvatore Sanfilippo
4b5f94feec Merge pull request #2573 from HeartSaVioR/fix-protocol-error-log-level
protocol error log should be seen by debug/verbose level
2015-05-15 17:06:18 +02:00
antirez
a93a48b2cb Sentinel: port address update code to shared links logic 2015-05-15 09:47:05 +02:00
antirez
6034acbfe5 Sentinel: config-rewrite unique ID just one time 2015-05-14 17:45:09 +02:00
antirez
9ab415cca5 Sentinel: remove debugging message from releaseInstanceLink() 2015-05-14 14:12:45 +02:00
antirez
5672f4c368 Sentinel: fix access to NULL link->cc in releaseInstanceLink() 2015-05-14 14:08:23 +02:00
antirez
da81f5b648 Sentinel: remove SHARED! debugging printf 2015-05-14 13:40:23 +02:00
antirez
5aa783eac9 Sentinel: rewrite callback chain removing instances with shared links
Otherwise pending commands callbacks will fire with a reference that no
longer exists.
2015-05-14 13:39:26 +02:00
antirez
be62919a68 Sentinel: debugging code removed from sentinelSendPing() 2015-05-14 10:52:32 +02:00
antirez
689afe98ee Sentinel: use active/last time for ping logic
The PING trigger was improved again by using two fields instead of a
single one to remember when the last ping was sent:

1. The "active" ping is the time at which we sent the last ping that
still received no reply. However we continue to ping non replying
instances even if they have an old active ping: the link may be
disconnected and reconencted in the meantime so the older pings may get
lost even if it's a TCP socket.

2. The "last" ping is the time at which we really sent the last ping
on the wire, and this is used in order to throttle the amount of pings
we send during failures (when no pong is received).

All in all the failure detector effectiveness should be identical but we
avoid to flood instances with pings during failures or when they are
slow.
2015-05-14 09:56:23 +02:00
antirez
773a7fe5c4 Sentinel: limit reconnection frequency to the ping period 2015-05-13 14:23:57 +02:00
antirez
1a7c6f5e04 Sentinel: PING trigger improved
It's ok to ping as soon as the ping period has elapsed since we received
the last PONG, but it's not good that we ping again if there is a
pending ping... With this change we'll send a new ping if there is one
pending only if two times the ping period elapsed since the ping which
is still pending was sent.
2015-05-12 17:03:53 +02:00
antirez
f54299a9e3 Sentinel: same-Sentinel link sharing across masters 2015-05-12 17:03:00 +02:00
antirez
67d19e865e Sentinel: add sentinelGetInstanceTypeString() fuction
This is useful for debugging and logging activities: given a
sentinelRedisInstance object returns a C string representing the
instance type: master, slave, sentinel.
2015-05-12 12:12:25 +02:00
Jungtaek Lim
db5985857a protocol error log should be seen debug/verbose level 2015-05-12 10:04:52 +09:00
antirez
7346c06fb0 Sentinel: add link refcount to instance description 2015-05-11 23:49:19 +02:00
therealbill
e19a09c411 adding a sentinel command: "flushconfig"
This new command triggers a config flush to save the in-memory config to
disk. This is useful for cases of a configuration management system or a
package manager wiping out your sentinel config while the process is
still running - and has not yet been restarted. It can also be useful
for scripting a backup and migrate or clone of a running sentinel.
2015-05-11 14:08:57 -05:00
antirez
c257c0b1c1 Sentinel: connection sharing WIP #1 2015-05-11 13:15:26 +02:00
antirez
fa9695e2d9 Sentinel: suppress warnings for not used args. 2015-05-08 17:17:59 +02:00
antirez
3eb45318d6 Sentinel: generate +sentinel again, removed in prev commit. 2015-05-08 17:16:48 +02:00
antirez
3cc4c341e7 Sentinel: Use privdata instead of c->data in sentinelReceiveHelloMessages()
This way we may later share the hiredis link "c" among the same Sentinel
instance referenced multiple times for multiple masters.
2015-05-08 17:16:39 +02:00
antirez
8b0615a04f Sentinel: clarify arguments of SENTINEL IS-MASTER-DOWN-BY-ADDR 2015-05-08 17:16:00 +02:00
antirez
038a39c0f8 Sentinel: don't detect duplicated Sentinels, just address switch
Since with a previous commit Sentinels now persist their unique ID, we
no longer need to detect duplicated Sentinels and re-add them. We remove
and re-add back using different events only in the case of address
switch of the same Sentinel, without generating a new +sentinel event.
2015-05-07 10:07:47 +02:00
antirez
686b84abde Sentinel: persist its unique ID across restarts.
Previously Sentinels always changed unique ID across restarts, relying
on the server.runid field. This is not a good idea, and forced Sentinel
to rely on detection of duplicated Sentinels and a potentially dangerous
clean-up and re-add operation of the Sentinel instance that was
rebooted.

Now the ID is generated at the first start and persisted in the
configuration file, so that a given Sentinel will have its unique
ID forever (unless the configuration is manually deleted or there is a
filesystem corruption).
2015-05-06 16:19:14 +02:00
Salvatore Sanfilippo
5ad8c035ca Merge pull request #2564 from charsyam/feature/compile-error-freebsd-1
fix compile error for struct msghdr in FreeBSD 10
2015-05-05 18:44:46 +02:00
antirez
eac4f0b19f Substitute DISQUE to REDIS after merge from Disque
Probably this stuff should be called CLIENT_* in order to cross merge
more easily.
2015-05-05 16:36:35 +02:00
antirez
8648703210 processUnblockedClients: don't process clients that blocekd again 2015-05-05 16:35:44 +02:00
antirez
8218790448 Don't put clients into unblocked list multiple times 2015-05-05 16:32:53 +02:00
clark.kang
cdafa148e2 fix compile error for struct msghdr 2015-05-05 22:51:27 +09:00
antirez
ec1e6d7a60 Fix order of release scripts. 2015-05-05 11:17:40 +02:00
Salvatore Sanfilippo
1b0dbc251b Merge pull request #2530 from FuGangqiang/unstable
fix sds.c
2015-05-04 13:00:02 +02:00
Salvatore Sanfilippo
42025e5368 Merge pull request #2534 from itamarhaber/patch-3
update copyright year
2015-05-04 12:56:02 +02:00
therealbill
b04184f34c Making sentinel flush config on +slave
Originally, only the +slave event which occurs when a slave is
reconfigured during sentinelResetMasterAndChangeAddress triggers a flush
of the config to disk.  However, newly discovered slaves don't
apparently trigger this flush but do trigger the +slave event issuance.

So if you start up a sentinel, add a master, then add a slave to the
master (as a way to reproduce it) you'll see the +slave event issued,
but the sentinel config won't be updated with the known-slave entry.

This change makes sentinel do the flush of the config if a new slave is
deteted in sentinelRefreshInstanceInfo.
2015-05-04 12:54:13 +02:00
antirez
b2d4dddaf9 Sentinel: remove useless sentinelFlushConfig() call
To rewrite the config in the loop that adds slaves back after a master
reset, in order to handle switching to another master, is useless: it
just adds latency since there is an fsync call in the inner loop,
without providing any additional guarantee, but the contrary, since if
after the first loop iteration the server crashes we end with just a
single slave entry losing all the other informations.

It is wiser to rewrite the config at the end when the full new
state is configured.
2015-05-04 12:50:44 +02:00
Salvatore Sanfilippo
514448d52a Merge pull request #2542 from yossigo/lua_client_buffer_crash
Fix Redis server crash when Lua command exceeds client output buffer limit.
2015-05-04 12:19:44 +02:00
Salvatore Sanfilippo
3a8d95a471 Merge pull request #2551 from charsyam/feature/sentinel-memory-leak-1
fix sentinel memory leak
2015-05-04 12:17:41 +02:00
antirez
b16601ddbb Merge branch 'unstable' of github.com:/antirez/redis into unstable 2015-04-29 10:34:08 +02:00
antirez
57629341cb Add header guard for ziplist.h
As suggested in #2543.
2015-04-29 10:33:21 +02:00
Salvatore Sanfilippo
a50ad33ec9 Merge pull request #2550 from badboy/readme-fixes
Fix spelling and grammatical errors in readme
2015-04-29 10:06:46 +02:00
antirez
aa6201e6ab Fix Sentinel memory leak (hiredis bug)
This fixes issue #2535, that was actually an hiredis library bug (I
submitted an issue and fix to the redis/hiredis repo as well).

When an asynchronous hiredis connection subscribes to a Pub/Sub channel
and gets an error, and in other related conditions, the function
redisProcessCallbacks() enters a code path where the link is
disconnected, however the function returns before freeing the allocated
reply object. This causes a memory leak. The memory leak was trivial to
trigger in Redis Sentinel, which uses hiredis, every time we tried to
subscribe to an instance that required a password, in case the Sentinel
was configured either with the wrong password or without password at
all. In this case, the -AUTH error caused the leaking code path to be
executed.

It was verified with Valgrind that after this change the leak no longer
happens in Sentinel with a misconfigured authentication password.
2015-04-28 22:10:23 +02:00
clark.kang
0040a15d13 fix sentinel memory leak 2015-04-29 00:05:26 +09:00
Jan-Erik Rediger
a92020c98b One more small fix 2015-04-28 15:21:11 +02:00
Jan-Erik Rediger
aecc4f2791 Fix spelling and grammatical errors in readme
Closes #2549
2015-04-28 11:07:21 +02:00
antirez
abe10625d2 sha1.c: use standard uint32_t. 2015-04-27 12:07:49 +02:00
antirez
6d9052dd78 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2015-04-27 12:05:32 +02:00
antirez
7a93f552a7 Example redis.conf doc about pidfile fixed.
An user changed the behavior via a PR without upgrading the doc.
2015-04-26 19:23:27 +02:00
Yossi Gottlieb
80991c6aa5 Fix Redis server crash when Lua command exceeds client output buffer
limit.
2015-04-26 12:04:16 +03:00
Salvatore Sanfilippo
ff8f2428ad Merge pull request #2539 from itamarhaber/patch-4
Added reference to IANA ticket for port 6379
2015-04-24 09:05:14 +02:00
Itamar Haber
136c27edff Added reference to IANA ticket for port 6379
Just so it's extra official 😄
2015-04-24 01:33:41 +03:00
Itamar Haber
6eacc06821 update copyright year 2015-04-21 18:54:49 +03:00