Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis 5.0 with Stream Feture. #5363

Closed
wants to merge 254 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
4223c41
Fix debug crash-and-recover help info.
GitHubMota May 25, 2018
733348b
MEMORY: fix the missing of monitor clients buffers
soloestoy May 27, 2018
07142f0
ZPOP: unblock multiple clients in right way
soloestoy May 31, 2018
9bb7c4b
Cluster Manager: fixed master_id check in clusterManagerNodeLoadInfo
artix75 Jun 1, 2018
ae9687d
Fix dictScan(): It can't scan all buckets when dict is shrinking.
May 8, 2018
525a7b3
XGROUP DESTROY implemented.
antirez Jun 4, 2018
d4ed462
Clean gcc 7.x warnings, redis-cli cluster fix.
yossigo Jun 3, 2018
8b9b02a
XGROUP SETID implemented + consumer groups core fixes.
antirez Jun 4, 2018
63ed0f7
Remove XINFO <key> special form.
antirez Jun 5, 2018
1317bab
ZPOP: invert score-ele to match ZRANGE WITHSCORES order.
antirez Jun 5, 2018
3502d1f
Fix streamIteratorRemoveEntry() to update elements count.
antirez Jun 6, 2018
59e51f9
zset: fix the int problem
soloestoy Dec 8, 2017
3ca02fb
zset: change the span of zskiplistNode to unsigned long
soloestoy Dec 8, 2017
d5712d2
adjust position of _dictNextPower in dictExpand
soloestoy Mar 29, 2018
4a9670f
RDB: expand dict if needed when rdb load object
soloestoy Apr 22, 2018
b85086c
Typo in preprocessor condition
KFilipek May 6, 2018
3ddc537
Return early in XPENDING if sent a nonexistent consumer group.
michael-grunder Jun 3, 2018
77acc63
Fix write() errno error
shenlongxing Jun 4, 2018
d01af7a
Streams: use non static macro node limits.
antirez Jun 7, 2018
b16e543
Streams: max node limits only checked if non zero.
antirez Jun 7, 2018
f2d65c3
Streams: make macro node limits configurable.
antirez Jun 7, 2018
eb26a81
Typo: entires -> entries in several places.
antirez Jun 7, 2018
b2a5a70
Streams: better document the max node limits.
antirez Jun 7, 2018
2cd6b00
fix stream config typo
shenlongxing Jun 7, 2018
5cdd475
Add the stream group to the script generating the help.
antirez Jun 7, 2018
a67ecb9
redis-cli inline help updated.
antirez Jun 7, 2018
24fb4e3
Implement DEBUG htstats-key.
antirez Jun 8, 2018
5a3d490
fix integer case error
shenlongxing Jun 9, 2018
3d4ad25
Abort in XGROUP if the key is not a stream
michael-grunder Jun 10, 2018
9d2b1f2
Streams: lookupKey[Read->Write]OrReply in xdel and xtrim
soloestoy Jun 10, 2018
28e0ca5
Streams: checkType for xread & xinfo
soloestoy Jun 10, 2018
260b32e
Regression test for the dictScan() issue #4906.
antirez Jun 11, 2018
280b2dc
Improved regression test for #4906.
antirez Jun 11, 2018
d769ce0
Fix client unblocking for XREADGROUP, issue #4978.
antirez Jun 11, 2018
093ec57
Use a less aggressive query buffer resize policy.
antirez Jun 11, 2018
2cadef4
Streams: increment dirty counter for XGROUP SETID/DESTROY.
antirez Jun 12, 2018
20bc378
Streams: fix backward iteration when entry is not flagged SAMEFIELD.
antirez Jun 12, 2018
6acd8a3
fix active-defrag-threshold value error
shenlongxing Jun 12, 2018
071e235
Regression test for issue #5006.
antirez Jun 12, 2018
86aade7
Security: fix Lua cmsgpack library stack overflow.
antirez May 14, 2018
c5dfff4
Security: update Lua struct package for security.
antirez May 14, 2018
e27a040
Security: more cmsgpack fixes by @soloestoy.
antirez May 15, 2018
5e0d984
Security: fix Lua struct package offset handling.
antirez May 15, 2018
b80e4b6
Security: fix redis-cli buffer overflow.
antirez Jun 11, 2018
8246a38
fix typo
leonchen83 Jun 12, 2018
cd2b5a7
Fix XGROUP help missing space.
antirez Jun 12, 2018
574017b
Streams: improve type correctness in t_stream.c.
antirez Jun 12, 2018
6b0cdbd
RDB: store times consistently in little endian.
antirez Jun 12, 2018
6838209
In scanDatabaseForReadyLists() now we need to handle ZSETs as well.
antirez Jun 12, 2018
3ad68a0
Fix rdbSaveKeyValuePair() integer overflow.
antirez Jun 12, 2018
af70696
Streams: generate a few additional events.
antirez Jun 12, 2018
5171a3f
RDB: Apply fix to rdbLoadMillisecondTime() only for new RDB versions.
antirez Jun 12, 2018
f720974
Redis 5.0 RC2.
antirez Jun 13, 2018
b4b0251
Rax library updated.
antirez Jun 4, 2018
48dfd42
Redis 5.0 RC3.
antirez Jun 14, 2018
77a7ec7
Merge branch 'unstable' into 5.0 branch
antirez Jul 23, 2018
49841a5
Fix merge errors.
antirez Jul 23, 2018
faf3dbf
Adds memory information about the script's cache to INFO
itamarhaber Apr 30, 2018
270903d
Adds Lua overheads to MEMORY STATS, smartens the MEMORY DOCTOR
itamarhaber Jul 22, 2018
2c07c10
Change 42 to 1000 as warning level for cached scripts.
antirez Jul 23, 2018
a4efac0
string2ll(): test for NULL pointer in all the cases.
antirez Jul 23, 2018
4f742bd
string2ll(): remove duplicated check for special case.
antirez Jul 23, 2018
c2ecdcd
fix recursion typo in zmalloc_usable
oranagra Jul 22, 2018
9e5bf04
Restore string2ll() to original version.
antirez Jul 24, 2018
8b4fe75
removing redundant check
dsomeshwar Jul 21, 2018
a1e081f
string2ll(): better commenting.
antirez Jul 24, 2018
4b79fdf
fix slave buffer test suite false positives
oranagra Apr 1, 2018
4724548
Streams: skip master fileds only when we are going forward in streamI…
soloestoy Jul 22, 2018
6bfb474
Streams: refactoring of next entry seek in the iterator.
antirez Jul 24, 2018
cd25ed1
INFO CPU: higher precision of reported values
rpv-tomsk Jul 25, 2018
89ec145
Do not migrate already expired keys.
trevor211 Jul 21, 2018
d6827ab
Make changes of PR #5154 hopefully simpler.
antirez Jul 24, 2018
dc600a2
Example the magic +1 in migrateCommand().
antirez Jul 24, 2018
0c00837
Streams: fix xdel memory leak
soloestoy Jul 24, 2018
f7740fa
optimize flushdb, avoid useless loops
soloestoy Jul 25, 2018
0e97ae7
Make emptyDb() change introduced in #4852 simpler to read.
antirez Jul 25, 2018
037b00d
Remove useless conditional from emptyDb().
antirez Jul 25, 2018
7b5f022
Dynamic HZ: separate hz from the configured hz.
antirez Jul 23, 2018
d42602f
Dynamic HZ: adapt cron frequency to number of clients.
antirez Jul 23, 2018
a330d06
Control dynamic HZ via server configuration.
antirez Jul 30, 2018
9a76472
Make dynamic hz actually configurable.
antirez Jul 30, 2018
50be4a1
Document dynamic-hz in the example redis.conf.
antirez Jul 30, 2018
6424275
Add year in log.
antirez Jul 30, 2018
2db31fd
Few typo fixes
gkorland Jul 30, 2018
1d073a6
Merge pull request #5168 from rpv-tomsk/issue-5033
antirez Jul 30, 2018
41607df
Consider aof write error as well as rdb in lua script.
trevor211 Jul 21, 2018
4e933e0
Introduce writeCommandsDeniedByDiskError().
antirez Jul 31, 2018
acfe9d1
Better top comment for writeCommandsDeniedByDiskError().
antirez Jul 31, 2018
0e77cef
Fix writeCommandsDeniedByDiskError() inverted return value.
antirez Jul 31, 2018
9e97173
Refactoring: replace low-level checks with writeCommandsDeniedByDiskE…
antirez Jul 31, 2018
c609f24
refactor dbOverwrite to make lazyfree work
soloestoy Jul 31, 2018
24c4553
Tranfer -> transfer typo fixed.
antirez Jul 31, 2018
a633f8e
Fix cluster-announce-ip memory leak
shenlongxing Jul 31, 2018
83d4311
Cluster cron announce IP minor refactoring.
antirez Jul 31, 2018
3662289
add DEBUG LOG, to to assist test suite debugging
oranagra Jul 29, 2018
1ce3cf7
test suite conveniency improvements
oranagra Jul 30, 2018
ab237a8
Minor improvements to PR #5187.
antirez Jul 31, 2018
c0c06b8
Streams: add mmid_supp argument in streamParseIDOrReply().
0xtonyxia Jul 30, 2018
bd2f3f6
Streams: rearrange the usage of '-' and '+' IDs in stream commands.
0xtonyxia Jul 30, 2018
8c297e8
zsetAdd() refactored adding zslUpdateScore().
antirez Aug 1, 2018
2011683
Optimize zslUpdateScore() as asked in #5179.
antirez Aug 1, 2018
741f29e
Remove old commented zslUpdateScore() from source.
antirez Aug 1, 2018
ddc87ee
Explain what's the point of zslUpdateScore() in top comment.
antirez Aug 1, 2018
724740c
More commenting of zslUpdateScore().
antirez Aug 1, 2018
63addc5
Fix zslUpdateScore() edge case.
antirez Aug 1, 2018
70c4bcb
Test: new sorted set skiplist order consistency.
antirez Aug 2, 2018
fbbcc6a
Streams IDs parsing refactoring.
antirez Jul 31, 2018
273d819
Test suite: new --stop option.
antirez Aug 2, 2018
a4d1201
Test suite: add --loop option.
antirez Aug 2, 2018
5b06bdf
Redis 5.0 RC4.
antirez Aug 3, 2018
df91123
Fix AOF comment to report the current behavior.
antirez Aug 3, 2018
a3f2437
Fix stream command paras
shenlongxing Aug 3, 2018
b59f04a
Streams: ID of xclaim command starts from the sixth argument.
0xtonyxia Jul 19, 2018
186df14
Make some defaults explicit in the sentinel.conf for package maintainers
lamby Jan 16, 2015
45a6c5b
Use SOURCE_DATE_EPOCH over unreproducible uname + date calls.
lamby Apr 29, 2016
aff86fa
pipeline: do not sdsrange querybuf unless all commands processed
soloestoy Aug 13, 2018
1203a04
adjust qbuf to 26 in test case for client list
soloestoy Aug 13, 2018
2c7972c
networking: just return C_OK if multibulk processing saw a <= 0 length.
soloestoy Aug 14, 2018
656e4b2
networking: just move qb_pos instead of sdsrange in processInlineBuffer
soloestoy Aug 14, 2018
fcd5ef1
networking: make setProtocolError simple and clear
soloestoy Aug 23, 2018
c03c591
block: rewrite BRPOPLPUSH as RPOPLPUSH to propagate
soloestoy Aug 14, 2018
22c166d
block: format code
soloestoy Aug 14, 2018
319f2ee
Re-apply rebased #2358.
antirez Aug 27, 2018
868b292
Better variable meaning in processCommand().
antirez Aug 27, 2018
447da44
Introduce repl_slave_ignore_maxmemory flag internally.
antirez Aug 27, 2018
02d729b
Make slave-ignore-maxmemory configurable.
antirez Aug 27, 2018
f2cd16b
Document slave-ignore-maxmemory in redis.conf.
antirez Aug 27, 2018
af675f0
Fix unstable tests on slow machines.
oranagra Aug 21, 2018
d928487
some commands' flags should be set correctly, issue #4834
soloestoy Apr 10, 2018
5ad888b
Supplement to PR #4835, just take info/memory/command as random commands
soloestoy Aug 29, 2018
4cb9ee1
Add maxmemory slave behavior change in the change log.
antirez Aug 29, 2018
eea0d3c
#5299 Fix blocking XREAD for streams that ran dry
Aug 29, 2018
b221ca4
Merge pull request #5300 from SaschaRoland/xread-block-5299
antirez Aug 31, 2018
395063d
remove duplicate bind in sentinel.conf
soloestoy Aug 27, 2018
8e5423e
Correct "did not received" -> "did not receive" typos/grammar.
lamby Aug 26, 2018
20ec1f0
Revise the comments of latency command.
0xtonyxia Aug 22, 2018
adc4e03
Allow scripts to timeout on slaves as well.
antirez Aug 29, 2018
7b75f4a
Allow scripts to timeout even if from the master instance.
antirez Aug 30, 2018
c2b104c
While the slave is busy, just accumulate master input.
antirez Aug 30, 2018
8bf42f6
After slave Lua script leaves busy state, re-process the master buffer.
antirez Aug 31, 2018
42bce87
Test: processing of master stream in slave -BUSY state.
antirez Aug 31, 2018
1723308
Make pending buffer processing safe for CLIENT_MASTER client.
antirez Sep 3, 2018
2e1cd82
fix multiple unblock for clientsArePaused()
soloestoy Nov 6, 2017
839bb52
if master is already unblocked, do not unblock it twice
soloestoy Sep 3, 2018
82fc63d
Unblocked clients API refactoring. See #4418.
antirez Sep 3, 2018
1898e6c
networking: optimize parsing large bulk greater than 32k
soloestoy Sep 3, 2018
37fb606
Merge branch '5.0' of github.com:/antirez/redis into 5.0
antirez Sep 4, 2018
2eed31a
networking: fix unexpected negative or zero readlen
soloestoy Aug 31, 2018
a0dd6f8
Clarify why remaining may be zero in readQueryFromClient().
antirez Sep 4, 2018
1705e42
Don't perform eviction when re-entering the event loop.
antirez Sep 5, 2018
dfbce91
Propagate read-only scripts as SCRIPT LOAD.
antirez Sep 5, 2018
c6c71ab
Safer script stop condition on OOM.
antirez Sep 5, 2018
3e1fb5f
Use commands (effects) replication by default in scripts.
antirez Sep 5, 2018
cfd969c
Fix scripting tests now that we default to commands repl.
antirez Sep 5, 2018
1d1bf7f
Document that effects replication is Redis 5 default.
antirez Sep 5, 2018
a72af0e
Redis 5.0 RC5.
antirez Sep 6, 2018
7642f9d
fix usage typo in redis-cli
Sep 6, 2018
fa7de8c
bio: fix bioWaitStepOfType.
youjiali1995 Sep 5, 2018
246980d
sentinel: fix randomized sentinelTimer.
youjiali1995 Sep 5, 2018
bb2bed7
CLI Help text loop verifies arg count
jeffreylovitz Aug 12, 2018
7928f57
Use geohash limit defines in constraint check
mesbahamin Sep 2, 2018
1f37f1d
Slave removal: SLAVEOF -> REPLICAOF. SLAVEOF is now an alias.
antirez Sep 10, 2018
c0952c0
Slave removal: redis-cli --slave -> --replica.
antirez Sep 10, 2018
2546158
Slave removal: config.c converted + config rewriting hacks.
antirez Sep 10, 2018
1d2fcf6
Slave removal: Convert cluster.c log messages and command names.
antirez Sep 10, 2018
34a5615
Slave removal: slave -> replica in redis.conf and output buffer option.
antirez Sep 10, 2018
0e222fb
Slave removal: fix typo of replicaof.
antirez Sep 10, 2018
a22168e
Slave removal: slave mode -> replica mode text in redis-cli.
antirez Sep 10, 2018
3fd7315
Slave removal: Make obvious in redis.conf what a replica is.
antirez Sep 10, 2018
be76ed0
Slave removal: blocked.c logs fixed.
antirez Sep 10, 2018
c92b02d
Slave removal: networking.c logs fixed.
antirez Sep 10, 2018
53fe558
Slave removal: replication.c logs fixed.
antirez Sep 10, 2018
f1de29b
Slave removal: scripting.c logs and other stuff fixed.
antirez Sep 10, 2018
7673d88
Slave removal: replace very few things in Sentinel.
antirez Sep 10, 2018
8943403
Slave removal: remove slave from sentinel.conf when possible.
antirez Sep 10, 2018
93d803c
Slave removal: server.c logs fixed.
antirez Sep 11, 2018
7da266e
Slave removal: remove slave from the README.
antirez Sep 11, 2018
1b9b19b
Slave removal: remove slave from object.c.
antirez Sep 11, 2018
c7841c2
Slave removal: remove slave from top-level tests descriptions.
antirez Sep 11, 2018
72e0368
Slave removal: remove slave from integration tests descriptions.
antirez Sep 11, 2018
4a1d6c7
Slave removal: capitalize Replica
vrana Sep 11, 2018
9c77114
LOLWUT: Emit Braille unicode according to pixel pattern.
antirez Sep 11, 2018
e30ba94
LOLWUT: canvas structure and BSD license on top.
antirez Sep 11, 2018
b404a6c
LOLWUT: show the output verbatim in redis-cli.
antirez Sep 11, 2018
3546d9c
LOLWUT: Rendering of the virtual canvas to a string.
antirez Sep 11, 2018
2d4143f
LOLWUT: draw lines using Bresenham algorithm.
antirez Sep 11, 2018
46286e6
LOLWUT: draw rotated squares using trivial trigonometry.
antirez Sep 12, 2018
34ebd89
LOLWUT: draw Schotter by Georg Nees.
antirez Sep 12, 2018
38b0d25
LOLWUT: wrap it into a proper command.
antirez Sep 12, 2018
a622f6c
LOLWUT: change default size to fit a normal terminal better.
antirez Sep 12, 2018
263dbad
LOLWUT: increase the translation factor.
antirez Sep 12, 2018
9b3098b
LOLWUT: Fix license copyright year.
antirez Sep 12, 2018
55dae69
LOLWUT: fix structure typo in comment.
antirez Sep 12, 2018
2ffb441
LOLWUT: fix crash when col < 2.
antirez Sep 13, 2018
ed08feb
Fix spelling descrive -> describe
slobo Sep 12, 2018
eb0fbd7
LOLWUT: change padding conditional to a more direct one.
antirez Sep 13, 2018
efed898
LOLWUT: Limit maximum CPU effort.
antirez Sep 13, 2018
bfcba42
LOLWUT: Ness -> Nees.
antirez Sep 13, 2018
2da823c
LOLWUT: add Redis version in the output.
antirez Sep 13, 2018
5c75840
Slave removal: add a few forgotten aliases for CONFIG SET.
antirez Sep 13, 2018
6c8a8f2
LOLWUT: split the command from version-specific implementations.
antirez Sep 14, 2018
a849407
Sentinel: document how to undo a renamed command.
antirez Sep 17, 2018
233aa2d
RedisModule_HashSet call must end with NULL
gkorland Sep 17, 2018
27b7fb5
Fix few typos
gkorland Sep 17, 2018
2647903
Revert "fix repeat argument issue and reduce unnessary loop times for…
antirez Sep 17, 2018
9a278db
typo fix
gkorland Sep 16, 2018
8afca14
No need to return "OK"
gkorland Sep 13, 2018
148e491
Cluster Manager: clusterManagerFixOpenSlot now counts node's keys in …
artix75 Sep 17, 2018
851b2ed
Modules: associate a fake client to cluster message context callback.
antirez Sep 18, 2018
2d11ee9
Modules: associate a fake client to timer context callback.
antirez Sep 18, 2018
0ff3537
Modules: rename the reused static client to something more general.
antirez Sep 18, 2018
6a39ece
Module cluster flags: initial vars / defines added.
antirez Sep 19, 2018
2ba5288
Module cluster flags: add hooks for NO_REDIRECTION flag.
antirez Sep 19, 2018
4ce6bff
Module cluster flags: add hooks for NO_FAILOVER flag.
antirez Sep 19, 2018
18c5ab9
Module cluster flags: add RM_SetClusterFlags() API.
antirez Sep 19, 2018
2821076
Module cluster flags: use RM_SetClusterFlags() in the example.
antirez Sep 19, 2018
4b0fa7a
Modules: dictionary API work in progress #1.
antirez Sep 21, 2018
8576b0a
Modules: dictionary API work in progress #2: Del API.
antirez Sep 24, 2018
45b7f77
Modules: dictionary API work in progress #3: Iterator creation.
antirez Sep 24, 2018
5fc16f1
Modules: dictionary API work in progress #4: reseek API.
antirez Sep 24, 2018
0bd7091
Modules: change RedisModuleString API to allow NULL context.
antirez Sep 24, 2018
11c53f8
Modules: dictionary API work in progress #5: rename API for consistency.
antirez Sep 25, 2018
05579e3
Modules: dictionary API WIP #6: implement automatic memory management.
antirez Sep 25, 2018
ef8413d
Modules: dictionary API WIP #7: don't store the context.
antirez Sep 25, 2018
6a73aca
Modules: dictionary API WIP #8: Iterator next/prev.
antirez Sep 25, 2018
3f82e59
Modules: dictionary API WIP #9: iterator returning string object.
antirez Sep 25, 2018
57b6c34
Modules: dictionary API WIP #10: export API to modules.
antirez Sep 26, 2018
f92b327
Fix typo in comment
Chupaka Sep 24, 2018
7ded552
add missing argument to function doc
gkorland Sep 20, 2018
1c8b224
Modules: fix top comment of hellotimer.c
antirez Sep 26, 2018
e33fdbe
Modules: remove useless defines in hellotimer.c
antirez Sep 26, 2018
36e66d8
Modules: hellodict example WIP #1: SET command.
antirez Sep 26, 2018
f9b3ce9
Modules: hellodict example WIP #1: GET command.
antirez Sep 27, 2018
01e0341
Modules: Modules: dictionary API WIP #11: DictCompareC API.
antirez Sep 27, 2018
f9a3e6e
Modules: Modules: dictionary API WIP #12: DictCompare API.
antirez Sep 27, 2018
af2f668
Modules: Modules: dictionary API WIP #13: Compare API exported.
antirez Sep 27, 2018
b0d2270
Modules: hellodict example WIP #3: KEYRANGE.
antirez Sep 27, 2018
55e9df8
Try to avoid issues with GCC pragmas and older compilers.
antirez Sep 28, 2018
b362a1b
fix dict get on not found
halaei Oct 1, 2018
8dde46a
Fix incorrect memory usage accounting in zrealloc
bmerry Sep 30, 2018
1a8447b
Fix invalid use of sdsZmallocSize on an embedded string
bmerry Sep 29, 2018
a996b2a
Fix XINFO comment for consistency.
antirez Oct 1, 2018
d6aeca8
fix #5024 - commandstats for multi-exec were logged as EXEC.
oranagra Sep 30, 2018
3454a04
script cache memory in INFO and MEMORY includes both script code and …
oranagra Aug 13, 2018
6b7ad83
bugfix: replace lastcmd with cmd when rewrite BRPOPLPUSH as RPOPLPUSH
soloestoy Sep 28, 2018
5d12f9d
Streams: update listpack with new pointer in XDEL
soloestoy Aug 3, 2018
260b53a
streamIteratorRemoveEntry(): set back lp only if pointer changed.
antirez Oct 2, 2018
5eca170
Fix printf type mismatch in genRedisInfoString().
antirez Oct 2, 2018
4566fbc
Listpack: optionally force reallocation on inserts.
antirez Oct 2, 2018
dc0b628
streamAppendItem(): Update the radix tree pointer only if changed.
antirez Oct 2, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1,480 changes: 1,469 additions & 11 deletions 00-RELEASENOTES

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -119,7 +119,7 @@ parameter (the path of the configuration file):
It is possible to alter the Redis configuration by passing parameters directly
as options using the command line. Examples:

% ./redis-server --port 9999 --slaveof 127.0.0.1 6379
% ./redis-server --port 9999 --replicaof 127.0.0.1 6379
% ./redis-server /etc/redis/6379.conf --loglevel debug

All the options in redis.conf are also supported as options using the command
Expand Down Expand Up @@ -245,7 +245,7 @@ A few important fields in this structure are:
* `server.db` is an array of Redis databases, where data is stored.
* `server.commands` is the command table.
* `server.clients` is a linked list of clients connected to the server.
* `server.master` is a special client, the master, if the instance is a slave.
* `server.master` is a special client, the master, if the instance is a replica.

There are tons of other fields. Most fields are commented directly inside
the structure definition.
Expand Down Expand Up @@ -323,7 +323,7 @@ Inside server.c you can find code that handles other vital things of the Redis s
networking.c
---

This file defines all the I/O functions with clients, masters and slaves
This file defines all the I/O functions with clients, masters and replicas
(which in Redis are just special clients):

* `createClient()` allocates and initializes a new client.
Expand Down Expand Up @@ -390,16 +390,16 @@ replication.c

This is one of the most complex files inside Redis, it is recommended to
approach it only after getting a bit familiar with the rest of the code base.
In this file there is the implementation of both the master and slave role
In this file there is the implementation of both the master and replica role
of Redis.

