[Groonga-commit] droonga/droonga-engine at 0e2b0dd [master] Set "last message timestamp" information of the source node as the "effective message timestamp" of the destination node

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Nov 21 13:06:14 JST 2014


YUKI Hiroshi	2014-11-21 13:06:14 +0900 (Fri, 21 Nov 2014)

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

  Message:
    Set "last message timestamp" information of the source node as the "effective message timestamp" of the destination node

  Modified files:
    bin/droonga-engine-absorb-data
    bin/droonga-engine-join

  Modified: bin/droonga-engine-absorb-data (+22 -0)
===================================================================
--- bin/droonga-engine-absorb-data    2014-11-21 13:05:47 +0900 (d988575)
+++ bin/droonga-engine-absorb-data    2014-11-21 13:06:14 +0900 (11c6a23)
@@ -76,6 +76,7 @@ unless options.destination_host
   raise "You must specify the destination host via --destination-host option."
 end
 
+source_node      = "#{options.source_host}:#{options.port}/#{options.tag}"
 destination_node = "#{options.destination_host}:#{options.port}/#{options.tag}"
 
 def run_remote_command(target, command, options)
@@ -109,6 +110,18 @@ if options.remote
     absorbing = response["value"]
     break unless absorbing
   end
+  response = run_remote_command(source_node, "report_status",
+                                "node" => source_node,
+                                "key" => "last_processed_message_timestamp")
+  timestamp = response["value"]
+  puts "The timestamp of the last processed message in the source node: #{timestamp}"
+  if timestamp and not timestamp.empty?
+    puts "Setting effective message timestamp for the destination node..."
+    response = run_remote_command(destination_node, "set_status",
+                                  "node" => destination_node,
+                                  "key" => "effective_message_timestamp",
+                                  "value" => timestamp)
+  end
 else
   Droonga::DataAbsorber.absorb(:dataset          => options.dataset,
                                :source_host      => options.source_host,
@@ -117,6 +130,15 @@ else
                                :tag              => options.tag) do |output|
     puts output
   end
+  response = run_remote_command(source_node, "report_status",
+                                "node" => source_node,
+                                "key" => "last_processed_message_timestamp")
+  timestamp = response["value"]
+  puts "The timestamp of the last processed message in the source node: #{timestamp}"
+  if timestamp and not timestamp.empty?
+    status = NodeStatus.new
+    status.set(:effective_message_timestamp, timestamp)
+  end
 end
 puts "Done."
 

  Modified: bin/droonga-engine-join (+13 -0)
===================================================================
--- bin/droonga-engine-join    2014-11-21 13:05:47 +0900 (6bdac0c)
+++ bin/droonga-engine-join    2014-11-21 13:06:14 +0900 (dc789db)
@@ -84,6 +84,19 @@ while true
   break unless absorbing
 end
 
+response = run_remote_command(source_node, "report_status",
+                              "node" => source_node,
+                              "key" => "last_processed_message_timestamp")
+timestamp = response["value"]
+puts "The timestamp of the last processed message in the source node: #{timestamp}"
+if timestamp and not timestamp.empty?
+  puts "Setting effective message timestamp for the destination node..."
+  response = run_remote_command(destination_node, "set_status",
+                                "node" => destination_node,
+                                "key" => "effective_message_timestamp",
+                                "value" => timestamp)
+end
+
 puts("Update existing hosts in the cluster...")
 run_remote_command(source_node, "add_replicas",
                    "dataset" => options[:dataset],
-------------- next part --------------
HTML����������������������������...
Download 



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