droonga-engine 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -2
  3. data/Gemfile +1 -1
  4. data/LICENSE.txt +1 -1
  5. data/Rakefile +1 -1
  6. data/benchmark/benchmark.rb +1 -1
  7. data/benchmark/utils.rb +1 -1
  8. data/benchmark/watch/benchmark-notify.rb +1 -1
  9. data/benchmark/watch/benchmark-publish.rb +1 -1
  10. data/benchmark/watch/benchmark-scan.rb +1 -1
  11. data/bin/droonga-engine +1 -1
  12. data/bin/droonga-engine-absorb-data +48 -8
  13. data/bin/droonga-engine-catalog-generate +1 -1
  14. data/bin/droonga-engine-catalog-modify +1 -1
  15. data/bin/droonga-engine-data-publisher +66 -0
  16. data/bin/droonga-engine-join +72 -17
  17. data/bin/droonga-engine-serf-event-handler +1 -1
  18. data/bin/droonga-engine-service +1 -1
  19. data/bin/droonga-engine-unjoin +11 -4
  20. data/bin/droonga-engine-worker +20 -0
  21. data/doc/text/news.md +8 -0
  22. data/droonga-engine.gemspec +3 -3
  23. data/lib/droonga/adapter.rb +1 -1
  24. data/lib/droonga/adapter_runner.rb +1 -1
  25. data/lib/droonga/address.rb +69 -0
  26. data/lib/droonga/buffered_tcp_socket.rb +44 -22
  27. data/lib/droonga/catalog/base.rb +1 -1
  28. data/lib/droonga/catalog/collection_volume.rb +1 -1
  29. data/lib/droonga/catalog/dataset.rb +8 -8
  30. data/lib/droonga/catalog/errors.rb +1 -1
  31. data/lib/droonga/catalog/schema.rb +1 -1
  32. data/lib/droonga/catalog/single_volume.rb +6 -8
  33. data/lib/droonga/catalog/slice.rb +1 -1
  34. data/lib/droonga/catalog/version1.rb +2 -2
  35. data/lib/droonga/catalog/version2.rb +6 -6
  36. data/lib/droonga/catalog/version2_validator.rb +1 -1
  37. data/lib/droonga/catalog/volume.rb +1 -1
  38. data/lib/droonga/catalog/volume_collection.rb +2 -2
  39. data/lib/droonga/catalog_generator.rb +49 -53
  40. data/lib/droonga/catalog_loader.rb +1 -1
  41. data/lib/droonga/collector.rb +1 -1
  42. data/lib/droonga/collector_message.rb +1 -1
  43. data/lib/droonga/collector_runner.rb +1 -1
  44. data/lib/droonga/collectors/and.rb +1 -1
  45. data/lib/droonga/collectors/or.rb +1 -1
  46. data/lib/droonga/collectors/sum.rb +1 -1
  47. data/lib/droonga/collectors.rb +1 -1
  48. data/lib/droonga/command/droonga_engine.rb +103 -55
  49. data/lib/droonga/command/droonga_engine_service.rb +22 -67
  50. data/lib/droonga/command/droonga_engine_worker.rb +232 -0
  51. data/lib/droonga/command/serf_event_handler.rb +126 -46
  52. data/lib/droonga/data_absorber.rb +32 -14
  53. data/lib/droonga/dispatcher.rb +15 -11
  54. data/lib/droonga/distributed_command_planner.rb +1 -1
  55. data/lib/droonga/distributor.rb +1 -1
  56. data/lib/droonga/engine/version.rb +2 -2
  57. data/lib/droonga/engine.rb +8 -3
  58. data/lib/droonga/engine_state.rb +15 -6
  59. data/lib/droonga/error.rb +1 -1
  60. data/lib/droonga/error_messages.rb +1 -1
  61. data/lib/droonga/event_loop.rb +1 -1
  62. data/lib/droonga/farm.rb +9 -1
  63. data/lib/droonga/file_observer.rb +1 -1
  64. data/lib/droonga/fluent_message_receiver.rb +11 -5
  65. data/lib/droonga/fluent_message_sender.rb +14 -17
  66. data/lib/droonga/forwarder.rb +23 -13
  67. data/lib/droonga/handler.rb +1 -1
  68. data/lib/droonga/handler_message.rb +1 -1
  69. data/lib/droonga/handler_messenger.rb +2 -2
  70. data/lib/droonga/handler_runner.rb +2 -2
  71. data/lib/droonga/input_message.rb +1 -1
  72. data/lib/droonga/internal_fluent_message_receiver.rb +3 -2
  73. data/lib/droonga/job_protocol.rb +1 -1
  74. data/lib/droonga/job_pusher.rb +1 -1
  75. data/lib/droonga/job_receiver.rb +1 -1
  76. data/lib/droonga/line_buffer.rb +1 -1
  77. data/lib/droonga/live_nodes_list_loader.rb +1 -1
  78. data/lib/droonga/loggable.rb +1 -1
  79. data/lib/droonga/logger.rb +3 -3
  80. data/lib/droonga/message_matcher.rb +1 -1
  81. data/lib/droonga/output_message.rb +1 -1
  82. data/lib/droonga/path.rb +5 -1
  83. data/lib/droonga/planner.rb +1 -1
  84. data/lib/droonga/pluggable.rb +1 -1
  85. data/lib/droonga/plugin/metadata/adapter_input_message.rb +1 -1
  86. data/lib/droonga/plugin/metadata/adapter_output_message.rb +1 -1
  87. data/lib/droonga/plugin/metadata/collector_message.rb +1 -1
  88. data/lib/droonga/plugin/metadata/handler_action.rb +1 -1
  89. data/lib/droonga/plugin/metadata/input_message.rb +1 -1
  90. data/lib/droonga/plugin.rb +2 -1
  91. data/lib/droonga/plugin_loader.rb +1 -1
  92. data/lib/droonga/plugin_registry.rb +3 -1
  93. data/lib/droonga/plugins/basic.rb +1 -1
  94. data/lib/droonga/plugins/crud.rb +1 -1
  95. data/lib/droonga/plugins/dump.rb +13 -2
  96. data/lib/droonga/plugins/error.rb +1 -1
  97. data/lib/droonga/plugins/groonga/column_create.rb +1 -1
  98. data/lib/droonga/plugins/groonga/column_list.rb +1 -1
  99. data/lib/droonga/plugins/groonga/column_remove.rb +1 -1
  100. data/lib/droonga/plugins/groonga/column_rename.rb +1 -1
  101. data/lib/droonga/plugins/groonga/delete.rb +1 -1
  102. data/lib/droonga/plugins/groonga/generic_command.rb +1 -1
  103. data/lib/droonga/plugins/groonga/generic_response.rb +1 -1
  104. data/lib/droonga/plugins/groonga/select.rb +1 -1
  105. data/lib/droonga/plugins/groonga/table_create.rb +1 -1
  106. data/lib/droonga/plugins/groonga/table_list.rb +1 -1
  107. data/lib/droonga/plugins/groonga/table_remove.rb +1 -1
  108. data/lib/droonga/plugins/groonga.rb +1 -1
  109. data/lib/droonga/plugins/search/distributed_search_planner.rb +1 -1
  110. data/lib/droonga/plugins/search.rb +1 -1
  111. data/lib/droonga/plugins/system.rb +1 -1
  112. data/lib/droonga/plugins/watch.rb +1 -1
  113. data/lib/droonga/{service_control_protocol.rb → process_control_protocol.rb} +2 -2
  114. data/lib/droonga/process_supervisor.rb +91 -0
  115. data/lib/droonga/processor.rb +1 -1
  116. data/lib/droonga/reducer.rb +1 -1
  117. data/lib/droonga/replier.rb +2 -2
  118. data/lib/droonga/safe_file_writer.rb +1 -1
  119. data/lib/droonga/schema_applier.rb +1 -1
  120. data/lib/droonga/searcher/mecab_filter.rb +1 -1
  121. data/lib/droonga/searcher.rb +31 -19
  122. data/lib/droonga/serf.rb +81 -14
  123. data/lib/droonga/serf_downloader.rb +2 -2
  124. data/lib/droonga/session.rb +1 -1
  125. data/lib/droonga/single_step.rb +1 -1
  126. data/lib/droonga/single_step_definition.rb +1 -1
  127. data/lib/droonga/slice.rb +30 -28
  128. data/lib/droonga/status_code.rb +1 -1
  129. data/lib/droonga/step_runner.rb +1 -1
  130. data/lib/droonga/supervisor.rb +170 -0
  131. data/lib/droonga/sweeper.rb +1 -1
  132. data/lib/droonga/test/stub_handler.rb +1 -1
  133. data/lib/droonga/test/stub_handler_message.rb +1 -1
  134. data/lib/droonga/test/stub_handler_messenger.rb +1 -1
  135. data/lib/droonga/test/stub_planner.rb +1 -1
  136. data/lib/droonga/test.rb +1 -1
  137. data/lib/droonga/watch_schema.rb +2 -2
  138. data/lib/droonga/watcher.rb +1 -1
  139. data/lib/droonga/worker_process_agent.rb +111 -0
  140. data/sample/cluster/Rakefile +150 -0
  141. data/test/command/config/default/catalog.json +1 -34
  142. data/test/command/config/version1/catalog.json +3 -12
  143. data/test/command/run-test.rb +1 -1
  144. data/test/command/suite/dump/column/index.expected +19 -82
  145. data/test/command/suite/dump/column/scalar.expected +5 -36
  146. data/test/command/suite/dump/column/vector.expected +5 -39
  147. data/test/command/suite/dump/record/vector/reference.expected +24 -93
  148. data/test/command/suite/dump/table/array.expected +0 -19
  149. data/test/command/suite/dump/table/double_array_trie.expected +0 -20
  150. data/test/command/suite/dump/table/hash.expected +0 -20
  151. data/test/command/suite/dump/table/patricia_trie.expected +0 -20
  152. data/test/command/suite/search/condition/query/nonexistent_column.expected +0 -11
  153. data/test/command/suite/search/condition/query/syntax_error.expected +0 -11
  154. data/test/command/suite/search/error/unknown-source.expected +0 -12
  155. data/test/command/suite/search/output/attributes/invalid.expected +0 -10
  156. data/test/command/suite/search/output/attributes/reference_vector.catalog.json +27 -0
  157. data/test/command/suite/search/output/attributes/reference_vector.expected +30 -0
  158. data/test/command/suite/search/output/attributes/reference_vector.test +32 -0
  159. data/test/command/suite/watch/subscribe.catalog.json +23 -0
  160. data/test/command/suite/watch/subscribe.test +2 -0
  161. data/test/command/suite/watch/unsubscribe.catalog.json +23 -0
  162. data/test/command/suite/watch/unsubscribe.test +2 -0
  163. data/test/performance/run-test.rb +1 -1
  164. data/test/unit/catalog/test_collection_volume.rb +1 -1
  165. data/test/unit/catalog/test_dataset.rb +1 -1
  166. data/test/unit/catalog/test_schema.rb +1 -1
  167. data/test/unit/catalog/test_single_volume.rb +27 -19
  168. data/test/unit/catalog/test_slice.rb +2 -2
  169. data/test/unit/catalog/test_version1.rb +1 -1
  170. data/test/unit/catalog/test_version2.rb +1 -1
  171. data/test/unit/catalog/test_version2_validator.rb +1 -1
  172. data/test/unit/catalog/test_volume_collection.rb +1 -1
  173. data/test/unit/helper/distributed_search_planner_helper.rb +1 -1
  174. data/test/unit/helper/fixture.rb +1 -1
  175. data/test/unit/helper/plugin_helper.rb +1 -1
  176. data/test/unit/helper/sandbox.rb +1 -1
  177. data/test/unit/helper/stub_worker.rb +1 -1
  178. data/test/unit/helper/watch_helper.rb +1 -1
  179. data/test/unit/helper.rb +1 -1
  180. data/test/unit/plugins/crud/test_add.rb +1 -1
  181. data/test/unit/plugins/groonga/select/test_adapter_input.rb +1 -1
  182. data/test/unit/plugins/groonga/select/test_adapter_output.rb +1 -1
  183. data/test/unit/plugins/groonga/test_column_create.rb +1 -1
  184. data/test/unit/plugins/groonga/test_column_list.rb +1 -1
  185. data/test/unit/plugins/groonga/test_column_remove.rb +1 -1
  186. data/test/unit/plugins/groonga/test_column_rename.rb +1 -1
  187. data/test/unit/plugins/groonga/test_delete.rb +1 -1
  188. data/test/unit/plugins/groonga/test_table_create.rb +1 -1
  189. data/test/unit/plugins/groonga/test_table_list.rb +1 -1
  190. data/test/unit/plugins/groonga/test_table_remove.rb +1 -1
  191. data/test/unit/plugins/search/planner/test_basic.rb +1 -1
  192. data/test/unit/plugins/search/planner/test_group_by.rb +1 -1
  193. data/test/unit/plugins/search/planner/test_output.rb +1 -1
  194. data/test/unit/plugins/search/planner/test_sort_by.rb +1 -1
  195. data/test/unit/plugins/search/test_collector.rb +1 -1
  196. data/test/unit/plugins/search/test_handler.rb +1 -1
  197. data/test/unit/plugins/search/test_planner.rb +1 -1
  198. data/test/unit/plugins/system/test_status.rb +1 -1
  199. data/test/unit/plugins/test_basic.rb +1 -1
  200. data/test/unit/plugins/test_groonga.rb +1 -1
  201. data/test/unit/plugins/test_watch.rb +1 -1
  202. data/test/unit/run-test.rb +1 -1
  203. data/test/unit/test_address.rb +53 -0
  204. data/test/unit/test_catalog_generator.rb +59 -1
  205. data/test/unit/test_line_buffer.rb +1 -1
  206. data/test/unit/test_message_matcher.rb +1 -1
  207. data/test/unit/test_schema_applier.rb +1 -1
  208. data/test/unit/test_sweeper.rb +1 -1
  209. data/test/unit/test_watch_schema.rb +1 -1
  210. data/test/unit/test_watcher.rb +1 -1
  211. metadata +39 -24
  212. data/lib/droonga/server.rb +0 -45
  213. data/lib/droonga/worker.rb +0 -66
  214. data/sample/cluster/catalog.json +0 -42
  215. data/test/command/config/default/fluentd.conf +0 -11
  216. data/test/command/config/version1/fluentd.conf +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 333168fcdecd92b88dfc590746445e0ed31319c4
