[Groonga-commit] droonga/droonga-engine at 8a757f8 [master] Export volume address as the label of worker

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Apr 29 21:37:17 JST 2015


YUKI Hiroshi	2015-04-29 21:37:17 +0900 (Wed, 29 Apr 2015)

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

  Message:
    Export volume address as the label of worker

  Modified files:
    lib/droonga/catalog/version2.rb
    lib/droonga/command/droonga_engine_worker.rb
    lib/droonga/farm.rb
    lib/droonga/handler.rb
    lib/droonga/handler_runner.rb
    lib/droonga/plugins/system/statistics.rb
    lib/droonga/slice.rb
    lib/droonga/supervisor.rb

  Modified: lib/droonga/catalog/version2.rb (+1 -0)
===================================================================
--- lib/droonga/catalog/version2.rb    2015-04-29 21:15:19 +0900 (41d776e)
+++ lib/droonga/catalog/version2.rb    2015-04-29 21:37:17 +0900 (c9339f0)
@@ -50,6 +50,7 @@ module Droonga
                 migrate_database_location(path, device, local_name)
 
                 options = {
+                  :label     => volume_address.to_s,
                   :dataset   => dataset_name,
                   :database  => path.to_s,
                   :n_workers => n_workers,

  Modified: lib/droonga/command/droonga_engine_worker.rb (+6 -0)
===================================================================
--- lib/droonga/command/droonga_engine_worker.rb    2015-04-29 21:15:19 +0900 (c2bd13a)
+++ lib/droonga/command/droonga_engine_worker.rb    2015-04-29 21:37:17 +0900 (59e3776)
@@ -40,6 +40,7 @@ module Droonga
         @contrtol_read_fd = nil
         @contrtol_write_fd = nil
         @pid_file_path = nil
+        @label = nil
         @dataset = nil
         @database_path = nil
         @plugins = []
@@ -91,6 +92,10 @@ module Droonga
                   "Put PID to PATH") do |path|
           @pid_file_path = Pathname.new(path)
         end
+        parser.on("--label=LABEL",
+                  "Use given value as the label") do |label|
+          @label = label
+        end
         parser.on("--dataset=DATASET",
                   "Process DATASET") do |dataset|
           @dataset = dataset
@@ -181,6 +186,7 @@ module Droonga
 
       def start_handler_runner
         options = {
+          :label     => @label,
           :forwarder => @forwarder,
           :dataset   => @dataset,
           :database  => @database_path.to_s,

  Modified: lib/droonga/farm.rb (+1 -1)
===================================================================
--- lib/droonga/farm.rb    2015-04-29 21:15:19 +0900 (975919c)
+++ lib/droonga/farm.rb    2015-04-29 21:37:17 +0900 (4203a10)
@@ -40,7 +40,7 @@ module Droonga
       slices =****@catal*****(name)
       slices.each do |slice_name, slice_options|
         dataset =****@catal*****[slice_options[:dataset]]
-        slice = Droonga::Slice.new(dataset,
+        slice = Droonga::Slice.new(slice_name, dataset,
                                    @loop,
                                    @options.merge(slice_options))
         @slices[slice_name] = slice

  Modified: lib/droonga/handler.rb (+3 -2)
===================================================================
--- lib/droonga/handler.rb    2015-04-29 21:15:19 +0900 (8423f3e)
+++ lib/droonga/handler.rb    2015-04-29 21:37:17 +0900 (e2ffa1b)
@@ -35,9 +35,10 @@ module Droonga
       end
     end
 
-    attr_reader :messenger, :loop
-    def initialize(name, context, messenger, loop)
+    attr_reader :label, :messenger, :loop
+    def initialize(name, label, context, messenger, loop)
       @name = name
+      @label = label
       @context = context
       @messenger = messenger
       @loop = loop

  Modified: lib/droonga/handler_runner.rb (+2 -1)
===================================================================
--- lib/droonga/handler_runner.rb    2015-04-29 21:15:19 +0900 (82bdc9b)
+++ lib/droonga/handler_runner.rb    2015-04-29 21:37:17 +0900 (399b444)
@@ -28,6 +28,7 @@ module Droonga
       @loop = loop
       @options = options
       @name = options[:name]
+      @label = options[:label]
       @dataset_name = options[:dataset]
       @database_name = options[:database]
       prepare
@@ -112,7 +113,7 @@ module Droonga
       handler_message.validate
 
       messenger = HandlerMessenger.new(@forwarder, handler_message, @options)
-      handler = handler_class.new(@name, @context, messenger, @loop)
+      handler = handler_class.new(@name, @label, @context, messenger, @loop)
       begin
         result = handler.handle(handler_message)
         unless result.nil?

  Modified: lib/droonga/plugins/system/statistics.rb (+1 -9)
===================================================================
--- lib/droonga/plugins/system/statistics.rb    2015-04-29 21:15:19 +0900 (598ec21)
+++ lib/droonga/plugins/system/statistics.rb    2015-04-29 21:37:17 +0900 (a12456b)
@@ -55,17 +55,9 @@ module Droonga
       class StatisticsObjectCountPerVolumeHandler < StatisticsObjectCountHandler
         def handle(message)
           {
-            replica_name => counts(message.request["output"]),
+            label => counts(message.request["output"]),
           }
         end
-
-        def replica_name
-          my_node_name
-        end
-
-        def my_node_name
-          ENV["DROONGA_ENGINE_NAME"]
-        end
       end
 
       define_single_step do |step|

  Modified: lib/droonga/slice.rb (+3 -1)
===================================================================
--- lib/droonga/slice.rb    2015-04-29 21:15:19 +0900 (06d51f2)
+++ lib/droonga/slice.rb    2015-04-29 21:37:17 +0900 (7e17b87)
@@ -26,7 +26,8 @@ module Droonga
     include Loggable
     include Deferrable
 
-    def initialize(dataset, loop, options={})
+    def initialize(label, dataset, loop, options={})
+      @label = label
       @dataset = dataset
       @loop = loop
       @options = options
@@ -118,6 +119,7 @@ module Droonga
 
       config = Supervisor::WorkerConfiguration.new
       config.name = @options[:name]
+      config.label = @label
       config.dataset = @dataset
       config.database_path = @database_path
       config.plugins = @options[:plugins]

  Modified: lib/droonga/supervisor.rb (+3 -0)
===================================================================
--- lib/droonga/supervisor.rb    2015-04-29 21:15:19 +0900 (ed5b6ce)
+++ lib/droonga/supervisor.rb    2015-04-29 21:37:17 +0900 (5bb2659)
@@ -78,6 +78,7 @@ module Droonga
 
     class WorkerConfiguration
       attr_accessor :name
+      attr_accessor :label
       attr_accessor :dataset
       attr_accessor :database_path
       attr_accessor :plugins
@@ -85,6 +86,7 @@ module Droonga
       attr_accessor :internal_connection_lifetime
       def initialize
         @name = nil
+        @label = nil
         @dataset = nil
         @database_path = nil
         @plugins = []
@@ -116,6 +118,7 @@ module Droonga
           "--control-write-fd", control_read_out.fileno.to_s,
           "--job-queue-socket-path", @config.job_pusher.socket_path.to_s,
           "--pid-file", pid_path.to_s,
+          "--label", @config.label,
           "--dataset", @config.dataset.name,
           "--database-path", @config.database_path.to_s,
           "--plugins", @config.plugins.join(","),
-------------- next part --------------
HTML����������������������������...
下载 



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