[Groonga-commit] droonga/droonga-engine at 1523d80 [master] Use last processed message timestamp which is possibly updated after graceful stop

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Apr 23 14:49:05 JST 2015


YUKI Hiroshi	2015-04-23 14:49:05 +0900 (Thu, 23 Apr 2015)

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

  Message:
    Use last processed message timestamp which is possibly updated after graceful stop

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

  Modified: bin/droonga-engine-absorb-data (+2 -8)
===================================================================
--- bin/droonga-engine-absorb-data    2015-04-23 14:37:15 +0900 (88bdab7)
+++ bin/droonga-engine-absorb-data    2015-04-23 14:49:05 +0900 (bfbd809)
@@ -43,15 +43,10 @@ module Droonga
       puts ""
       puts "Absorbing..."
 
-      succeeded = update_accept_messages_newer_than_timestamp
-      unless succeeded
-        do_cancel
-        return false
-      end
-
       succeeded = absorb
 
       if succeeded
+        update_accept_messages_newer_than_timestamp
         puts "Done."
       else
         do_cancel
@@ -247,7 +242,7 @@ module Droonga
     end
 
     def update_accept_messages_newer_than_timestamp
-      timestamp = source_node_serf.last_processed_message_timestamp
+      timestamp = source_node_serf.latest_last_processed_message_timestamp
       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..."
@@ -261,7 +256,6 @@ module Droonga
                        "the last processed message from the source node. " +
                        "Any message will be forwarded to the joining node.")
       end
-      true
     end
 
     def trap_signals

  Modified: bin/droonga-engine-join (+2 -7)
===================================================================
--- bin/droonga-engine-join    2015-04-23 14:37:15 +0900 (a6d698a)
+++ bin/droonga-engine-join    2015-04-23 14:49:05 +0900 (d370c9f)
@@ -66,17 +66,13 @@ module Droonga
         do_join
         register_to_existing_nodes
         set_source_node_role
-        successed = update_accept_messages_newer_than_timestamp
-        unless successed
-          do_cancel
-          return false
-        end
         if should_copy?
           successed = copy_data
           unless successed
             do_cancel
             return false
           end
+          update_accept_messages_newer_than_timestamp
         end
         reset_source_node_role
         reset_joining_node_role
@@ -322,7 +318,7 @@ module Droonga
     end
 
     def update_accept_messages_newer_than_timestamp
-      timestamp = source_node_serf.last_processed_message_timestamp
+      timestamp = source_node_serf.latest_last_processed_message_timestamp
       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..."
@@ -336,7 +332,6 @@ module Droonga
                        "the last processed message from the source node. " +
                        "Any message will be forwarded to the joining node.")
       end
-      true
     end
 
     def register_to_existing_nodes

  Modified: lib/droonga/serf.rb (+6 -0)
===================================================================
--- lib/droonga/serf.rb    2015-04-23 14:37:15 +0900 (83aec49)
+++ lib/droonga/serf.rb    2015-04-23 14:49:05 +0900 (d8c40c9)
@@ -199,6 +199,12 @@ module Droonga
       get_tag(Tag.last_processed_message_timestamp)
     end
 
+    def latest_last_processed_message_timestamp
+      query("export_last_processed_message_timestamp",
+            "node" => @name)
+      last_processed_message_timestamp
+    end
+
     def last_processed_message_timestamp=(timestamp)
       set_tag(Tag.last_processed_message_timestamp, timestamp)
       # after that you must run update_cluster_state to update the cluster information cache
-------------- next part --------------
HTML����������������������������...
Download 



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