4
- data.tar.gz: bb082dd818cfd171a131e0e45dc75269a1cd814d
3
+ metadata.gz: 5e783348c7bfbef6e04de3de388c902839e8633b
4
+ data.tar.gz: 01b3367f3c22fb2a40245ca9bedc4920b42a494a
5
5
  SHA512:
6
- metadata.gz: 38167299101e872c86cb07ac35449f023028ffaaa405477423c7882fd981c90677f4483671ea3c326e71338274326acbbfab644f668c77b7602d932b3c19717e
7
- data.tar.gz: 41fe28134710faf85c694abe7c702e120d33188f321611e8627788b80ceabc5cca295f7d590621a85d1a87b936746a7d90e63cfeb938eb932287110c5548cfe1
6
+ metadata.gz: 399c8b21fd8368610a2ad498246584614f4bde6bc99bed78f8ba705164627a920ea59e32311ef5bf565fcaeb838e58837ab200a3d2ed0b2ee56f7ca26f1efa0e
7
+ data.tar.gz: 30bdef9c53baa70dd2095869656283488517d579942bc214c9267ff7c095e2c0aac9ff0d0e01db59263f4d4c86cf6f2165e5d4681db9af21726a2d69f4d798af
data/.gitignore CHANGED
@@ -3,5 +3,6 @@
3
3
  /doc/
