Hello Tidy Bot, Alexey Serbin, Kudu Jenkins,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/9382

to look at the new patch set (#2).

Change subject: Fix move constructors to be noexcept
......................................................................

Fix move constructors to be noexcept

I noticed while looking at a profile of a tablet server starting up that
I saw a lot of CPU used in stacks like:

  kudu::subtle::RefCountedThreadSafeBase::AddRef() const
  void std::vector<scoped_refptr<kudu::fs::internal::LogBlock>>::
       _M_emplace_back_aux<scoped_refptr<kudu::fs::internal::LogBlock>>

Digging into the source of std::vector, I saw that the emplace_back_aux
function is used when emplacing requires resizing the underlying array.
Since scoped_refptr has a move constructor I was surprised to see it
using AddRef() here during the array expansion. In fact it turns out
that std::vector<> will only use the move constructor when it is marked
'noexcept', which ours was not.

I verified this with a simple test program as well[1]. If the move
constructor is marked 'noexcept', it is called. Otherwise, it is not.

This patch corrects scoped_refptr as well as a few other spots where we
had move constructors without noexcept.

[1] https://gist.github.com/toddlipcon/c9a807c6a67037ccd1b63caa93f74c67

Change-Id: Idd7487766be3261e3506ff9613a5d733013018b0
---
M src/kudu/cfile/block_cache.h
M src/kudu/cfile/block_handle.h
M src/kudu/gutil/ref_counted.h
M src/kudu/tablet/lock_manager.cc
M src/kudu/tablet/lock_manager.h
M src/kudu/util/cow_object.h
M src/kudu/util/status.h
7 files changed, 17 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/82/9382/2
--
To view, visit http://gerrit.cloudera.org:8080/9382
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Idd7487766be3261e3506ff9613a5d733013018b0
Gerrit-Change-Number: 9382
Gerrit-PatchSet: 2
Gerrit-Owner: Todd Lipcon <t...@apache.org>
Gerrit-Reviewer: Alexey Serbin <aser...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <t...@apache.org>

Reply via email to