Commit Graph

6237 Commits

Author SHA1 Message Date
antirez
7c2153dafa Add panic() into redisassert.h.
This header file is for libs, like ziplist.c, that we want to leave
almost separted from the core. The panic() calls will be easy to delete
in order to use such files outside, but the debugging info we gain are
very valuable compared to simple assertions where it is not possible to
print debugging info.
2017-01-27 10:49:25 +01:00
antirez
dc83ddf068 serverPanic(): allow printf() alike formatting.
This is of great interest because allows us to print debugging
informations that could be of useful when debugging, like in the
following example:

    serverPanic("Unexpected encoding for object %d, %d",
        obj->type, obj->encoding);
2017-01-27 10:49:22 +01:00
antirez
3ef81eb301 Ziplist: remove static from functions, they prevent good crash reports. 2017-01-13 11:47:14 +01:00
Jan-Erik Rediger
96f75faac6 Initialize help only in repl mode 2017-01-13 11:34:55 +01:00
antirez
bcd51a6acb Use const in modules types mem_usage method.
As suggested by @itamarhaber.
2017-01-13 09:07:37 +01:00
antirez
354ccf0ce9 Add memory defragmenting capability in 4.0 release notes. 2017-01-12 10:01:21 +01:00
antirez
57c81853b7 Defrag: don't crash when a module value is encountered. 2017-01-12 09:59:31 +01:00
antirez
e36d52227c MEMORY USAGE: support for modules data types.
As a side effect of supporting it, we no longer crash when MEMORY USAGE
is called against a module data type.

Close #3637.
2017-01-12 09:59:31 +01:00
antirez
82ec0fe6fa Defrag: document the feature in redis.conf. 2017-01-12 09:59:31 +01:00
antirez
19bf0249d7 Defrag: not enabled by default. Error on CONFIG SET if not available. 2017-01-12 09:59:31 +01:00
antirez
fa0d8b6204 Defrag: fix function name typo defarg -> defrag. 2017-01-12 09:59:31 +01:00
antirez
ebb9a7e7e7 Defrag: do not crash on empty quicklist. 2017-01-12 09:59:31 +01:00
antirez
da84b9c47a Defrag: fix comments & code to conform to the Redis code base.
Don't go over 80 cols. Start with captial letter, capital letter afer
point, end comment with a point and so forth. No actual code behavior
touched at all.
2017-01-12 09:59:31 +01:00
antirez
a18f3cf389 Defrag: activate it only if running modified version of Jemalloc.
This commit also includes minor aesthetic changes like removal of
trailing spaces.
2017-01-12 09:59:31 +01:00
oranagra
1ad4883710 active defrag improvements 2017-01-12 09:59:31 +01:00
oranagra
67def2611f active memory defragmentation 2017-01-12 09:59:30 +01:00
antirez
b4f3c5a499 deps/hiredis updated to latest version.
Close #3687.
2016-12-21 12:12:25 +01:00
antirez
6549c6cfaf Fix test "server is up" detection after logging changes. 2016-12-21 11:05:46 +01:00
Alexander Zhukov
b87fd12075 Fix an article usage 2016-12-21 11:05:42 +01:00
whatacold
bd84549386 fix the wrong description of intsetGet(). 2016-12-21 11:05:38 +01:00
antirez
952e870696 4.0 release notes updated with API incompatibility notice about GEO. 2016-12-20 13:37:25 +01:00
antirez
f3add0692f Geo: fuzzy test inconsistency report fixed to show all points.
We need to report all the points added into the set, not just the ones
matching the Tcl distance algo.
2016-12-20 13:33:46 +01:00
antirez
056c81e4a7 Geo: fix GEOHASH return value for consistency.
The same thing observed in #3551 by gnethercutt also fixed for
GEOHASH as the original PR did.
2016-12-20 13:33:46 +01:00
antirez
d5036018b6 Geo: fix edge case return values for uniformity.
There were two cases outlined in issue #3512 and PR #3551 where
the Geo API returned unexpected results: empty strings where NULL
replies were expected, or a single null reply where an array was
expected. This violates the Redis principle that Redis replies for
existing keys or elements should be indistinguishable.

