3675 Commits

Author SHA1 Message Date
Geoff Garside
ac940caf4f Add anetSetReuseAddr(err, fd) static function.
Extract setting SO_REUSEADDR socket option into separate function
so the same code can be more easily used by anetCreateSocket and
other functions.
2013-07-08 15:49:22 +02:00
Geoff Garside
13c44e7b07 Use getaddrinfo(3) in anetResolve. #apichange
Change anetResolve() function to use getaddrinfo(3) to resolve hostnames.
Resolved hostnames are limited to those reachable by the AF_INET address
family.

API Change: anetResolve requires additional argument.
  additional argument required to specify the length of the character
  buffer the IP address is written to in order to comply with
  inet_ntop(3) function semantics. inet_ntop(3) replaces inet_ntoa(3)
  as it has been designed to be compatible with more address families.
2013-07-08 15:47:57 +02:00
antirez
eb0d75f21a Example redis.conf: bind to multiple interfaces documented. 2013-07-08 10:42:22 +02:00
antirez
d3cde09645 Binding multiple IPs done properly with multiple sockets. 2013-07-05 11:47:20 +02:00
antirez
8ea3b1e79d Revert "Cluster: use new anet.c listening socket creation API."
This reverts commit c5e87a13de69dba4f9d9017271ba59fe36231144.
2013-07-05 11:08:44 +02:00
antirez
f6c4fa5ff2 Revert "anet.c: Allow creation of TCP listening sockets bound to N addresses."
Bind() can't be called multiple times against the same socket, multiple
sockets are required to bind multiple interfaces, silly me.

This reverts commit e0be252d5ea895ed0adb43d8d14f2bee233c6953.
2013-07-05 11:07:55 +02:00
antirez
bd9b1251ac Ability to bind multiple addresses. 2013-07-04 18:50:15 +02:00
antirez
c5e87a13de Cluster: use new anet.c listening socket creation API. 2013-07-04 18:49:49 +02:00
antirez
e0be252d5e anet.c: Allow creation of TCP listening sockets bound to N addresses. 2013-07-04 18:48:46 +02:00
antirez
de40c9df4f sds.c: new function sdsjoin() to join strings. 2013-07-04 18:30:59 +02:00
antirez
01430e6599 redis-cli: introduced --pipe-timeout.
When in --pipe mode, after all the data transfer to the server is
complete, now redis-cli waits at max the specified amount of
seconds (30 by default, use 0 to wait forever) without receiving any
reply at all from the server. After this time limit the operation is
aborted with an error.

That's related to issue #681.
2013-07-03 12:22:03 +02:00
antirez
703cd738dc redis-cli --pipe: send final ECHO in a safer way.
If the protocol read from stdin happened to contain grabage (invalid
random chars), in the previous implementation it was possible to end
with something like:

dksfjdksjflskfjl*2\r\n$4\r\nECHO....

That is invalid as the *2 should start into a new line. Now we prefix
the ECHO with a CRLF that has no effects on the server but prevents this
issues most of the times.

Of course if the offending wrong sequence is something like:

$3248772349\r\n

No one is going to save us as Redis will wait for data in the context of
a big argument, so this fix does not cover all the cases.

This partially fixes issue #681.
2013-07-03 11:59:44 +02:00
antirez
4a6701d7ec pqsort.c: remove the "switch to insertion sort" optimization.
It causes catastrophic performance for certain inputs.

Relevant NetBSD commit:

http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdlib/qsort.c?rev=1.20&content-type=text/x-cvsweb-markup&only_with_tag=MAIN

This fixes issue #968.
2013-07-02 17:47:32 +02:00
Salvatore Sanfilippo
10aca2ba76 Merge pull request #776 from charsyam/ziplist-bug
fix randstring bug in ziplist.c
2013-07-02 03:18:18 -07:00
antirez
37b5ec9425 Only allow basenames for dbfilename and appendfilename.
This fixes issue #1094.
2013-07-02 12:14:28 +02:00
antirez
0726c25900 pathIsBaseName() added to utils.c
The function is used to test that the specified string looks like just
as the basename of a path, without any absolute or relative path.
2013-07-02 12:08:07 +02:00
antirez
f57a871de0 getAbsolutePath() moved into utils.c 2013-07-02 11:56:52 +02:00
antirez
f4805fa45a CONFIG SET maxclients. 2013-06-28 17:08:03 +02:00
antirez
9281336e6b ae.c event loop: API to resize the fd set size on the run. 2013-06-28 16:39:49 +02:00
antirez
e94b5b9359 Allow SHUTDOWN in loading state. 2013-06-27 12:18:29 +02:00
antirez
1065918c36 function renamed: popcount_binary -> redisPopcount. 2013-06-26 15:19:06 +02:00
Salvatore Sanfilippo
a59318f0a4 Merge pull request #1111 from yamt/netbsd3
netbsd support
2013-06-26 06:17:02 -07:00
antirez
cdaacf03aa Don't disconnect pre PSYNC replication clients for timeout.
Clients using SYNC to replicate are older implementations, such as
redis-cli --slave, and are not designed to acknowledge the master with
REPLCONF ACK commands, so we don't have any feedback and should not
disconnect them on timeout.
2013-06-26 10:11:20 +02:00
antirez
600567383a Test: add some AOF testing to EVALSHA replication test. 2013-06-25 15:49:07 +02:00
antirez
e9f50cb1a1 Flush the replication script cache after SCRIPT FLUSH. 2013-06-25 15:36:48 +02:00
antirez
1ff422dc47 Test: EVALSHA replication. 2013-06-25 15:35:48 +02:00
antirez
31f34595c6 Test: randomInt() behavior commented. 2013-06-25 15:32:37 +02:00
antirez
c43286e5a9 Test: replication-3 test speedup in master-slave setup. 2013-06-25 15:13:14 +02:00
antirez
32b465b998 Force propagation of SCRIPT LOAD to AOF. 2013-06-25 12:49:56 +02:00
antirez
a4a60080b7 SCRIPT FLUSH comment minor pedantic improvement. 2013-06-25 10:56:59 +02:00
antirez
8338e50127 Move Replication Script Cache initialization in safer place.
It should be called just one time at startup and not every time the Lua
scripting engine is re-initialized, otherwise memory is leaked.
2013-06-24 19:27:49 +02:00
antirez
eaebabe564 Use the RSC to replicate EVALSHA unmodified.
This commit uses the Replication Script Cache in order to avoid
translating EVALSHA into EVAL whenever possible for both the AOF and
slaves.
2013-06-24 18:57:31 +02:00
antirez
a9e1c46f40 Replication of scripts as EVALSHA: sha1 caching implemented.
This code is only responsible to take an LRU-evicted fixed length cache
of SHA1 that we are sure all the slaves received.

