Yecheng Fu
f0266532fc
fix typo in comments (redis.c, networking.c)
2012-11-01 22:26:46 +01:00
antirez
2ea41242f6
Unix socket clients properly displayed in MONITOR and CLIENT LIST.
...
This also fixes issue #745 .
2012-11-01 22:10:45 +01:00
antirez
3a32897856
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-06-27 09:43:57 +02:00
antirez
5b63ccce6c
Fix c->reply_bytes computation in setDeferredMultiBulkLength()
...
In order to implement reply buffer limits introduced in 2.6 and useful
to close the connection under user-selected circumastances of big output
buffers (for instance slow consumers in pub/sub, a blocked slave, and so
forth) Redis takes a counter with the amount of used memory in objects
inside the output list stored into c->reply.
The computation was broken in the function setDeferredMultiBulkLength(),
in the case the object was glued with the next one. This caused the
c->reply_bytes field to go out of sync, be subtracted more than needed,
and wrap back near to ULONG_MAX values.
This commit fixes this bug and adds an assertion that is able to trap
this class of problems.
This problem was discovered looking at the INFO output of an unrelated
issue (issue #547 ).
2012-06-15 10:03:25 +02:00
antirez
09f66a0be8
New client info field added to CLIENT LIST output: multi, containing the length of the current pipeline. Test modified accordingly.
2012-04-07 11:14:52 +02:00
antirez
4cba71e898
Fixed typo in comment: "te" -> "the".
2012-03-29 09:33:29 +02:00
antirez
179e54d2a9
Fix for slaves chains. Force resync of slaves (simply disconnecting them) when SLAVEOF turns a master into a slave.
2012-03-29 09:24:02 +02:00
Premysl Hruby
d194905449
use server.unixtime instead of time(NULL) where possible (cluster.c not checked though)
2012-03-27 17:39:58 +02:00
antirez
ae22bf1ef6
Reclaim space from the client querybuf if needed.
2012-03-14 15:32:30 +01:00
antirez
d19015be12
Process async client checks like client timeouts and BLPOP timeouts incrementally using a circular list.
2012-03-13 18:05:11 +01:00
antirez
bbaeda402c
Added a qbuf-free field to CLIENT LIST output.
2012-03-13 13:26:33 +01:00
antirez
e74dca73d9
Client creation time in redisClient structure. New age field in CLIENT LIST output.
2012-03-13 13:05:08 +01:00
antirez
573373802e
c->bufpos initialization moved for aesthetics.
2012-03-13 12:59:27 +01:00
antirez
7b845b6228
anetPeerToString() automatically populates ip/port with something that may be provided to the user as output in case of errors.
2012-03-07 11:30:30 +01:00
antirez
6e09ad1c15
Return ASAP from checkClientOutputBufferLimits() if c->reply_bytes is zero.
2012-02-16 12:20:56 +01:00
antirez
609baba8a2
Fixes to c->reply_bytes computation, and debug messages to closely study the behavior of memory pressure + slaves + maxmemory + blocked slaves.
2012-02-07 17:41:31 +01:00
antirez
442246dde2
Precision of getClientOutputBufferMemoryUsage() greatily improved, see issue #327 for more information.
2012-02-07 13:05:36 +01:00
antirez
8b7c3455b9
freeMemoryIfNeeded() minor refactoring
2012-02-06 16:56:42 +01:00
antirez
f6b32c14f4
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-04 14:05:54 +01:00
antirez
355f859134
Use less memory when emitting the protocol, by using more shared objects for commonly emitted parts of the protocol.
2012-02-04 08:58:37 +01:00
antirez
c715c9b8bf
Fixed typo in getClientLimitClassByName()
2012-01-25 18:07:56 +01:00
antirez
2f0f0d95c0
lenght -> length
2012-01-24 15:33:15 +01:00
antirez
7957c67604
after all closing a client for output buffer limit overcoming is a WARNING level message.
2012-01-24 12:03:48 +01:00
antirez
7fe8d49a70
Client output buffer limits: configuration of parameters for the different classes of clients implemented.
2012-01-24 10:43:30 +01:00
antirez
06b3dced99
asyncCloseClientOnOutputBufferLimitReached() now ignores clients with REDIS_CLOSE_ASAP flag already set. Return value of the function changed from int to void since it is not used. Fixed logging of the client scheduled to be closed.
2012-01-24 09:32:39 +01:00
antirez
51669c5ac1
client buffer handling refactoring and optimization
2012-01-23 17:15:49 +01:00
antirez
7eac2a75a4
Implementation of the internals that make possible to terminate clients overcoming configured output buffer (soft and hard) limits.
2012-01-23 16:12:37 +01:00
antirez
498dc5557c
Introduced three client limit classes: normal, slave, pubsub
2012-01-17 12:43:01 +01:00
antirez
3853c16839
Track the length of the client pending output buffers (still to transfer) in a new field in the client structure.
2012-01-17 12:23:25 +01:00
antirez
00010fa96f
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:02:57 +01:00
antirez
11e0c4c55b
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.
2011-12-31 16:09:46 +01:00
antirez
1824e3a3a3
Fixed replication when multiple slaves are attaching at the same time. The output buffer was not copied correctly between slaves. This fixes issue #141 .
2011-12-30 19:40:43 +01:00
antirez
1844f9900f
server.replstate -> server.repl_state
2011-12-21 12:23:18 +01:00
antirez
0a466a7542
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:16:37 +01:00
antirez
63fd13996d
show initial querybuf bytes on querybuf overflow.
2011-11-28 11:12:55 +01:00
antirez
3e0a975e07
log client protocol errors for log level >= verbose
2011-11-25 16:09:34 +01:00
antirez
45e7a1ce00
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:04:42 +01:00
antirez
2c74a9f948
last executed command in CLIENT LIST output.
2011-11-24 14:56:34 +01:00
antirez
3c95e7212e
new counter in INFO output: rejected_connections with number of dropped connections because of maxclients limit reached.
2011-11-23 18:38:12 +01:00
antirez
afd0f06b75
Fixed bug in getClientInfoString() that was not rendering the N (no flags) special flag correctly.
2011-11-21 16:19:30 +01:00
antirez
becf5fdb0c
Close client connection and log the event when the client input buffer reaches 1GB.
2011-11-21 16:17:51 +01:00
antirez
6621b8ffa1
show active events in client file descriptor in CLIENT LIST.
2011-11-21 16:06:03 +01:00
antirez
491c1c4e04
added output list and buffer length, query buffer size, to CLIENT LIST output.
2011-11-21 15:54:49 +01:00
antirez
17d25a33e2
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 15:34:32 +01:00
antirez
b90314588f
useless double if removed.
2011-11-08 11:26:06 +01:00
antirez
b0a2e34059
yet another #if REDIS_MBULK_BIG_ARG removed.
2011-11-08 11:24:12 +01:00
antirez
53272781d0
Multi bulk optimization for creating big objects without copying data is no longer optional, #ifdefs removed. Also debugging messages removed.
2011-11-08 11:22:40 +01:00
antirez
ca908473e8
A comment moved a few lines for clarity.
2011-11-04 11:18:15 +01:00
antirez
94d490b9f6
Added a define to set the size threshold to enable the multi bulk parsing big objects optimization.
2011-11-04 11:16:11 +01:00
antirez
826b5beb9c
further optimizations for the multi bulk protocol parsing code when big objects are transmitted to Redis.
2011-11-03 15:53:40 +01:00
antirez
9217095572
optimized object creation in multi-bulk protocol parsing
2011-11-02 17:30:19 +01:00
antirez
b8d743e181
sdsIncrLen() / sdsMakeRoomFor() used to avoid copying to intermediate buffer while reading the client query.
2011-11-02 16:52:45 +01:00
antirez
58732c23d5
maxclients configuration is now implemented dealing with the actual process rlimits. Setting maxclients to 0 no longer makes sense and is now invalid, the new default is 10000.
...
See issue #162 for more information.
2011-10-31 10:49:27 +01:00
antirez
6856c7b4d6
First implementation of the ASKING command. Semantics still to verify.
2011-10-17 17:35:23 +02:00
antirez
eab0e26e03
replaced redisAssert() with redisAssertWithInfo() in a shitload of places.
2011-10-04 18:43:03 +02:00
antirez
3bc89500d2
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:28 +02:00
Hampus Wessman
64f201c2aa
Fix crash when pipelining several blocking commands.
2011-07-28 13:50:44 +02:00
antirez
4dd444bb4a
Replicate EVALSHA as EVAL taking a dictionary of sha1 -> script source code.
2011-07-13 15:38:03 +02:00
antirez
0681c5ad84
master branch merged into scripting.
2011-07-12 12:39:16 +02:00
antirez
09e2d9eeba
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-08 12:59:30 +02:00
antirez
994ed2bc55
unstable merge conflicts resolved
2011-06-25 12:29:24 +02:00
antirez
c9d0c3623a
diskstore removed
2011-06-25 12:22:03 +02:00
antirez
c1c9d551da
Fix for bug 561 and other related problems
2011-06-20 17:19:36 +02:00
antirez
07486df6fe
new INFO filed master_link_down_since_seconds
2011-06-17 16:16:46 +02:00
antirez
3bb818df40
Make sure error and status replies emitted by Lua scripts can never have more than a newline, otherwise it is a protocol violation and clients will desync.
2011-05-25 12:32:50 +02:00
antirez
7b72272790
when creating not connected clients do not add them into the clients list, otherwise they will be subject to timeouts and other stuff
2011-05-25 12:32:44 +02:00
antirez
7156f43c04
Correctly glue the reply buffer. For now returned as it is to Lua, but will be converted into Lua native type later.
2011-05-25 12:32:44 +02:00
antirez
0f1d64ca57
Lua call of Redis command work in progress: sorry I have to go to the cinema to watch the Source Code movie
2011-05-25 12:32:44 +02:00
antirez
df541beae3
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 11:47:34 +02:00
Pieter Noordhuis
bf9fd5ffa2
Check for \n after finding \r
2011-05-05 16:32:22 +02:00
Pieter Noordhuis
af0e51f2e1
Move code
2011-05-05 16:25:48 +02:00
Pieter Noordhuis
5af302011c
Use custom string2ll and strchr
2011-05-05 16:25:48 +02:00
antirez
d37299e3b7
Fixed a bug with replication where SLAVEOF NO ONE caused a slave to close the connection with its slaves
2011-04-29 14:18:16 +02:00
antirez
b93fdb7bbb
CLIENT KILL implemented
2011-04-21 15:47:47 +02:00
antirez
3cd12b5687
CLIENT LIST implemented
2011-04-21 15:38:02 +02:00
antirez
c7ba7b8bbb
removed check for zmalloc return NULL in createClient(). The check was misplaced, and zmalloc never returns NULL.
2011-04-20 12:51:03 +02:00
antirez
009db67645
addReplyLongLong optimized to return shared objects when the value to reply is 0 or 1
2011-04-15 18:08:24 +02:00
antirez
5b94b8ac5d
fixed memory leak introduced with the previous commit. Many thanks to Pieter Noordhuis for spotting it in no time
2011-03-31 19:52:15 +02:00
antirez
25ef31920a
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:44:43 +02:00
antirez
89a1433e69
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 13:18:23 +01:00
Pieter Noordhuis
3bcffcbe5b
Remove client from list of unblocked clients when it is free'd
2011-01-17 10:04:13 +01:00
antirez
7a1fd61e3d
implemented two new INFO fields showing the size of clients max input and output buffers.
2011-01-14 10:20:02 +01:00
Pieter Noordhuis
a510cb0c03
Remove glueoutputbuf option and broken code
2011-01-05 10:39:41 +01:00
antirez
3be00d7ed6
implemented a different approach to IO scheduling, so object->storage is no longer used, instead there is a queue and hash table of IO tasks to process, and it is always possible to know what are the scheduled and acrtive IO operations against every single key.
2011-01-01 21:35:56 +01:00
antirez
98a9abb66d
don't use small shared integer objects when disk store is enabled
2010-12-30 18:17:01 +01:00
antirez
16d778780e
a lot of code reworked/removed to implement object caching
2010-12-28 18:06:40 +01:00
antirez
697af434fb
initial changes needed to turn the current VM code into a cache system. Tons of work to do still.
2010-12-28 15:20:20 +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
Pieter Noordhuis
5e78edb350
Unify two client flags that mean the same
2010-10-28 15:07:45 +01:00
Pieter Noordhuis
b19c33d48a
Prevent clients from making too large multibulk requests
2010-10-15 19:15:38 +02:00
Pieter Noordhuis
9da6caac4e
Don't reset the client when processCommand returns REDIS_ERR
2010-10-15 17:27:05 +02:00
Pieter Noordhuis
cd8788f26d
Refactor request parsing code for efficiency
2010-10-15 15:44:55 +02:00
Pieter Noordhuis
b04ce2a35c
Merge master with resolved conflict in src/redis-cli.c
2010-10-13 18:55:46 +02:00
Pieter Noordhuis
4fe83b554a
sockaddr_un.sun_path appears to never hold anything after accept()
2010-10-13 18:50:07 +02:00
Pieter Noordhuis
ab17b909fe
Use different accept handlers for TCP and unix socket connections
2010-10-13 18:34:24 +02:00
Pieter Noordhuis
941c9fa285
Return OK on QUIT
2010-10-13 11:25:40 +02:00
antirez
a4f3f93b90
new parsing code bugfixing
2010-09-17 16:05:01 +02:00
antirez
34a719d250
try to parse the request in a smarter way to gain speed... work in progress
2010-09-17 15:26:07 +02:00
antirez
4c2e506a39
modified a bit addReply() to play better with copy on write now that we have a static buffer. Changed the name of a function from _ensureFileEvent() to _installWriteEvent().
2010-09-16 13:08:40 +02:00
antirez
83f39c7ab2
Merge remote branch 'pietern/networking-perf'
2010-09-16 12:02:18 +02:00
Pieter Noordhuis
f335779240
Static buffer in client struct has a constant size
2010-09-16 11:59:53 +02:00
antirez
89f9f83769
Merge remote branch 'pietern/networking-perf'
2010-09-16 11:38:40 +02:00
Pieter Noordhuis
106bd87a3c
Fix bug where the client is not present in server.clients when free'ing it
...
When creating the readable event results in an error (this happens when
the server hits OS limits), the client was not added to the list of
clients when freeClient was called. This results in an assertion error.
It is better to check this condition first and free the client
immediately when this condition occurs. Port of 00a90feb.
2010-09-07 10:25:34 +02:00
Pieter Noordhuis
49128f0b9d
Fix bug in gluing a deferred multi bulk length to the next reply chunk
2010-09-02 23:34:41 +02:00
Pieter Noordhuis
3ab203762f
Use specialized function to add status and error replies
2010-09-02 23:33:06 +02:00
Pieter Noordhuis
36c19d03e0
Changed reply buildup internals
2010-09-02 19:52:04 +02:00
Pieter Noordhuis
4a7893ca9c
Removed unneeded function
2010-09-02 19:52:04 +02:00
Pieter Noordhuis
cd76bb651d
Free the sds in addReplySds when it cannot be added to the reply
2010-09-02 19:52:04 +02:00
Pieter Noordhuis
0537e7bf80
Use specialized function to add multi bulk reply length
2010-09-02 12:51:14 +02:00
Pieter Noordhuis
57b0738011
Don't build a reply when replaying the AOF
2010-08-30 16:51:39 +02:00
Pieter Noordhuis
b301c1fc2b
Wrapper for adding unknown multi bulk length to reply list
2010-08-30 16:39:14 +02:00
Pieter Noordhuis
834ef78e27
Refactor reply buildup for speed on large multi bulk replies
2010-08-30 16:39:08 +02:00
antirez
778b2210a9
slave with attached slaves now close the conection to all the slaves when the connection to the master is lost. Now a slave without a connected link to the master will refuse SYNC from other slaves. Enhanced the replication error reporting. All this will fix Issue 156
2010-08-24 16:04:13 +02:00
antirez
e452436a07
BLPOPping clients are no longer subject to connection timeouts, fixing issues 155
2010-08-24 12:10:59 +02:00
antirez
1a71fb9669
vm_blocked_clients count fixed in INFO, thanks to Pietern Noordhuis
2010-07-21 13:16:26 +02:00
antirez
e2641e09cc
redis.c split into many different C files.
...
networking related stuff moved into networking.c
moved more code
more work on layout of source code
SDS instantaneuos memory saving. By Pieter and Salvatore at VMware ;)
cleanly compiling again after the first split, now splitting it in more C files
moving more things around... work in progress
split replication code
splitting more
Sets split
Hash split
replication split
even more splitting
more splitting
minor change
2010-07-01 14:38:51 +02:00