Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
This comparison is big! We’re only showing the most recent 250 commits
Commits on Jun 23, 2015
@antirez Geo: test GEOADD with wrong input coordinates 0425c60
@antirez Geo: return REDIS_* where appropriate, improve commenting 8d5ad19
Commits on Jun 24, 2015
@antirez Geo: GEORADIUS fuzzy testing by reimplementing it in Tcl.
We set random points in the world, pick a random position, and check if
the returned points by Redis match the ones computed by Tcl by brute
forcing all the points using the distance between two points formula.

This approach is sounding since immediately resulted in finding a bug in
the original implementation.
@antirez Geo: Fix geohashEstimateStepsByRadius() step underestimation.
The returned step was in some case not enough towards normal
coordinates (for example when our search position was was already near the
margin of the central area, and we had to match, using the east or west
neighbor, a very far point). Example:

    geoadd points 67.575457940146066 -62.001317572780565 far
    geoadd points 66.685439060295664 -58.925040587282297 center
    georadius points 66.685439060295664 -58.925040587282297 200 km

In the above case the code failed to find a match (happens at smaller
latitudes too) even if far and center are at less than 200km.

Another fix introduced by this commit is a progressively larger area
towards the poles, since meridians are a lot less far away, so we need
to compensate for this.

The current implementation works comparably to the Tcl brute-force
stress tester implemented in the fuzzy test in the geo.tcl unit for
latitudes between -70 and 70, and is pretty accurate over +/-80 too,
with sporadic false negatives.

A more mathematically clean implementation is possible by computing the
meridian distance at the specified latitude and computing the step
according to it.
@badboy badboy Do not attempt to lock on Solaris d28c51d
@badboy badboy Don't include sysctl header
It's not needed (anymore) and is not available on Solaris.
@antirez Geo: GEOHASH command added, returning standard geohash strings. 87521f4
@antirez Geo: GEOHASH command test. 5fd756b
@antirez Geo: explain increment magic in membersOfGeoHashBox(). 03ce189
Commits on Jun 26, 2015
@antirez Geo: from lat,lon API to lon,lat API according to GIS standard
The GIS standard and all the major DBs implementing GIS related
functions take coordinates as x,y that is longitude,latitude.
It was a bad start for Redis to do things differently, so even if this
means that existing users of the Geo module will be required to change
their code, Redis now conforms to the standard.

Usually Redis is very backward compatible, but this is not an exception
to this rule, since this is the first Geo implementation entering the
official Redis source code. It is not wise to try to be backward
compatible with code forks... :-)

Close #2637.
@MOON-CLJ MOON-CLJ pfcount support multi keys c232235
Commits on Jun 27, 2015
@antirez Geo: remove useless variable. geoRadiusGeneric() top comment improved. 710c05a
@antirez Geo: only one way to specify any given option. cd91bee
@antirez Geo: COUNT option for GEORADIUS. a3b07b1
Commits on Jun 29, 2015
@antirez Geo: commands top comment as in other Redis code. 7d59e0a
@antirez Geo: GEOADD form using radius removed.
Can't immagine how this is useful in the context of the API exported by
Redis, and we are always in time to add more bloat if needed, later.
@antirez Geo: debugging printf calls removed. db3df44
@antirez Geo: fix comment indentation. 1884bff
@antirez Geo: GEOENCODE now returns score ranges.
If GEOENCODE must be our door to enter the Geocoding implementation
details and do fancy things client side, than return the scores as well
so that we can query the sorted sets directly if we wish to do the same
search multiple times, or want to compute the boxes in the client side
to refine our search needs.
@antirez Geo: GEOENCODE: fix command arity check. ddc7b85
@antirez Geo: GEOENCODE test fixed for new return value. 7cd2a4e
@antirez Geo: GEORADIUS COUNT tests. f6edd0c
@antirez Geo: GEOPOS command and tests. aae0a1f
@antirez Geo: command function names converted to lowercase, as elsewhere.
In Redis MULTIWORDCOMMANDNAME are mapped to functions where the command
name is all lowercase: multiwordcommandnameCommand().
@antirez Geo: GEODIST and tests. f108c68
@antirez Geo: remove static declarations.
Stack traces produced by Redis on crash are the most useful tool we
have to fix non easily reproducible crashes, or even easily reproducible
ones where the user just posts a bug report and does not collaborate

By declaring functions "static" they no longer show up in the stack
@antirez Geo: support units only in abbreviated form.
I'm not a strong believer in multiple syntax for the same stuff, so
now units can be specified only as m, km, ft, mi.
@antirez Geo: added my copyright notice in modified files. d308cad
Commits on Jul 01, 2015
@antirez Geo: sync faster decoding from krtm that synched from Ardb.
Instead of successive divisions in iteration the new code uses bitwise
magic to interleave / deinterleave two 32bit values into a 64bit one.
All tests still passing and is measurably faster, so worth it.
Commits on Jul 03, 2015
@antirez Removed useless tryObjectEncoding() call from ZRANK. 5254c2d
Commits on Jul 06, 2015
@antirez Geo: validate long,lat passed by user via API 5e04189
Commits on Jul 09, 2015
@antirez Geo: -Ofast breaks builds on older GCCs. 1e12784
@antirez Geo: use ULL suffix for unsigned 64 bit constants. 965abcf
@antirez GEOENCODE / GEODECODE commands removed.

