YUKI Hiroshi
null+****@clear*****
Fri Dec 5 15:49:24 JST 2014
YUKI Hiroshi 2014-12-05 15:49:24 +0900 (Fri, 05 Dec 2014) New Revision: b3e885142dccaeb3ea233f782e58f4196047dfa6 https://github.com/droonga/droonga-engine/commit/b3e885142dccaeb3ea233f782e58f4196047dfa6 Merged e0f9f34: Merge pull request #30 from piroor/replicas-in-a-branch Message: Detect sliced or not by each volume Modified files: lib/droonga/catalog/dataset.rb lib/droonga/catalog/replicas_volume.rb lib/droonga/catalog/single_volume.rb lib/droonga/catalog/slices_volume.rb lib/droonga/plugins/search/distributed_search_planner.rb test/unit/helper/distributed_search_planner_helper.rb test/unit/plugins/search/test_planner.rb Modified: lib/droonga/catalog/dataset.rb (+3 -5) =================================================================== --- lib/droonga/catalog/dataset.rb 2014-12-05 15:44:41 +0900 (abb832d) +++ lib/droonga/catalog/dataset.rb 2014-12-05 15:49:24 +0900 (4c985f4) @@ -72,12 +72,10 @@ module Droonga :live_nodes => live_nodes) end - def single_slice? + def sliced? # TODO: Support slice key - replicas.all? do |volume| - volume.is_a?(SingleVolume) or - volume.is_a?(ReplicasVolume) or - volume.slices.size == 1 + replicas.any? do |volume| + volume.sliced? end end end Modified: lib/droonga/catalog/replicas_volume.rb (+4 -0) =================================================================== --- lib/droonga/catalog/replicas_volume.rb 2014-12-05 15:44:41 +0900 (30645c6) +++ lib/droonga/catalog/replicas_volume.rb 2014-12-05 15:49:24 +0900 (7898c7a) @@ -94,6 +94,10 @@ module Droonga routes end + def sliced? + false + end + private def collect_all_nodes nodes = [] Modified: lib/droonga/catalog/single_volume.rb (+4 -0) =================================================================== --- lib/droonga/catalog/single_volume.rb 2014-12-05 15:44:41 +0900 (4acf433) +++ lib/droonga/catalog/single_volume.rb 2014-12-05 15:49:24 +0900 (de26a20) @@ -31,6 +31,10 @@ module Droonga def all_nodes @all_nodes ||= [node] end + + def sliced? + false + end end end end Modified: lib/droonga/catalog/slices_volume.rb (+4 -0) =================================================================== --- lib/droonga/catalog/slices_volume.rb 2014-12-05 15:44:41 +0900 (6141ab4) +++ lib/droonga/catalog/slices_volume.rb 2014-12-05 15:49:24 +0900 (8c62207) @@ -86,6 +86,10 @@ module Droonga routes end + def sliced? + slices.size > 1 + end + private def compute_continuum total_weight = compute_total_weight Modified: lib/droonga/plugins/search/distributed_search_planner.rb (+4 -4) =================================================================== --- lib/droonga/plugins/search/distributed_search_planner.rb 2014-12-05 15:44:41 +0900 (5263244) +++ lib/droonga/plugins/search/distributed_search_planner.rb 2014-12-05 15:49:24 +0900 (d56e3c9) @@ -210,13 +210,13 @@ module Droonga end def final_offset - return @original_output_offset if****@datas*****_slice? + return @original_output_offset unles****@datas*****? @original_sort_offset + @original_output_offset end def final_limit - return @original_output_limit if****@datas*****_slice? + return @original_output_limit unles****@datas*****? if @original_sort_limit == UNLIMITED and @original_output_limit == UNLIMITED @@ -251,7 +251,7 @@ module Droonga "type" => "sum", } if unifiable? - unles****@datas*****_slice? + if****@datas*****? if @query["sortBy"].is_a?(Hash) @query["sortBy"]["limit"] = UNLIMITED end @@ -261,7 +261,7 @@ module Droonga "target" => "records", } unless @output["elements"].include?("records") - @records_limit = UNLIMITED unles****@datas*****_slice? + @records_limit = UNLIMITED if****@datas*****? @output["elements"] << "records" @output["attributes"] ||= ["_key"] @output_records = false Modified: test/unit/helper/distributed_search_planner_helper.rb (+2 -2) =================================================================== --- test/unit/helper/distributed_search_planner_helper.rb 2014-12-05 15:44:41 +0900 (6c36a21) +++ test/unit/helper/distributed_search_planner_helper.rb 2014-12-05 15:49:24 +0900 (cb127cb) @@ -22,8 +22,8 @@ module DistributedSearchPlannerHelper stub(stub_dataset).name do Droonga::Catalog::Dataset::DEFAULT_NAME end - stub(stub_dataset).single_slice? do - false + stub(stub_dataset).sliced? do + true end planner = Droonga::Plugins::Search::DistributedSearchPlanner.new(stub_dataset, search_request) planner.plan Modified: test/unit/plugins/search/test_planner.rb (+2 -2) =================================================================== --- test/unit/plugins/search/test_planner.rb 2014-12-05 15:44:41 +0900 (0a2b35e) +++ test/unit/plugins/search/test_planner.rb 2014-12-05 15:49:24 +0900 (7cb3651) @@ -24,8 +24,8 @@ class SearchPlannerTest < Test::Unit::TestCase stub(stub_dataset).name do Droonga::Catalog::Dataset::DEFAULT_NAME end - stub(stub_dataset).single_slice? do - false + stub(stub_dataset).sliced? do + true end @plugin = Droonga::Plugins::Search::Planner.new(stub_dataset) end -------------- next part -------------- HTML����������������������������...Download