Commit Graph

2987 Commits

Author SHA1 Message Date
c13d787d13 Fix redis-trib import SCAN call 2014-12-11 15:07:49 +01:00
b3349204b8 Reconnect redis-cli when cluster return "moved"
if redis works in cluster-mode and redis-cli was run with argv, reconnect if needs.
    example:
    ./redis-cli set foo bar

    if return is MOVED redis-cli just do nothing.
2014-12-11 15:07:49 +01:00
2f52a1191f zipmap.c: update comments above 2014-12-09 16:01:11 +01:00
c86b031572 replaced // comments #2150 2014-12-09 15:26:22 +01:00
0aac7ad8ff redis-benchmark AUTH command to be discarded after the first send #2150 2014-12-09 15:26:22 +01:00
c5b449ea55 sds.c: Correct two spelling mistakes in comments 2014-12-09 15:14:09 +01:00
559cefce13 sds.c/sdscatvprintf: set va_end to finish va_list cpy 2014-12-09 15:14:09 +01:00
3959fa2c02 sds.c: Correct some comments 2014-12-09 15:14:09 +01:00
24ae9a4a82 redis-benchmark: default num of requests is now 100000.
10000 completes in a too short time and may easily provide unreliable
figures because of tiny duration.
2014-12-09 13:02:10 +01:00
97d31c63e8 fix benchmark memleak in loop mode 2014-12-09 13:02:10 +01:00
73996c8615 Cluster PUBLISH message: fix totlen count.
bulk_data field size was not removed from the count. It is not possible
to declare it simply as 'char bulk_data[]' since the structure is nested
into another structure.
2014-12-09 13:01:47 +01:00
2533e2994e Include stropts only if __sun is defined. 2014-12-09 12:59:36 +01:00
52bc358c11 Fix implicit declaration of ioctl on Solaris 2014-12-09 12:57:56 +01:00
aa130caeae bitops.c/bitopCommand: skip short minlen for FAST PATH 2014-12-09 12:46:43 +01:00
5fc55a1afa bitops.c/redisPopcount: little optimization in loop 2014-12-09 12:46:43 +01:00
5ab2c31189 Silence _BSD_SOURCE warnings in glibc 2.20 and forward
See https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes
2014-12-09 12:24:28 +01:00
bafd82167b sparkline.c: AddSample skip Empty label 2014-12-09 11:28:50 +01:00
6370afc281 sparkline.c: mov label-ini into the AddSample Function 2014-12-09 11:28:50 +01:00
c8305accc3 Only ignore sigpipe in interactive mode
This allows shell pipes to correctly end redis-cli.

Ref #2066
2014-12-09 09:01:08 +01:00
e7d6f51dcb Check that tcp-backlog is matched by /proc/sys/net/core/somaxconn. 2014-12-04 11:07:52 +01:00
8a67e5d456 Network bandwidth tracking + refactoring.
Track bandwidth used by clients and replication (but diskless
replication is not tracked since the actual transfer happens in the
child process).

This includes a refactoring that makes tracking new instantaneous
metrics simpler.
2014-12-03 12:17:15 +01:00
8fb0d455d4 Don't show the ASCII logo if syslog is enabled.
Closes issue #1935.
2014-12-03 10:52:07 +01:00
b42e00065f Handle infinite explicitly in createStringObjectFromLongLong(). 2014-12-03 10:41:03 +01:00
b6b7bc0bff Use exp format and more precision output for ZSCAN.
Ref: issue #2175
2014-12-03 10:41:03 +01:00
6a0b1b5b43 Over 80 chars comment trimmed in pfcountCommand(). 2014-12-02 17:03:20 +01:00
69efb59ac7 Mark PFCOUNT as read-only, even if not true.
PFCOUNT is technically speaking a write command, since the cached value
of the HLL is exposed in the data structure (design error, mea culpa), and
can be modified by PFCOUNT.

However if we flag PFCOUNT as "w", read only slaves can't execute the
command, which is a problem since there are environments where slaves
are used to scale PFCOUNT reads.

Nor it is possible to just prevent PFCOUNT to modify the data structure
in slaves, since without the cache we lose too much efficiency.

So while this commit allows slaves to create a temporary inconsistency
(the strings representing the HLLs in the master and slave can be
different in certain moments) it is actually harmless.

In the long run this should be probably fixed by turning the HLL into a
more opaque representation, for example by storing the cached value in
the part of the string which is not exposed (this should be possible
with SDS strings).
2014-12-02 17:01:53 +01:00
4c1b3add7f Fix DEBUG OBJECT lru field to report seconds.
Because of (not so) recent Redis changes, now the LRU internally
reported unit is milliseconds, not seconds, but the DEBUG OBJECT output
was still claiming seconds while providing milliseconds.
However OBJECT IDLETIME was working as expected, which is the correct
API to use.
2014-11-26 16:40:04 +01:00
1490809f1f Document redis-cli --stat in --help output. 2014-11-25 18:25:55 +01:00
f2876f6cf7 Avoid valgrind memory leak false positive in processInlineBuffer().
zmalloc(0) cauesd to actually trigger a non-zero allocation since with
standard libc malloc we have our own zmalloc header for memory tracking,
but at the same time the returned pointer is at the end of the block and
not in the middle. This triggers a false positive when testing with
valgrind.