This is technically an API breakage so will be merged only into 4.0 and
specified in the changelog in the list of breaking compatibilities, even
if it is not very likely that actual code will be affected, hopefully,
since with the past behavior basically there was to acconut for *both*
the possibilities, and the new behavior is always one of the two, but
in a consistent way.
2016-12-20 13:33:46 +01:00
Justin Carvalho
47b462538c Fix missing brackets around encoding variable in ZIP_DECODE_LENGTH macro 2016-12-20 13:33:46 +01:00
antirez
a0e9511894 Remove first version of ASCII wave, later discarded. 2016-12-20 13:33:46 +01:00
antirez
3334a409b3 Only show Redis logo if logging to stdout / TTY.
You can still force the logo in the normal logs.
For motivations, check issue #3112. For me the reason is that actually
the logo is nice to have in interactive sessions, but inside the logs
kinda loses its usefulness, but for the ability of users to recognize
restarts easily: for this reason the new startup sequence shows a one
liner ASCII "wave" so that there is still a bit of visual clue.

Startup logging was modified in order to log events in more obvious
ways, and to log more events. Also certain important informations are
now more easy to parse/grep since they are printed in field=value style.

The option --always-show-logo in redis.conf was added, defaulting to no.
2016-12-20 13:33:45 +01:00
antirez
db53c23037 adjustOpenFilesLimit() comment made hopefully more clear. 2016-12-19 08:54:46 +01:00
antirez
bc00ef454c Hopefully improve code comments for issue #3616.
This commit also contains other changes in order to conform the code to
the Redis core style, specifically 80 chars max per line, smart
conditionals in the same line:

    if (that) do_this();
2016-12-19 08:54:46 +01:00
itamar
075a3381af Corrects a couple of omissions in the modules docs 2016-12-19 08:54:46 +01:00
andyli
8d82b3b166 Modify MIN->MAX 2016-12-19 08:54:46 +01:00
oranagra
69282df839 when a slave loads an RDB, stop an AOFRW fork before flusing db and parsing rdb file, to avoid a CoW disaster. 2016-12-19 08:54:46 +01:00
hylepo
869dda8494 Update redis-benchmark.c
Fixing typo in the usage of redis-benchmark
2016-12-19 08:54:46 +01:00
oranagra
7f870fadc2 fix unsigned int overflow in adjustOpenFilesLimit 2016-12-19 08:54:46 +01:00
antirez
2e375d4f42 Switch PFCOUNT to LogLog-Beta algorithm.
The new algorithm provides the same speed with a smaller error for
cardinalities in the range 0-100k. Before switching, the new and old
algorithm behavior was studied in details in the context of
issue #3677. You can find a few graphs and motivations there.
2016-12-16 11:07:42 +01:00
antirez
735b928b33 Use llroundl() before converting loglog-beta output to integer.
Otherwise for small cardinalities the algorithm will output something
like, for example, 4.99 for a candinality of 5, that will be converted
to 4 producing a huge error.
2016-12-16 11:07:42 +01:00
antirez
6cae609e8a Fix HLL gnuplot graph generator script for new redis-rb versions.
The PFADD now takes an array and has mandatory two arguments.
2016-12-16 11:07:42 +01:00
Harish Murthy
4d475e0f88 LogLog-Beta Algorithm support within HLL
Config option to use LogLog-Beta Algorithm for Cardinality
2016-12-16 11:07:42 +01:00
Dvir Volk
90d918bd6b fixed stop condition in RM_ZsetRangeNext and RM_ZsetRangePrev 2016-12-16 09:21:17 +01:00
antirez
3b19580ae8 ziplist.c explanation of format improved a bit. 2016-12-16 09:05:49 +01:00
antirez
457c6878b3 DEBUG: new "ziplist" subcommand added. Dumps a ziplist on stdout.
The commit improves ziplistRepr() and adds a new debugging subcommand so
that we can trigger the dump directly from the Redis API.
This command capability was used while investigating issue #3684.
2016-12-16 09:05:48 +01:00
antirez
17cda261a3 MIGRATE: Remove upfront ttl initialization.
After the fix for #3673 the ttl var is always initialized inside the
loop itself, so the early initialization is not needed.

