Dan Burkert has uploaded a new change for review.

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

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 <a...@cloudera.com>
(cherry picked from commit 69e65780843040c085ca34901803b97b59595c0e)
---
M src/kudu/util/cache.cc
1 file changed, 3 insertions(+), 1 deletion(-)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7809e5697df657a589b2ceae5c6d4edbf161b52a
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: branch-1.0.x
Gerrit-Owner: Dan Burkert <d...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <t...@apache.org>

Reply via email to