1. The commands look like internals exposed without a real strong use
2. Whatever there is an use case, the client would implement the
commands client side instead of paying RTT just to use a simple to
reimplement library.
3. They add complexity to an otherwise quite straightforward API.

So for now KILLED ;-)
Commits on Jul 13, 2015
@antirez Geo: fix command table keys position indexes for three commands.
GEOHASH, GEOPOS and GEODIST where declared as commands not accepting
keys, so the Redis Cluster redirection did not worked.

Close #2671.
@antirez EXISTS is now variadic.
The new return value is the number of keys existing, among the ones
specified in the command line, counting the same key multiple times if
given multiple times (and if it exists).

See PR #2667.
Commits on Jul 14, 2015
@antirez DEBUG HTSTATS <dbid> added.
The command reports information about the hash table internal state
representing the specified database ID.

This can be used in order to investigate rehashings, memory usage issues
and for other debugging purposes.
@oranagra oranagra sds size classes - memory optimization f15df8b
@antirez Fix DEBUG structsize output. a76b380
@antirez Fix redis-benchmark sds binding.
Same as redis-cli, now redis-benchmark requires to use hiredis sds copy
since it is different compared to the memory optimized fork of Redis
Commits on Jul 15, 2015
@antirez SDS: New sds type 5 implemented.
This is an attempt to use the refcount feature of the sds.c fork
provided in the Pull Request #2509. A new type, SDS_TYPE_5 is introduced
having a one byte header with just the string length, without
information about the available additional length at the end of the
string (this means that sdsMakeRoomFor() will be required each time
we want to append something, since the string will always report to have
0 bytes available).

More work needed in order to avoid common SDS functions will pay the
cost of this type. For example both sdscatprintf() and sdscatfmt()
should try to upgrade to SDS_TYPE_8 ASAP when appending chars.
Commits on Jul 16, 2015
@antirez Add sdshdr5 to DEBUG structsize. 3da97ea
@antirez Clarify a comment in clientsCron(). e0bb454
@july2993 july2993 config tcp-keepalive should be numerical field not bool 92c146d
@antirez Client timeout handling improved.
The previos attempt to process each client at least once every ten
seconds was not a good idea, because:

1. Usually because of the past min iterations set to 50, you get much
better processing period most of the times.

2. However when there are many clients and a normal setting for
server.hz, the edge case is triggered, and waiting 10 seconds for a
BLPOP that asked for 1 second is not ok.

3. Moreover, because of the high min-itereations limit of 50, when HZ
was set to an high value, the actual behavior was to process a lot of
clients per second.

Also the function checking for timeouts called gettimeofday() at each
iteration which can be costly.

The new implementation will try to process each client once per second,
gets the current time as argument, and does not attempt to process more
than 5 clients per iteration if not needed.

So now:

1. The CPU usage of an idle Redis process is the same or better.
2. The CPU usage of a busy Redis process is the same or better.
3. However a non trivial amount of work may be performed per iteration
when there are many many clients. In this particular case the user may
want to raise the "HZ" value if needed.

Btw with 4000 clients it was still not possible to noticy any actual
latency created by processing 400 clients per second, since the work
performed for each client is pretty small.
Commits on Jul 17, 2015
@antirez Merge pull request #2676 from july2993/unstable
config tcp-keepalive should be numerical field not bool
@Kiemes Kiemes Fix: aof_delayed_fsync is not reset
aof_delayed_fsync was not set to 0 when calling CONFIG RESETSTAT
@Abioy Abioy bugfix: errno might change before logging
Signed-off-by: Yongyue Sun <>
@antirez Merge pull request #2644 from MOON-CLJ/command_info_fix
pfcount support multi keys
@antirez Merge pull request #2636 from badboy/cluster-lock-fix
Cluster lock fix
Commits on Jul 20, 2015
@antirez Fix SDS type 5 sdsIncrLen() bug and added test.
Thanks to @oranagra for spotting this error.
Commits on Jul 23, 2015
@antirez SDS: use type 8 if we are likely to append to the string.
When empty strings are created, or when sdsMakeRoomFor() is called, we
are likely into an appending pattern. Use at least type 8 SDS strings
since TYPE 5 does not remember the free allocation size and requires to
call sdsMakeRoomFor() at every new piece appended.
Commits on Jul 24, 2015
@antirez Merge branch 'sds' into unstable 9352512
@antirez SDS: avoid compiler warning in sdsIncrLen(). 64fcd0e
@antirez Jemalloc: use LG_QUANTUM of 3 for AMD64 and I386.
This gives us a 24 bytes size class which is dict.c dictEntry size, thus
improving the memory efficiency of Redis significantly.
Moreover other non 16 bytes aligned tiny classes are added that further
reduce the fragmentation of the allocator.