One of the most important functions inside this file is `replicationFeedSlaves()` that writes commands to the clients representing slave instances connected
to our master, so that the slaves can get the writes performed by the clients:
One of the most important functions inside this file is `replicationFeedSlaves()` that writes commands to the clients representing replica instances connected
to our master, so that the replicas can get the writes performed by the clients:
this way their data set will remain synchronized with the one in the master.

This file also implements both the `SYNC` and `PSYNC` commands that are
used in order to perform the first synchronization between masters and
slaves, or to continue the replication after a disconnection.
replicas, or to continue the replication after a disconnection.

Other C files
---
Expand Down
281 changes: 161 additions & 120 deletions redis.conf

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion runtest
Expand Up @@ -11,4 +11,4 @@ then
echo "You need tcl 8.5 or newer in order to run the Redis test"
exit 1
fi
$TCLSH tests/test_helper.tcl $*
$TCLSH tests/test_helper.tcl "${@}"
58 changes: 39 additions & 19 deletions sentinel.conf
Expand Up @@ -20,6 +20,21 @@
# The port that this sentinel instance will run on
port 26379

# By default Redis Sentinel does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis-sentinel.pid when
# daemonized.
daemonize no

# When running daemonized, Redis Sentinel writes a pid file in
# /var/run/redis-sentinel.pid by default. You can specify a custom pid file
# location here.
pidfile /var/run/redis-sentinel.pid

