4570 Commits

Author SHA1 Message Date
Jan-Erik Rediger
71955c513a install_server.sh: add missing bang
This was discovered by _bodya and reported in the IRC channel.
Everything worked fine as these scripts are always executed as shell
scripts.

Closes #1728
2014-08-26 10:41:02 +02:00
Edgars Irmejs
b6b6bcbe70 Change unixsocketperm comment to 700 from 755
According to unix manuals, "Connecting to the socket object requires
read/write permission." -- mode 755 is useless for anybody
other than the owner.

Fixes #1696
2014-08-26 10:41:02 +02:00
ripcurld00d
9f98303bdb redis-check-dump: use names instead of magic nums
Use constants to avoid magic numbers in `types`, which is an array
that stores the names of `REDIS` types.

Closes #1681
2014-08-26 10:41:02 +02:00
Kashif Rasul
54e054fff3 Fix issues raised by clang analyzer
Modified by @antirez since the original fix to genInfoString() looked
weak. Probably the clang analyzer complained about `section` being
possibly NULL, and strcasecmp() called with a NULL pointer. In the
practice this can never happen, still for the sake of correctness
the right fix is not to modify only the first call, but to set `section`
to the value of "default" if it happens to be NULL.

Closes #1660
2014-08-26 10:41:02 +02:00
antirez
59c084860d Force quit when receiving a second SIGINT.
Also quit ASAP when we are still loading a DB, since care is not needed
in this special condition, especially for a SIGINT.
2014-08-26 10:41:01 +02:00
Matt Stancliff
5bc57330cd Add graceful exit when Ctrl-C is received 2014-08-26 10:41:01 +02:00
Matt Stancliff
56558ba989 Fix intset midpoint selection
The classic (min+max)/2 is provably unsafe.  Fixed
as recommended in research:
http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html

Fix inspired by @wjin, but I used a different approach.
(later, I found @kuebler fixed the same issue too).

Fixes #1741, #1602
2014-08-26 10:41:01 +02:00
Matt Stancliff
14cedd4279 Fix key extraction for SORT
We only want to use the last STORE key, but we have to record
we actually found a STORE key so we can increment the final return
key count.

Test added to prevent further regression.

Closes #1883, #1645, #1647
2014-08-26 10:41:01 +02:00
Jan-Erik Rediger
b7a4cfb4b3 Handle large getrange requests
Previously the end was casted to a smaller type
which resulted in a wrong check and failed
with values larger than handled by unsigned.

Closes #1847, #1844
2014-08-26 10:41:01 +02:00
Matt Stancliff
9d4ebed9e9 scripting: no eval with negative key count
Negative key count causes segfault in Lua functions.

Fixes #1842
Closes #1843
2014-08-26 10:41:01 +02:00
kingsumos
9ac7787838 cluster: fix node connection memory leak
Cluster leaks memory while connecting due to missing freeaddrinfo()

(Commit modified by @antirez. The freeaddrinfo() call was misplaced so
 in case of no address was bound, the memory leak was still there).

Closes #1801
2014-08-26 10:41:01 +02:00
Jan-Erik Rediger
bc9a5bbed4 redis-cli: fix latency result output
(Cleaned up a little by @mattsta)

Closes #1774
2014-08-26 10:41:01 +02:00
Wei Jin
4215bf453a Remove redundant else/return block
Fixes #1741
2014-08-26 10:41:01 +02:00
antirez
409f5d71e7 Clarify AIX "#undef hz". 2014-08-26 10:41:01 +02:00
siahl
a95888ecb4 Add support for compiling on AIX
Closes #1900
2014-08-26 10:41:01 +02:00
Matt Stancliff
161a5acf75 redis-cli: Add --no-raw option
Some people need formatted output even when they have no
interactive tty.

Fixes #760
2014-08-26 10:41:01 +02:00
Matt Stancliff
7693b84b35 redis-cli: stop showing incorrectly selected DB
Previously redis-cli would happily show "-1" or "99999"
as valid DB choices.

Now, if the SELECT call returned an error, we don't update
the DB number in the CLI.

