You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Todd Lipcon (Code Review)" <ge...@cloudera.org> on 2017/01/18 22:14:23 UTC

[kudu-CR] binary plain block: fix an incorrect vector.reserve()

Hello Adar Dembo,

I'd like you to do a code review.  Please visit

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

to review the following change.

Change subject: binary_plain_block: fix an incorrect vector.reserve()
......................................................................

binary_plain_block: fix an incorrect vector.reserve()

I noticed the following surprising stack trace on a tserver:

 Thread 118 (Thread 0x7f9a865ff700 (LWP 1332)):
 #0  0x0000003ae0a89b40 in _wordcopy_fwd_aligned () from /lib64/libc.so.6
 #1  0x0000003ae0a83992 in memmove () from /lib64/libc.so.6
 #2  0x0000000001018dee in void std::vector<unsigned int, std::allocator<unsigned int> >::_M_emplace_back_aux<unsigned int>(unsigned int&&) ()
 #3  0x00000000018c8b15 in emplace_back<unsigned int> (this=0x7f9a858304b0) at /opt/rh/devtoolset-3/root/usr/include/c++/4.9.2/bits/vector.tcc:101
 #4  push_back (this=0x7f9a858304b0) at /opt/rh/devtoolset-3/root/usr/include/c++/4.9.2/bits/stl_vector.h:932
 #5  kudu::cfile::BinaryPlainBlockDecoder::ParseHeader (this=0x7f9a858304b0) at ../../src/kudu/cfile/binary_plain_block.cc:225
 #6  0x00000000018d4ffa in kudu::cfile::CFileIterator::PrepareForNewSeek (this=0x7f9a858e4d00) at ../../src/kudu/cfile/cfile_reader.cc:724

This implied that the emplace_back calls in the block decoder were actually
causing reallocation. The issue is that the reserve() was not appropriately
large.

Change-Id: Id3688e2c9e71bd05b5386e939c9582b707e57ff3
---
M src/kudu/cfile/binary_plain_block.cc
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/34/5734/1
-- 
To view, visit http://gerrit.cloudera.org:8080/5734
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3688e2c9e71bd05b5386e939c9582b707e57ff3
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>

[kudu-CR] binary plain block: fix an incorrect vector.reserve()

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has submitted this change and it was merged.

Change subject: binary_plain_block: fix an incorrect vector.reserve()
......................................................................


binary_plain_block: fix an incorrect vector.reserve()

I noticed the following surprising stack trace on a tserver:

 Thread 118 (Thread 0x7f9a865ff700 (LWP 1332)):
 #0  0x0000003ae0a89b40 in _wordcopy_fwd_aligned () from /lib64/libc.so.6
 #1  0x0000003ae0a83992 in memmove () from /lib64/libc.so.6
 #2  0x0000000001018dee in void std::vector<unsigned int, std::allocator<unsigned int> >::_M_emplace_back_aux<unsigned int>(unsigned int&&) ()
 #3  0x00000000018c8b15 in emplace_back<unsigned int> (this=0x7f9a858304b0) at /opt/rh/devtoolset-3/root/usr/include/c++/4.9.2/bits/vector.tcc:101
 #4  push_back (this=0x7f9a858304b0) at /opt/rh/devtoolset-3/root/usr/include/c++/4.9.2/bits/stl_vector.h:932
 #5  kudu::cfile::BinaryPlainBlockDecoder::ParseHeader (this=0x7f9a858304b0) at ../../src/kudu/cfile/binary_plain_block.cc:225
 #6  0x00000000018d4ffa in kudu::cfile::CFileIterator::PrepareForNewSeek (this=0x7f9a858e4d00) at ../../src/kudu/cfile/cfile_reader.cc:724

This implied that the emplace_back calls in the block decoder were actually
causing reallocation. The issue is that the reserve() was not appropriately
large.

Change-Id: Id3688e2c9e71bd05b5386e939c9582b707e57ff3
Reviewed-on: http://gerrit.cloudera.org:8080/5734
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
---
M src/kudu/cfile/binary_plain_block.cc
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Adar Dembo: Looks good to me, approved
  Kudu Jenkins: Verified



-- 
To view, visit http://gerrit.cloudera.org:8080/5734
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id3688e2c9e71bd05b5386e939c9582b707e57ff3
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot

[kudu-CR] binary plain block: fix an incorrect vector.reserve()

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change.

Change subject: binary_plain_block: fix an incorrect vector.reserve()
......................................................................


Patch Set 1: Code-Review+2

-- 
To view, visit http://gerrit.cloudera.org:8080/5734
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id3688e2c9e71bd05b5386e939c9582b707e57ff3
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: No