# Specify the log file name. Also the empty string can be used to force
# Sentinel to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile ""

# sentinel announce-ip <ip>
# sentinel announce-port <port>
#
Expand Down Expand Up @@ -58,23 +73,23 @@ dir /tmp
# be elected by the majority of the known Sentinels in order to
# start a failover, so no failover can be performed in minority.
#
# Slaves are auto-discovered, so you don't need to specify slaves in
# Replicas are auto-discovered, so you don't need to specify replicas in
# any way. Sentinel itself will rewrite this configuration file adding
# the slaves using additional configuration options.
# the replicas using additional configuration options.
# Also note that the configuration file is rewritten when a
# slave is promoted to master.
# replica is promoted to master.
#
# Note: master name should not include special characters or spaces.
# The valid charset is A-z 0-9 and the three characters ".-_".
sentinel monitor mymaster 127.0.0.1 6379 2

# sentinel auth-pass <master-name> <password>
#
# Set the password to use to authenticate with the master and slaves.
# Set the password to use to authenticate with the master and replicas.
# Useful if there is a password set in the Redis instances to monitor.
#
# Note that the master password is also used for slaves, so it is not
# possible to set a different password in masters and slaves instances
# Note that the master password is also used for replicas, so it is not
# possible to set a different password in masters and replicas instances
# if you want to be able to monitor these instances with Sentinel.
#
# However you can have Redis instances without the authentication enabled
Expand All @@ -89,19 +104,19 @@ sentinel monitor mymaster 127.0.0.1 6379 2

