Kouhei Sutou
null+****@clear*****
Sun Nov 2 21:33:17 JST 2014
Kouhei Sutou 2014-11-02 21:33:17 +0900 (Sun, 02 Nov 2014) New Revision: 872d67f1b92d554ea603fc383a4af87f3b36f394 https://github.com/droonga/droonga-engine/commit/872d67f1b92d554ea603fc383a4af87f3b36f394 Message: Introduce "change_schema" attribute It is for reducing database reopen. Modified files: lib/droonga/handler_runner.rb lib/droonga/plugin/metadata/handler_action.rb lib/droonga/plugins/groonga/column_create.rb lib/droonga/plugins/groonga/column_remove.rb lib/droonga/plugins/groonga/column_rename.rb lib/droonga/plugins/groonga/delete.rb lib/droonga/plugins/groonga/table_create.rb lib/droonga/plugins/groonga/table_remove.rb lib/droonga/processor.rb Modified: lib/droonga/handler_runner.rb (+4 -0) =================================================================== --- lib/droonga/handler_runner.rb 2014-11-02 21:07:26 +0900 (3ce67c6) +++ lib/droonga/handler_runner.rb 2014-11-02 21:33:17 +0900 (82bdc9b) @@ -44,6 +44,10 @@ module Droonga logger.trace("shutdown: done") end + def change_schema?(type) + find_handler_class(type).action.change_schema? + end + def prefer_synchronous?(type) find_handler_class(type).action.synchronous? end Modified: lib/droonga/plugin/metadata/handler_action.rb (+8 -0) =================================================================== --- lib/droonga/plugin/metadata/handler_action.rb 2014-11-02 21:07:26 +0900 (9035aae) +++ lib/droonga/plugin/metadata/handler_action.rb 2014-11-02 21:33:17 +0900 (1bc92b1) @@ -21,6 +21,14 @@ module Droonga @handler_class = handler_class end + def change_schema? + configuration[:change_schema] + end + + def change_schema=(boolean) + configuration[:change_schema] = boolean + end + def synchronous? configuration[:synchronous] end Modified: lib/droonga/plugins/groonga/column_create.rb (+1 -1) =================================================================== --- lib/droonga/plugins/groonga/column_create.rb 2014-11-02 21:07:26 +0900 (266b870) +++ lib/droonga/plugins/groonga/column_create.rb 2014-11-02 21:33:17 +0900 (36c1bf2) @@ -103,7 +103,7 @@ module Droonga end class Handler < Droonga::Handler - action.synchronous = true + action.change_schema = true def handle(message) command = Command.new(@context) Modified: lib/droonga/plugins/groonga/column_remove.rb (+1 -1) =================================================================== --- lib/droonga/plugins/groonga/column_remove.rb 2014-11-02 21:07:26 +0900 (9ee130e) +++ lib/droonga/plugins/groonga/column_remove.rb 2014-11-02 21:33:17 +0900 (d3d1816) @@ -46,7 +46,7 @@ module Droonga end class Handler < Droonga::Handler - action.synchronous = true + action.change_schema = true def handle(message) command = Command.new(@context) Modified: lib/droonga/plugins/groonga/column_rename.rb (+1 -1) =================================================================== --- lib/droonga/plugins/groonga/column_rename.rb 2014-11-02 21:07:26 +0900 (fad8a04) +++ lib/droonga/plugins/groonga/column_rename.rb 2014-11-02 21:33:17 +0900 (edc2a22) @@ -48,7 +48,7 @@ module Droonga end class Handler < Droonga::Handler - action.synchronous = true + action.change_schema = true def handle(message) command = Command.new(@context) Modified: lib/droonga/plugins/groonga/delete.rb (+1 -1) =================================================================== --- lib/droonga/plugins/groonga/delete.rb 2014-11-02 21:07:26 +0900 (7f3adcd) +++ lib/droonga/plugins/groonga/delete.rb 2014-11-02 21:33:17 +0900 (40e244a) @@ -97,7 +97,7 @@ module Droonga end class Handler < Droonga::Handler - action.synchronous = true + action.change_schema = true def handle(message) command = Command.new(@context) Modified: lib/droonga/plugins/groonga/table_create.rb (+1 -1) =================================================================== --- lib/droonga/plugins/groonga/table_create.rb 2014-11-02 21:07:26 +0900 (05c8154) +++ lib/droonga/plugins/groonga/table_create.rb 2014-11-02 21:33:17 +0900 (c9cd9b1) @@ -91,7 +91,7 @@ module Droonga end class Handler < Droonga::Handler - action.synchronous = true + action.change_schema = true def handle(message) command = Command.new(@context) Modified: lib/droonga/plugins/groonga/table_remove.rb (+1 -1) =================================================================== --- lib/droonga/plugins/groonga/table_remove.rb 2014-11-02 21:07:26 +0900 (59b51e4) +++ lib/droonga/plugins/groonga/table_remove.rb 2014-11-02 21:33:17 +0900 (f2993f7) @@ -37,7 +37,7 @@ module Droonga end class Handler < Droonga::Handler - action.synchronous = true + action.change_schema = true def handle(message) command = Command.new(@context) Modified: lib/droonga/processor.rb (+3 -2) =================================================================== --- lib/droonga/processor.rb 2014-11-02 21:07:26 +0900 (1e10f9d) +++ lib/droonga/processor.rb 2014-11-02 21:33:17 +0900 (eb4f24b) @@ -44,9 +44,10 @@ module Droonga if @handler_runner.processable?(type) logger.trace("process: handlable: #{type}") synchronous = @handler_runner.prefer_synchronous?(type) - if @n_workers.zero? or synchronous + change_schema = @handler_runner.change_schema?(type) + if @n_workers.zero? or synchronous or change_schema @handler_runner.process(message) - if synchronous + if change_schema @job_pusher.broadcast(database_reopen_message) end else -------------- next part -------------- HTML����������������������������...Download