142 Commits

Author SHA1 Message Date
antirez
9419eb0ffd More incremental active expired keys collection process.
If a large amonut of keys are all expiring about at the same time, the
"active" expired keys collection cycle used to block as far as the
percentage of already expired keys was >= 25% of the total population of
keys with an expire set.

This could block the server even for many seconds in order to reclaim
memory ASAP. The new algorithm uses at max a small amount of
milliseconds per cycle, even if this means reclaiming the memory less
promptly it also means a more responsive server.
2012-05-12 09:33:47 +02:00
antirez
df10c797e0 Limit memory used by big SLOWLOG entries.
Two limits are added:

1) Up to SLOWLOG_ENTRY_MAX_ARGV arguments are logged.
2) Up to SLOWLOG_ENTRY_MAX_STRING bytes per argument are logged.
3) slowlog-max-len is set to 128 by default (was 1024).

The number of remaining arguments / bytes is logged in the entry
so that the user can understand better the nature of the logged command.
2012-04-21 21:50:25 +02:00
Salvatore Sanfilippo
3c38b0876e Merge pull request #417 from josephjang/e95ca1db21b2dbe82f39a3f7f6390cb5f58dafae
a memory leak with replication on two or more dbs including >= db10
2012-03-30 01:28:58 -07:00
Joseph Jang
e95ca1db21 Fixed a memory leak with replication
occurs when two or more dbs are replicated and at least one of them is >db10
2012-03-30 02:17:21 +09: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
b3a86b8209 Fixed a few broken stuff introduced while merging issue #327 related code in 2.4 2012-02-15 15:30:29 +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
f373061563 Added a server.arch_bits field instead of computing it at runtime for INFO. 2012-02-02 10:02:40 +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
8a82ee0f3c better bug report info on crash (backported from unstable) 2011-11-24 15:53:35 +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
a6e4627438 Close client connection and log the event when the client input buffer reaches 1GB. 2011-11-21 18:37:17 +01:00
antirez
b1b98c64cc Max log message length set to 4k to avoid truncated INFO output in logs on Redis crash. This is just a workaround and it is handled better in the unstable branch. 2011-11-21 18:32:08 +01:00
antirez
beb4bacce6 I/O buffer length enlarged 2011-11-11 17:19:57 +01:00
antirez
3fac86ff1d set default client timeout to zero inside redis.h as well 2011-11-11 17:16:03 +01:00
Herbert G. Fischer
1fe4cd5de9 fixed source indenting 2011-10-18 19:03:18 -02:00
Herbert G. Fischer
7c6da7327f Added repl_ping_slave_period and repl_timeout options support 2011-10-18 18:56:10 -02:00
Nathan Florea
09cefcfbb3 Added a config directive for a Unix socket mask
Added a configuration directive to allow a user to specify the
permissions to be granted to the Unix socket file.  I followed
the format Pieter and Salvatore discusses in issue #85 (
https://github.com/antirez/redis/issues/85).
2011-10-10 22:08:11 +02:00
antirez
79b9ec53d1 fixed flushAppendOnlyFile() function prototype to reflect the new implementation, fixing compilation. 2011-09-19 17:43:56 +02:00
antirez
4c2d5f0980 postpone the AOF fsync if policy is everysec and there is a background fsync already going. 2011-09-19 17:43:49 +02:00
antirez
3a4afb0473 Manual merge after cherry-pick 2011-07-12 10:03:22 +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
19453556d4 dataspace change hook functions backported to 2.4. They are just wrappers at this point but this makes simpler to cherry-pick between branches. 2011-07-12 09:56:41 +02:00
antirez
30b345ddbb more slow log merge, I forgot to resolve a conflict. 2011-07-02 00:27:10 +02:00
antirez
99509ab257 slow log merged into 2.4 2011-07-02 00:24:11 +02:00
antirez
5d5fe340e0 new INFO filed master_link_down_since_seconds 2011-06-17 16:13:22 +02:00
antirez
307868e149 DB API refactoring. The changes were designed together with Pieter Noordhuis. 2011-06-14 16:59:45 +02:00
antirez
61751a4dc4 AOF auto rewrite backported to 2.4 2011-06-10 18:31:27 +02:00
antirez
27c8f84c66 INFO now contains the time (in usecs) needed to fork() in order to persist. The info is available in the stats section of INFO. 2011-06-08 23:20:11 +02:00
antirez
4f8cf6a23c use the new rewriteClientCommandVector() function for SPOP -> SREM replication translation as well. 2011-05-31 12:15:55 +02:00
Pieter Noordhuis
afc151d3ba Make replication faster (biggest gain for small number of slaves) 2011-05-29 17:55:13 -07:00
Pieter Noordhuis
ecfc0583da Configurable synchronous I/O timeout 2011-05-22 12:57:56 +02:00
Pieter Noordhuis
ff8d85885e Minor changes in non-blocking repl. connect 2011-05-22 12:48:10 +02:00
Pieter Noordhuis
78c05caf5e Non-blocking connect with master 2011-05-19 18:53:31 +02:00
antirez
deff2338fa Merge remote branch 'pietern/2.4-misc' into 2.4 2011-05-05 16:50:28 +02:00
Pieter Noordhuis
20dad91bdf Tests for string2ll; move isObject* to object.c 2011-04-27 13:26:33 +02:00
antirez
91867a5ea2 CLIENT LIST implemented 2011-04-21 17:09:46 +02:00
antirez
1c30cad1ab peak mem in INFO backported from unstable branch 2011-04-21 16:55:27 +02:00
antirez
760dec3a6c VM/direct-saving fixes 2011-04-20 17:48:46 +02:00
antirez
1f84b0648b yet more manual backporting from unstable 2011-04-20 15:57:35 +02:00
antirez
c92283770d added new RDB codes for ziplist encoded lists and intset encodeed sets 2011-04-20 15:41:13 +02:00
antirez
3dffb8e21e save zipmap encoded hashes as blobs. Work in progress. 2011-04-20 15:41:13 +02:00
Pieter Noordhuis
dfeb899b2d Merge branch '2.2' into 2.2-zset
Conflicts:
	src/object.c
2011-04-06 15:46:33 +02:00
antirez
93db956e06 make sure that OBJECT ENCODING returns skiplist for sorted sets, and not raw, so that once we will merge specially encoded sorted sets everything will make sense. 2011-04-06 15:38:08 +02:00
antirez
cf6c3f4b04 OBJECT command implemented 2011-04-06 12:22:09 +02:00