antirez
873f328fd8
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
a89d435d8e
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
996a643752
Cluster: use O(log(N)) algo for countKeysInSlot().
2013-02-25 12:37:50 +01:00
antirez
d2154254be
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
1abce14611
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
392e0fa7eb
Cluster: fix case of slotToKey...() functions.
2013-02-22 10:16:21 +01:00
antirez
d04770988d
Cluster: empty the internal sorted set mapping keys to slots on FLUSHDB/ALL.
2013-02-22 10:15:32 +01:00
antirez
1649e509c3
Cluster: the cluster state structure is now heap allocated.
2013-02-14 13:20:56 +01:00
antirez
078882025e
PSYNC: work in progress, preview #2 , rebased to unstable.
2013-02-12 12:52:21 +01:00
antirez
4dfb5752e0
Send 'expired' events when a key expires by lookup.
2013-01-28 13:15:19 +01:00
antirez
fce016d31b
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
da04e6ed44
Keyspace events added for more commands.
2013-01-28 13:14:56 +01:00
antirez
5b9357a6b3
Initial test events for the new keyspace notification API.
2013-01-28 13:14:46 +01:00
antirez
2ea9518a53
Fixed over-80-cols comment in db.c
2013-01-28 13:14:42 +01:00
antirez
79a0ef62db
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
9d09ce3981
Fixed many typos.
2013-01-19 10:59:44 +01:00
antirez
aa2bf6ba8b
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
4365e5b2d3
BSD license added to every C source and header file.
2012-11-08 18:31:32 +01:00
antirez
bfc197c3b6
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
cc4f65fea4
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
4cb8bb2952
Never used function stringObjectEqualsMs() removed.
2012-04-07 02:10:48 +02:00
antirez
70381bbf82
expireGenericCommand(): better variable names and a top-comment that describes the function's behavior.
2012-04-05 15:52:08 +02:00
Premysl Hruby
c6bf4a0034
for (p)expireat use absolute time, without double recomputation
2012-04-05 15:46:21 +02:00
Premysl Hruby
d48d1309c6
fix mstime() ommited while comparing if key is already expired
2012-04-05 15:46:15 +02:00
Premysl Hruby
b57dbdbba3
remove disk-store related comments
2012-03-27 18:46:51 +02:00
Premysl Hruby
024f213b12
fix time() instead of mstime() in expireIfNeeded
2012-03-27 17:31:21 +02: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
b80b1c5914
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
89f6f6abcf
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
f48cd4b90c
some RDB server struct fields renamed.
2011-12-21 12:22:13 +01:00
antirez
ff2145adac
more AOF server struct fields renamed.
2011-12-21 12:17:02 +01:00
antirez
e394114d95
AOF refactoring, now with three states: ON, OFF, WAIT_REWRITE.
2011-12-21 10:31:34 +01:00
antirez
4ab8695d53
New script timeout semantics and SCRIPT KILL implemented. SHUTDOWN NOSAVE and SHUTDOWN SAVE implemented.
2011-11-18 14:10:48 +01:00
antirez
12d293ca6e
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
52d46855d9
TTL, EXPIRE and EXPIREAT now support the milliseconds input/output form
2011-11-09 18:05:35 +01:00
antirez
7dcc10b65e
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
antirez
c0ba9ebe13
dict.c API names modified to be more coincise and consistent.
2011-11-08 17:07:55 +01:00
antirez
13cd1515f9
FLUSHALL now prevents rdbSave() from resetting the dirty counter, so that the command will get replicated and put inside the AOF. This fixes issue #142
2011-10-17 10:31:47 +02:00
antirez
42a6fcd6c5
FLUSHALL will only perform a blocking SAVE if RDB persistence is configured.
2011-10-17 10:31:34 +02:00
antirez
4ab18a3331
Fix for bug #128 about the RENAME command.
2011-10-10 15:21:19 +02:00
antirez
eab0e26e03
replaced redisAssert() with redisAssertWithInfo() in a shitload of places.
2011-10-04 18:43:03 +02:00
antirez
812ecc8b10
don't process EXPIRE with negative TTL or EXPIREAT with time in the past if we are a slave too (see http://groups.google.com/group/redis-db/browse_thread/thread/5a931fefb88b16d5 ). Also propagate it as DEL.
2011-07-07 16:24:37 +02:00
Hampus Wessman
040b0ade7d
Don't expire keys while loading AOF.
...
They will be expired (and a DEL will be logged) after the loading is done
instead.
2011-07-07 16:08:30 +02:00
antirez
c9d0c3623a
diskstore removed
2011-06-25 12:22:03 +02:00
antirez
f85cd526c1
DB API refactoring. The changes were designed together with Pieter Noordhuis.
2011-06-20 16:42:16 +02:00
antirez
a7b058dae6
Fixed semantics of CLUSTER SETSLOT, SELECT now only denied in cluster mode if selected DB is not 0 so that MIGRATE still works well.
2011-05-05 18:10:02 +02:00
antirez
484354ff95
CLUSTER GETKEYSINSLOT implemented
2011-04-29 16:17:58 +02:00
antirez
c772d9c6e7
take a hashslot -> keys index, will be used for cluster rehasing
2011-04-28 19:00:33 +02:00
antirez
ecc9109434
Cluster branch merged to unstable.
2011-03-29 17:51:15 +02:00
antirez
4b61ca460c
fixed a bug in RENAME getKeys() function
2011-03-28 18:46:22 +02:00
antirez
6e1b9b58ec
bug fixed in zunionstore specific getKeys() implementation
2011-03-28 18:21:06 +02:00
antirez
b4b5144694
Fixes to the new preloading / key discovery APIs
2011-03-28 17:54:42 +02:00
antirez
9791f0f8ce
new preloading implemented, still EXEC not handled correctly, everything to test
2011-03-23 18:09:17 +01:00
antirez
15db4aa006
TTL command fixed to work reliably with diskstore
2011-03-04 15:49:01 +01:00
antirez
3a73be7524
master-slave replication fixed, it was not listing any key using KEYS command in the slave.
2011-01-14 09:53:57 +01:00
antirez
69bfffb4a7
test adapted to run with diskstore, and a few bugs fixed
2011-01-09 18:25:34 +01:00
antirez
36c17a53b6
source reshaped a bit to play well with a bgsaving thread, still work to do, does not compile.
2011-01-07 18:15:14 +01:00
antirez
5ab7bbfc27
fixed logging level for debugging message
2011-01-03 17:40:10 +01:00
antirez
5d46e370b7
diskstore more fixes
2011-01-03 17:18:37 +01:00
antirez
c15a3887e0
diskstore bug fixing and negative cache proper implementation
2011-01-03 10:47:39 +01:00
antirez
120b9ba8f8
FLUSHALL / FLUSHDB for diskstore implemented
2011-01-03 10:17:39 +01:00
antirez
4942145d72
fixed a bug in diskstore
2011-01-02 21:39:17 +01:00
antirez
9a3730289f
blocking load fixed with the new design
2011-01-01 21:39:48 +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
aa81e4d5f4
minor changes to doc and comments
2010-12-31 18:23:31 +01:00
antirez
d934e1e85b
negative caching implemented
2010-12-31 17:32:59 +01:00
antirez
a440ecf0d3
major bug and a dead lock fixed
2010-12-31 14:30:24 +01:00
antirez
ad01a25553
blocking load of keys on lookup -- nor tested, nor finished
2010-12-31 00:18:17 +01:00
antirez
4e941ecacb
short but important comment added
2010-12-30 19:20:23 +01:00
antirez
3122229228
handled DEL command as a special optimized case for disk store
2010-12-30 19:16:59 +01:00
antirez
8d51fb6a80
diskstore cache bug fixing
2010-12-30 18:37:46 +01:00
antirez
4ab988238f
more work done for diskstore without trying to compile, more work needed to build again.
2010-12-30 16:41:36 +01:00
antirez
cea8c5cd75
touched key for WATCH refactored into a more general thing that can be used also for the cache system. Some more changes towards diskstore working.
2010-12-29 19:39:42 +01:00
antirez
16d778780e
a lot of code reworked/removed to implement object caching
2010-12-28 18:06:40 +01:00
antirez
1b1f47c915
command lookup process turned into a much more flexible and probably faster hash table
2010-11-03 11:23:59 +01:00
antirez
7d0966a6b7
Do not update the LRU info on key lookup when we have a saving child. With this trivial change the additional memory used while saving with a background child in presence of many read operations is zero.
2010-11-02 18:59:48 +01:00
antirez
53eeeaff08
added keyspace_hits and keyspace_misses fields in INFO output
2010-10-15 12:19:21 +02:00
antirez
670bf2fd36
Don't increment dirty on expireIfNeeded() as natural expires are not considered database changes. This will avoid useless read-only commands in the AOF file as a result of, for instance, a GET operation triggering an expirIfNeeded() call resulting in an expired key removed.
2010-10-15 11:29:03 +02:00
antirez
ef59a8bc9e
Object approximated LRU algorithm enhanced / fixed / refactored. This is used for the VM currently but will soon be used for maxmemory expiring.
2010-10-14 13:52:58 +02:00
antirez
144a5e72f2
fixed an alignment problem with time_t is 32 bit, long is 64 bit, and arch is sparc or any other where unaligned accesses will result to sigbus
2010-10-07 16:21:35 +02:00
antirez
89f9f83769
Merge remote branch 'pietern/networking-perf'
2010-09-16 11:38:40 +02:00
antirez
da14590bd9
Fix re-enabled again, I forgot to check if VM was enabled before calling handleClientsBlockedOnSwappedKey()
2010-09-08 13:47:28 +02:00
antirez
155fb4b45e
latest fix reverted, there is some problem reported by the CI test
2010-09-08 13:45:51 +02:00
antirez
7f00cd2264
Fixed a race condition in VM happening when a key was deleted while there was a client waiting for this key to be resumed from swap to memory. The client would hang forever.
2010-09-08 13:26:16 +02:00
Pieter Noordhuis
9e83ac06ef
Merge branch 'master' into networking-perf
...
Resolved conflict in src/db.c and changed adding an error to the reply
in blockingPopGenericCommand to use the new API.
2010-09-03 16:44:50 +02:00
Pieter Noordhuis
3ab203762f
Use specialized function to add status and error replies
2010-09-02 23:33:06 +02:00
Pieter Noordhuis
b70d355521
Use existing reply functions where possible
2010-09-02 19:52:04 +02:00
Pieter Noordhuis
b301c1fc2b
Wrapper for adding unknown multi bulk length to reply list
2010-08-30 16:39:14 +02:00
antirez
e0e1c19520
Fixed MONITOR mode and Issue 296
2010-08-30 11:51:45 +02:00
antirez
c91abdcd07
Fixed overflow detection in argument to long convertion function in general, and in expire/ttl pairs specifically, addressing issue 54
2010-08-23 17:06:38 +02:00
antirez
1fb4e8def7
PERSIST: a fix and some basic test
2010-08-03 14:25:22 +02:00
antirez
a539d29ac5
PERSIST command implemented
2010-08-03 14:19:20 +02:00
antirez
0cf5b7b57c
allow to set a new EXPIRE of an existing volatile key
2010-08-03 12:26:30 +02:00
antirez
c25a5d3b10
memory leak removed from expire propagation code
2010-08-02 21:37:39 +02:00
antirez
bcf2995c98
support for write operations against expiring keys, by master-controlled expiring in replication and AOF synthesizing DEL operations
2010-08-02 18:13:39 +02:00
antirez
5b4bff9c17
WATCH is now affected only when write commands actually modify the key content
2010-07-12 12:01:15 +02:00
antirez
b7a8daef60
WATCH will now consider touched keys target of EXPIRE command after the WATCH is performed, but not before
2010-07-05 19:38:12 +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