Inspired by @anupshendkar in #1313

Fixes #566, #1313
2014-08-26 10:41:01 +02:00
Matt Stancliff
839608569e redis-cli: Re-attach selected DB after auth
Previously, if you did SELECT then AUTH, redis-cli
would show your SELECT'd db even though it didn't
happen.

Note: running into this situation is a (hopefully) very limited
used case of people using multiple DBs and AUTH all at the same
time.

Fixes antirez#1639
2014-08-26 10:41:01 +02:00
antirez
f3b0cbd15c Redis 2.9.57 (Redis 3.0.0 beta-8). 3.0.0-beta8 2014-07-29 10:17:48 +02:00
Yossi Gottlieb
8ea459cc9b Fail SYNC if background save child aborted due to a signal. 2014-07-28 14:55:10 +02:00
vps
c2cfdc2c38 * fixed doc URL for keyspace events 2014-07-28 14:55:10 +02:00
antirez
f2cb04e18c Cluster test: unit 07, replicas migration. 2014-07-28 14:55:10 +02:00
antirez
f2fd98bef9 Cluster test: unit 06 cluster creation comment fixed. 2014-07-28 14:55:10 +02:00
Matt Robenolt
9d30ffa405 Fix spelling of "stand alone" in ascii art
Also unified the logic to match `genRedisInfoString`
2014-07-28 14:55:10 +02:00
antirez
582d8c0c66 Cluster test: node reachability condition fixed. 2014-07-28 14:55:10 +02:00
antirez
f54162074e Cluster test: init test, be patient during restarts. 2014-07-28 14:55:10 +02:00
antirez
999205736b Cluster test: 03 unit speedup, don't send WAIT to slaves. 2014-07-28 14:55:10 +02:00
antirez
b43c44a196 Cluster test: unit 06, slaves with stale data can't failover. 2014-07-28 14:55:10 +02:00
antirez
bf267d3083 Example redis.conf: improve slaveof description. 2014-07-28 14:55:10 +02:00
antirez
1400b6679a Cluster test: new unit 05, slave selection. 2014-07-28 14:55:10 +02:00
antirez
c5bd330f9e Cluster: don't migrate to a master that never had slaves.
Replica migration algorithm modified so that slaves never try to migrate
to masters that were never configured to have slaves in the past.
We want the algorithm to take care of masters that remained without
*working* slaves, but that used to have slaves according to the cluster
configuration.
2014-07-28 14:55:10 +02:00
antirez
5a4a86707e Fix util.c compilation by including stdint.h. 2014-07-23 18:01:58 +02:00
antirez
d6f309d4c0 Faster ll2string() implementation.
Based on ideas documented in this blog post:

https://www.facebook.com/notes/facebook-engineering/three-optimization-tips-for-c/10151361643253920

The original code was modified to handle signed integers, reformetted to
fit inside the Redis code base, and was stress-tested with a program
in order to validate the implementation against snprintf().

Redis was measured to be measurably faster from the point of view of
clients in real-world operations because of this change, since sometimes
number to string conversion is used extensively (for example every time
a GET results into an integer encoded object to be returned to the
user).
2014-07-23 14:58:28 +02:00
antirez
dd50295de6 PFSELFTEST: less false positives.
This is just a quickfix, for the nature of the test the right way to fix
it is to average the error of N runs, since otherwise it is always
possible to get a false positive with a bad run, or to minimize too much
this possibility we may end testing with too much "large" error ranges.
2014-07-23 11:45:08 +02:00
antirez
42f4a83ed7 Test: check sorted set elements order after union.
This is not a regression but issue #1786 showed the need for this test.
2014-07-23 09:41:01 +02:00
antirez
b46271cc78 Remove useless var and check in zunionInterGenericCommand(). 2014-07-23 09:41:01 +02:00
antirez
5e88bd0526 ZUNIONSTORE reimplemented for speed.
The user @kjmph provided excellent ideas to improve speed of ZUNIONSTORE
(in certain cases by many order of magnitude), together with an
implementation of the ideas.