Technically speaking LG_QUANTUM should be 4 on i386 / AMD64 because of
SSE types and other 16 bytes types, however we don't use those, and our
jemalloc only targets Redis.

New versions of Jemalloc will have an explicit configure switch in order
to specify the quantum value for a platform without requiring any change
to the Jemalloc source code: we'll switch to this system when available.

This change was originally proposed by Oran Agra (@oranagra) as a change
to the Jemalloc script to generate the size classes define. We ended
doing it differently by changing LG_QUANTUM since it is apparently the
supported Jemalloc method to obtain a 24 bytes size class, moreover it
also provides us other potentially useful size classes.

Related to issue #2510.
@rogerlz rogerlz Check args before run ckquorum. Fix issue #2635 ef29748
Commits on Jul 25, 2015
@antirez SDS: sdsjoinsds() call ported from antirez/sds fork. 11425c8
@antirez SDS: Copyright notice updated. 9894495
@antirez SDS: changes to unify Redis SDS with antirez/sds repo. cb2782c
@antirez SDS: Copyright updated further. c6333de
@antirez deps/hiredis SDS updated to version 2.0.0. b684e2d
Commits on Jul 26, 2015
@antirez RDMF (Redis/Disque merge friendlyness) refactoring WIP 1. cef054e
@antirez RDMF: redisLog -> serverLog. 424fe9a
@antirez RDMF: use client instead of redisClient, like Disque. 554bd0e
@antirez RDMF: OBJ_ macros for object related stuff. 14ff572
@antirez RDMF: redisAssert -> serverAssert. 2d9e3eb
@antirez RDMF: REDIS_OK REDIS_ERR -> C_OK C_ERR. 40eb548
Commits on Jul 27, 2015
@antirez RDMF: More consistent define names. 32f80e2
@antirez RDMF: more names updated. 3325a9b
@antirez RDMF: use representClusterNodeFlags() generic name. 02b1d52
Commits on Jul 28, 2015
@antirez Use mstime_t as return value of mstime(). a83e79b
@antirez RDMF: dictRedisObjectDestructor -> dictObjectDestructor." 5cfb792
@antirez Avoid magic "0" argument to prepareForShutdown().
Backported from Disque.
@antirez RDMF: Redis -> Server in adjustOpenFilesLimit(). 54c71f2
@antirez replicationHandleMasterDisconnection() belongs to replication.c. 278ea9d
@antirez Force slaves to resync after unsuccessful PSYNC.
Using chained replication where C is slave of B which is in turn slave of
A, if B reconnects the replication link with A but discovers it is no
longer possible to PSYNC, slaves of B must be disconnected and PSYNC
not allowed, since the new B dataset may be completely different after
the synchronization with the master.

Note that there are varius semantical differences in the way this is
handled now compared to the past. In the past the semantics was:

1. When a slave lost connection with its master, disconnected the chained
slaves ASAP. Which is not needed since after a successful PSYNC with the
master, the slaves can continue and don't need to resync in turn.

2. However after a failed PSYNC the replication backlog was not reset, so a
slave was able to PSYNC successfully even if the instance did a full
sync with its master, containing now an entirely different data set.

Now instead chained slaves are not disconnected when the slave lose the
connection with its master, but only when it is forced to full SYNC with
its master. This means that if the slave having chained slaves does a
successful PSYNC all its slaves can continue without troubles.

See issue #2694 for more details.
@antirez CLIENT_MASTER introduced. e6f3933
@antirez Support for CLIENT KILL TYPE MASTER. 3c8861a
Commits on Jul 29, 2015
@antirez checkTcpBacklogSetting() now called in Sentinel mode too. 4bc42ca
@antirez Sentinel: add more commonly useful sections to INFO.
Debugging is hard without those when there are problems like the one
investigated in issue #2700.
Commits on Aug 04, 2015
@antirez Test PSYNC with diskless replication.
Thanks to Oran Agra from Redis Labs for providing this patch.
@antirez PSYNC initial offset fix.
This commit attempts to fix a bug involving PSYNC and diskless
replication (currently experimental) found by Yuval Inbar from Redis Labs
and that was later found to have even more far reaching effects (the bug also
exists when diskstore is off).

The gist of the bug is that, a Redis master replies with +FULLRESYNC to
a PSYNC attempt that fails and requires a full resynchronization.
However, the baseline offset sent along with FULLRESYNC was always the
current master replication offset. This is not ok, because there are
many reasosn that may delay the RDB file creation. And... guess what,
the master offset we communicate must be the one of the time the RDB
was created. So for example:

1) When the BGSAVE for replication is delayed since there is one
   already but is not good for replication.
2) When the BGSAVE is not needed as we attach one currently ongoing.
3) When because of diskless replication the BGSAVE is delayed.

In all the above cases the PSYNC reply is wrong and the slave may
reconnect later claiming to need a wrong offset: this may cause
data curruption later.
Commits on Aug 05, 2015
@antirez syncCommand() comments improved. 62b5c60
@antirez PSYNC test: also test the vanilla SYNC. 76e0be4
@antirez Don't send SELECT to slaves in WAIT_BGSAVE_START state. a5a06a8
@antirez Test: csvdump now scans all DBs. 175707e
@antirez Make sure we re-emit SELECT after each new slave full sync setup.
In previous commits we moved the FULLRESYNC to the moment we start the
BGSAVE, so that the offset we provide is the right one. However this
also means that we need to re-emit the SELECT statement every time a new
slave starts to accumulate the changes.