# sentinel down-after-milliseconds <master-name> <milliseconds>
#
# Number of milliseconds the master (or any attached slave or sentinel) should
# Number of milliseconds the master (or any attached replica or sentinel) should
# be unreachable (as in, not acceptable reply to PING, continuously, for the
# specified period) in order to consider it in S_DOWN state (Subjectively
# Down).
#
# Default is 30 seconds.
sentinel down-after-milliseconds mymaster 30000

# sentinel parallel-syncs <master-name> <numslaves>
# sentinel parallel-syncs <master-name> <numreplicas>
#
# How many slaves we can reconfigure to point to the new slave simultaneously
# during the failover. Use a low number if you use the slaves to serve query
# to avoid that all the slaves will be unreachable at about the same
# How many replicas we can reconfigure to point to the new replica simultaneously
# during the failover. Use a low number if you use the replicas to serve query
# to avoid that all the replicas will be unreachable at about the same
# time while performing the synchronization with the master.
sentinel parallel-syncs mymaster 1

Expand All @@ -113,18 +128,18 @@ sentinel parallel-syncs mymaster 1
# already tried against the same master by a given Sentinel, is two
# times the failover timeout.
#
# - The time needed for a slave replicating to a wrong master according
# - The time needed for a replica replicating to a wrong master according
# to a Sentinel current configuration, to be forced to replicate
# with the right master, is exactly the failover timeout (counting since
# the moment a Sentinel detected the misconfiguration).
#
# - The time needed to cancel a failover that is already in progress but
# did not produced any configuration change (SLAVEOF NO ONE yet not
# acknowledged by the promoted slave).
# acknowledged by the promoted replica).
#
# - The maximum time a failover in progress waits for all the slaves to be
# reconfigured as slaves of the new master. However even after this time
# the slaves will be reconfigured by the Sentinels anyway, but not with
# - The maximum time a failover in progress waits for all the replicas to be
# reconfigured as replicas of the new master. However even after this time
# the replicas will be reconfigured by the Sentinels anyway, but not with
# the exact parallel-syncs progression as specified.
#
# Default is 3 minutes.
Expand Down Expand Up @@ -185,7 +200,7 @@ sentinel failover-timeout mymaster 180000
# <role> is either "leader" or "observer"
#
# The arguments from-ip, from-port, to-ip, to-port are used to communicate
# the old address of the master and the new address of the elected slave
# the old address of the master and the new address of the elected replica
# (now a master).
#
# This script should be resistant to multiple invocations.
Expand Down Expand Up @@ -213,12 +228,17 @@ sentinel deny-scripts-reconfig yes
#
# In such case it is possible to tell Sentinel to use different command names
# instead of the normal ones. For example if the master "mymaster", and the
# associated slaves, have "CONFIG" all renamed to "GUESSME", I could use:
# associated replicas, have "CONFIG" all renamed to "GUESSME", I could use:
#
# sentinel rename-command mymaster CONFIG GUESSME
# SENTINEL rename-command mymaster CONFIG GUESSME
#
# After such configuration is set, every time Sentinel would use CONFIG it will
# use GUESSME instead. Note that there is no actual need to respect the command
# case, so writing "config guessme" is the same in the example above.
#
# SENTINEL SET can also be used in order to perform this configuration at runtime.
#
# In order to set a command back to its original name (undo the renaming), it
# is possible to just rename a command to itsef:
#
# SENTINEL rename-command mymaster CONFIG CONFIG
2 changes: 1 addition & 1 deletion src/Makefile
Expand Up @@ -144,7 +144,7 @@ endif

