kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject [3/3] kudu git commit: Fix unlocked access to cmeta in RaftConsensus::Start()
Date Wed, 07 Feb 2018 23:00:02 GMT
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 <aserbin@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/9b1281c9
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/9b1281c9
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/9b1281c9

Branch: refs/heads/master
Commit: 9b1281c9551af1d390a59f9d199be7f845f9b9b2
Parents: be16a81
Author: Mike Percy <mpercy@apache.org>
Authored: Tue Feb 6 20:40:10 2018 -0800
Committer: Mike Percy <mpercy@apache.org>
Committed: Wed Feb 7 22:59:38 2018 +0000

----------------------------------------------------------------------
 src/kudu/consensus/raft_consensus.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/9b1281c9/src/kudu/consensus/raft_consensus.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/raft_consensus.cc b/src/kudu/consensus/raft_consensus.cc
index 2040733..a699a24 100644
--- a/src/kudu/consensus/raft_consensus.cc
+++ b/src/kudu/consensus/raft_consensus.cc
@@ -225,7 +225,7 @@ Status RaftConsensus::Start(const ConsensusBootstrapInfo& info,
   txn_factory_ = DCHECK_NOTNULL(txn_factory);
   mark_dirty_clbk_ = std::move(mark_dirty_clbk);
 
-  term_metric_ = metric_entity->FindOrCreateGauge(&METRIC_raft_term, cmeta_->current_term());
+  term_metric_ = metric_entity->FindOrCreateGauge(&METRIC_raft_term, CurrentTerm());
   follower_memory_pressure_rejections_ =
       metric_entity->FindOrCreateCounter(&METRIC_follower_memory_pressure_rejections);
 


Mime
View raw message