Commit Graph

3377 Commits

Author SHA1 Message Date
Geoff Garside
e0cb24351c Use getaddrinfo(3) in a anetTcpServer.
Change anetTcpServer() function to use getaddrinfo(3) to perform
address resolution, socket creation and binding. Resolved addresses
are limited to those reachable by the AF_INET address family.
2013-07-08 15:49:22 +02:00
Geoff Garside
0e01ce1b13 Use getaddrinfo(3) in anetTcpGenericConnect.
Change anetTcpGenericConnect() function to use getaddrinfo(3) to
perform address resolution, socket creation and connection. Resolved
addresses are limited to those reachable by the AF_INET family.
2013-07-08 15:49:22 +02:00
Geoff Garside
580b7dce9b 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
071963c855 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
64b3b9b1d4 Example redis.conf: bind to multiple interfaces documented. 2013-07-08 10:42:22 +02:00
antirez
98eecb70eb Binding multiple IPs done properly with multiple sockets. 2013-07-05 11:47:20 +02:00
antirez
2160effc78 Revert "Cluster: use new anet.c listening socket creation API."
This reverts commit 016ac38a21.
2013-07-05 11:08:44 +02:00
antirez
c978b864f7 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 bd234d62bb.
2013-07-05 11:07:55 +02:00
antirez
90b0d66cce Ability to bind multiple addresses. 2013-07-04 18:50:15 +02:00
antirez
016ac38a21 Cluster: use new anet.c listening socket creation API. 2013-07-04 18:49:49 +02:00
antirez
bd234d62bb anet.c: Allow creation of TCP listening sockets bound to N addresses. 2013-07-04 18:48:46 +02:00
antirez
585b0a61ce sds.c: new function sdsjoin() to join strings. 2013-07-04 18:30:59 +02:00
antirez
1135e9faa2 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
fbb97c6b13 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
7e63167d27 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
7d626d4975 Merge pull request #776 from charsyam/ziplist-bug
fix randstring bug in ziplist.c
2013-07-02 03:18:18 -07:00
antirez
1b10522a08 Only allow basenames for dbfilename and appendfilename.
This fixes issue #1094.
2013-07-02 12:14:28 +02:00
antirez
6978aeb3bf 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
0781ad6899 getAbsolutePath() moved into utils.c 2013-07-02 11:56:52 +02:00
antirez
de9a221749 CONFIG SET maxclients. 2013-06-28 17:08:03 +02:00
antirez
8e2d082066 ae.c event loop: API to resize the fd set size on the run. 2013-06-28 16:39:49 +02:00
antirez
3130670b97 Allow SHUTDOWN in loading state. 2013-06-27 12:18:29 +02:00
antirez
13585dd677 function renamed: popcount_binary -> redisPopcount. 2013-06-26 15:19:06 +02:00
Salvatore Sanfilippo
bae60ede1d Merge pull request #1111 from yamt/netbsd3
netbsd support
2013-06-26 06:17:02 -07:00
antirez
8ca265cdb7 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
d5f1e4b0b5 Test: add some AOF testing to EVALSHA replication test. 2013-06-25 15:49:07 +02:00
antirez
73d7955c6f Flush the replication script cache after SCRIPT FLUSH. 2013-06-25 15:36:48 +02:00
antirez
882e36366f Test: EVALSHA replication. 2013-06-25 15:35:48 +02:00
antirez
d1f2d0733c Test: randomInt() behavior commented. 2013-06-25 15:32:37 +02:00
antirez
7e5be50cbf Test: replication-3 test speedup in master-slave setup. 2013-06-25 15:13:14 +02:00
antirez
fb67468813 Force propagation of SCRIPT LOAD to AOF. 2013-06-25 12:49:56 +02:00
antirez
e27b136069 SCRIPT FLUSH comment minor pedantic improvement. 2013-06-25 10:56:59 +02:00
antirez
82ea1c6f5d 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
f0bf5fd8c7 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
94ec7db470 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
515a26bbc1 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
b0c2cdd6a7 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
5ac7ca9c94 Initialize char* to NULL to remove compiler warning 2013-06-20 17:53:35 +03:00
antirez
519c9e11d1 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
455563faec 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
4c0f8c4e5a 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
b02bb47e67 Test: regression test for #1163. 2013-06-19 18:53:07 +02:00
antirez
f8ba3b5668 Fix comment typo in integration/aof.tcl. 2013-06-19 18:31:33 +02:00
antirez
d363299af3 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
338cd4835d 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
9c2c878e45 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
51adc6e1bc 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
b96ba52cfa 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
82d782d3b5 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
edd7eb9b7d 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