Fix race in ActiveStream.bufferedBackfill.bytes

Race identified by ThreadSanitizer:

      Read of size 4 at 0x7d480000b554 by main thread (mutexes: write M18379, write M899, write M18337):
        #0 void STATWRITER_NAMESPACE::add_casted_stat<unsigned int>(char const*, unsigned int const&, void (*)(char const*, unsigned short, char const*, unsigned int, void const*), void const*) /home/vagrant/couchbase-server/ep-engine/src/statwriter.h:45 (ep.so+0x000000107639)
        #1 ActiveStream::addStats(void (*)(char const*, unsigned short, char const*, unsigned int, void const*), void const*) /home/vagrant/couchbase-server/ep-engine/src/dcp-stream.cc:388 (ep.so+0x0000000ff272)
        #2 DcpProducer::addStats(void (*)(char const*, unsigned short, char const*, unsigned int, void const*), void const*) /home/vagrant/couchbase-server/ep-engine/src/dcp-producer.cc:502 (ep.so+0x0000000efcd3)
        #3 ConnStatBuilder::operator()(SingleThreadedRCPtr<ConnHandler>&) /home/vagrant/couchbase-server/ep-engine/src/ep_engine.cc:3725 (ep.so+0x0000001ba8bd)
        #4 ConnStatBuilder std::for_each<std::_List_iterator<SingleThreadedRCPtr<ConnHandler> >, ConnStatBuilder>(std::_List_iterator<SingleThreadedRCPtr<ConnHandler> >, std::_List_iterator<SingleThreadedRCPtr<ConnHandler> >, ConnStatBuilder) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_algo.h:4417 (ep.so+0x0000001ba4f5)
        #5 void ConnMap::each_UNLOCKED<ConnStatBuilder>(ConnStatBuilder) /home/vagrant/couchbase-server/ep-engine/src/connmap.h:148 (ep.so+0x0000001ba459)
        #6 void ConnMap::each<ConnStatBuilder>(ConnStatBuilder) /home/vagrant/couchbase-server/ep-engine/src/connmap.h:140 (ep.so+0x0000001b2b8e)
        #7 EventuallyPersistentEngine::doDcpStats(void const*, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /home/vagrant/couchbase-server/ep-engine/src/ep_engine.cc:3978 (ep.so+0x0000001891ce)
        #8 EventuallyPersistentEngine::getStats(void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /home/vagrant/couchbase-server/ep-engine/src/ep_engine.cc:4384 (ep.so+0x00000018dbb3)
        #9 EvpGetStats(engine_interface*, void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /home/vagrant/couchbase-server/ep-engine/src/ep_engine.cc:214 (ep.so+0x000000173fa2)
        #10 mock_get_stats /home/vagrant/couchbase-server/memcached/programs/engine_testapp/engine_testapp.c:196 (exe+0x0000000a741d)
        #11 get_ull_stat(engine_interface*, engine_interface_v1*, char const*, char const*) /home/vagrant/couchbase-server/ep-engine/tests/ep_test_apis.cc:817 (ep_testsuite.so+0x0000000e1aa6)
        #12 dcp_stream(engine_interface*, engine_interface_v1*, char const*, void const*, unsigned short, unsigned int, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, int, int, int, int, int, bool) /home/vagrant/couchbase-server/ep-engine/tests/ep_testsuite.cc:3370 (ep_testsuite.so+0x0000000afd38)
        #13 test_dcp_producer_stream_req_disk(engine_interface*, engine_interface_v1*) /home/vagrant/couchbase-server/ep-engine/tests/ep_testsuite.cc:3596 (ep_testsuite.so+0x000000094ed0)
        #14 execute_test /home/vagrant/couchbase-server/memcached/programs/engine_testapp/engine_testapp.c:1055 (exe+0x0000000a3e83)
        #15 main /home/vagrant/couchbase-server/memcached/programs/engine_testapp/engine_testapp.c:1313 (exe+0x0000000a1d84)

      Previous write of size 4 at 0x7d480000b554 by thread T10 (mutexes: write M277108936295898408, write M18343):
        #0 ActiveStream::backfillReceived(Item*, backfill_source_t) /home/vagrant/couchbase-server/ep-engine/src/dcp-stream.cc:216 (ep.so+0x0000000fd3d3)
        #1 CacheCallback::callback(CacheLookup&) /home/vagrant/couchbase-server/ep-engine/src/dcp-backfill.cc:58 (ep.so+0x0000000cf5cc)
        #2 CouchKVStore::recordDbDump(_db*, _docinfo*, void*) /home/vagrant/couchbase-server/ep-engine/src/couch-kvstore/couch-kvstore.cc:1577 (ep.so+0x0000002f3f77)
        #3 recordDbDumpC(_db*, _docinfo*, void*) /home/vagrant/couchbase-server/ep-engine/src/couch-kvstore/couch-kvstore.cc:74 (ep.so+0x0000002f2b00)
        #4 lookup_callback(couchfile_lookup_request*, _sized_buf const*, _sized_buf const*) /home/vagrant/couchbase-server/couchstore/src/couch_db.cc:729 (libcouchstore.so+0x000000019e46)
        #5 btree_lookup_inner(couchfile_lookup_request*, unsigned long, int, int) /home/vagrant/couchbase-server/couchstore/src/btree_read.cc:101 (libcouchstore.so+0x0000000132d7)
        #6 btree_lookup_inner(couchfile_lookup_request*, unsigned long, int, int) /home/vagrant/couchbase-server/couchstore/src/btree_read.cc:71 (libcouchstore.so+0x000000012bd3)
        #7 btree_lookup /home/vagrant/couchbase-server/couchstore/src/btree_read.cc:133 (libcouchstore.so+0x00000001236b)
        #8 couchstore_changes_since /home/vagrant/couchbase-server/couchstore/src/couch_db.cc:774 (libcouchstore.so+0x0000000196ca)
        #9 CouchKVStore::scan(ScanContext*) /home/vagrant/couchbase-server/ep-engine/src/couch-kvstore/couch-kvstore.cc:1227 (ep.so+0x0000002f27f8)
        #10 DCPBackfill::scan() /home/vagrant/couchbase-server/ep-engine/src/dcp-backfill.cc:150 (ep.so+0x0000000d08ea)
        #11 DCPBackfill::run() /home/vagrant/couchbase-server/ep-engine/src/dcp-backfill.cc:97 (ep.so+0x0000000cfeb3)
        #12 BackfillManager::backfill() /home/vagrant/couchbase-server/ep-engine/src/dcp-backfill-manager.cc:171 (ep.so+0x0000000c778d)
        #13 BackfillManagerTask::run() /home/vagrant/couchbase-server/ep-engine/src/dcp-backfill-manager.cc:50 (ep.so+0x0000000c745a)
        #14 ExecutorThread::run() /home/vagrant/couchbase-server/ep-engine/src/executorthread.cc:110 (ep.so+0x0000002163af)
        #15 launch_executor_thread(void*) /home/vagrant/couchbase-server/ep-engine/src/executorthread.cc:34 (ep.so+0x0000002158ba)
        #16 platform_thread_wrap /home/vagrant/couchbase-server/platform/src/cb_pthreads.c:19 (libplatform.so.0.1.0+0x0000000033f4)

Change-Id: Ia80928489df9b57b64b463c67fafee5ba15d2aac
Reviewed-on: http://review.couchbase.org/43319
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>