4
4
  /.yardoc/
5
5
  /pkg/
6
- /sample/cluster/0*
7
- /sample/cluster/state/
6
+ /sample/cluster/0/
7
+ /sample/cluster/1/
8
+ /sample/cluster/2/
data/Gemfile CHANGED
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # You should have received a copy of the GNU Lesser General Public
13
13
  # License along with this library; if not, write to the Free Software
14
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
15
 
16
16
  source "https://rubygems.org"
17
17
 
data/LICENSE.txt CHANGED
@@ -11,4 +11,4 @@ Lesser General Public License for more details.
11
11
 
12
12
  You should have received a copy of the GNU Lesser General Public
13
13
  License along with this library; if not, write to the Free Software
14
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
data/Rakefile CHANGED
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "bundler/gem_helper"
19
19
  require "packnga"
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "droonga/client"
19
19
 
data/benchmark/utils.rb CHANGED
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "json"
19
19
  require "thread"
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  # this benchmark must be done by benchmark-notify.sh.
19
19
 
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "benchmark"
19
19
  require "fileutils"
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "benchmark"
19
19
  require "fileutils"
data/bin/droonga-engine CHANGED
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "droonga/command/droonga_engine"
19
19
 
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "ostruct"
19
19
  require "optparse"
@@ -21,12 +21,15 @@ require "open3"
21
21
 