REDIS_SERVER_NAME=redis-server
REDIS_SENTINEL_NAME=redis-sentinel
REDIS_SERVER_OBJ=adlist.o quicklist.o ae.o anet.o dict.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o
REDIS_SERVER_OBJ=adlist.o quicklist.o ae.o anet.o dict.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o
REDIS_CLI_NAME=redis-cli
REDIS_CLI_OBJ=anet.o adlist.o dict.o redis-cli.o zmalloc.o release.o anet.o ae.o crc64.o siphash.o crc16.o
REDIS_BENCHMARK_NAME=redis-benchmark
Expand Down
4 changes: 3 additions & 1 deletion src/aof.c
Expand Up @@ -798,7 +798,9 @@ int loadAppendOnlyFile(char *filename) {
}

/* This point can only be reached when EOF is reached without errors.
* If the client is in the middle of a MULTI/EXEC, log error and quit. */
* If the client is in the middle of a MULTI/EXEC, handle it as it was
* a short read, even if technically the protocol is correct: we want
* to remove the unprocessed tail and continue. */
if (fakeClient->flags & CLIENT_MULTI) goto uxeof;

loaded_ok: /* DB loaded, cleanup and return C_OK to the caller. */
Expand Down
6 changes: 3 additions & 3 deletions src/bio.c
Expand Up @@ -204,14 +204,14 @@ void *bioProcessBackgroundJobs(void *arg) {
}
zfree(job);