Variables declaration also moved to a more local scope.
2016-12-14 12:44:35 +01:00
Jan-Erik Rediger
9515648d41 Reset the ttl for additional keys
Before, if a previous key had a TTL set but the current one didn't, the
TTL was reused and thus resulted in wrong expirations set.

This behaviour was experienced, when `MigrateDefaultPipeline` in
redis-trib was set to >1

Fixes #3655
2016-12-14 12:41:17 +01:00
antirez
1eec780e50 Writable slaves expires: unit test. 2016-12-13 18:34:04 +01:00
antirez
9a8bc6d22a Writable slaves expires: fix leak in key tracking.
We need to use a dictionary type that frees the key, since we copy the
keys in the dictionary we use to track expires created in the slave
side.
2016-12-13 18:34:04 +01:00
antirez
746d70b015 INFO: show num of slave-expires keys tracked. 2016-12-13 18:34:04 +01:00
antirez
1469c4edc1 Fix created->created typo in expire.c 2016-12-13 18:34:04 +01:00
antirez
c65dfb436e Replication: fix the infamous key leakage of writable slaves + EXPIRE.
BACKGROUND AND USE CASEj

Redis slaves are normally write only, however the supprot a "writable"
mode which is very handy when scaling reads on slaves, that actually
need write operations in order to access data. For instance imagine
having slaves replicating certain Sets keys from the master. When
accessing the data on the slave, we want to peform intersections between
such Sets values. However we don't want to intersect each time: to cache
the intersection for some time often is a good idea.

To do so, it is possible to setup a slave as a writable slave, and
perform the intersection on the slave side, perhaps setting a TTL on the
resulting key so that it will expire after some time.

THE BUG

Problem: in order to have a consistent replication, expiring of keys in
Redis replication is up to the master, that synthesize DEL operations to
send in the replication stream. However slaves logically expire keys
by hiding them from read attempts from clients so that if the master did
not promptly sent a DEL, the client still see logically expired keys
as non existing.

Because slaves don't actively expire keys by actually evicting them but
just masking from the POV of read operations, if a key is created in a
writable slave, and an expire is set, the key will be leaked forever:

1. No DEL will be received from the master, which does not know about
such a key at all.

2. No eviction will be performed by the slave, since it needs to disable
eviction because it's up to masters, otherwise consistency of data is
lost.

THE FIX

In order to fix the problem, the slave should be able to tag keys that
were created in the slave side and have an expire set in some way.

My solution involved using an unique additional dictionary created by
the writable slave only if needed. The dictionary is obviously keyed by
the key name that we need to track: all the keys that are set with an
expire directly by a client writing to the slave are tracked.

The value in the dictionary is a bitmap of all the DBs where such a key
name need to be tracked, so that we can use a single dictionary to track
keys in all the DBs used by the slave (actually this limits the solution
to the first 64 DBs, but the default with Redis is to use 16 DBs).

This solution allows to pay both a small complexity and CPU penalty,
which is zero when the feature is not used, actually. The slave-side
eviction is encapsulated in code which is not coupled with the rest of
the Redis core, if not for the hook to track the keys.

TODO

I'm doing the first smoke tests to see if the feature works as expected:
so far so good. Unit tests should be added before merging into the
4.0 branch.
2016-12-13 18:34:04 +01:00
Yossi Gottlieb
80944aac7f Fix redis-cli rare crash.
This happens if the server (mysteriously) returns an unexpected response
to the COMMAND command.
2016-12-12 19:37:19 +01:00
antirez
8226f2c3a7 Redis 4.0.0-RC2 (3.9.102). 2016-12-06 09:30:00 +01:00