22
22
  require "droonga/engine/version"
23
23
  require "droonga/catalog_generator"
24
+ require "droonga/path"
25
+ require "droonga/data_absorber"
24
26
  require "droonga/serf"
25
27
 
26
28
  options = OpenStruct.new
27
29
  options.port = Droonga::CatalogGenerator::DEFAULT_PORT
28
30
  options.tag = Droonga::CatalogGenerator::DEFAULT_TAG
29
31
  options.dataset = Droonga::CatalogGenerator::DEFAULT_DATASET
32
+ options.remote = true
30
33
  parser = OptionParser.new
31
34
  parser.version = Droonga::Engine::VERSION
32
35
 
@@ -45,6 +48,11 @@ parser.on("--port=PORT", Integer,
45
48
  "(#{options.port})") do |port|
46
49
  options.port = port
47
50
  end
51
+ parser.on("--[no-]remote",
52
+ "Run command in remote node or not.",
53
+ "(#{options.remote})") do |remote|
54
+ options.remote = remote
55
+ end
48
56
 
49
57
  parser.separator("")
50
58
  parser.separator("Data:")
@@ -70,13 +78,45 @@ end
70
78
 
71
79
  destination_node = "#{options.destination_host}:#{options.port}/#{options.tag}"
72
80
 
73
- puts "Absorbing data..."
74
- Droonga::Serf.send_query(destination_node, "absorb_data",
75
- "node" => destination_node,
76
- "source" => options.source_host,
77
- "port" => options.port,
78
- "tag" => options.tag,
79
- "dataset" => options.dataset)
81
+ def run_remote_command(target, command, options)
82
+ result = Droonga::Serf.send_query(target, command, options)
83
+ puts result[:result]
84
+ puts result[:error] unless result[:error].empty?
85
+ result[:response]
86
+ end
87
+
88
+ puts "Start to absorb data from #{options.source_host}"
89
+ puts " to #{options.destination_host}"
90
+ puts " dataset = #{options.dataset}"
91
+ puts " port = #{options.port}"
92
+ puts " tag = #{options.tag}"
93
+ puts ""
94
+ puts "Absorbing..."
95
+
96
+ if options.remote
97
+ run_remote_command(destination_node, "absorb_data",
98
+ "node" => destination_node,
99
+ "source" => options.source_host,
100
+ "port" => options.port,
101
+ "tag" => options.tag,
102
+ "dataset" => options.dataset)
103
+ while true
104
+ sleep(3)
105
+ response = run_remote_command(destination_node, "report_status",
106
+ "node" => destination_node,
107
+ "key" => "absorbing")
108
+ absorbing = response["value"]
109
+ break unless absorbing
110
+ end
111
+ else
112
+ Droonga::DataAbsorber.absorb(:dataset => options.dataset,
113
+ :source_host => options.source_host,
114
+ :destination_host => options.destination_host,
115
+ :port => options.port,
116
+ :tag => options.tag) do |output|
117
+ puts output
118
+ end
119
+ end
80
120
  puts "Done."