/* Unblock threads blocked on bioWaitStepOfType() if any. */
pthread_cond_broadcast(&bio_step_cond[type]);

/* Lock again before reiterating the loop, if there are no longer
* jobs to process we'll block again in pthread_cond_wait(). */
pthread_mutex_lock(&bio_mutex[type]);
listDelNode(bio_jobs[type],ln);
bio_pending[type]--;

/* Unblock threads blocked on bioWaitStepOfType() if any. */
pthread_cond_broadcast(&bio_step_cond[type]);
}
}

Expand Down
40 changes: 30 additions & 10 deletions src/blocked.c
Expand Up @@ -126,12 +126,37 @@ void processUnblockedClients(void) {
* the code is conceptually more correct this way. */
if (!(c->flags & CLIENT_BLOCKED)) {
if (c->querybuf && sdslen(c->querybuf) > 0) {
processInputBuffer(c);
processInputBufferAndReplicate(c);
}
}
}
}

/* This function will schedule the client for reprocessing at a safe time.
*
* This is useful when a client was blocked for some reason (blocking opeation,
* CLIENT PAUSE, or whatever), because it may end with some accumulated query
* buffer that needs to be processed ASAP:
*
* 1. When a client is blocked, its readable handler is still active.
* 2. However in this case it only gets data into the query buffer, but the
* query is not parsed or executed once there is enough to proceed as
* usually (because the client is blocked... so we can't execute commands).
* 3. When the client is unblocked, without this function, the client would
* have to write some query in order for the readable handler to finally
* call processQueryBuffer*() on it.
* 4. With this function instead we can put the client in a queue that will
* process it for queries ready to be executed at a safe time.
*/
void queueClientForReprocessing(client *c) {
/* The client may already be into the unblocked list because of a previous
* blocking operation, don't add back it into the list multiple times. */
if (!(c->flags & CLIENT_UNBLOCKED)) {
c->flags |= CLIENT_UNBLOCKED;
listAddNodeTail(server.unblocked_clients,c);
}
}