To obtian this effect in a more clean way, the function that sends the
FULLRESYNC reply was overloaded with a more important role of also doing
this and chanigng the slave state. So it was renamed to
replicationSetupSlaveForFullResync() to better reflect what it does now.
@antirez Remove slave state change handled by replicationSetupSlaveForFullResy…
@antirez Fix RDB encoding test for new csvdump format. 1d59497
@antirez Fix replication slave pings period.
For PINGs we use the period configured by the user, but for the newlines
of slaves waiting for an RDB to be created (including slaves waiting for
the FULLRESYNC reply) we need to ping with frequency of 1 second, since
the timeout is fixed and needs to be refreshed.
@antirez Fix synchronous readline "\n" handling.
Our function to read a line with a timeout handles newlines as requests
to refresh the timeout, however the code kept subtracting the buffer
size left every time a newline was received, for a bug in the loop
logic. Fixed by this commit.
Commits on Aug 06, 2015
@antirez Replication: add REPLCONF CAPA EOF support.
Add the concept of slaves capabilities to Redis, the slave now presents
to the Redis master with a set of capabilities in the form:


This has the effect of setting slave->slave_capa with the corresponding
SLAVE_CAPA macros that the master can test later to understand if it
the slave will understand certain formats and protocols of the
replication process. This makes it much simpler to introduce new
replication capabilities in the future in a way that don't break old
slaves or masters.

