[Groonga-commit] droonga/droonga-engine at adad427 [master] Update "accept_messages_newer_than" timestamp before absorbing.

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Apr 21 19:52:44 JST 2015


YUKI Hiroshi	2015-04-21 19:52:44 +0900 (Tue, 21 Apr 2015)

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

  Message:
    Update "accept_messages_newer_than" timestamp before absorbing.
    
    Because "system.absorb-data.end" can be forwarded before all restore messages are completely processed.
    Restarting while restoring can stop the operation.

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

  Modified: bin/droonga-engine-absorb-data (+12 -1)
===================================================================
--- bin/droonga-engine-absorb-data    2015-04-21 19:19:23 +0900 (ff59bdc)
+++ bin/droonga-engine-absorb-data    2015-04-21 19:52:44 +0900 (e7f3bcb)
@@ -44,6 +44,12 @@ module Droonga
       puts ""
       puts "Absorbing..."
 
+      succeeded = update_accept_messages_newer_than_timestamp
+      unless succeeded
+        do_cancel
+        return false
+      end
+
       succeeded = absorb
 
       if succeeded
@@ -238,7 +244,10 @@ module Droonga
       end
 
       puts ""
+      true
+    end
 
+    def update_accept_messages_newer_than_timestamp
       timestamp = source_node_serf.last_processed_message_timestamp
       unless timestamp
         $stderr.puts("Couldn't get the time stamp of " +
@@ -248,9 +257,11 @@ module Droonga
       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 = destination_node_serf.send_query("accept_messages_newer_than",
+        destination_node_serf.ensure_restarted do
+          destination_node_serf.send_query("accept_messages_newer_than",
                                                     "node"      => destination_node.to_s,
                                                     "timestamp" => timestamp)
+        end
       end
       true
     end

  Modified: bin/droonga-engine-join (+6 -3)
===================================================================
--- bin/droonga-engine-join    2015-04-21 19:19:23 +0900 (643eb7f)
+++ bin/droonga-engine-join    2015-04-21 19:52:44 +0900 (224305a)
@@ -66,6 +66,7 @@ module Droonga
         do_join
         register_to_existing_nodes
         set_source_node_role
+        update_accept_messages_newer_than_timestamp
         if should_copy?
           successed = copy_data
           unless successed
@@ -73,7 +74,6 @@ module Droonga
             return false
           end
         end
-        set_effective_message_timestamp
         reset_source_node_role
         reset_joining_node_role
         puts("Done.")
@@ -317,7 +317,7 @@ module Droonga
       true
     end
 
-    def set_effective_message_timestamp
+    def update_accept_messages_newer_than_timestamp
       timestamp = source_node_serf.last_processed_message_timestamp
       unless timestamp
         $stderr.puts("Couldn't get the time stamp of " +
@@ -327,10 +327,13 @@ module Droonga
       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 = joining_node_serf.send_query("accept_messages_newer_than",
+        joining_node_serf.ensure_restarted do
+          joining_node_serf.send_query("accept_messages_newer_than",
                                                 "node"      => joining_node.to_s,
                                                 "timestamp" => timestamp)
+        end
       end
+      true
     end
 
     def register_to_existing_nodes
-------------- next part --------------
HTML����������������������������...
Download 



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