Cluster: clusterAcceptHandler() comments updated to match the code.
Cluster: bulk-accept new nodes connections.

The same change was operated for normal client connections. This is
important for Cluster as well, since when a node rejoins the cluster,
when a partition heals or after a restart, it gets flooded with new
connection attempts by all the other nodes trying to form a full
mesh again.
DEBUG POPULATE: call dictExpand() to avoid useless rehashing.
redis-trib: allow support for mandatory options.
CLUSTER MEET: better error messages when address is invalid.

Fixes issue #1734.
Cluster: initial ability to import data from standalone instance.
RESTORE: reply with -BUSYKEY special error code.

The error when the target key is busy was a generic one, while it makes
sense to be able to distinguish between the target key busy error and
the others easily.
redis-trib.rb: MIGRATE hardcoded timeout set to 15 sec.

Will be configurable / adaptive at some point but let's start with a
saner value compared to 1 sec which is not a good idea for big data
structures stored into a single key.
redis-trib import: trap MIGRATE errors.
Sentinel: Add "dir /tmp" directive in example sentinel.conf.
redis-trib create: use CONFIG SET-CONFIG-EPOCH before joining the cluster.

This way there is no need for the conflict resolution algo to be used in
order to start with a cluster where each node has a different
configEpoch.
fixed possible buffer overflow error
Fixed possible buffer overflow bug if RDB file is corrupted.

(Note: commit message modified by @antirez for clarity).
Cluster: bypass data_age check for manual failovers.

Automatic failovers only happen in Redis Cluster if the slave trying to
be elected was disconnected from its master for no more than 10 times
the node-timeout value. However there should be no such a check for
manual failovers, since these are initiated by the sysadmin that, in
theory, knows what she is doing when a slave is selected to be promoted.
Cluster: forced failover implemented.

Using CLUSTER FAILOVER FORCE it is now possible to failover a master in
a forced way, which means:

1) No check to understand if the master is up is performed.
2) No data age of the slave is checked. Evan a slave with very old data
   can manually failover a master in this way.
3) No chat with the master is attempted to reach its replication offset:
   the master can just be down.
Cluster: fixed data_age computation / check integer overflow.
Remove unused global variable commandTable
Add dynamic command loading

We can now add custom commands to Redis without recompiling.

Add commands by creating a shared library containing:
    - a table exporting your command definitions
      - (exactly the same as redisCommandTable has always been)
    - a string defining the name of your module

You can add modules in redis.conf with
    "module-add [module.so]"
or on the command line with
    redis-server --module-add module.so
or at runtime with
    "CONFIG SET MODULE-ADD [module.so]"

If you add a module twice, the second time will:
  - load the new module
  - unload the previous module
  - overwrite commands from the old module with
    commands in the new module
  - reset per-command stats/counters for each of
    the newly re-added commands

(Note: Any commands in the old module but not
in the new module will stick around.  To remove a command you
should keep it in your module and just give it a
noop definition or alias it to something simple like the
ping command.)

(Note: There is no way to remove or unload
a module.  You can only add modules and reload existing
modules by re-adding them.  To remove a module, restart
Redis.)

(Note: Running a master-replica or cluster setup with Redis
instances not containing the same set of modules will break
horribly.  Either fully distribute your modules or don't
use modules with replicated Redis.)

This commit contains these changes:
    - Make sure the Redis command table ends with a NULL entry
    - Rename populateCommandTable() to populateCommand(), and
      make it only process one command per invocation.
    - Replace all numcommands calculations with redisCommands.length.
    - Replace usage of redisCommandTable with redisCommands.table.
    - Replace the server startup call to populateCommandTable()
      with a call to loadDynamicCommands(NULL).  When given NULL,
      loadDynamicCommands reads the command table from the
      redis-server executable instead of an externally loaded module.
      Yes, that means the same mechanism used to import new commands
      from external modules bootstraps built-in commands too.
    - Add new INFO MODULES section to output all loaded
      modules, with their names, library filenames, original
      load timestamp, most recent load timestamp (for when
      modules are reloaded with CONFIG SET), and the list of
      commands the module provides.  Note: The redis-server itself
      is processed as a module, so it shows up as module <builtin>.
    - Add new configuration option 'module-add'.
    - Add new CONFIG SET option 'module-add'.

Example output of INFO MODULES:
    127.0.0.1:6379> info modules
    # Modules
    module_demo_ping:filename=ping.so,first_loaded=0,last_loaded=1395789529,commands=poong,pooooong,pooong
    module_<builtin>:filename=<builtin>,first_loaded=0,last_loaded=0,commands=get,set,setnx,setex,psetex,append,strlen,del,exists,setbit,getbit,setrange,getrange,substr,incr,decr,mget,rpush,lpush,rpushx,lpushx,linsert,rpop,lpop,brpop,brpoplpush,blpop,llen,lindex,lset,lrange,ltrim,lrem,rpoplpush,sadd,srem,smove,sismember,scard,spop,srandmember,sinter,sinterstore,sunion,sunionstore,sdiff,sdiffstore,smembers,sscan,zadd,zincrby,zrem,zremrangebyscore,zremrangebyrank,zunionstore,zinterstore,zrange,zrangebyscore,zrevrangebyscore,zcount,zrevrange,zcard,zscore,zrank,zrevrank,zscan,hset,hsetnx,hget,hmset,hmget,hincrby,hincrbyfloat,hdel,hlen,hkeys,hvals,hgetall,hexists,hscan,incrby,decrby,incrbyfloat,getset,mset,msetnx,randomkey,select,move,rename,renamenx,expire,expireat,pexpire,pexpireat,keys,scan,dbsize,auth,ping,echo,save,bgsave,bgrewriteaof,shutdown,lastsave,type,multi,exec,discard,sync,psync,replconf,flushdb,flushall,sort,info,monitor,ttl,pttl,persist,slaveof,debug,config,subscribe,unsubscribe,psubscribe,punsubscribe,publish,pubsub,watch,unwatch,cluster,restore,restore-asking,migrate,asking,readonly,readwrite,dump,object,client,eval,evalsha,slowlog,script,time,bitop,bitcount,bitpos,wait

(Note: {first,last}_loaded of 0 means it was loaded at startup from a configuration
directive or command line argument.  If loaded != 0, then the module
was evaluated after the server started using CONFIG SET MODULE-ADD [module.so])
Fix module reloading

Allow modules to be reloaded with the same filename.  Previously,
due to dlopen refcounting, loading the same module twice, even
if updated, wouldn't actually reload any module contents.

Now modules are loaded, checked for name, checked for existing
module, if existing module found, old module is unloaded, current
module is unloaded (at this point, refcount = 0), then the process
is re-started to load the module again, this time so it gets reloaded
because the prior refcount is now zero.

Got it?

Also fix a Linux compatability issue by removing RTLD_FIRST.
Remove unnecessary malloc

Hey, look, we're using c99 and can do things like this now.