In this commit only the implementation is provided, but the Redis core
does not use it to actually send EVALSHA to slaves when possible.
2013-06-24 10:26:04 +02:00
antirez
08dff9fb66 New API to force propagation.
The old REDIS_CMD_FORCE_REPLICATION flag was removed from the
implementation of Redis, now there is a new API to force specific
executions of a command to be propagated to AOF / Replication link:

    void forceCommandPropagation(int flags);

The new API is also compatible with Lua scripting, so a script that will
execute commands that are forced to be propagated, will also be
propagated itself accordingly even if no change to data is operated.

As a side effect, this new design fixes the issue with scripts not able
to propagate PUBLISH to slaves (issue #873).
2013-06-21 12:07:53 +02:00
Salvatore Sanfilippo
e73548b0ee Merge pull request #1167 from badboy/patch-1
Initialize char* to NULL to remove compiler warning
2013-06-20 07:56:31 -07:00
Jan-Erik Rediger
21afa5dbed Initialize char* to NULL to remove compiler warning 2013-06-20 17:53:35 +03:00
antirez
c0a47ea63c Allow PUBSUB NUMSUB without channels.
The result is an empty list but it is handy to call it programmatically.
2013-06-20 15:34:56 +02:00
antirez
d337302b90 PUBSUB command implemented.
Currently it implements three subcommands:

PUBSUB CHANNELS [<pattern>]    List channels with non-zero subscribers.
PUBSUB NUMSUB [channel_1 ...]  List number of subscribers for channels.
PUBSUB NUMPAT                  Return number of subscribed patterns.
2013-06-20 15:32:00 +02:00
antirez
8b49716f0d Sentinel: parse new INFO replication output correctly.
Sentinel was not able to detect slaves when connected to a very recent
version of Redis master since a previos non-backward compatible change
to INFO broken the parsing of the slaves ip:port INFO output.

This fixes issue #1164
2013-06-20 10:23:23 +02:00
antirez
5f770dcc2f Test: regression test for #1163. 2013-06-19 18:53:07 +02:00
antirez
96574ee610 Fix comment typo in integration/aof.tcl. 2013-06-19 18:31:33 +02:00
antirez
f352985cc1 Allow writes from scripts called by AOF loading in read-only slaves.
This fixes issue #1163
2013-06-19 18:25:03 +02:00
antirez
f0861f0116 Fix logStackTrace() when logging to stdout.
When the semantics changed from logfile = NULL to logfile = "" to log
into standard output, no proper change was made to logStackTrace() to
make it able to work with the new setup.

This commit fixes the issue.
2013-06-19 14:44:40 +02:00
antirez
058541f3be Lua script errors format more unified.
lua_pcall error handler now formats errors in a way more similar to
luaPushError() so that errors generated in different contexts look alike.
2013-06-18 19:30:56 +02:00
antirez
af2cadc4b7 Lua scripting: improve error reporting.
When calling Lua scripts we try to report not just the error but
information about the code line causing the error.
2013-06-18 17:33:35 +02:00
Salvatore Sanfilippo
8cf042f959 Merge pull request #1124 from ioddly/fix-issue-1121
Try to report source of bad Lua API calls
2013-06-17 03:14:31 -07:00
Salvatore Sanfilippo
3acb4acba8 Merge pull request #819 from Keruspe/unstable
test-server: only listen to 127.0.0.1
2013-06-17 03:08:14 -07:00
Marc-Antoine Perennou
f9eef102c8 test-server: only listen to 127.0.0.1
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2013-06-12 22:49:32 +02:00
antirez
811c5a2cdf Cluster: detect nodes address change. 2013-06-12 10:50:07 -07:00
antirez
fffc5f809e clusterProcessPacket() comments improved for correctness. 2013-06-11 21:34:34 +02:00