MB-19374 Address datarace in AtomicUnorderedMap::size()
MB-19374 Address datarace in AtomicUnorderedMap::size()

std::unordered_map::size() is not thread-safe unless other
threads are read-only.

WARNING: ThreadSanitizer: data race (pid=131734)
  Write of size 8 at 0x7d580002fc50 by thread T19 (mutexes: read M15526, write M20152):
    #0 std::_Hashtable<unsigned short, std::pair<unsigned short const, SingleThreadedRCPtr<Stream> >, std::allocator<std::pair<unsigned short const, SingleThreadedRCPtr<Stream> > >, std::__detail::_Select1st, std::equal_to<unsigned short>, std::hash<unsigned short>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_insert_unique_node(unsigned long, unsigned long, std::__detail::_Hash_node<std::pair<unsigned short const, SingleThreadedRCPtr<Stream> >, false>*) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/hashtable.h:1625 (ep.so+0x000000069fa7)
    #1 AtomicUnorderedMap<unsigned short, Stream, SingleThreadedRCPtr<Stream>, std::hash<unsigned short>, std::equal_to<unsigned short>, std::allocator<std::pair<unsigned short const, SingleThreadedRCPtr<Stream> > > >::insert(std::pair<unsigned short const, SingleThreadedRCPtr<Stream> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/hashtable.h:1724 (ep.so+0x0000000613e9)
    #2 EvpDcpStreamReq(engine_interface*, void const*, unsigned int, unsigned int, unsigned short, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long*, ENGINE_ERROR_CODE (*)(vbucket_failover_t*, unsigned long, void const*)) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/ep_engine.cc:1512 (ep.so+0x0000000b3737)

...

 Previous read of size 8 at 0x7d580002fc50 by main thread (mutexes: write M14188, write M20259, write M14598):
    #0 DcpProducer::addStats(void (*)(char const*, unsigned short, char const*, unsigned int, void const*), void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/hashtable.h:500 (ep.so+0x0000000640f4)
    #1 ConnStatBuilder::operator()(SingleThreadedRCPtr<ConnHandler>&) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/ep_engine.cc:3859 (ep.so+0x0000000e02c1)
    #2 EventuallyPersistentEngine::doDcpStats(void const*, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/ep_engine.cc:4116 (ep.so+0x0000000bf61a)

Change-Id: I139ca87ee1e4a1615f84ffc5318f577eee162106
Reviewed-on: http://review.couchbase.org/63363
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Chiyoung Seo <fcffc23db27b19ee4ebba46695ee6b50e09216a2@couchbase.com>

membase/ep-engine,daverigby/ep-engine,hisundar/ep-engine,daverigby/ep-engine,couchbase/ep-engine,membase/ep-engine,daverigby/ep-engine,hisundar/ep-engine,owendCB/ep-engine,teligent-ru/ep-engine,owendCB/ep-engine,owendCB/ep-engine,daverigby/kv_engine,teligent-ru/ep-engine,daverigby/kv_engine,membase/ep-engine,teligent-ru/ep-engine,daverigby/ep-engine,daverigby/kv_engine,daverigby/kv_engine,teligent-ru/ep-engine,couchbase/ep-engine,hisundar/ep-engine,couchbase/ep-engine,membase/ep-engine,hisundar/ep-engine,owendCB/ep-engine,couchbase/ep-engine