238 Commits

Author SHA1 Message Date
John Sully
7e62ed49af Implement database merging for Active Replicas
Former-commit-id: 91e6368de0f0ecb7e4db497ce286a15336d4ec34
2019-03-28 15:12:43 -04:00
John Sully
02b030bc8c Module threading fixes
Former-commit-id: 2785a8b4d40b09caea5e209ab49fc5f1484981a8
2019-03-07 19:13:01 -05:00
John Sully
f4b060e0bd Prevent mixed up client replies, and deadlocks 2019-02-22 01:24:16 -05:00
John Sully
29c1105132 Multithreading works! 2019-02-20 01:20:26 -05:00
John Sully
2f9d958e96 Reduce memory usage for in place strings by 8 bytes 2019-02-09 13:04:18 -05:00
John Sully
e38d1e6c7f Support AWS S3 saving via the s3 cli tools 2019-02-06 01:06:48 -05:00
John Sully
41a24e689e Make main headers C++ safe, and change rdb to use file descriptor instead of FILE pointer 2019-02-05 23:36:40 -05:00
John Sully
0ffcf355fe Custom flash heap 2019-01-29 18:10:46 -05:00
antirez
23abe9612a Refactoring: always kill AOF/RDB child via helper functions. 2019-01-21 11:28:44 +01:00
Salvatore Sanfilippo
d8128968a9 Merge branch 'unstable' into fixChildInfoPipeFdLeak 2019-01-21 11:20:56 +01:00
Salvatore Sanfilippo
a010bf750e Merge pull request #5797 from trevor211/fixUpdateDictResizePolicy
Fix update dict resize policy
2019-01-21 11:14:48 +01:00
WuYunlong
c00d2a334e Fix child info pipe fd leak when child process gets killed. 2019-01-21 17:48:45 +08:00
WuYunlong
9f3ebe6d59 Update dict resize policy when rdb child process gets killed. 2019-01-21 17:33:18 +08:00
antirez
7872d57d27 RESP3: most null replies converted. 2019-01-09 17:00:29 +01:00
antirez
f5a4f6bdf4 RESP3: Use new deferred len API in dict.c. 2019-01-09 17:00:29 +01:00
lsytj0413
c8443f9a9e fix a typo: craeted -> created 2018-12-06 11:08:59 +08:00
Salvatore Sanfilippo
6c69d894d6 Merge pull request #5469 from soloestoy/stat-key-miss-if-expired
if we read a expired key, misses++
2018-10-24 12:31:28 +02:00
antirez
bad3e8f745 Simplify part of the #5470 patch. 2018-10-24 12:26:27 +02:00
Salvatore Sanfilippo
e826aee8b2 Merge pull request #5470 from soloestoy/keys-no-trigger-expire
do not delete expired keys in KEYS command
2018-10-24 12:23:59 +02:00
hujie
0a2f8facfc fix typo 2018-10-20 12:18:56 +08:00
zhaozhao.zz
0bfb601dd3 if we read a expired key, misses++ 2018-10-19 18:16:29 +08:00
zhaozhao.zz
67e8236a06 do not delete expired keys in KEYS command 2018-10-19 18:00:57 +08:00
zhaozhao.zz
f2a10a9536 refactor dbOverwrite to make lazyfree work 2018-07-31 12:07:57 +08:00
antirez
22829267ec Remove useless conditional from emptyDb().
Related to #4852.
2018-07-25 16:34:57 +02:00
antirez
945d779d12 Make emptyDb() change introduced in #4852 simpler to read. 2018-07-25 16:32:52 +02:00
zhaozhao.zz
31d005a3e4 optimize flushdb, avoid useless loops 2018-07-25 18:13:34 +08:00
Jack Drogon
df7bafeb44 Fix typo 2018-07-03 18:19:46 +02:00
zhaozhao.zz
7a04c30907 fix some compile warnings 2018-06-28 17:22:59 +08:00
shenlongxing
bdb2664a81 fix typo 2018-06-21 22:08:09 +08:00
antirez
c215f94a2c Streams: fix xreadGetKeys() for correctness.
The old version could not handle the fact that "STREAMS" is a valid key
name for streams. Now we really try to parse the command like the
command implementation would do.

Related to #5028 and 4857.
2018-06-18 14:06:06 +02:00
Salvatore Sanfilippo
e61571f3bd Merge pull request #4857 from youjiali1995/fix-command-getkeys
Fix core dump when using some commands with wrong arguments.
2018-06-18 13:54:38 +02:00
antirez
6ec405c989 Streams: fix xreadGetKeys() buffer overflow.
The loop allocated a buffer for the right number of keys positions, then
overflowed it going past the limit.

Related to #4857 and cause of the memory violation seen in #5028.
2018-06-18 13:51:19 +02:00
antirez
c2dbda9b6a Merge branch 'unstable' of github.com:/antirez/redis into unstable 2018-06-14 18:11:04 +02:00
antirez
66b99d9639 Fix infinite loop in dbRandomKey().
Thanks to @kevinmcgehee for signaling the issue and reasoning about the
consequences and potential fixes.

