Todd Lipcon has submitted this change and it was merged.

Change subject: KUDU-1297 - Fix RowSetTree sorting on mac osx
......................................................................


KUDU-1297 - Fix RowSetTree sorting on mac osx

We use a sorting function, RSEndpointBySliceCompare(), for the std::sort()
call in RowSetTree::Reset().

Sorting functions have a hard requirement that they should only return
true iif a < b and should return false in all other cases. Our function would
behave well in all cases except when a == b, in which case it might return
true or false depending on whether a.endpoint_ == START or a.endpoint_ == STOP.

Apparently when this requirement is not met, in some cases, segfaults ensue:
https://schneide.wordpress.com/2010/11/01/bug-hunting-fun-with-stdsort/

The fix is to return false if a == b. I've made sure that this fixes
the failing test (rowset_tree-test) in mac osx.

Change-Id: I315b4a71438cccb7bdc12e8929b064e9e5074f71
Reviewed-on: http://gerrit.cloudera.org:8080/1885
Tested-by: David Ribeiro Alves <[email protected]>
Reviewed-by: Todd Lipcon <[email protected]>
---
M src/kudu/tablet/rowset_tree-test.cc
M src/kudu/tablet/rowset_tree.cc
2 files changed, 3 insertions(+), 2 deletions(-)

Approvals:
  David Ribeiro Alves: Verified
  Todd Lipcon: Looks good to me, approved



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I315b4a71438cccb7bdc12e8929b064e9e5074f71
Gerrit-PatchSet: 4
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: Todd Lipcon <[email protected]>

Reply via email to