MB-37546: Do not use VBucket::state at EPBucket::flushVBucket
MB-37546: Do not use VBucket::state at EPBucket::flushVBucket

If we use VBucket::state at persistence for determining the new vbstate,
then we may hit logic race conditions with KVBucket::setVBucketState
that may end up in writing the wrong vbstate on disk.

MB-35331 addresses most part of the issue. But even after that fix we
may still set the new snap-range in vbstate depending on VBucket::state,
which is fix here.

Change-Id: I4a5de4016499a205975d5dafa2b8a28a6732e971
Reviewed-on: http://review.couchbase.org/121267
Well-Formed: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: James Harrison <5c25a7b3db09830813688775bfc8e6de736a230c@couchbase.com>

daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine