Alexey Serbin has submitted this change and it was merged. (
http://gerrit.cloudera.org:8080/16021 )
Change subject: [consensus] small cleanup on Peer::SignalRequest()
......................................................................
[consensus] small cleanup on Peer::SignalRequest()
It's possible not to hold 'peer_lock_' when scheduling SendNextRequest()
on the thread pool: if 'request_pending_' or 'closed_' changes, it's
handled by Peer::SendNextRequest() as necessary. It might be an extra
run a thread in Raft pool in the worst case, but it seems better than
blocking the thread running PrepareTask(). Blocking the latter involves
blocking other tasks on corresponding locks and slowing the replication
of a Raft operation, which leads to lower write throughput.
The motivation for this change was seeing the following in the logs
during intensive ingest workloads:
0531 13:09:40.403224 (+515724us) spinlock_profiling.cc:244] Waited 514 ms on
lock 0xa1581150
with the stack symbolized like below:
kudu::(anonymous namespace)::SubmitSpinLockProfileData(void const*, long)
src/kudu/util/spinlock_profiling.cc:230
kudu::consensus::Peer::SignalRequest(bool)
src/kudu/gutil/spinlock.h:106
kudu::consensus::PeerManager::SignalRequest(bool)
src/kudu/consensus/peer_manager.cc:98
kudu::consensus::RaftConsensus::Replicate(scoped_refptr<kudu::consensus::ConsensusRound>
const&)
src/kudu/consensus/raft_consensus.cc:740 (discriminator 2)
kudu::tablet::TransactionDriver::Prepare()
src/kudu/tablet/transactions/transaction_driver.cc:333
kudu::tablet::TransactionDriver::PrepareTask()
src/kudu/tablet/transactions/transaction_driver.cc:243
kudu::ThreadPool::DispatchThread()
src/kudu/util/threadpool.cc:686
The stack trace pointed to 'peer_lock_' in Peer::SignalRequest(),
consensus_peer.cc,167 as in one of its previous revisions, as the
rest of the stack.
I also did other minor cleanup on the code around.
Change-Id: I899aec0964bc404e6df3742bd48d0d049e52d900
Reviewed-on: http://gerrit.cloudera.org:8080/16021
Tested-by: Kudu Jenkins
Reviewed-by: Andrew Wong <[email protected]>
---
M src/kudu/consensus/consensus_peers.cc
M src/kudu/consensus/consensus_peers.h
M src/kudu/consensus/peer_manager.cc
M src/kudu/consensus/raft_consensus.cc
M src/kudu/tablet/ops/op_driver.cc
M src/kudu/tablet/ops/op_tracker.cc
6 files changed, 55 insertions(+), 46 deletions(-)
Approvals:
Kudu Jenkins: Verified
Andrew Wong: Looks good to me, approved
--
To view, visit http://gerrit.cloudera.org:8080/16021
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I899aec0964bc404e6df3742bd48d0d049e52d900
Gerrit-Change-Number: 16021
Gerrit-PatchSet: 3
Gerrit-Owner: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>
Gerrit-Reviewer: Bankim Bhavsar <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)