Fix unlocked access to cmeta in RaftConsensus::Start()
Fix unlocked access to cmeta in RaftConsensus::Start()

In a future patch, after removing the thread safety of the
ConsensusMetadata class, unlocked access to cmeta triggered a warning
from the collision warner in RaftConsensus::Start():

  F0206 20:31:24.554322 30972 thread_collision_warner.cc:23] Thread Collision! Previous thread id: 30962, current thread id: 30972

  Thread 4331 (Thread 0x7ffe5f964700 (LWP 30962)):
  #0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
  #1  0x00007ffff331966f in kudu::ConditionVariable::TimedWait (this=0x8c10b0, max_time=...) at ../../src/kudu/util/condition_variable.cc:123
  #2  0x00007ffff74e6c71 in kudu::tserver::Heartbeater::Thread::RunThread (this=0x8c0f80) at ../../src/kudu/tserver/heartbeater.cc:538
  #3  0x00007ffff74efec9 in boost::_mfi::mf0<void, kudu::tserver::Heartbeater::Thread>::operator() (this=0xd015d0, p=0x8c0f80) at ../../thirdparty/installed/uninstrumented/include/boost/bind/mem_fn_template.hpp:49

  Thread 4341 (Thread 0x7ffe5a95a700 (LWP 30972)):
  #0  0x00007ffff156c428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
  #1  0x00007ffff156e02a in __GI_abort () at abort.c:89
  #2  0x00007ffff2ff1c67 in google::DumpStackTraceAndExit () at /home/mpercy/src/kudu/thirdparty/src/glog-0.3.5/src/utilities.cc:152
  #3  0x00007ffff2fe8b1d in google::LogMessage::Fail () at /home/mpercy/src/kudu/thirdparty/src/glog-0.3.5/src/logging.cc:1488
  #4  0x00007ffff2feaa03 in google::LogMessage::SendToLog (this=0x7ffe5a957d68) at /home/mpercy/src/kudu/thirdparty/src/glog-0.3.5/src/logging.cc:1442
  #5  0x00007ffff2fe867a in google::LogMessage::Flush (this=this@entry=0x7ffe5a957d68) at /home/mpercy/src/kudu/thirdparty/src/glog-0.3.5/src/logging.cc:1311
  #6  0x00007ffff2feb3cf in google::LogMessageFatal::~LogMessageFatal (this=0x7ffe5a957d68, __in_chrg=<optimized out>) at /home/mpercy/src/kudu/thirdparty/src/glog-0.3.5/src/logging.cc:2023
  #7  0x00007ffff30bc20b in base::DCheckAsserter::warn (this=0x7fffbc016a90, previous_thread_id=30962, current_thread_id=30972) at ../../src/kudu/gutil/threading/thread_collision_warner.cc:23
  #8  0x00007ffff30bc34d in base::ThreadCollisionWarner::Enter (this=0x7fffbc00bde0) at ../../src/kudu/gutil/threading/thread_collision_warner.cc:81
  #9  0x00007ffff6dd3933 in base::ThreadCollisionWarner::ScopedCheck::ScopedCheck (this=0x7ffe5a957e30, warner=0x7fffbc00bde0) at ../../src/kudu/gutil/threading/thread_collision_warner.h:184
  #10 0x00007ffff6a95fca in kudu::consensus::ConsensusMetadata::current_term (this=0x7fffbc00bd90) at ../../src/kudu/consensus/consensus_meta.cc:56
  #11 0x00007ffff6afa4a4 in kudu::consensus::RaftConsensus::Start(kudu::consensus::ConsensusBootstrapInfo const&, gscoped_ptr<kudu::consensus::PeerProxyFactory, kudu::DefaultDeleter<kudu::consensus::PeerProxyFactory> >, scoped_refptr<kudu::log::Log>, scoped_refptr<kudu::consensus::TimeManager>, kudu::consensus::ReplicaTransactionFactory*, scoped_refptr<kudu::MetricEntity>, kudu::Callback<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) (this=0x7fffbc0008d0, info=..., peer_proxy_factory=..., log=..., time_manager=..., txn_factory=0x7fffbc00bff0, metric_entity=..., mark_dirty_clbk=...) at ../../src/kudu/consensus/raft_consensus.cc:228
  #12 0x00007ffff6e231b5 in kudu::tablet::TabletReplica::Start (this=0x7fffbc00bff0, bootstrap_info=..., tablet=std::shared_ptr (empty) 0x0, clock=..., messenger=std::shared_ptr (empty) 0x0, result_tracker=..., log=..., prepare_pool=0xd07140) at ../../src/kudu/tablet/tablet_replica.cc:220

Change-Id: I661c603a57b9ecaeee926ce7cd86c9ecf2ad58a8
Reviewed-on: http://gerrit.cloudera.org:8080/9245
Reviewed-by: Alexey Serbin <864f6b82bd94e8dda64141d4274519ee66e0102e@cloudera.com>
Tested-by: Kudu Jenkins

helifu/kudu,andrwng/kudu,cloudera/kudu,andrwng/kudu,helifu/kudu,EvilMcJerkface/kudu,EvilMcJerkface/kudu,helifu/kudu,helifu/kudu,EvilMcJerkface/kudu,cloudera/kudu,cloudera/kudu,cloudera/kudu,cloudera/kudu,helifu/kudu,cloudera/kudu,InspurUSA/kudu,andrwng/kudu,InspurUSA/kudu,InspurUSA/kudu,cloudera/kudu,EvilMcJerkface/kudu,EvilMcJerkface/kudu,EvilMcJerkface/kudu,andrwng/kudu,EvilMcJerkface/kudu,InspurUSA/kudu,EvilMcJerkface/kudu,andrwng/kudu,andrwng/kudu,InspurUSA/kudu,helifu/kudu,InspurUSA/kudu,andrwng/kudu,InspurUSA/kudu,andrwng/kudu,helifu/kudu,helifu/kudu,andrwng/kudu,cloudera/kudu,InspurUSA/kudu,cloudera/kudu,helifu/kudu,EvilMcJerkface/kudu,InspurUSA/kudu