CBD-1283: support graceful failover

Change-Id: Iee7862a52e01ef8e4a152aa1a523c7f2753adbb2
Reviewed-on: http://review.couchbase.org/34476
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Bin Cui <bin.cui@gmail.com>