[Groonga-commit] droonga/droonga-engine at f8892dc [master] Support scattar without record for version1 catalog

Back to archive index

YUKI Piro Hiroshi null+****@clear*****
Tue Apr 14 23:43:54 JST 2015


YUKI "Piro" Hiroshi	2015-04-14 23:43:54 +0900 (Tue, 14 Apr 2015)

  New Revision: f8892dcb718b6798b59fbf023291bacfee55f9db
  https://github.com/droonga/droonga-engine/commit/f8892dcb718b6798b59fbf023291bacfee55f9db

  Message:
    Support scattar without record for version1 catalog

  Modified files:
    lib/droonga/catalog/version1.rb

  Modified: lib/droonga/catalog/version1.rb (+8 -1)
===================================================================
--- lib/droonga/catalog/version1.rb    2015-04-14 22:14:58 +0900 (0319643)
+++ lib/droonga/catalog/version1.rb    2015-04-14 23:43:54 +0900 (08e86c1)
@@ -397,7 +397,13 @@ module Droonga
               select_range_and_replicas(partition, args, routes)
             end
           when "scatter"
-            name = get_partition(args["record"]["_key"])
+            record = args["record"]
+            if record
+              key = record["_key"]
+            else
+              key = nil
+            end
+            name = get_partition(key)
             partition = self["ring"][name]
             select_range_and_replicas(partition, args, routes)
           end
@@ -407,6 +413,7 @@ module Droonga
         def get_partition(key)
           continuum = self["continuum"]
           return self["ring"].keys[0] unless continuum
+          return continuum.sample[1] unless key
           key = key.to_s unless key.is_a?(String)
           hash = Zlib.crc32(key)
           min = 0
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index