Navigation Menu

Skip to content

Commit

Permalink
Support scattar without record for version1 catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 14, 2015
1 parent 9471fc3 commit f8892dc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/droonga/catalog/version1.rb
Expand Up @@ -397,7 +397,13 @@ def compute_routes(args, active_nodes=nil)
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
Expand All @@ -407,6 +413,7 @@ def compute_routes(args, active_nodes=nil)
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
Expand Down

0 comments on commit f8892dc

Please sign in to comment.