457 Commits

Author SHA1 Message Date
antirez
7a5a646df9 Fixed grammar: before H the article is a, not an. 2013-12-05 16:35:32 +01:00
antirez
faa5495eea Fix clients timeout handling.
During the refactoring of blocking operations, commit
83e363d3e67c27865d7679c27f466c5e12b3d4ee, a bug was introduced where
a milliseconds time is compared to a seconds time, so all the clients
always appear to timeout if timeout is set to non-zero value.

Thanks to Jonathan Leibiusky for finding the bug and helping verifying
the cause and fix.
2013-12-05 14:55:07 +01:00
antirez
a7ebb0c7bf WAIT command: synchronous replication for Redis. 2013-12-04 16:20:03 +01:00
antirez
83e363d3e6 BLPOP blocking code refactored to be generic & reusable. 2013-12-03 17:43:53 +01:00
antirez
5502face59 Cluster: basic data structures for nodes black list. 2013-11-29 17:37:06 +01:00
antirez
7cd6b48963 Stop writes on MISCONF only if instance is a master.
From the point of view of the slave not accepting writes from the master
can only create a bigger consistency issue.
2013-11-28 16:29:26 +01:00
antirez
d0a7a5a39f Reply to PING with error when there is a MISCONF state. 2013-11-28 16:17:10 +01:00
antirez
adbba45d5d Sentinel: test for writable config file.
This commit introduces a funciton called when Sentinel is ready for
normal operations to avoid putting Sentinel specific stuff in redis.c.
2013-11-21 12:28:15 +01:00
antirez
5d77fe69c7 Sentinel: distinguish between is-master-down-by-addr requests.
Some are just to know if the master is down, and in this case the runid
in the request is set to "*", others are actually in order to seek for a
vote and get elected. In the latter case the runid is set to the runid
of the instance seeking for the vote.
2013-11-19 16:50:04 +01:00
antirez
b2618c6cdb ZSCAN implemented. 2013-10-28 11:36:42 +01:00
antirez
6618167a9f HSCAN implemented. 2013-10-28 11:35:26 +01:00
antirez
e96ffac563 SSCAN implemented. 2013-10-28 11:17:32 +01:00
antirez
e74c235567 SCAN is a random command and does not require output sorting.
Sorting the output helps when we want to turn a non-deterministic into a
deterministic command, in that case this is not possible.
2013-10-28 11:13:43 +01:00
Pieter Noordhuis
25ae316f65 SCAN requires at least 1 argument 2013-10-25 10:49:56 +02:00
Pieter Noordhuis
956c0ed927 Add SCAN command 2013-10-25 10:49:48 +02:00
antirez
e4b341a335 Cluster: time switched from seconds to milliseconds.
All the internal state of cluster involving time is now using mstime_t
and mstime() in order to use milliseconds resolution.

Also the clusterCron() function is called with a 10 hz frequency instead
of 1 hz.

The cluster node_timeout must be also configured in milliseconds by the
user in redis.conf.
2013-10-09 16:19:26 +02:00
antirez
1560b70889 Cluster: cluster stuff moved from redis.h to cluster.h. 2013-10-09 15:38:05 +02:00
antirez
c8d6bc94e4 Cluster: react faster when a slave wins an election. 2013-09-26 16:54:43 +02:00
antirez
90e1829ec4 Allow AUTH / PING when disconnected from slave and serve-stale-data is no. 2013-09-17 09:46:06 +02:00
antirez
a97a8b8954 Only run the fast active expire cycle if master & enabled. 2013-08-27 09:31:55 +02:00
antirez
85bfeb8fea Opening TCP listening ports refactored into a function. 2013-08-22 14:01:16 +02:00
antirez
d42715de50 Print error message when can't bind * on any address. 2013-08-22 13:02:59 +02:00
antirez
18317ae6b4 Fix for issue #1214 simplified. 2013-08-21 11:36:09 +02:00
Salvatore Sanfilippo
617c877d29 Merge pull request #1214 from kaoshijuan/unstable
fixed initServer fail problem
2013-08-21 02:18:41 -07:00
antirez
623ad22fa8 Add per-db average TTL information in INFO output.
Example:

db0:keys=221913,expires=221913,avg_ttl=655

The algorithm uses a running average with only two samples (current and
previous). Keys found to be expired are considered at TTL zero even if
the actual TTL can be negative.

The TTL is reported in milliseconds.
2013-08-06 15:00:43 +02:00
antirez
67b4704bc6 activeExpireCycle(): fix about fast cycle early start.
We don't want to repeat a fast cycle too soon, the previous code was
broken, we need to wait two times the period *since* the start of the
previous cycle in order to avoid there is an even space between cycles:

.-> start                   .-> second start
|                           |
+-------------+-------------+--------------+
| first cycle |    pause    | second cycle |
+-------------+-------------+--------------+

The second and first start must be PERIOD*2 useconds apart hence the *2
in the new code.
2013-08-06 12:59:04 +02:00
antirez
1dd670c34b Some activeExpireCycle() refactoring. 2013-08-06 12:55:49 +02:00
antirez
8d70078b45 Remove dead code and fix comments for new expire code. 2013-08-06 12:36:13 +02:00
antirez
f526102801 Darft #2 for key collection algo: more improvements.
This commit makes the fast collection cycle time configurable, at
the same time it does not allow to run a new fast collection cycle
for the same amount of time as the max duration of the fast
collection cycle.
2013-08-05 16:14:28 +02:00
antirez
db3bbb9006 Draft #1 of a new expired keys collection algorithm.
The main idea here is that when we are no longer to expire keys at the
rate the are created, we can't block more in the normal expire cycle as
this would result in too big latency spikes.