Issue #5015.
2018-06-14 18:08:21 +02:00
zhaozhao.zz
d836647376 fix exists command on slave 2018-06-14 01:30:07 +08:00
antirez
d9a2f80281 In scanDatabaseForReadyLists() now we need to handle ZSETs as well.
Since the introduction of ZPOP makes this needed. Thanks to @oranagra
for reporting.
2018-06-12 17:28:40 +02:00
赵磊
366c45a2ec Fix core dump when using 'command getkeys' with wrong arguments. 2018-06-04 15:14:50 +08:00
Itamar Haber
e3e0a66adf Implements [B]Z[REV]POP and the respective unit tests
An implementation of the
[Ze POP Redis Module](https://github.com/itamarhaber/zpop) as core
Redis commands.

Fixes #1861.
2018-04-30 02:10:42 +03:00
Salvatore Sanfilippo
b260f1fffb Merge pull request #4679 from youjiali1995/fix-lru
Some commands will udpate lfu-counter many times in one call.
2018-03-22 16:26:01 +01:00
antirez
550181a96b expireIfNeeded() needed a top comment documenting the behavior. 2018-02-27 16:44:43 +01:00
antirez
4db08588cc expireIfNeeded() comment: claim -> pretend. 2018-02-27 16:37:37 +01:00
赵磊
04a3125f02 Remove updateLFU() in dbOverwrite(). 2018-02-11 21:02:07 +08:00
antirez
677e9dd036 Fix getKeysUsingCommandTable() in the case of nagative arity.
This fixes a crash with Redis Cluster when OBJECT is mis-used, because
getKeysUsingCommandTable() will call serverPanic() detecting we are
accessing an invalid argument in the case "OBJECT foo" is called.

This bug was introduced when OBJECT HELP was introduced, because the key
argument is set fixed at index 2 in the command table, however now
OBJECT may be called with an insufficient number of arguments to extract
the key.

The "Right Thing" would be to have a specific function to extract keys
from the OBJECT command, however this is kinda of an overkill, so I
preferred to make getKeysUsingCommandTable() more robust and just return
no keys when it's not possible to honor the command table, because new
commands are often added and also there are a number with an HELP
subcommand violating the normal form, and crashing for this trivial
reason or having many command-specific key extraction functions is not
great.
2018-01-12 11:26:29 +01:00
antirez
97d57e3052 Streams: fix TYPE for stream type. 2017-12-01 10:24:24 +01:00
antirez
06a30111a8 Streams: fix XREAD ready-key signaling.
With lists we need to signal only on key creation, but streams can
provide data to clients listening at every new item added.
To make this slightly more efficient we now track different classes of
blocked clients to avoid signaling keys when there is nobody listening.
A typical case is when the stream is used as a time series DB and
accessed only by range with XRANGE.
2017-12-01 10:24:24 +01:00
antirez
bfeeeb9f34 Streams: XREAD get-key method fixed. 2017-12-01 10:24:24 +01:00
antirez
084a871019 Streams: XREAD get-keys method. 2017-12-01 10:24:24 +01:00
antirez
896300be30 Streams: initial work to use blocking lists logic for streams XREAD. 2017-12-01 10:24:24 +01:00
zhaozhao.zz
660f01011c LFU: do some changes about LFU to find hotkeys
Firstly, use access time to replace the decreas time of LFU.
For function LFUDecrAndReturn,
it should only try to get decremented counter,
not update LFU fields, we will update it in an explicit way.
And we will times halve the counter according to the times of
elapsed time than server.lfu_decay_time.
Everytime a key is accessed, we should update the LFU
including update access time, and increment the counter after
call function LFUDecrAndReturn.
If a key is overwritten, the LFU should be also updated.
Then we can use `OBJECT freq` command to get a key's frequence,
and LFUDecrAndReturn should be called in `OBJECT freq` command
in case of the key has not been accessed for a long time,
because we update the access time only when the key is read or
overwritten.
2017-11-27 18:39:22 +01:00
zhaozhao.zz
a45d0fc482 PSYNC2: make persisiting replication info more solid
This commit is a reinforcement of commit c1c99e9.

1. Replication information can be stored when the RDB file is
generated by a mater using server.slaveseldb when server.repl_backlog
is not NULL, or set repl_stream_db be -1. That's safe, because
NULL server.repl_backlog will trigger full synchronization,
then master will send SELECT command to replicaiton stream.
2. Only do rdbSave* when rsiptr is not NULL,
if we do rdbSave* without rdbSaveInfo, slave will miss repl-stream-db.
3. Save the replication informations also in the case of
SAVE command, FLUSHALL command and DEBUG reload.
2017-09-20 11:18:10 +02:00