Todd Lipcon has submitted this change and it was merged.

Change subject: Don't take a reference to a temporary when comparing first and 
last encoded keys
......................................................................


Don't take a reference to a temporary when comparing first and last encoded keys

In DiskRowSeWriter we have a check that makes sure that the first encoded key 
is less
than or equal to the last key. We perform the check by creating slices for the 
keys
and comparing the slices, for 'first_enc_slice' we're building it with a 
reference
to the string returned by key_index_writer()->GetMetaValueOrDie(), which ceases 
to
exist immediately. This because in libc++, returning the std::string copy is 
actually
a new copy of the underlying data, so our Slice points to a temporary bit of 
memory.

By making sure that the string survives the check the crash disappears.

While this doesn't contain a test for the crash it was easily reproducible by 
setting
kFlushDueToTimeMs in tablet_peer_mm_ops.cc to something like 2 and then running 
any
test that performed a reasonable amount of flushes (like create-table-itest). 
With
this fix it isn't reproducible anymore.

I also tested this with a large-ish table (150GBs) which would crash 
semi-regularly
and can't observe the crashes anymore.

Change-Id: Iaa1cbb087c6467bb5da777234270df089a4b3252
Reviewed-on: http://gerrit.cloudera.org:8080/2271
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <[email protected]>
---
M src/kudu/tablet/diskrowset.cc
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Todd Lipcon: Looks good to me, approved
  Kudu Jenkins: Verified



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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaa1cbb087c6467bb5da777234270df089a4b3252
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: David Ribeiro Alves <[email protected]>
Gerrit-Reviewer: Dan Burkert <[email protected]>
Gerrit-Reviewer: David Ribeiro Alves <[email protected]>
Gerrit-Reviewer: Jean-Daniel Cryans
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <[email protected]>

Reply via email to