cbdatasource: handle stopCh and bad vbucket map
cbdatasource: handle stopCh and bad vbucket map

These fixes were found when testing bucket FLUSH scenarios...

The stopCh is closed when the application wants to close the
cbdatasource, and this change adds another place where the stopCh
should be checked.

Also, during a FLUSH, the vbucket map provided by couchbase server
might be temporarily bad (such as an empty vbucket map), so this
change also kicks the cbdatasource to "refresh from the top" when we
detect this situation.

Change-Id: I8868d796974fd04a8193b499203b1f229b5bac2b
Reviewed-on: http://review.couchbase.org/57740
Well-Formed: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Marty Schoch <ba9951d7d66412e2a57aea395f01176a793cf5eb@gmail.com>
Tested-by: Steve Yen <ef850f73f7832052d3c6d9b5ddd3a1716d9a57f1@gmail.com>

couchbase/go-couchbase