antirez
b998ebe904
REPLCONF internal command introduced.
...
The REPLCONF command is an internal command (not designed to be directly
used by normal clients) that allows a slave to set some replication
related state in the master before issuing SYNC to start the
replication.
The initial motivation for this command, and the only reason currently
it is used by the implementation, is to let the slave instance
communicate its listening port to the slave, so that the master can
show all the slaves with their listening ports in the "replication"
section of the INFO output.
This allows clients to auto discover and query all the slaves attached
into a master.
Currently only a single option of the REPLCONF command is supported, and
it is called "listening-port", so the slave now starts the replication
process with something like the following chat:
REPLCONF listening-prot 6380
SYNC
Note that this works even if the master is an older version of Redis and
does not understand REPLCONF, because the slave ignores the REPLCONF
error.
In the future REPLCONF can be used for partial replication and other
replication related features where there is the need to exchange
information between master and slave.
NOTE: This commit also fixes a bug: the INFO outout already carried
information about slaves, but the port was broken, and was obtained
with getpeername(2), so it was actually just the ephemeral port used
by the slave to connect to the master as a client.
2012-07-09 11:59:42 +02:00
antirez
6938960b66
Fix for slaves chains. Force resync of slaves (simply disconnecting them) when SLAVEOF turns a master into a slave.
2012-03-29 09:31:39 +02:00
antirez
4de73b7e0f
Fixes to c->reply_bytes computation, and debug messages to closely study the behavior of memory pressure + slaves + maxmemory + blocked slaves.
2012-02-15 15:26:08 +01:00
antirez
8b1829009b
Precision of getClientOutputBufferMemoryUsage() greatily improved, see issue #327 for more information.
2012-02-15 15:24:36 +01:00
antirez
35a4761f1d
freeMemoryIfNeeded() minor refactoring
2012-02-15 15:22:57 +01:00
antirez
c63e1b83c4
This fixes issue #327 , is a very complex fix (unfortunately), details:
...
1) sendReplyToClient() now no longer stops transferring data to a single
client in the case we are out of memory (maxmemory-wise).
2) in processCommand() the idea of we being out of memory is no longer
the naive zmalloc_used_memory() > server.maxmemory. To say if we can
accept or not write queries is up to the return value of
freeMemoryIfNeeded(), that has full control about that.
3) freeMemoryIfNeeded() now does its math without considering output
buffers size. But at the same time it can't let the output buffers to
put us too much outside the max memory limit, so at the same time it
makes sure there is enough effort into delivering the output buffers to
the slaves, calling the write handler directly.
This three changes are the result of many tests, I found (partially
empirically) that is the best way to address the problem, but maybe
we'll find better solutions in the future.
2012-02-15 15:20:20 +01:00
antirez
05755f5c40
Initial version of c->reply_bytes implementation backported from unstable to 2.4, in order to apply issue 327 patches.
2012-02-15 15:20:05 +01:00
antirez
fbfe656236
On crash print information about the current client (if any), command vector, and object associated to first argument assuming it is a key.
2012-01-12 16:16:23 +01:00
antirez
e7b85b3315
Protections against protocol desyncs, leading to infinite query buffer growing, due to nul-terms in specific bytes of the request or indefinitely long multi bulk or bulk count strings without newlines. This bug is related to Issue #141 as well.
2012-01-07 12:50:44 +01:00
antirez
a5045d552c
Fixed replication when multiple slaves are attaching at the same time. The output buffer was not copied correctly between slaves. This fixes issue #141 .
2012-01-07 12:48:10 +01:00
antirez
8b860b36b3
Fixed memleak in CLIENT INFO, added simple test that will work as regression test on mac os x and in the CI when running over valgrind. This fixes issue #256
2011-12-19 10:19:08 +01:00
antirez
0f2199ec29
show initial querybuf bytes on querybuf overflow.
2011-11-25 17:08:25 +01:00
antirez
7558b1fe4d
log client protocol errors for log level >= verbose
2011-11-25 16:09:16 +01:00
antirez
f4e2abfcd4
minor refactoring to networking.c adding a separated function to get a string representing the current state of all the connected clients.
2011-11-24 15:47:55 +01:00
antirez
3852e2a831
last executed command in CLIENT LIST output.
2011-11-24 14:56:43 +01:00
antirez
5d5e68a486
Fixed bug in getClientInfoString() that was not rendering the N (no flags) special flag correctly.
2011-11-21 18:37:22 +01:00
antirez
a6e4627438
Close client connection and log the event when the client input buffer reaches 1GB.
2011-11-21 18:37:17 +01:00
antirez
93babe4b41
show active events in client file descriptor in CLIENT LIST.
2011-11-21 18:37:05 +01:00
antirez
51baa1922b
added output list and buffer length, query buffer size, to CLIENT LIST output.
2011-11-21 18:36:56 +01:00
antirez
f3ac12aac2
code generating the CLIENT LIST output refactored to have a function that is able to render a single client into a client info string.
2011-11-21 18:36:41 +01:00
antirez
3c51d3b36b
Remove the write handler only if there are no longer objects in the output queue AND if the static buffer is empty. This bug was the cause of a possible server-stop-responding-to-client bug under some specific work load. Thanks to Pieter Noordhuis for spotting and fixing it.
2011-09-12 11:06:11 +02:00
antirez
63aed54a27
Take a pointer to the relevant entry of the command table in the client structure. This is generally a more sounding design, simplifies a few functions prototype, and as a side effect fixes a bug related to the conversion of EXPIRE -1 to DEL: before of this fix Redis tried to convert it into an EXPIREAT in the AOF code, regardless of our rewrite of the command.
2011-07-12 10:00:12 +02:00
antirez
5d5fe340e0
new INFO filed master_link_down_since_seconds
2011-06-17 16:13:22 +02:00
antirez
4f8cf6a23c
use the new rewriteClientCommandVector() function for SPOP -> SREM replication translation as well.
2011-05-31 12:15:55 +02:00
antirez
ba07e1f505
Merge branch '2.4' of github.com:antirez/redis into 2.4
2011-05-07 12:10:11 +02:00
antirez
8ec9d6ef69
when Redis fails accepting a new connection reports the error at WARNING and not VERBOSE error level. Thanks to offby1 for proposing this in the Redis mailing list. #backport-candidate
2011-05-07 12:09:55 +02:00
antirez
deff2338fa
Merge remote branch 'pietern/2.4-misc' into 2.4
2011-05-05 16:50:28 +02:00
antirez
c924df8c83
Fixed a bug with replication where SLAVEOF NO ONE caused a slave to close the connection with its slaves
2011-04-29 14:18:45 +02:00
Pieter Noordhuis
f1e072c57d
Check for \n after finding \r
2011-04-27 14:29:27 +02:00
Pieter Noordhuis
d548f3daad
Move code
2011-04-27 13:16:23 +02:00
antirez
0882fe5e43
addReplyLongLong optimized to return shared objects when the value to reply is 0 or 1
2011-04-21 17:15:47 +02:00
antirez
7e5cf2660c
CLIENT KILL implemented
2011-04-21 17:11:24 +02:00
antirez
91867a5ea2
CLIENT LIST implemented
2011-04-21 17:09:46 +02:00
antirez
bd50301f3e
removed check for zmalloc return NULL in createClient(). The check was misplaced, and zmalloc never returns NULL.
2011-04-21 16:44:00 +02:00
Pieter Noordhuis
3fa46ef069
Use custom string2ll and strchr
2011-04-18 21:25:52 +02:00
antirez
fb90934c47
fixed memory leak introduced with the previous commit. Many thanks to Pieter Noordhuis for spotting it in no time
2011-03-31 19:54:08 +02:00
antirez
97d3b7dc8d
Fixed issue #503 . MONITOR + QUIT could crash the server, there are actually other interactions that could have the same effect (for instance Pub/Sub).
2011-03-31 16:45:05 +02:00
antirez
db0e263b42
Fixed issue #435 and at the same time introduced explicit ping in the master-slave channel that will detect a blocked master or a broken even if apparently connected TCP link.
2011-01-20 18:02:51 +01:00
Pieter Noordhuis
e18b59ae7e
Remove client from list of unblocked clients when it is free'd
2011-01-17 10:03:21 +01:00
antirez
ebb07fb4bb
implemented two new INFO fields showing the size of clients max input and output buffers.
2011-01-14 10:20:35 +01:00
Pieter Noordhuis
90419b5681
Remove glueoutputbuf option and broken code
2011-01-05 10:37:23 +01:00
antirez
401c3e213c
bulk transfers limited to 512 MB as this is the new limit of all the redis strings
2010-12-15 16:07:49 +01:00
antirez
f858c11d7d
Merge remote branch 'pietern/brpoplpush'
2010-12-14 16:26:37 +01:00
antirez
d51ebef509
LRANGE converted into a COW friendly command. Some refactoring, comment, and new addReply*() family function added in the process.
2010-12-07 16:33:13 +01:00
Damian Janowski & Michel Martens
e3c51c4b1b
Rename bstate to bpop.
2010-11-29 23:52:07 -03:00
Damian Janowski & Michel Martens
357a841714
Move to struct.
2010-11-29 23:52:07 -03:00
antirez
f4aa600b99
first attempt to non blocking implementation of slave replication and SYNC bulk data download. Never compiled so far...
2010-11-04 17:29:53 +01:00
antirez
0a546fc017
Merge remote branch 'pietern/unixsocket'
2010-11-02 23:47:52 +01:00
Pieter Noordhuis
4794d88f15
Rewrite comment that was no longer valid
2010-10-28 16:59:05 +01:00
Pieter Noordhuis
a3a323e0e5
When REDIS_CLOSE_AFTER_REPLY is set, there may never be new replies
2010-10-28 16:52:23 +01:00