81
121
 
82
122
  exit(true)
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "ostruct"
19
19
  require "optparse"
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "ostruct"
19
19
  require "optparse"
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2014 Droonga Project
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License version 2.1 as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+
18
+ require "ostruct"
19
+ require "optparse"
20
+ require "pathname"
21
+ require "fileutils"
22
+ require "webrick"
23
+
24
+ require "droonga/engine/version"
25
+ require "droonga/path"
26
+
27
+ options = OpenStruct.new
28
+ options.base_dir = ENV[Droonga::Path::BASE_DIR_ENV_NAME] || Dir.pwd
29
+ options.port = 10032
30
+
31
+ parser = OptionParser.new
32
+ parser.version = Droonga::Engine::VERSION
33
+
34
+ parser.on("--base-dir=PATH",
35
+ "Path to the base directory the catalog.json is located in.",
36
+ "(#{options.base_dir})") do |path|
37
+ options.base_dir = path
38
+ end
39
+ parser.on("--port=PORT", Integer,
40
+ "Port number to listen.",
41
+ "(#{options.port})") do |port|
42
+ options.port = port
43
+ end
44
+ parser.on("--published-file=PATH",
45
+ "Path to the file to be published.") do |path|
46
+ options.published_file = path
47
+ end
48
+
49
+ parser.parse!(ARGV)
50
+
51
+ include WEBrick
52
+
53
+ published_dir = Droonga::Path.published(options.port)
54
+ FileUtils.mkdir_p(published_dir.to_s)
55
+ published_file = Pathname(options.published_file).expand_path
56
+ FileUtils.copy(published_file.to_s, published_dir + published_file.basename)
57
+
58
+ server = HTTPServer.new(:Port => options.port,
59
+ :DocumentRoot => published_dir)
60
+
61
+ trap("INT") do
62
+ server.shutdown
63
+ FileUtils.rm_rf(published_dir.to_s)
64
+ end
65
+
66
+ server.start
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "ostruct"
19
19
  require "optparse"