While the ideas were sounding, the implementation could be improved both
in terms of speed and clearness, so that's my attempt at reimplementing
the speedup proposed, trying to improve by directly using just a
dictionary with an embedded score inside, and reusing the single-pass
aggregate + order-later approach.

Note that you can't apply this commit without applying the previous
commit in this branch that adds a double in the dictEntry value union.

Issue #1786.
2014-07-23 09:41:01 +02:00
antirez
36498152f5 Add double field in dict.c entry value union. 2014-07-23 09:41:01 +02:00
antirez
955b25624e CLUSTER RESET: Flush dataset if node is a slave.
For non-empty masters, CLUSTER RESET is denied, and the user requires to
start to reset a node by explicitly clearing it with FLUSHALL.
However CLUSTER RESET when executed with slaves don't have this
restrictions since data is just a replica of the master, and with
read-only slaves it is also not possible to remove the data set. However
the node was turned from slave to master after a reset, without touching
the old slave data. This is 99.99% of times not appropriate and forces
full resets to follow this path to work with both slave and master
nodes:

    FLUSHALL
    CLUSTER RESET HARD
    FLUSHALL

Since we need the first flushall for masters, and the second for slaves.

This commit changes the behavior so that CLUSTER RESET removes the data set
of a slave node during a reset, in the moment it gets turned into a master,
so the new pattern is simply:

    FLUSHALL (that may fail for slaves)
    CLUSTER RESET
2014-07-23 09:41:01 +02:00
antirez
e8199b67e3 Cluster test: use larger keyspace in resharding test. 2014-07-23 09:41:01 +02:00
antirez
b4937427db Cluster test: unit 04, consistency during resharding. 2014-07-23 09:41:01 +02:00
antirez
16a66581fe Cluster: fix redis-trib --from all. 2014-07-23 09:41:01 +02:00
antirez
ec054b36c3 redis-trib: allow to reshard in non-interactive way.
The introduction of --from --to --slots --yes options allow to reshard
from cli in an automated way from scripts. The code is ugly and needs
refactoring as soon as we get it in RC / stable release.
2014-07-23 09:41:01 +02:00
antirez
e6ac6a170b Cluster test: test that writes are retained during failovers.
In the test we use WAIT when the master and slave are up, and only later the
partition is created killing the master, so we are sure we don't incur
in failure modes that may lose writes in this test: the goal here is to
make sure that the elected slave was replicating correctly with the
master.
2014-07-23 09:41:01 +02:00
antirez
d080eea03d Test: Pub/Sub PING. 2014-07-18 12:20:56 +02:00
antirez
e236199be8 Test: small integer sharing depends on maxmemory policy. 2014-07-18 12:20:56 +02:00
antirez
29e1c431bd PING: backward compatible error for wrong number of args. 2014-07-18 12:20:56 +02:00
antirez
2570eeb711 tryObjectEncoding(): use shared objects with maxmemory and non-LRU policy.
In order to make sure every object has its own private LRU counter, when
maxmemory is enabled tryObjectEncoding() does not use the pool of shared
integers. However when the policy is not LRU-based, it does not make
sense to do so, and it is much better to save memory using shared
integers.
2014-07-18 12:20:56 +02:00
antirez
2264b9816c Variadic PING with support for Pub/Sub.
PING can now be called with an additional arugment, behaving exactly
like the ECHO command. PING can now also be called in Pub/Sub mode (with
one more more subscriptions to channels / patterns) in order to trigger
the delivery of an asynchronous pong message with the optional payload.

This fixes issue #420.
2014-07-18 12:20:56 +02:00
antirez
23c1408963 PubSub clients refactoring and new PUBSUB flag.
The code tested many times if a client had active Pub/Sub subscriptions
by checking the length of a list and dictionary where the patterns and
channels are stored. This was substituted with a client flag called
REDIS_PUBSUB that is simpler to test for. Moreover in order to manage
this flag some code was refactored.

This commit is believed to have no effects in the behavior of the
server.
2014-07-18 12:20:56 +02:00