Added test for ketama. Fixed bug in setting behavior.
author <brian@localhost.localdomain> <>
Wed, 23 Apr 2008 12:13:18 +0000 (05:13 -0700)
committer <brian@localhost.localdomain> <>
Wed, 23 Apr 2008 12:13:18 +0000 (05:13 -0700)
libmemcached/memcached_behavior.c
tests/function.c

index aac63f4239541d12cb9f2fd06417e6e3fc56829c..e89473cff8997d6f19d40110c9604398143373c4 100644 (file)
@@ -44,17 +44,20 @@ memcached_return memcached_behavior_set(memcached_st *ptr,
       break;
     }
   case MEMCACHED_BEHAVIOR_KETAMA:
-    if (data)
     {
-      ptr->hash= MEMCACHED_HASH_MD5;
-      ptr->distribution= MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA;
-    }
-    else
-    {
-      ptr->hash= 0;
-      ptr->distribution= 0;
+      if (data)
+      {
+        ptr->hash= MEMCACHED_HASH_MD5;
+        ptr->distribution= MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA;
+      }
+      else
+      {
+        ptr->hash= 0;
+        ptr->distribution= 0;
+      }
+      run_distribution(ptr);
+      break;
     }
-    break;
   case MEMCACHED_BEHAVIOR_HASH:
     ptr->hash= (memcached_hash)(data);
     break;
index 3f7e096efa6ea5e45355ac08cb36c539c2c273bf..cc63daddcd4dbad3a6c09aceacbc1b8aac9b5e9a 100644 (file)
@@ -2723,6 +2723,7 @@ collection_st collection[] ={
   {"user", 0, 0, user_tests},
   {"generate", 0, 0, generate_tests},
   {"generate_hsieh", pre_hsieh, 0, generate_tests},
+  {"generate_ketama", pre_behavior_ketama, 0, generate_tests},
   {"generate_hsieh_consistent", enable_consistent, 0, generate_tests},
   {"generate_md5", pre_md5, 0, generate_tests},
   {"generate_murmur", pre_murmur, 0, generate_tests},