@@ -32,6 +32,8 @@ options.base_dir = ENV[Droonga::Path::BASE_DIR_ENV_NAME] || Dir.pwd
32
32
  options.drndump = "drndump"
33
33
  options.client = "droonga-request"
34
34
  options.copy = true
35
+ options.port = Droonga::CatalogGenerator::DEFAULT_PORT
36
+ options.tag = Droonga::CatalogGenerator::DEFAULT_TAG
35
37
 
36
38
  parser = OptionParser.new
37
39
  parser.version = Droonga::Engine::VERSION
@@ -58,6 +60,21 @@ parser.on("--replica-source-host=HOST",
58
60
  "Host name of the soruce cluster to be connected.") do |host|
59
61
  options.replica_source_host = host
60
62
  end
63
+ parser.on("--dataset=DATASET",
64
+ "Tag dataset name of the cluster to be joined as a node.",
65
+ "(#{options.dataset})") do |dataset|
66
+ options.dataset = dataset
67
+ end
68
+ parser.on("--port=PORT", Integer,
69
+ "Port number of the source cluster to be connected.",
70
+ "(#{options.port})") do |port|
71
+ options.port = port
72
+ end
73
+ parser.on("--tag=TAG",
74
+ "Tag name of the soruce cluster to be connected.",
75
+ "(#{options.tag})") do |tag|
76
+ options.tag = tag
77
+ end
61
78
 
62
79
  parser.parse!(ARGV)
63
80
 
@@ -87,28 +104,66 @@ generator = Droonga::CatalogGenerator.new
87
104
  generator.load(source_catalog)
88
105
 
89
106
  dataset = generator.dataset_for_host(options.replica_source_host)
90
- unless dataset
91
- raise "Specified source host #{options.replica_source_host} is not a " +
92
- "member of the cluster. You must specify correct host via " +
93
- "--replica-source-host option."
107
+ if dataset
108
+ if generator.dataset_for_host(options.joining_host)
109
+ raise "The joining node is already a member of the cluster. " +
110
+ "You cannot join a member twice."
111
+ end
112
+
113
+ options.dataset = dataset.name
114
+ options.tag = dataset.replicas.tag
115
+ options.port = dataset.replicas.port
94
116
  end
95
117
 