/* Unblock a client calling the right function depending on the kind
* of operation the client is blocking for. */
void unblockClient(client *c) {
Expand All @@ -152,12 +177,7 @@ void unblockClient(client *c) {
server.blocked_clients_by_type[c->btype]--;
c->flags &= ~CLIENT_BLOCKED;
c->btype = BLOCKED_NONE;
/* The client may already be into the unblocked list because of a previous
* blocking operation, don't add back it into the list multiple times. */
if (!(c->flags & CLIENT_UNBLOCKED)) {
c->flags |= CLIENT_UNBLOCKED;
listAddNodeTail(server.unblocked_clients,c);
}
queueClientForReprocessing(c);
}

/* This function gets called when a blocked client timed out in order to
Expand Down Expand Up @@ -195,7 +215,7 @@ void disconnectAllBlockedClients(void) {
if (c->flags & CLIENT_BLOCKED) {
addReplySds(c,sdsnew(
"-UNBLOCKED force unblock from blocking operation, "
"instance state changed (master -> slave?)\r\n"));
"instance state changed (master -> replica?)\r\n"));
unblockClient(c);
c->flags |= CLIENT_CLOSE_AFTER_REPLY;
}
Expand Down Expand Up @@ -269,7 +289,7 @@ void handleClientsBlockedOnKeys(void) {
robj *dstkey = receiver->bpop.target;
int where = (receiver->lastcmd &&
receiver->lastcmd->proc == blpopCommand) ?
LIST_HEAD : LIST_TAIL;
LIST_HEAD : LIST_TAIL;
robj *value = listTypePop(o,where);

if (value) {
Expand All @@ -285,7 +305,7 @@ void handleClientsBlockedOnKeys(void) {
{
/* If we failed serving the client we need
* to also undo the POP operation. */
listTypePush(o,value,where);
listTypePush(o,value,where);
}

if (dstkey) decrRefCount(dstkey);
Expand Down