This patch was designed and implemented together with Oran Agra
@antirez Client structure comments improved. fd08839
@antirez startBgsaveForReplication(): log what you really do. ce5761e
@antirez flushSlavesOutputBuffers(): details clarified via comments.
Talking with @oranagra we had to reason a little bit to understand if
this function could ever flush the output buffers of the wrong slaves,
having online state but actually not being ready to receive writes
before the first ACK is received from them (this happens with diskless

Next time we'll just read this comment.
@antirez syncWithMaster(): non blocking state machine. 88c716a
Commits on Aug 07, 2015
@antirez slaveTryPartialResynchronization and syncWithMaster: better synergy.
It is simpler if removing the read event handler from the FD is up to
slaveTryPartialResynchronization, after all it is only called in the
context of syncWithMaster.

This commit also makes sure that on error all the event handlers are
removed from the socket before closing it.
Commits on Aug 20, 2015
@antirez startBgsaveForReplication(): handle waiting slaves state change.
Before this commit, after triggering a BGSAVE it was up to the caller of
startBgsavForReplication() to handle slaves in WAIT_BGSAVE_START in
order to update them accordingly. However when the replication target is
the socket, this is not possible since the process of updating the
slaves and sending the FULLRESYNC reply must be coupled with the process
of starting an RDB save (the reason is, we need to send the FULLSYNC
command and spawn a child that will start to send RDB data to the slaves

This commit moves the responsibility of handling slaves in
WAIT_BGSAVE_START to startBgsavForReplication() so that for both
diskless and disk-based replication we have the same chain of
responsiblity. In order accomodate such change, the syncCommand() also
needs to put the client in the slave list ASAP (just after the initial
checks) and not at the end, so that startBgsavForReplication() can find
the new slave alrady in the list.

Another related change is what happens if the BGSAVE fails because of
fork() or other errors: we now remove the slave from the list of slaves
and send an error, scheduling the slave connection to be terminated.

As a side effect of this change the following errors found by
Oran Agra are fixed (thanks!):

1. rdbSaveToSlavesSockets() on failed fork will get the slaves cleaned
up, otherwise they remain in a wrong state forever since we setup them
for full resync before actually trying to fork.

2. updateSlavesWaitingBgsave() with replication target set as "socket"
was broken since the function changed the slaves state from
replicationSetupSlaveForFullResync(), so later rdbSaveToSlavesSockets()
will not find any slave in the right state (WAIT_BGSAVE_START) to feed.
Commits on Aug 21, 2015
@antirez Log client details on SLAVEOF command having an effect. d036abe
Commits on Sep 07, 2015
@antirez Test: print info on HSTRLEN test failure.
This additional info may provide more clues about the test randomly
failing from time to time. Probably the failure is due to some previous
test that overwrites the logical content in the Tcl variable, but this
will make the problem more obvious.
ubuntu SCAN iter parsing changed from atoi to chartoull 11381b0
@antirez Merge pull request #2753 from ofirluzon/unstable
SCAN iter parsing changed from atoi to chartoull
@antirez Undo slaves state change on failed rdbSaveToSlavesSockets().
As Oran Agra suggested, in startBgsaveForReplication() when the BGSAVE
attempt returns an error, we scan the list of slaves in order to remove
them since there is no way to serve them currently.

However we check for the replication state BGSAVE_START, which was
modified by rdbSaveToSlaveSockets() before forking(). So when fork fails
the state of slaves remain BGSAVE_END and no cleanup is performed.

This commit fixes the problem by making rdbSaveToSlavesSockets() able to
undo the state change on fork failure.
Commits on Sep 08, 2015
@antirez Merge pull request #2695 from rogerlz/unstable
redis-sentinel crash if ckquorum command is executed without args
@antirez Sentinel: command arity check added where missing. 33769f8
Commits on Sep 14, 2015
@antirez MOVE now can move TTL metadata as well.
MOVE was not able to move the TTL: when a key was moved into a different
database number, it became persistent like if PERSIST was used.

In some incredible way (I guess almost nobody uses Redis MOVE) this bug
remained unnoticed inside Redis internals for many years.
Finally Andy Grunwald discovered it and opened an issue.

This commit fixes the bug and adds a regression test.

Close #2765.
@antirez MOVE re-add TTL check fixed.
getExpire() returns -1 when no expire exists.

Related to #2765.
@antirez Test: MOVE expire test improved.
Related to #2765.
@antirez GEORADIUS: Don't report duplicates when radius is huge.
Georadius works by computing the center + neighbors squares covering all
the area of the specified position and radius. Then a distance filter is
used to remove elements which are actually outside the range.

When a huge radius is used, like 5000 km or more, adjacent neighbors may
collide and be the same, leading to the reporting of the same element
multiple times. This only happens in the edge case of huge radius but is
not ideal.

A robust but slow solution would involve qsorting the range to remove
all the duplicates. However since the collisions are only in adjacent
boxes, for the way they are ordered in the code, it is much faster to
just check if the current box is the same as the previous one processed.

This commit adds a regression test for the bug.

Fixes #2767.
Commits on Sep 15, 2015
@antirez Test: fix false positive in HSTRLEN test.
HINCRBY* tests later used the value "tmp" that was sometimes generated
by the random key generation function. The result was ovewriting what
Tcl expected to be inside Redis with another value, causing the next
HSTRLEN test to fail.
Commits on Sep 29, 2015
@antirez Mark version of unstable branch in an unique way. 622366a
Commits on Sep 30, 2015
@antirez redis-cli pipe mode: don't stay in the write loop forever.
The code was broken and resulted in redis-cli --pipe to, most of the
times, writing everything received in the standard input to the Redis
connection socket without ever reading back the replies, until all the
content to write was written.

This means that Redis had to accumulate all the output in the output
buffers of the client, consuming a lot of memory.

Fixed thanks to the original report of anomalies in the behavior
provided by Twitter user @fsaintjacques.
@antirez Avoid installing the client write handler when possible. 1c7d87d
@antirez Move handleClientsWithPendingWrites() in networking.c. 481a0db
@antirez handleClientsWithPendingWrites(): detect dead clients. b741a90
@antirez writeToClient(): don't remove write handler if not needed. 063ecbd
@antirez Reverse list of clients with pending writes.
May potentially improve locality... not exactly clear if this makes a
difference or not. But for sure is harmless.
@antirez Refactoring: new function to test if client has pending output. fdb3be9
@antirez Refactoring: unlinkClient() added to lower freeClient() complexity. 1e71538
@antirez Fix processEventsWhileBlocked() to handle PENDING_WRITE clients.
After the introduction of the list with clients with pending writes, to
process clients incrementally outside of the event loop we also need to
process the pending writes list.
@antirez Call writeToClient() directly instead of the write handler. 712ea72
Commits on Oct 01, 2015
@antirez Lazyfree: a first implementation of non blocking DEL. 0c05436
@antirez Lazyfree: client output buffers no longer use Redis Objects. 4ff3c17
@antirez Lazyfree: Convert Sets to use plains SDS (several commits squashed). 86d48ef
@antirez Lazyfree: Sorted sets convereted to plain SDS. (several commits squas…
@antirez SORT memory leak fixed. 34e489c
@antirez DEBUG DIGEST Set type memory leak fixed. afc4b92
@antirez Lazyfree: Hash converted to use plain SDS WIP 1. 1c24755
@antirez Lazyfree: Hash converted to use plain SDS WIP 2. 777396a
@antirez Lazyfree: Hash converted to use plain SDS WIP 3. 4a18352
@antirez Lazyfree: Hash converted to use plain SDS WIP 4. 974514b
@antirez Test: support for stack logging for OSX malloc/leaks. 36be34b
@antirez Lazyfree: Hash converted to use plain SDS WIP 5. 97ba4e3
@antirez Hash new implementation memleaks fixed. 1dab60d
@antirez Test: stack_logging var should be initialized to 0. 5b850d7
@antirez bio.c: new API bioWaitStepOfType(). 4d50d69
@antirez Threaded lazyfree WIP #1. 9253d85
@antirez Lazyfree: incremental removed, only threaded survived. 7af4eeb
@antirez Atomic vars implemented in a more general way.
We have them into zmalloc.c, but this is going to replace that
implementation, so that it's possible to use the same idea everywhere
inside the code base.
@antirez zmalloc.c converted to use atomicvar.h. c7b46a4
@antirez Lazyfree: keep count of objects to free. b08c36c
@antirez Lazyfree: ability to free whole DBs in background. c69c6c8
@antirez Lazyfree: pending objects count in INFO output. 1f26a94
@antirez FLUSHDB and FLUSHALL ASYNC option implemented. ecdbc33
@antirez Fixed a bug in the emptyDb() new implementation. 5359696
Commits on Oct 02, 2015
@antirez Lazyfree: cond vars to enabled/disable it based on DEL context. 252cfa0
Commits on Oct 05, 2015
@antirez Lazyfree options implemented in the configuration. 880c606
@antirez Lazyfree options documented in the example redis.conf. 19f6ab5
Commits on Oct 06, 2015
@antirez Fix GEORADIUS COUNT option arity checks. 319d180
@antirez Regression test for GEORADIUS COUNT arity check. ceaf58d
@antirez Added a README into deps on dependencies and how to upgrade. e3ded02
@antirez Jemalloc updated to 4.0.3. a9951b1
Commits on Oct 07, 2015
@antirez Jemalloc configure script fixed to work nested.
Now way to make unmodified Jemalloc configure to work when the jemalloc
source tree is inside a subdirectory of a different git repository.

Problem signaled here:
@antirez Fix extractLongLatOrReply() sanity check conditionals.
the check for lat/long valid ranges were performed inside the for loop,
two times instead of one, and the first time when the second element of
the array, xy[1], was yet not populated. This resulted into issue #2799.

Close issue #2799.
@antirez Test: fix attach_to_replication_stream to handle newlines. 363c0f6
Commits on Oct 09, 2015
@antirez Test: basic lazyfree unit test. 6ddcba6
@antirez Cluster: redis-trib fix, coverage for migrating=1 case.
Kinda related to #2770.
Commits on Oct 13, 2015
@antirez Server: restartServer() API.
This new function is able to restart the server "in place". The current
Redis process executes the same executable it was executed with, using
the same arguments and configuration file.
@antirez DEBUG RESTART/CRASH-AND-RECOVER [delay] implemented. 35a0c77
Commits on Oct 14, 2015
David Thomson Update import command to optionally use copy and replace parameters 03d0de7
David Thomson Add back blank line 8a85ad2
Commits on Oct 15, 2015
@antirez PR 2813 fix ported to unstable. ed62288
@antirez Regression test for issue #2813. 5f0fef5
@antirez Redis.conf example: make clear user must pass its path as argument. 6ed12bd
@antirez Merge pull request #2810 from dwlt/add-copy-replace-parameters-to-red…

Add copy & replace parameters to redis-trib import
Commits on Oct 21, 2015
@antirez CLIENT REPLY command implemented: ON, OFF and SKIP modes.
Sometimes it can be useful for clients to completely disable replies
from the Redis server. For example when the client sends fire and forget
commands or performs a mass loading of data, or in caching contexts
where new data is streamed constantly. In such contexts to use server
time and bandwidth in order to send back replies to clients, which are
going to be ignored, is a shame.

Multiple mechanisms are possible to implement such a feature. For
example it could be a feature of MULTI/EXEC, or a command prefix
such as "NOREPLY SADD myset foo", or a different mechanism that allows
to switch on/off requests using the CLIENT command.

The MULTI/EXEC approach has the problem that transactions are not
strictly part of the no-reply semantics, and if we want to insert a lot
of data in a bulk way, creating a huge MULTI/EXEC transaction in the
server memory is bad.

The prefix is the best in this specific use case since it does not allow
desynchronizations, and is pretty clear semantically. However Redis
internals and client libraries are not prepared to handle this

So the implementation uses the CLIENT command, providing a new REPLY
subcommand with three options:

    CLIENT REPLY OFF disables the replies, and does not reply itself.
    CLIENT REPLY ON re-enables the replies, replying +OK.
    CLIENT REPLY SKIP only discards the reply of the next command, and
                      like OFF does not reply anything itself.

The reason to add the SKIP command is that it allows to have an easy
way to send conceptually "single" commands that don't need a reply
as the sum of two pipelined commands:

    SET key value

Note that CLIENT REPLY ON replies with +OK so it should be used when
sending multiple commands that don't need a reply. However since it
replies with +OK the client can check that the connection is still
active and all the previous commands were received.

This is currently just into Redis "unstable" so the proposal can be
modified or abandoned based on users inputs.
Commits on Oct 27, 2015
@antirez CONTRIBUTING updated. d37ef78
Commits on Oct 30, 2015
@antirez call(): don't inherit CLIENT_PREVENT_PROP + minor refactoring. 9dd3d2e
@antirez call(): selective ability to prevent propagation on AOF / slaves. cdda674
@antirez Scripting: single commands replication mode implemented.
By calling redis.replicate_commands(), the scripting engine of Redis
switches to commands replication instead of replicating whole scripts.
This is useful when the script execution is costly but only results in a
few writes performed to the dataset.

Morover, in this mode, it is possible to call functions with side
effects freely, since the script execution does not need to be
deterministic: anyway we'll capture the outcome from the point of view
of changes to the dataset.

In this mode math.random() returns different sequences at every call.

If redis.replicate_commnads() is not called before any other write, the
command returns false and sticks to whole scripts replication instead.
@antirez Lua script selective replication WIP. a3e8de0
@antirez Lua script selective replication fixes. 514a234
@antirez Fix call() FORCE_REPL/AOF flags setting.
This commit also inverts two stanzas of the code just becuase they are
more logical like that, not because currently it makes any difference.
@antirez Scripting: fix error reporting of many Redis provided functions. ebaa922
@antirez Scripting: test Redis provided Lua functions error reporting. eda06b5
@antirez Scripting: ability to turn on Lua commands style replication globally.
Currently this feature is only accessible via DEBUG for testing, since
otherwise depending on the instance configuration a given script works
or is broken, which is against the Redis philosophy.
@antirez Scripting: execute tests with command replication as well. 073a42b
@antirez More reliable DEBUG loadaof.
Make sure to flush the AOF output buffers before reloading.
Result: less false timing related false positives on AOF tests.
@antirez Scripting: commands replication tests. 5b63ae3
@antirez Dependencies updated. 77362b9
Commits on Nov 03, 2015
@antirez Test: improve PFCOUNT with multiple keys testing.
An user raised a question about a given behavior of PFCOUNT. Added a
test to show the behavior (union) is correct when most of the items are
in common.
Commits on Nov 04, 2015
@badboy badboy Remove printf 35afefc
@antirez README now has info about Redis codebase layout. 15d57c3
@antirez A few README typos fixed. d80d051
@antirez A few README typos fixed #2. 8badf16
@antirez README operations -> commands, is more clear now. b9fb240
@antirez README operations -> commands, is more clear now #2. 73510f4
@antirez README: remove garbage at end of line. 462026c
@Joe8Bit Joe8Bit Fix typo in READme sever/server 8bc8f6f
@antirez README new internals section improved a bit more. dfe90ac
@antirez Merge pull request #2850 from Joe8Bit/fix_typo-in-readme
Fix typo in READme sever/server
@antirez Add regression test for HINCRBYFLOAT formatting change.
This test was kindly provided by Jan-Erik Rediger (@badboy here on
Github) that discovered the issue.

See issue #2846.
@antirez Fix HINCRBYFLOAT to work with long doubles.
During the refactoring needed for lazy free, specifically the conversion
of t_hash from struct robj to plain SDS strings, HINCRBFLOAT was
accidentally moved away from long doubles to doubles for internal
processing of increments and formatting.

The diminished precision created more obvious artifacts in the way small
numbers are formatted once we convert from decimal number in radix 10 to
double and back to its string in radix 10.

By using more precision, we now have less surprising results at least
with small numbers like "1.23", exactly like in the previous versions of

See issue #2846.
Commits on Nov 05, 2015
@antirez scripting.c source code better organized into sections. 9aa1f94
@antirez Initialize all Lua scripting related things into scripting.c cd8f19e
Commits on Nov 09, 2015
@antirez Fix error reply in subscribed Pub/Sub mode.
PING is now a valid command to issue in this context.
@antirez Scripting: fix error reporting.
Arguments arity and arguments type error of were not
reported correctly to Lua, so the command acted in this regard like
redis.pcall(), but just for two commands. should always
raise errors instead.
@antirez Use clientHasPendingReplies() in flushSlavesOutputBuffers()
The old version only flushed data to slaves if there were strings
pending in the client->reply list. Now also static buffers are flushed.
Does not help to free memory (which is the only use we have right now in
the fuction), but is more correct conceptually, and may be used in
other contexts.
@antirez Best effort flush of slave buffers before SHUTDOWN. 87a12a6
@antirez Merge pull request #2848 from badboy/removed-printf
Remove printf
Commits on Nov 10, 2015
@antirez call() deserves a good top-comment. 54f5ecf
Commits on Nov 13, 2015
@antirez AOF: rewriting child killed by SIGUSR1 is not an error. 8a0258a
Commits on Nov 17, 2015
@antirez Fix MIGRATE entry in command table.
Thanks to Oran Agra (@oranagra) for reporting. Key extraction would not
work otherwise and it does not make sense to take wrong data in the
command table.
@antirez Update redis-cli help and the script to generate it. f3dd472
@antirez Remove "s" flag for MIGRATE in command table.
Maybe there are legitimate use cases for MIGRATE inside Lua scripts, at
least for now. When the command will be executed in an asynchronous
fashion (planned) it is possible we'll no longer be able to permit it
from within Lua scripts.
@antirez Lua debugger: foundations implemented. c494db8
@antirez Lua debugger: initial REPL. d3d1fa9
@antirez Lua debugger: log Redis commands. List command. 5417217
@antirez Lua debugger: ability to show local vars content. 5c4f492
@antirez Lua debugger: breakpoints. 1f8d614
@antirez Lua debugger: output improvements, eval command. cf4700b
@antirez Lua debugger: redis.breakpoint() implemented. 3a04cb0
@antirez Lua debugger: added comment about helper functions. 36392dd
@antirez Lua debugger: print now handles ARGV and KEYS. f480580
@antirez Lua debugger: much better Lua values pretty printer. 1f8fdaf
@antirez Lua debugger: try to eval as expression first.
It's handly to just eval "5+5" without the return and see it printed on
the screen as result. However prepending "return" does not always result
into valid Lua code. So what we do is to exploit a common Lua community
trick of trying to compile with return prepended, and if compilation
fails then it's not an expression that can be returned, so we try again
without prepending "return". Works great apparently.
@antirez Lua debugger: redis command implemented. a076e42
@antirez Lua debugger: removing breakpoints now works. cd112db
@antirez Lua debugger: redis-cli, mark end of debugging session. 23a4d70
@antirez Lua debugger: redis.debug() implemented. 7492237
@antirez Lua debugger: clear end of session protocol.
When the debugger exits now it produces an <endsession> tag that informs
redis-cli (or other debugging clients) that the session terminated.
This way the client knows there is yet another reply to read (the one of
the EVAL script itself), and can switch to non-debugging mode ASAP.
@antirez Lua debugger: fix help typo, beark -> break. 56d9bb8
@antirez Lua debugger: inform user changes are rolled back.
When redis-cli will support the synchronous mode, this will not be
@antirez Lua debugger: handle forked sessions children during shutdown. 7be9170
@antirez Lua debugger: better support for synchronous mode. 87672ad
@antirez Lua debugger: ldbSendLogs() memory leak fixed. d99ce09
@antirez Lua debugger: abort implemented. 0163643
@antirez Lua debugger: call wait3() if there are pending forked debugging sess…
@antirez Lua debugger: reply +OK to SCRIPT DEBUG no.
Thanks to Itamar Haber for reporting.
@antirez Lua debugging: fix error message for SCRIPT DEBUG.
"async" -> "sync".

Thanks to Itamar Haber for reporting.
@antirez Lua debugger: use sds_malloc() to allocate eval cli array.
Redis-cli handles the debugger "eval" command in a special way since
sdssplitargs() would not be ok: we need to send the Redis debugger the
whole Lua script without any parsing. However in order to later free the
argument vector inside redis-cli using just sdsfreesplitres(), we need
to allocate the array of SDS pointers using the same allocator SDS is
using, that may differ to what Redis is using.

So now a newer version of SDS exports sds_malloc() and other allocator
functions to give access, to the program it is linked to, the allocator
used internally by SDS.
@antirez Lua debugger: redis-cli error when --ldb is without --eval.
Otherwise the result is a messed CLI without prompt.
Thanks to Itamar Haber for reporting this issue.
@antirez Lua debugger: default behavior of "list" command changed.
Now it lists code around the current position by default. Can list any
other part using other arguments, but a new "whole" command was added in
order to show the whole source code easily.
@antirez Lua debugger: print without args show all local vars. 70a5169
@antirez Lua debugger: redis-cli: show compile errors in LDB mode. 22959e0
@antirez Lua debugger: trace command implemented. c560c64
@antirez Lua debugger: maxlen command implemented.
Let the user control the replies truncation.
@antirez Lua debugger: redis-cli can restart Lua debugging sessions. 58573f1
@antirez Lua debugger: redis-cli: allow restart after end of session. 6604e04
@antirez Lua debugger: fix trace command infinite loop.
Thanks to Itamar Haber for bug report and test case to reproduce.
Commits on Nov 18, 2015
@antirez Lua debugger: infinite loop detection. 4b0b28b
Commits on Nov 20, 2015
@antirez Added Tcl program to show commits graphicaly.
Used to generate
Commits on Nov 27, 2015
@antirez Redis Cluster: hint about validity factor when slave can't failover. a0d41e5
@itamarhaber itamarhaber Revert Lua's `redis.LOG_<level>` to original
Fixes #2898
@antirez Merge pull request #2899 from itamarhaber/patch-1
Revert Lua's `redis.LOG_<level>` to original
@antirez Handle wait3() errors.
My guess was that wait3() with WNOHANG could never return -1 and an
error. However issue #2897 may possibly indicate that this could happen
under non clear conditions. While we try to understand this better,
better to handle a return value of -1 explicitly, otherwise in the
case a BGREWRITE is in progress but wait3() returns -1, the effect is to
match the first branch of the if/else block since server.rdb_child_pid
is -1, and call backgroundSaveDoneHandler() without a good reason, that
will, in turn, crash the Redis server with an assertion.
@antirez Merge branch 'unstable' of into unstable c2c68c5
@antirez Fix typo in prepareClientToWrite() comment. e6a5117
Commits on Nov 28, 2015
@antirez fix sprintf and snprintf format string
There are some cases of printing unsigned integer with %d conversion
specificator and vice versa (signed integer with %u specificator).

Patch by Sergey Polovko. Backported to Redis from Disque.
@antirez Test HINCRBYFLOAT rounding only in x86_64 and when valgrind is not in…
… use.

64 bit double math is not enough to make the test passing, and rounding
to 1.2999999 instead of 1.23 is not an error in the implementation.
Valgrind and sometimes other archs are not able to work with 80 bit