[Groonga-commit] droonga/droonga-engine at 4a5e7ff [master] Specify default "slice" value for all plan

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Apr 15 22:27:27 JST 2015


YUKI Hiroshi	2015-04-15 22:27:27 +0900 (Wed, 15 Apr 2015)

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

  Message:
    Specify default "slice" value for all plan

  Modified files:
    lib/droonga/catalog/slices_volume.rb
    lib/droonga/distributed_command_planner.rb
    lib/droonga/planner.rb
    test/unit/plugins/search/test_planner.rb

  Modified: lib/droonga/catalog/slices_volume.rb (+2 -3)
===================================================================
--- lib/droonga/catalog/slices_volume.rb    2015-04-15 22:10:18 +0900 (7eda769)
+++ lib/droonga/catalog/slices_volume.rb    2015-04-15 22:27:27 +0900 (2d11e5b)
@@ -84,14 +84,13 @@ module Droonga
         slices = []
         case message["type"]
         when "broadcast"
-          slices = select_slices
+          slices = select_slices(message["slice"].to_sym)
         when "scatter"
           record = message["record"]
           if record
             slices = [choose_slice(record)]
           else
-            slice_option = message["slice"] || "all"
-            slices = select_slices(slice_option.to_sym)
+            slices = select_slices(message["slice"].to_sym)
           end
         end
         slices.each do |slice|

  Modified: lib/droonga/distributed_command_planner.rb (+2 -0)
===================================================================
--- lib/droonga/distributed_command_planner.rb    2015-04-15 22:10:18 +0900 (a4b377f)
+++ lib/droonga/distributed_command_planner.rb    2015-04-15 22:27:27 +0900 (77088ff)
@@ -64,6 +64,7 @@ module Droonga
         "type"    => "scatter",
         "outputs" => [],
         "replica" => options[:replica] || "all",
+        "slice"   => options[:slice] || "all",
         "post"    => options[:write] || false,
       }
     end
@@ -76,6 +77,7 @@ module Droonga
         "type"    => "broadcast",
         "outputs" => [],
         "replica" => options[:replica] || "random",
+        "slice"   => options[:slice] || "all",
         "post"    => options[:write] || false,
       }
     end

  Modified: lib/droonga/planner.rb (+6 -1)
===================================================================
--- lib/droonga/planner.rb    2015-04-15 22:10:18 +0900 (2110181)
+++ lib/droonga/planner.rb    2015-04-15 22:27:27 +0900 (13ac2d0)
@@ -79,7 +79,12 @@ module Droonga
       broadcast_options = {
         :write => write?,
       }
-      broadcast_options[:replica] = "all" if write?
+      if write?
+        broadcast_options[:replica] = "all"
+      elsif single_operation?
+        broadcast_options[:slice]   = "random"
+        broadcast_options[:replica] = "random"
+      end
       planner.broadcast(broadcast_options)
       planner.reduce(options[:reduce])
       planner.plan

  Modified: test/unit/plugins/search/test_planner.rb (+1 -0)
===================================================================
--- test/unit/plugins/search/test_planner.rb    2015-04-15 22:10:18 +0900 (228572b)
+++ test/unit/plugins/search/test_planner.rb    2015-04-15 22:27:27 +0900 (76f69be)
@@ -174,6 +174,7 @@ class SearchPlannerTest < Test::Unit::TestCase
         "query2",
       ],
       "replica" => "random",
+      "slice" => "all",
       "post" => false,
     }
     message << searcher
-------------- next part --------------
HTML����������������������������...
Descargar 



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