Adar Dembo has submitted this change and it was merged. Change subject: cache: fix behavior on single-CPU systems ......................................................................
cache: fix behavior on single-CPU systems On a system with only a single CPU, shard_bits_ would be set to 0. This would then result in calculating 'hash >> (32 - 0)' which is undefined behavior. With optimizations, this would turn into a no-op, and we'd end up using the whole hash as the shard index, instead of 0, causing a crash. The fix is to widen the hash to uint64_t before shifting. Tested by manually making NumCPUs return 1 and running cache-test. Change-Id: I7809e5697df657a589b2ceae5c6d4edbf161b52a Reviewed-on: http://gerrit.cloudera.org:8080/4535 Tested-by: Kudu Jenkins Reviewed-by: Adar Dembo <[email protected]> --- M src/kudu/util/cache.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/4535 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7809e5697df657a589b2ceae5c6d4edbf161b52a Gerrit-PatchSet: 3 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Todd Lipcon <[email protected]> Gerrit-Reviewer: Adar Dembo <[email protected]> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Marcel Kornacker <[email protected]>