96
- if generator.dataset_for_host(options.joining_host)
97
- raise "The joining node is already a member of the cluster. " +
98
- "You cannot join a member twice."
99
- end
118
+ options.joining_node = "#{options.joining_host}:#{options.port}/#{options.tag}"
119
+ options.source_node = "#{options.replica_source_host}:#{options.port}/#{options.tag}"
100
120
 
101
- options.tag = dataset.replicas.tag
102
- options.port = dataset.replicas.port
121
+ def run_remote_command(target, command, options)
122
+ result = Droonga::Serf.send_query(target, command, options)
123
+ puts result[:result]
124
+ puts result[:error] unless result[:error].empty?
125
+ result[:response]
126
+ end
103
127
 
104
- options.joining_node = "#{options.joining_host}:#{options.port}/#{options.tag}"
128
+ =begin
129
+ XXX disable fetching until it become working
130
+ puts "Preparing to fetch cluster information..."
131
+ publish_port = 10032 + rand(10000)
132
+ run_remote_command(options.source_node, "publish_catalog",
133
+ "node" => options.source_node,
134
+ "port" => publish_port)
135
+ sleep(3) # wait until the HTTP server becomes ready
136
+ =end
105
137
 
106
138
  puts "Joining new replica to the cluster..."
107
- Droonga::Serf.send_query(options.joining_node, "join",
108
- "node" => options.joining_node,
109
- "type" => "replica",
110
- "source" => options.replica_source_host,
111
- "copy" => options.copy)
139
+ run_remote_command(options.joining_node, "join",
140
+ "node" => options.joining_node,
141
+ "type" => "replica",
142
+ "source" => options.source_node,
143
+ # "fetch_port" => publish_port,
144
+ "copy" => options.copy)
145
+ sleep(5) #TODO: wait for restarting of the joining node. this should be done more safely.
146
+
147
+ while true
148
+ sleep(3)
149
+ response = run_remote_command(options.joining_node, "report_status",
150
+ "node" => options.joining_node,
151
+ "key" => "absorbing")
152
+ absorbing = response["value"]
153
+ break unless absorbing
154
+ end
155
+
156
+ puts "Update existing hosts in the cluster..."
157
+ run_remote_command(options.source_node, "add_replicas",
158
+ "dataset" => options.dataset,
159
+ "hosts" => [options.joining_host])
160
+
161
+ =begin
162
+ XXX disable fetching until it become working
163
+ run_remote_command(options.source_node, "unpublish_catalog",
164
+ "node" => options.source_node,
165
+ "port" => publish_port)
166
+ =end
112
167
 
113
168
  puts "Done."
114
169
 
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "droonga/command/serf_event_handler"
19
19
 
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "droonga/command/droonga_engine_service"
19
19
 
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  require "ostruct"
19
19
  require "optparse"
@@ -79,11 +79,18 @@ remaining_host = options.other_hosts.first || options.replica_remove_host
79
79
  options.remaining_node = "#{remaining_host}:#{options.port}/#{options.tag}"
80
80
 
81
81
 
82
+ def run_remote_command(target, command, options)
83
+ result = Droonga::Serf.send_query(target, command, options)
84
+ puts result[:result]
85
+ puts result[:error] unless result[:error].empty?
86
+ end
87
+
88
+
82
89
  puts "Unjoining replica from the cluster..."
83
90
 
84
- Droonga::Serf.send_query(options.remaining_node, "remove_replicas",
85
- "dataset" => options.dataset,
86
- "hosts" => [options.replica_remove_host])
91
+ run_remote_command(options.remaining_node, "remove_replicas",
92
+ "dataset" => options.dataset,
93
+ "hosts" => [options.replica_remove_host])
87
94
 
88
95
  puts "Done."
89
96
 
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2014 Droonga Project
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License version 2.1 as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+
18
+ require "droonga/command/droonga_engine_worker"
19
+
20
+ exit(Droonga::Command::DroongaEngineWorker.run(ARGV))
data/doc/text/news.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # News
2
2
 
3
+ ## 1.0.5: 2014-07-29
4
+
5
+ * Restarts server processes more gracefully.
6
+ * Works with search results with vector reference column values correctly.
7
+ * Messages forwarded to other nodes are always buffered for now.
8
+ * Works again for the case: `nWorkers` == `0`
9
+ * droonga-engine-join: Works correctly and safely for databases with much records.
10
+
3
11
  ## 1.0.4: 2014-06-29
