The flusher should persist the new vbstate on disk based only on the information retrieved from the disk queue.
Issue already faced and partially addressed in
Code at EPBucket::flushVBucket() (http://src.couchbase.org/source/xref/mad-hatter/kv_engine/engines/ep/src/ep_bucket.cc#594-599):
- frontend queues a set-vbstate(active) item into the CheckpointManager
- flusher pulls that item from the CM and initializes the new vbstate to persist -> note that the flusher should initialize the range as per new-vb-state=active
- before the flusher executes line 594, the frontend processes a new set-vbstate(replica) -> VBucket::state is set to replica immediately and a new set-vbstate(replica) items is queued into the CM
- now the flusher executes from line 594 and skips the block, as it reads (VBucket::state = replica)