Address data race identified with DcpProducer's control parameters
Address data race identified with DcpProducer's control parameters

WARNING: ThreadSanitizer: data race (pid=69534)
  Write of size 1 at 0x7d580002fb11 by thread T19:
    #0 DcpProducer::control(unsigned int, void const*, unsigned short, void const*, unsigned int) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/dcp/producer.cc:530 (ep.so+0x00000006839d)
    #1 EvpDcpControl(engine_interface*, void const*, unsigned int, void const*, unsigned short, void const*, unsigned int) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/ep_engine.cc:1731 (ep.so+0x0000000b77c7)
    #2 mock_dcp_control(engine_interface*, void const*, unsigned int, void const*, unsigned short, void const*, unsigned int) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/memcached/programs/engine_testapp/engine_testapp.cc:780 (engine_testapp+0x0000004cf364)
    #3 TestDcpConsumer::run(engine_interface*, engine_interface_v1*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/tests/ep_testsuite_dcp.cc:198 (ep_testsuite_dcp.so+0x000000005eb2)
    #4 continuous_dcp_thread(void*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/tests/ep_testsuite_dcp.cc:812 (ep_testsuite_dcp.so+0x00000003bcbd)
    #5 platform_thread_wrap(void*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/platform/src/cb_pthreads.cc:54 (libplatform.so.0.1.0+0x00000000568b)

  Previous read of size 1 at 0x7d580002fb11 by main thread (mutexes: write M16012, write M1085223645971803896, write M16013):
    #0 DcpProducer::addStats(void (*)(char const*, unsigned short, char const*, unsigned int, void const*), void const*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/dcp/producer.cc:692 (ep.so+0x0000000696cd)
    #1 ConnStatBuilder::operator()(SingleThreadedRCPtr<ConnHandler>&) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/src/ep_engine.cc:3880 (ep.so+0x0000000e32b1)
    #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:4137 (ep.so+0x0000000c2cca)
    #3 EventuallyPersistentEngine::getStats(void const*, char const*, int, 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:4583 (ep.so+0x0000000c67f4)
    #4 EvpGetStats(engine_interface*, void const*, char const*, int, 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:224 (ep.so+0x0000000b5e5e)
    #5 mock_get_stats(engine_interface*, void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/memcached/programs/engine_testapp/engine_testapp.cc:241 (engine_testapp+0x0000004ce06d)
    #6 get_int_stat(engine_interface*, engine_interface_v1*, char const*, char const*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/tests/ep_test_apis.cc:999 (ep_testsuite_dcp.so+0x000000047992)
    #7 wait_for_stat_to_be(engine_interface*, engine_interface_v1*, char const*, int, char const*, long) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/tests/ep_test_apis.cc:1134 (ep_testsuite_dcp.so+0x00000004da72)
    #8 test_dcp_producer_keep_stream_open(engine_interface*, engine_interface_v1*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/ep-engine/tests/ep_testsuite_dcp.cc:1786 (ep_testsuite_dcp.so+0x00000001d287)
    #9 execute_test(test, char const*, char const*) /home/couchbase/jenkins/workspace/ep-engine-threadsanitizer-master/memcached/programs/engine_testapp/engine_testapp.cc:1135 (engine_testapp+0x0000004cc650)
    #10 __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 (libc.so.6+0x00000002176c)

(cherry picked from commit 79f7e266043ffb209b18b62d007afd0e212e2019)

Change-Id: Iae57b949c048a35a92112d599643b2eb8d124bff
Reviewed-on: http://review.couchbase.org/61155
Reviewed-by: Sriram Ganesan <fde85c3124eed34938bb85159f430bf7e5b650f6@couchbase.com>
Reviewed-by: abhinav dangeti <d73ef2279de6577f7bf081737ee47554bbb7dc82@couchbase.com>
Reviewed-by: Chiyoung Seo <fcffc23db27b19ee4ebba46695ee6b50e09216a2@couchbase.com>
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>

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