summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Use cached time in expireCommand()less-mstimeantirez2015-05-041-1/+2
| | | | | | Should not be an issue given that the precision is the second here, at least if we are using a decent HZ value and the cached time refreshes enough times. So the cached time is only used if HZ is >= 10.
* Update cached time during slow scripts & transactionsantirez2015-05-042-1/+6
| | | | | | Commands may use cached time when the precision is not vital. It is a good idea to refresh it from time to time during the execution of long running scripts or transactions composed of quite a lot of commands.
* Less gettimeofday() calls in activeExpireCycle().antirez2015-04-301-3/+5
| | | | | | mstime() is not going to change significantly every 16 iterations, so now we update `now` with the current milliseconds time only when we check if the time limit was reached.
* Avoid gettimeofday() in expireIfNeeded() when possible.antirez2015-04-291-1/+15
| | | | | | | | | When the key expires far in the future compared to the cached time in server.mstime, calling mstime(), that calls gettimeofday(), should not be very useful. Instead when we are near the expire, we want the additional precision. This commit is related to issue #2552.
* A way to disable time accounting in call().antirez2015-04-292-4/+13
| | | | | | | | | | | | | | | | This commit allows to avoid two mstime() calls inside the call() function, when the following conditions are true: 1. slowlog is disabled. 2. latency monitoring is disabled. 3. command time acconuting is disabled. Note that '3' was not configurable, this patch just disable it without really allowing the user to turn it on, since this is currently an experiment. If the commit will be merged into unstable, proper support to configure this parameter will be added. Related to issue #2552.
* Merge branch 'unstable' of github.com:/antirez/redis into unstableantirez2015-04-291-3/+3
|\
| * Merge pull request #2550 from badboy/readme-fixesSalvatore Sanfilippo2015-04-291-3/+3
| |\ | | | | | | Fix spelling and grammatical errors in readme
| | * One more small fixJan-Erik Rediger2015-04-281-1/+1
| | |
| | * Fix spelling and grammatical errors in readmeJan-Erik Rediger2015-04-281-3/+3
| | | | | | | | | | | | Closes #2549
* | | Add header guard for ziplist.hantirez2015-04-291-0/+5
|/ / | | | | | | As suggested in #2543.
* | Fix Sentinel memory leak (hiredis bug)antirez2015-04-281-0/+1
|/ | | | | | | | | | | | | | | | | | | This fixes issue #2535, that was actually an hiredis library bug (I submitted an issue and fix to the redis/hiredis repo as well). When an asynchronous hiredis connection subscribes to a Pub/Sub channel and gets an error, and in other related conditions, the function redisProcessCallbacks() enters a code path where the link is disconnected, however the function returns before freeing the allocated reply object. This causes a memory leak. The memory leak was trivial to trigger in Redis Sentinel, which uses hiredis, every time we tried to subscribe to an instance that required a password, in case the Sentinel was configured either with the wrong password or without password at all. In this case, the -AUTH error caused the leaking code path to be executed. It was verified with Valgrind that after this change the leak no longer happens in Sentinel with a misconfigured authentication password.
* sha1.c: use standard uint32_t.antirez2015-04-272-11/+11
|
* Merge branch 'unstable' of github.com:/antirez/redis into unstableantirez2015-04-271-1/+1
|\
| * Merge pull request #2539 from itamarhaber/patch-4Salvatore Sanfilippo2015-04-241-1/+1
| |\ | | | | | | Added reference to IANA ticket for port 6379
| | * Added reference to IANA ticket for port 6379Itamar Haber2015-04-241-1/+1
| |/ | | | | Just so it's extra official :smile:
* | Example redis.conf doc about pidfile fixed.antirez2015-04-261-2/+9
|/ | | | An user changed the behavior via a PR without upgrading the doc.
* Net: improve prepareClientToWrite() error handling and comments.antirez2015-04-012-10/+37
| | | | | | | | | | | | | When we fail to setup the write handler it does not make sense to take the client around, it is missing writes: whatever is a client or a slave anyway the connection should terminated ASAP. Moreover what the function does exactly with its return value, and in which case the write handler is installed on the socket, was not clear, so the functions comment are improved to make the goals of the function more obvious. Also related to #2485.
* Merge pull request #2485 from oranagra/diskless-repl-fixesSalvatore Sanfilippo2015-04-012-1/+2
|\ | | | | fixes to diskless replication.
| * fixes to diskless replication.Oran Agra2015-03-312-1/+2
| | | | | | | | | | master was closing the connection if the RDB transfer took long time. and also sent PINGs to the slave before it got the initial ACK, in which case the slave wouldn't be able to find the EOF marker.
* | Test: be more patient waiting for servers to exit.antirez2015-03-311-1/+6
|/ | | | | This should likely fix a false positive when running with the --valgrind option.
* Fix setTypeNext call assuming NULL can be passed.antirez2015-03-311-2/+10
| | | | | | | | Segfault introduced during a refactoring / warning suppression a few commits away. This particular call assumed that it is safe to pass NULL to the object pointer argument when we are sure the set has a given encoding. This can't be assumed and is now guaranteed to segfault because of the new API of setTypeNext().
* Sentinel / Cluster test: exit with non-zero error code on failures.antirez2015-03-303-0/+16
|
* Set: setType*() API more defensive initializing both values.antirez2015-03-301-0/+6
| | | | | | | This change fixes several warnings compiling at -O3 level with GCC 4.8.2, and at the same time, in case of misuse of the API, we have the pointer initialize to NULL or the integer initialized to the value -123456789 which is easy to spot by naked eye.
* Check bio.c job type at thread startup.antirez2015-03-301-0/+7
| | | | | Another one just to avoid a warning. Slightly more defensive code anyway.
* Ensure array index is in range in addReplyLongLongWithPrefix().antirez2015-03-301-2/+2
| | | | | Change done in order to remove a warning and improve code robustness. No actual bug here.
* Test: regression for issue #2473.antirez2015-03-271-8/+44
|
* dict.c: convert types to unsigned long where appropriate.antirez2015-03-271-7/+7
| | | | | | No semantical changes since to make dict.c truly able to scale over the 32 bit table size limit, the hash function shoulds and other internals related to hash function output should be 64 bit ready.
* dict.c: add casting to avoid compilation warning.antirez2015-03-271-1/+1
| | | | | | rehashidx is always positive in the two code paths, since the only negative value it could have is -1 when there is no rehashing in progress, and the condition is explicitly checked.
* Replication: disconnect blocked clients when switching to slave role.antirez2015-03-243-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug as old as Redis and blocking operations. It's hard to trigger since only happens on instance role switch, but the results are quite bad since an inconsistency between master and slave is created. How to trigger the bug is a good description of the bug itself. 1. Client does "BLPOP mylist 0" in master. 2. Master is turned into slave, that replicates from New-Master. 3. Client does "LPUSH mylist foo" in New-Master. 4. New-Master propagates write to slave. 5. Slave receives the LPUSH, the blocked client get served. Now Master "mylist" key has "foo", Slave "mylist" key is empty. Highlights: * At step "2" above, the client remains attached, basically escaping any check performed during command dispatch: read only slave, in that case. * At step "5" the slave (that was the master), serves the blocked client consuming a list element, which is not consumed on the master side. This scenario is technically likely to happen during failovers, however since Redis Sentinel already disconnects clients using the CLIENT command when changing the role of the instance, the bug is avoided in Sentinel deployments. Closes #2473.
* Cluster: redirection refactoring + handling of blocked clients.antirez2015-03-244-29/+102
| | | | | | | | | | | | | | | | | | | There was a bug in Redis Cluster caused by clients blocked in a blocking list pop operation, for keys no longer handled by the instance, or in a condition where the cluster became down after the client blocked. A typical situation is: 1) BLPOP <somekey> 0 2) <somekey> hash slot is resharded to another master. The client will block forever int this case. A symmentrical non-cluster-specific bug happens when an instance is turned from master to slave. In that case it is more serious since this will desynchronize data between slaves and masters. This other bug was discovered as a side effect of thinking about the bug explained and fixed in this commit, but will be fixed in a separated commit.
* Merge pull request #2470 from superlogical/unstableSalvatore Sanfilippo2015-03-241-2/+2
|\ | | | | create-cluster fix for stop and watch commands
| * create-cluster fix for stop and watch commandssuperlogical2015-03-241-2/+2
|/
* Cluster: unit 10 modified to leave cluster in proper state.antirez2015-03-221-0/+5
|
* Cluster: CLUSTER FAILOVER TAKEOVER tests.antirez2015-03-221-0/+59
|
* Cluster: more tests for manual failover + FORCE.antirez2015-03-221-1/+93
|
* Cluster: new tests1 for manual failover and scripts replication.antirez2015-03-221-0/+95
|
* Cluster: fix Lua scripts replication to slave nodes.antirez2015-03-222-2/+5
|
* Two cluster.c comments improved.antirez2015-03-211-2/+3
|
* Cluster: TAKEOVER option for manual failover.antirez2015-03-211-7/+20
|
* Fix typo in beforeSleep() comment.antirez2015-03-211-1/+1
|
* Net: processUnblockedClients() and clientsArePaused() minor changes.antirez2015-03-212-2/+6
| | | | | | | | 1. No need to set btype in processUnblockedClients(), since clients flagged REDIS_UNBLOCKED should have it already cleared. 2. When putting clients in the unblocked clients list, clientsArePaused() should flag them with REDIS_UNBLOCKED. Not strictly needed with the current code but is more coherent.
* Net: clientsArePaused() should not touch blocked clients.antirez2015-03-211-1/+1
| | | | | | | | | | | | When the list of unblocked clients were processed, btype was set to blocking type none, but the client remained flagged with REDIS_BLOCKED. When timeout is reached (or when the client disconnects), unblocking it will trigger an assertion. There is no need to process pending requests from blocked clients, so now clientsArePaused() just avoid touching blocked clients. Close #2467.
* Cluster: non-conditional steps of slave failover refactored into a function.antirez2015-03-201-27/+40
|
* Cluster: separate unknown master check from the rest.antirez2015-03-201-2/+5
| | | | | In no case we should try to attempt to failover if myself->slaveof is NULL.
* Cluster: refactoring around configEpoch handling.antirez2015-03-201-124/+157
| | | | | | | | | | | | This commit moves the process of generating a new config epoch without consensus out of the clusterCommand() implementation, in order to make it reusable for other reasons (current target is to have a CLUSTER FAILOVER option forcing the failover when no master majority is reachable). Moreover the commit moves other functions which are similarly related to config epochs in a new logical section of the cluster.c file, just for clarity.
* Cluster: better cluster state transiction handling.antirez2015-03-203-2/+21
| | | | | | | | | | | | | | | | | Before we relied on the global cluster state to make sure all the hash slots are linked to some node, when getNodeByQuery() is called. So finding the hash slot unbound was checked with an assertion. However this is fragile. The cluster state is often updated in the clusterBeforeSleep() function, and not ASAP on state change, so it may happen to process clients with a cluster state that is 'ok' but yet certain hash slots set to NULL. With this commit the condition is also checked in getNodeByQuery() and reported with a identical error code of -CLUSTERDOWN but slightly different error message so that we have more debugging clue in the future. Root cause of issue #2288.
* Cluster: move clusterBeforeSleep() call before unblocked clients processing.antirez2015-03-201-3/+6
| | | | Related to issue #2288.
* Cluster: more robust slave check in CLUSTER REPLICATE.antirez2015-03-181-1/+1
| | | | | There are rare conditions where node->slaveof may be NULL even if the node is a slave. To check by flag is much more robust.
* Merge pull request #2386 from inkel/sentinel-add-client-commandSalvatore Sanfilippo2015-03-131-0/+1
|\ | | | | Support CLIENT commands in Redis Sentinel
| * Support CLIENT commands in Redis SentinelLeandro López (inkel)2015-02-021-0/+1
| | | | | | | | | | | | | | | | | | | | When trying to debug sentinel connections or max connections errors it would be very useful to have the ability to see the list of connected clients to a running sentinel. At the same time it would be very helpful to be able to name each sentinel connection or kill offending clients. This commits adds the already defined CLIENT commands back to Redis Sentinel.