From 72832a88ffcdb0ecd8272f8ec5c795a7ed357aba Mon Sep 17 00:00:00 2001
From: Russell Sears <sears@yahoo-inc.com>
Date: Fri, 18 Nov 2011 17:00:34 -0800
Subject: [PATCH] We use FNV hash functions to generate a large indexable
 sequence of non-colliding keys.  Unforunately, for reasonably sized
 workloads, this leads to key collisions, which throws off experiments.

The implementations of the FNV32 and FNV64 hash functions we use manipulate signed integers instead of unsigned integers, so it
is unclear if this is a limitation of the FNV algorithms or of our implementations.

As a workaround, this patch switches from FNV32 to FNV64, reducing the chances of such bad behavior (and eliminating it in our
experiments to date).
---
 src/com/yahoo/ycsb/Utils.java                  | 4 ++--
 src/com/yahoo/ycsb/workloads/CoreWorkload.java | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/com/yahoo/ycsb/Utils.java b/src/com/yahoo/ycsb/Utils.java
index f94ebc0d..57dd141a 100644
--- a/src/com/yahoo/ycsb/Utils.java
+++ b/src/com/yahoo/ycsb/Utils.java
@@ -48,9 +48,9 @@ public class Utils
       /**
        * Hash an integer value.
        */
-      public static int hash(int val)
+      public static long hash(long val)
       {
-	 return FNVhash32(val);
+	 return FNVhash64(val);
       }
 	
       public static final int FNV_offset_basis_32=0x811c9dc5;
diff --git a/src/com/yahoo/ycsb/workloads/CoreWorkload.java b/src/com/yahoo/ycsb/workloads/CoreWorkload.java
index ceaeb88e..4c95bb66 100644
--- a/src/com/yahoo/ycsb/workloads/CoreWorkload.java
+++ b/src/com/yahoo/ycsb/workloads/CoreWorkload.java
@@ -411,7 +411,7 @@ public class CoreWorkload extends Workload
 		}
 	}
 
-	public String buildKeyName(int keynum) {
+	public String buildKeyName(long keynum) {
  		if (!orderedinserts)
  		{
  			keynum=Utils.hash(keynum);
-- 
GitLab