For this reason the commit introduces a "fast" expire cycle that does
not run for more than 1 millisecond but is called in the beforeSleep()
hook of the event loop, so much more often, and with a frequency bound
to the frequency of executed commnads.

The fast expire cycle is only called when the standard expiration
algorithm runs out of time, that is, consumed more than
REDIS_EXPIRELOOKUPS_TIME_PERC of CPU in a given cycle without being able
to take the number of already expired keys that are yet not collected
to a number smaller than 25% of the number of keys.

You can test this commit with different loads, but a simple way is to
use the following:

Extreme load with pipelining:

redis-benchmark -r 100000000 -n 100000000  \
        -P 32 set ele:rand:000000000000 foo ex 2

Remove the -P32 in order to avoid the pipelining for a more real-world
load.

In another terminal tab you can monitor the Redis behavior with:

redis-cli -i 0.1 -r -1 info keyspace

and

redis-cli --latency-history

Note: this commit will make Redis printing a lot of debug messages, it
is not a good idea to use it in production.
2013-08-05 12:05:22 +02:00
Allan
74ff4fc728 fixed initServer fail while having no IPv6 nor IPv4 2013-07-25 15:36:00 +08:00
Allan
d3736ba400 fixed initServer failed if no IPV4 or no IPV6 2013-07-25 15:28:33 +08:00
Allan
f1be75e5d0 fixed bug issue of #1213 2013-07-24 21:34:55 +08:00
antirez
aa32f92338 Introduction of a new string encoding: EMBSTR
Previously two string encodings were used for string objects:

1) REDIS_ENCODING_RAW: a string object with obj->ptr pointing to an sds
stirng.

2) REDIS_ENCODING_INT: a string object where the obj->ptr void pointer
is casted to a long.

This commit introduces a experimental new encoding called
REDIS_ENCODING_EMBSTR that implements an object represented by an sds
string that is not modifiable but allocated in the same memory chunk as
the robj structure itself.

The chunk looks like the following:

+--------------+-----------+------------+--------+----+
| robj data... | robj->ptr | sds header | string | \0 |
+--------------+-----+-----+------------+--------+----+
                     |                       ^
                     +-----------------------+

The robj->ptr points to the contiguous sds string data, so the object
can be manipulated with the same functions used to manipulate plan
string objects, however we need just on malloc and one free in order to
allocate or release this kind of objects. Moreover it has better cache
locality.

This new allocation strategy should benefit both the memory usage and
the performances. A performance gain between 60 and 70% was observed
during micro-benchmarks, however there is more work to do to evaluate
the performance impact and the memory usage behavior.
2013-07-22 10:31:38 +02:00
yoav
dddfb15bc0 Chunked loading of RDB to prevent redis from stalling reading very large keys. 2013-07-16 15:41:24 +02:00
antirez
912470cd00 Use the environment locale for strcoll() collation. 2013-07-12 13:38:43 +02:00
antirez
e4d2e6fc9d All IP string repr buffers are now REDIS_IP_STR_LEN bytes. 2013-07-09 11:32:52 +02:00
antirez
ef8ca93920 IPv6: bind IPv4 and IPv6 interfaces by default. 2013-07-09 10:47:17 +02:00
antirez
2fa66d5e76 Fix old anetPeerToString() API call in replication.c 2013-07-08 16:11:52 +02:00
Geoff Garside
d61f125b1b Cleanup main() and BACKTRACE mistaken pulled while rebasing. 2013-07-08 16:07:26 +02:00
Geoff Garside
f0eb97325c Fix calls to anetPeerToString() missing buffer size. 2013-07-08 16:07:26 +02:00
Geoff Garside
dc7e8ec27f Update calls to anetPeerToString to include ip_len. 2013-07-08 15:57:22 +02:00
antirez
d3cde09645 Binding multiple IPs done properly with multiple sockets. 2013-07-05 11:47:20 +02:00
antirez
bd9b1251ac Ability to bind multiple addresses. 2013-07-04 18:50:15 +02:00
antirez
f57a871de0 getAbsolutePath() moved into utils.c 2013-07-02 11:56:52 +02:00
antirez
f4805fa45a CONFIG SET maxclients. 2013-06-28 17:08:03 +02:00
antirez
e94b5b9359 Allow SHUTDOWN in loading state. 2013-06-27 12:18:29 +02:00
Salvatore Sanfilippo
a59318f0a4 Merge pull request #1111 from yamt/netbsd3
netbsd support
2013-06-26 06:17:02 -07:00
antirez
8338e50127 Move Replication Script Cache initialization in safer place.
It should be called just one time at startup and not every time the Lua
scripting engine is re-initialized, otherwise memory is leaked.
2013-06-24 19:27:49 +02:00
antirez
eaebabe564 Use the RSC to replicate EVALSHA unmodified.
This commit uses the Replication Script Cache in order to avoid
translating EVALSHA into EVAL whenever possible for both the AOF and
slaves.
2013-06-24 18:57:31 +02:00