212 Commits

Author SHA1 Message Date
antirez
eda292a7fa SCAN: stay inside 80 cols. 2013-10-25 12:01:49 +02:00
antirez
fe0ffe6a1c Revert "Fixed typo in SCAN comment. iff -> if."
Probably here Pieter means "if and only if".

This reverts commit 0a970b93e911c0ece1fa2551ade71e122d8c01e1.
2013-10-25 12:00:13 +02:00
antirez
7bd87839c1 SCAN: simplify keys list cleanup using listSetFreeMethod(). 2013-10-25 11:58:03 +02:00
antirez
6f69128751 SCAN: improve variable names for readability. 2013-10-25 11:54:45 +02:00
antirez
6bff0f3cb6 SCAN: remove additional newlines to conform to Redis code base. 2013-10-25 11:51:08 +02:00
antirez
32b555c5fb SCAN: remove useless assertion, already enforced by command table. 2013-10-25 11:49:08 +02:00
antirez
6874fcc216 SCAN: use define REDIS_LONGSTR_SIZE instead of fixed len. 2013-10-25 11:48:18 +02:00
antirez
0a970b93e9 Fixed typo in SCAN comment. iff -> if. 2013-10-25 11:46:02 +02:00
antirez
5227a1f66f SCAN option name changed: pattern -> match. 2013-10-25 11:45:32 +02: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
1560b70889 Cluster: cluster stuff moved from redis.h to cluster.h. 2013-10-09 15:38:05 +02:00
antirez
e94b5b9359 Allow SHUTDOWN in loading state. 2013-06-27 12:18:29 +02:00
antirez
cf608e0451 EXPIRE should not resurrect keys. Issue #1026. 2013-03-28 12:45:07 +01:00
antirez
f334cccf8e TTL / PTTL commands: two bugs fixed.
This commit fixes two corner cases for the TTL command.

1) When the key was already logically expired (expire time older
than current time) the command returned -1 instead of -2.

2) When the key was existing and the expire was found to be exactly 0
(the key was just about to expire), the command reported -1 (that is, no
expire) instead of a TTL of zero (that is, about to expire).
2013-03-26 11:45:22 +01:00
antirez
4ad1f69d2a Cluster: move slotToKeyFlush() to emptyDb().
This way we are sure to destroy the slot->key map every time we destroy
the DB, for instance when reloading a DB due to replication.
2013-03-21 17:13:08 +01:00
antirez
e1b0d246f9 Cluster: use O(log(N)) algo for countKeysInSlot(). 2013-02-25 12:37:50 +01:00
antirez
301f162a2d Cluster: fix case for getKeysInSlot() and countKeysInSlot().
Redis functions start in low case. A few functions about cluster were
capitalized the wrong way.
2013-02-25 11:25:40 +01:00
antirez
9766072239 Cluster: added new API countKeysInSlot().
This is similar to getKeysInSlot() but just returns the number of keys
found in a given hash slot, without returning the keys.
2013-02-25 11:15:03 +01:00
antirez
ff71171a8e Cluster: fix case of slotToKey...() functions. 2013-02-22 10:16:21 +01:00
antirez
782e3ee485 Cluster: empty the internal sorted set mapping keys to slots on FLUSHDB/ALL. 2013-02-22 10:15:32 +01:00
antirez
2531fea2a5 Cluster: the cluster state structure is now heap allocated. 2013-02-14 13:20:56 +01:00
antirez
75512d94d9 PSYNC: work in progress, preview #2, rebased to unstable. 2013-02-12 12:52:21 +01:00
antirez
6aa1a3b030 Send 'expired' events when a key expires by lookup. 2013-01-28 13:15:19 +01:00
antirez
f28d386cc5 Keyspace events: it is now possible to select subclasses of events.
When keyspace events are enabled, the overhead is not sever but
noticeable, so this commit introduces the ability to select subclasses
of events in order to avoid to generate events the user is not
interested in.

The events can be selected using redis.conf or CONFIG SET / GET.
2013-01-28 13:15:12 +01:00
antirez
f2d1105618 Keyspace events added for more commands. 2013-01-28 13:14:56 +01:00
antirez
ccef29ae2c Initial test events for the new keyspace notification API. 2013-01-28 13:14:46 +01:00
antirez
be77f92e10 Fixed over-80-cols comment in db.c 2013-01-28 13:14:42 +01:00
antirez
247df4e83b Whitelist SIGUSR1 to avoid auto-triggering errors.
This commit fixes issue #875 that was caused by the following events:

1) There is an active child doing BGSAVE.
2) flushall is called (or any other condition that makes Redis killing
the saving child process).
3) An error is sensed by Redis as the child exited with an error (killed
by a singal), that stops accepting write commands until a BGSAVE happens
to be executed with success.

Whitelisting SIGUSR1 and making sure Redis always uses this signal in
order to kill its own children fixes the issue.
2013-01-19 13:30:38 +01:00
guiquanz
df7a5b7157 Fixed many typos. 2013-01-19 10:59:44 +01:00
antirez
547c83bf5d TTL API change: TTL returns -2 for non existing keys.
The previous behavior was to return -1 if:

1) Existing key but without an expire set.
2) Non existing key.

Now the second case is handled in a different, and TTL will return -2
if the key does not exist at all.

PTTL follows the same behavior as well.
2012-11-12 23:04:36 +01:00
antirez
a32d1ddff6 BSD license added to every C source and header file. 2012-11-08 18:31:32 +01:00
antirez
f3dc5e66f7 Make sure that SELECT argument is an integer or return an error.
Unfortunately we had still the lame atoi() without any error checking in
place, so "SELECT foo" would work as "SELECT 0". This was not an huge
problem per se but some people expected that DB can be strings and not
just numbers, and without errors you get the feeling that they can be
numbers, but not the behavior.

Now getLongFromObjectOrReply() is used as almost everybody else across
the code, generating an error if the number is not an integer or
overflows the long type.

Thanks to @mipearson for reporting that on Twitter.
2012-09-11 10:32:04 +02:00
Pieter Noordhuis
86b1d9e798 Use safe dictionary iterator from KEYS
Every matched key in a KEYS call is checked for expiration. When the key
is set to expire, the call to `getExpire` will assert that the key also
exists in the main dictionary. This in turn causes a rehashing step to
be executed. Rehashing a dictionary when there is an iterator active may
result in the iterator emitting duplicate entries, or not emitting some
entries at all. By using a safe iterator, the rehash step is omitted.
2012-05-01 10:52:03 +02:00
antirez
015b287ce3 Never used function stringObjectEqualsMs() removed. 2012-04-07 02:10:48 +02:00
antirez
fd3da94a95 expireGenericCommand(): better variable names and a top-comment that describes the function's behavior. 2012-04-05 15:52:08 +02:00
Premysl Hruby
aa83592cd4 for (p)expireat use absolute time, without double recomputation 2012-04-05 15:46:21 +02:00
Premysl Hruby
3cfe7fb462 fix mstime() ommited while comparing if key is already expired 2012-04-05 15:46:15 +02:00
Premysl Hruby
9519b3efd6 remove disk-store related comments 2012-03-27 18:46:51 +02:00
Premysl Hruby
b371ac5b20 fix time() instead of mstime() in expireIfNeeded 2012-03-27 17:31:21 +02:00
antirez
ea71e06988 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
c814e1baca Only incremnet stats for key miss/hit when the key is semantically accessed in read-only. 2012-02-01 21:51:20 +01:00
antirez
e6369ae06e setKey(): call the higher level wrapper setModifiedKey() instead of touchWatchedKey() even if currently they are exactly the same. 2012-01-30 10:27:50 +01:00
antirez
4aa527ba09 some RDB server struct fields renamed. 2011-12-21 12:22:13 +01:00
antirez
0bb9c8b70d more AOF server struct fields renamed. 2011-12-21 12:17:02 +01:00
antirez
6bb4b565ff AOF refactoring, now with three states: ON, OFF, WAIT_REWRITE. 2011-12-21 10:31:34 +01:00
antirez
194a790664 New script timeout semantics and SCRIPT KILL implemented. SHUTDOWN NOSAVE and SHUTDOWN SAVE implemented. 2011-11-18 14:10:48 +01:00
antirez
bd19e43850 high resolution expires API modified to use separated commands. AOF transation to PEXPIREAT of all the expire-style commands fixed. 2011-11-10 17:52:02 +01:00
antirez
b93074be52 TTL, EXPIRE and EXPIREAT now support the milliseconds input/output form 2011-11-09 18:05:35 +01:00
antirez
027876589d Initial support for key expire times with millisecond resolution. RDB version is now 3, new opcoded added for high resolution times. Redis is still able to correctly load RDB version 2. Tests passing but still a work in progress. API to specify milliseconds expires still missing, but the precision of normal expires is now already improved and working. 2011-11-09 16:51:19 +01:00