[Groonga-commit] droonga/droonga-engine at fdf9a6a [master] Set effective timestamp for buffered messages via Serf's tag

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Apr 7 18:51:31 JST 2015


YUKI Hiroshi	2015-04-07 18:51:31 +0900 (Tue, 07 Apr 2015)

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

  Message:
    Set effective timestamp for buffered messages via Serf's tag

  Modified files:
    bin/droonga-engine-absorb-data
    bin/droonga-engine-join
    lib/droonga/command/remote.rb
    lib/droonga/command/serf_event_handler.rb
    lib/droonga/serf.rb

  Modified: bin/droonga-engine-absorb-data (+2 -3)
===================================================================
--- bin/droonga-engine-absorb-data    2015-04-07 17:19:42 +0900 (473f28c)
+++ bin/droonga-engine-absorb-data    2015-04-07 18:51:31 +0900 (680f60f)
@@ -202,10 +202,9 @@ class AbsorbDataCommand
     if timestamp and not timestamp.empty?
       puts "The timestamp of the last processed message in the source node: #{timestamp}"
       puts "Setting effective message timestamp for the destination node..."
-      response = run_remote_command(destination_node, "set_metadata",
+      response = run_remote_command(destination_node, "accept_messages_newer_than",
                                     "node" => destination_node,
-                                    "key" => "effective_message_timestamp",
-                                    "value" => timestamp)
+                                    "timestamp" => timestamp)
     end
   end
 

  Modified: bin/droonga-engine-join (+2 -3)
===================================================================
--- bin/droonga-engine-join    2015-04-07 17:19:42 +0900 (e04d660)
+++ bin/droonga-engine-join    2015-04-07 18:51:31 +0900 (441fdb7)
@@ -253,10 +253,9 @@ class JoinCommand
     if timestamp and not timestamp.empty?
       puts "The timestamp of the last processed message in the source node: #{timestamp}"
       puts "Setting effective message timestamp for the destination node..."
-      response = run_remote_command(joining_node, "set_metadata",
+      response = run_remote_command(joining_node, "accept_messages_newer_than",
                                     "node" => joining_node,
-                                    "key" => "effective_message_timestamp",
-                                    "value" => timestamp)
+                                    "timestamp" => timestamp)
     end
   end
 

  Modified: lib/droonga/command/remote.rb (+8 -0)
===================================================================
--- lib/droonga/command/remote.rb    2015-04-07 17:19:42 +0900 (acf58b3)
+++ lib/droonga/command/remote.rb    2015-04-07 18:51:31 +0900 (5d0d8df)
@@ -124,6 +124,14 @@ module Droonga
         end
       end
 
+      class AcceptMessagesNewerThan < Base
+        def process
+          log("old timestamp: #{@serf.accept_messages_newer_than_timestamp}")
+          @serf.accept_messages_newer_than(@params["timestamp"])
+          log("new timestamp: #{@serf.accept_messages_newer_than_timestamp}")
+        end
+      end
+
       class ReportMetadata < Base
         def process
           metadata = NodeMetadata.new

  Modified: lib/droonga/command/serf_event_handler.rb (+2 -0)
===================================================================
--- lib/droonga/command/serf_event_handler.rb    2015-04-07 17:19:42 +0900 (4518339)
+++ lib/droonga/command/serf_event_handler.rb    2015-04-07 18:51:31 +0900 (e1fdae2)
@@ -82,6 +82,8 @@ module Droonga
         case event_name
         when "change_role"
           Remote::ChangeRole
+        when "accept_messages_newer_than"
+          Remote::AcceptMessagesNewerThan
         when "report_metadata"
           Remote::ReportMetadata
         when "set_metadata"

  Modified: lib/droonga/serf.rb (+12 -0)
===================================================================
--- lib/droonga/serf.rb    2015-04-07 17:19:42 +0900 (6093679)
+++ lib/droonga/serf.rb    2015-04-07 18:51:31 +0900 (d479f96)
@@ -177,6 +177,18 @@ module Droonga
       # after that you must run update_cluster_state to update the cluster information cache
     end
 
+    def accept_messages_newer_than_timestamp
+      @node_metadata.reload
+      @node_metadata.get(:accept_messages_newer_than)
+    end
+
+    def accept_messages_newer_than(timestamp)
+      @node_metadata.reload
+      @node_metadata.set(:accept_messages_newer_than, timestamp.to_s)
+      set_tag("accept-messages-newer-than", timestamp.to_s)
+      # after that you must run update_cluster_state to update the cluster information cache
+    end
+
     def cluster_id
       loader = CatalogLoader.new(Path.catalog.to_s)
       catalog = loader.load
-------------- next part --------------
HTML����������������������������...
Download 



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