When the inline protocol args count is 0, we now avoid reallocating
c->argv, preventing the issue to happen.
2014-11-25 14:51:00 +01:00
6b53b32ba2 Fix non-linux builds error introduced with THP checks. 2014-11-14 17:19:58 +01:00
d071e5feab Lua: Add bitop
A few people have written custom C commands because bit
manipulation isn't exposed through Lua.  Let's give
them Mike Pall's bitop.

This adds bitop 1.0.2 (2012-05-08) from http://bitop.luajit.org/

bitop is imported as "bit" into the global namespace.

New Lua commands: bit.tobit, bit.tohex, bit.bnot, bit.band, bit.bor, bit.bxor,
bit.lshift, bit.rshift, bit.arshift, bit.rol, bit.ror, bit.bswap

Verification of working (the asserts would abort on error, so (nil) is correct):
127.0.0.1:6379> eval "assert(bit.tobit(1) == 1); assert(bit.band(1) == 1); assert(bit.bxor(1,2) == 3); assert(bit.bor(1,2,4,8,16,32,64,128) == 255)" 0
(nil)
127.0.0.1:6379> eval 'assert(0x7fffffff == 2147483647, "broken hex literals"); assert(0xffffffff == -1 or 0xffffffff == 2^32-1, "broken hex literals"); assert(tostring(-1) == "-1", "broken tostring()"); assert(tostring(0xffffffff) == "-1" or tostring(0xffffffff) == "4294967295", "broken tostring()")' 0
(nil)

Tests also integrated into the scripting tests and can be run with:
./runtest --single unit/scripting

Tests are excerpted from `bittest.lua` included in the bitop distribution.
2014-11-14 17:18:43 +01:00
c623f0ac50 THP detection for LATENCY DOCTOR. 2014-11-12 11:17:44 +01:00
868f40c165 Check THP support at startup and warn about it. 2014-11-12 11:17:44 +01:00
e293cfcffb THP detection / reporting functions added. 2014-11-12 11:17:44 +01:00
90911905f8 Diskless SYNC: fix RDB EOF detection.
RDB EOF detection was relying on the final part of the RDB transfer to
be a magic 40 bytes EOF marker. However as the slave is put online
immediately, and because of sockets timeouts, the replication stream is
actually contiguous with the RDB file.

This means that to detect the EOF correctly we should either:

1) Scan all the stream searching for the mark. Sucks CPU-wise.
2) Start to send the replication stream only after an acknowledge.
3) Implement a proper chunked encoding.

For now solution "2" was picked, so the master does not start to send
ASAP the stream of commands in the case of diskless replication. We wait
for the first REPLCONF ACK command from the slave, that certifies us
that the slave correctly loaded the RDB file and is ready to get more
data.
2014-11-12 09:51:29 +01:00
78ac9b7f11 Disconnect timedout slave: regression introduced with diskless repl. 2014-11-12 09:51:29 +01:00
75e68625f1 Parse cluster state file in IPv6 compatible way
We need to pick the port based on the _last_ colon, not the first one.
2014-10-31 10:39:33 +01:00
bb0ff49ea3 Fix redis-trib.rb IP:Port disassembly for IPv6
IP format is now any of:
  - 127.0.0.1:6379
  - ::1:6379
2014-10-31 10:39:33 +01:00
f1a6f78024 Networking: add more outbound IP binding fixes
Same as the original bind fixes (we just missed these the
first time around).

This helps Redis not automatically send
connections from the first IP on an interface if we are bound
to a specific IP address (e.g. with multiple IP aliases on one
interface, you want to send from _your_ IP, not from the first IP
on the interface).
2014-10-31 10:02:42 +01:00
e8f7899ae2 redis-cli: ignore SIGPIPE network errors
Closes #2066
2014-10-30 12:02:28 +01:00
2480315f2a redis-cli: add missing newline in error message. 2014-10-29 14:27:15 +01:00
f0124c1d90 Fix DEBUG POPULATE warning for lack of casting. 2014-10-29 14:27:15 +01:00
6231c42ed6 Diskless replication: missing listRewind() added.
This caused BGSAVE to be triggered a second time without any need when
we switch from socket to disk target via the command

    CONFIG SET repl-diskless-sync no

and there is already a slave waiting for the BGSAVE to start.
Also comments clarified about what is happening.
2014-10-29 14:26:48 +01:00
18698b5269 Log slave ip:port in more log messages. 2014-10-29 14:26:48 +01:00
f687976601 Use new slave name function for diskless repl reporting. 2014-10-29 14:26:48 +01:00
2fd3fc7f01 Added a function to get slave name for logs. 2014-10-29 14:26:48 +01:00
e1c0a25ca4 Diskless replication: log BGSAVE delay only when it is non-zero. 2014-10-29 14:26:48 +01:00
6bbeb8c535 Diskless sync delay is now configurable. 2014-10-29 14:26:48 +01:00
2882f819f4 Remove duplicated log message about starting BGSAVE. 2014-10-29 14:26:48 +01:00
575c80041c Diskless replication: child -> parent communication improved.
Child now reports full info to the parent including IDs of slaves in
failure state and exit code.
2014-10-29 14:26:48 +01:00