1. 17 Dec, 2015 11 commits
    • antirez's avatar
      Cluster: resharding test now checks AOF consistency. · cd29e7be
      antirez authored
      It's a key invariant that when AOF is enabled, after the cluster
      reshards, a crash-recovery event causes all the keys to be still fine
      with the expected logical content. Now this is part of unit 04.
      cd29e7be
    • antirez's avatar
      Fix a race that may lead to the active (slave) client to be freed. · 7a7e46b2
      antirez authored
      In issue #2948 a crash was reported in processCommand(). Later Oran Agra
      (@oranagra) traced the bug (in private chat) in the following sequence
      of events:
      
      1. Some maxmemory is set.
      2. The slave is the currently active client and is executing PING or
         REPLCONF or whatever a slave can send to its master.
      3. freeMemoryIfNeeded() is called since maxmemory is set.
      4. flushSlavesOutputBuffers() is called by freeMemoryIfNeeded().
      5. During slaves buffers flush, a write error could be encoutered in
         writeToClient() or sendReplyToClient() depending on the version of
         Redis. This will trigger freeClient() against the currently active
         client, so a segmentation fault will likely happen in
         processCommand() immediately after the call to freeMemoryIfNeeded().
      
      There are different possible fixes:
      
      1. Add flags to writeToClient() (recent versions code base) so that
         we can ignore the write errors, and use this flag in
         flushSlavesOutputBuffers(). However this is not simple to do in older
         versions of Redis.
      2. Use freeClientAsync() during write errors. This works but changes the
         current behavior of releasing clients ASAP when possible. Normally
         we write to clients during the normal event loop processing, in the
         writable client, where there is no active client, so no care must be
         taken.
      3. The fix of this commit: to detect that the current client is no
         longer valid. This fix is a bit "ad-hoc", but works across all the
         versions and has the advantage of not changing the remaining
         behavior. Only alters what happens during this race condition,
         hopefully.
      7a7e46b2
    • antirez's avatar
      Fix processCommand() comment about return value. · f50dfff0
      antirez authored
      f50dfff0
    • antirez's avatar
      Hopefully better memory test on crash. · fc00042e
      antirez authored
      The old test, designed to do a transformation on the bits that was
      invertible, in order to avoid touching the original memory content, was
      not effective as it was redis-server --test-memory. The former often
      reported OK while the latter was able to spot the error.
      
      So the test was substituted with one that may perform better, however
      the new one must backup the memory tested, so it tests memory in small
      pieces. This limits the effectiveness because of the CPU caches. However
      some attempt is made in order to trash the CPU cache between the fill
      and the check stages, but not for the addressing test unfortunately.
      
      We'll see if this test will be able to find errors where the old failed.
      fc00042e
    • antirez's avatar
      Suppress harmless warnings. · ef92f90d
      antirez authored
      ef92f90d
    • antirez's avatar
      4fee3903
    • antirez's avatar
      Crash report format improvements. · f034a075
      antirez authored
      f034a075
    • antirez's avatar
    • antirez's avatar
      8bc75fc1
    • antirez's avatar
      b8373fb4
    • antirez's avatar
      1ae68665
  2. 15 Dec, 2015 1 commit
  3. 14 Dec, 2015 1 commit
  4. 13 Dec, 2015 7 commits
  5. 11 Dec, 2015 3 commits
  6. 10 Dec, 2015 4 commits
  7. 09 Dec, 2015 1 commit
    • antirez's avatar
      Fix replicas migration by adding a new flag. · db65f6d3
      antirez authored
      Some time ago I broken replicas migration (reported in #2924).
      The idea was to prevent masters without replicas from getting replicas
      because of replica migration, I remember it to create issues with tests,
      but there is no clue in the commit message about why it was so
      undesirable.
      
      However my patch as a side effect totally ruined the concept of replicas
      migration since we want it to work also for instances that, technically,
      never had slaves in the past: promoted slaves.
      
      So now instead the ability to be targeted by replicas migration, is a
      new flag "migrate-to". It only applies to masters, and is set in the
      following two cases:
      
      1. When a master gets a slave, it is set.
      2. When a slave turns into a master because of fail over, it is set.
      
      This way replicas migration targets are only masters that used to have
      slaves, and slaves of masters (that used to have slaves... obviously)
      and are promoted.
      
      The new flag is only internal, and is never exposed in the output nor
      persisted in the nodes configuration, since all the information to
      handle it are implicit in the cluster configuration we already have.
      db65f6d3
  8. 03 Dec, 2015 2 commits
  9. 28 Nov, 2015 1 commit
    • antirez's avatar
      fix sprintf and snprintf format string · 4916d205
      antirez authored
      There are some cases of printing unsigned integer with %d conversion
      specificator and vice versa (signed integer with %u specificator).
      
      Patch by Sergey Polovko. Backported to Redis from Disque.
      4916d205
  10. 27 Nov, 2015 3 commits
    • Itamar Haber's avatar
      Revert Lua's `redis.LOG_<level>` to original · 47daa9b0
      Itamar Haber authored
      Fixes #2898
      47daa9b0
    • antirez's avatar
      Handle wait3() errors. · 1cc7a454
      antirez authored
      My guess was that wait3() with WNOHANG could never return -1 and an
      error. However issue #2897 may possibly indicate that this could happen
      under non clear conditions. While we try to understand this better,
      better to handle a return value of -1 explicitly, otherwise in the
      case a BGREWRITE is in progress but wait3() returns -1, the effect is to
      match the first branch of the if/else block since server.rdb_child_pid
      is -1, and call backgroundSaveDoneHandler() without a good reason, that
      will, in turn, crash the Redis server with an assertion.
      1cc7a454
    • antirez's avatar
  11. 19 Nov, 2015 6 commits