4
12
 
5
13
  * New command (and plugin) [`status`](http://droonga.org/reference/1.0.4/commands/status/) is now available.
@@ -13,7 +13,7 @@
13
13
  #
14
14
  # You should have received a copy of the GNU Lesser General Public
15
15
  # License along with this library; if not, write to the Free Software
16
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
  base_dir = File.dirname(__FILE__)
19
19
  $LOAD_PATH.unshift(File.join(base_dir, "lib"))
@@ -35,16 +35,16 @@ Gem::Specification.new do |gem|
35
35
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
36
36
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
37
37
  gem.require_paths = ["lib"]
38
- gem.add_dependency "rroonga", ">= 3.1.0"
38
+ gem.add_dependency "rroonga", ">= 4.0.1"
39
39
  gem.add_dependency "groonga-command-parser"
40
40
  gem.add_dependency "json"
41
41
  gem.add_dependency "cool.io"
42
- gem.add_dependency "serverengine"
43
42
  gem.add_dependency "droonga-message-pack-packer", ">= 1.0.1"
44
43
  gem.add_dependency "faraday"
45
44
  gem.add_dependency "faraday_middleware"
46
45
  gem.add_dependency "archive-zip"
47
46
  gem.add_dependency "sigdump"
47
+ gem.add_dependency "droonga-client", ">= 0.1.9"
48
48
  gem.add_dependency "drndump"
49
49
  gem.add_development_dependency "rake"
50
50
  gem.add_development_dependency "bundler"
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # You should have received a copy of the GNU Lesser General Public
13
13
  # License along with this library; if not, write to the Free Software
14
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
15
 
16
16
  require "droonga/pluggable"
17
17
  require "droonga/loggable"
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # You should have received a copy of the GNU Lesser General Public
13
13
  # License along with this library; if not, write to the Free Software
14
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
15
 
16
16
  require "droonga/loggable"
17
17
  require "droonga/message_matcher"
@@ -0,0 +1,69 @@
1
+ # Copyright (C) 2014 Droonga Project
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License version 2.1 as published by the Free Software Foundation.
6
+ #
7
+ # This library is distributed in the hope that it will be useful,
8
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
+ # Lesser General Public License for more details.
11
+ #
12
+ # You should have received a copy of the GNU Lesser General Public
13
+ # License along with this library; if not, write to the Free Software
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
+
16
+ module Droonga
17
+ class Address
18
+ class << self
19
+ def parse(string)
20
+ if /\A(.+):(\d+)\/([^.]+)(?:\.(.+))?\z/ =~ string
21
+ components = {
22
+ :host => $1,
23
+ :port => $2.to_i,
24
+ :tag => $3,
25
+ :name => $4
26
+ }
27
+ new(components)
28
+ else
29
+ format = "${host_name}:${port_number}/${tag}.${name}"
30
+ message = "volume address must be <#{format}> format: <#{string}>"
31
+ raise ArgumentError, message
32
+ end
33
+ end
34
+ end
35
+
36
+ DEFAULT_HOST = "127.0.0.1"
37
+ DEFAULT_PORT = 10031
38
+ DEFAULT_TAG = "droonga"
39
+
40
+ attr_reader :host
41
+ attr_reader :port
42
+ attr_reader :tag
43
+ attr_reader :name
44
+ def initialize(components={})
45
+ @host = components[:host] || DEFAULT_HOST
46
+ @port = components[:port] || DEFAULT_PORT
47
+ @tag = components[:tag] || DEFAULT_TAG
48
+ @name = components[:name]
49
+ end
50
+
51
+ def to_s
52
+ string = node
53
+ string << ".#{@name}" if @name
54
+ string
55
+ end
56
+
57
+ def to_a
58
+ [@host, @port, @tag, @name]
59
+ end
60
+
61
+ def ==(other)
62
+ other.is_a?(self.class) and to_a == other.to_a
63
+ end
64
+
65
+ def node
66
+ "#{@host}:#{@port}/#{@tag}"
67
+ end
68
+ end
69
+ end