roma 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +42 -2
  3. data/Gemfile +1 -15
  4. data/LICENSE +1 -1
  5. data/README.md +78 -0
  6. data/Rakefile +1 -62
  7. data/bin/chg_redundancy +10 -0
  8. data/bin/cpdb +7 -0
  9. data/bin/key_access +7 -0
  10. data/bin/key_list +7 -0
  11. data/bin/log_merger +7 -0
  12. data/{ruby/server/bin → bin}/mkconfig +3 -1
  13. data/bin/mkrecent +7 -0
  14. data/bin/mkroute +7 -0
  15. data/{ruby/server/bin → bin}/multi_commander +4 -3
  16. data/bin/recoverlost +11 -0
  17. data/bin/recoverlost_alist +10 -0
  18. data/bin/recoverlost_alist_all +10 -0
  19. data/bin/recoverlost_alist_keys +10 -0
  20. data/bin/roma_watcher +10 -0
  21. data/{ruby/server/bin → bin}/romad +3 -2
  22. data/bin/safecopy_integration_test +10 -0
  23. data/bin/safecopy_test +10 -0
  24. data/bin/sample_watcher +10 -0
  25. data/bin/sample_watcher2 +10 -0
  26. data/bin/sample_watcher3 +10 -0
  27. data/bin/simple_bench +11 -0
  28. data/bin/ssroute +10 -0
  29. data/bin/tc_data_restore.rb +123 -0
  30. data/bin/test-scenario +11 -0
  31. data/bin/tribunus +7 -0
  32. data/{ruby/server/lib → lib}/roma/async_process.rb +105 -26
  33. data/{ruby/server/lib → lib}/roma/command/bg_command_receiver.rb +0 -0
  34. data/{ruby/server/lib → lib}/roma/command/command_definition.rb +12 -12
  35. data/{ruby/server/lib → lib}/roma/command/mh_command_receiver.rb +4 -4
  36. data/{ruby/server/lib → lib}/roma/command/receiver.rb +0 -0
  37. data/{ruby/server/lib → lib}/roma/command/rt_command_receiver.rb +7 -0
  38. data/{ruby/server/lib → lib}/roma/command/sys_command_receiver.rb +68 -3
  39. data/{ruby/server/lib → lib}/roma/command/util_command_receiver.rb +0 -0
  40. data/{ruby/server/lib → lib}/roma/command/vn_command_receiver.rb +0 -0
  41. data/{ruby/server/lib → lib}/roma/command_plugin.rb +0 -0
  42. data/{ruby/server/lib → lib}/roma/config.rb +4 -1
  43. data/{ruby/server/lib → lib}/roma/dns_cache.rb +0 -0
  44. data/{ruby/server/lib → lib}/roma/event/con_pool.rb +0 -0
  45. data/{ruby/server/lib → lib}/roma/event/handler.rb +0 -0
  46. data/{ruby/server/lib → lib}/roma/logging/rlogger.rb +61 -2
  47. data/{ruby/server/lib → lib}/roma/messaging/con_pool.rb +14 -0
  48. data/{ruby/server/lib → lib}/roma/plugin/plugin_alist.rb +0 -0
  49. data/{ruby/server/lib → lib}/roma/plugin/plugin_cmd_aliases.rb +0 -0
  50. data/{ruby/server/lib → lib}/roma/plugin/plugin_debug.rb +0 -0
  51. data/{ruby/server/lib → lib}/roma/plugin/plugin_gui.rb +12 -13
  52. data/{ruby/server/lib → lib}/roma/plugin/plugin_map.rb +0 -0
  53. data/{ruby/server/lib → lib}/roma/plugin/plugin_mapcount.rb +0 -0
  54. data/{ruby/server/lib → lib}/roma/plugin/plugin_storage.rb +11 -11
  55. data/{ruby/server/lib → lib}/roma/plugin/plugin_test.rb +0 -0
  56. data/{ruby/server/lib → lib}/roma/romad.rb +25 -1
  57. data/{ruby/server/lib → lib}/roma/routing/cb_rttable.rb +0 -0
  58. data/{ruby/server/lib → lib}/roma/routing/merkle_tree.rb +0 -0
  59. data/{ruby/server/lib → lib}/roma/routing/random_balancer.rb +0 -0
  60. data/{ruby/server/lib → lib}/roma/routing/random_partitioner.rb +0 -0
  61. data/{ruby/server/lib → lib}/roma/routing/routing_data.rb +0 -0
  62. data/{ruby/server/lib → lib}/roma/routing/rttable.rb +0 -0
  63. data/{ruby/server/lib → lib}/roma/stats.rb +11 -0
  64. data/{ruby/server/lib → lib}/roma/storage/basic_storage.rb +3 -0
  65. data/{ruby/server/lib → lib}/roma/storage/dbm_storage.rb +0 -0
  66. data/{ruby/server/lib → lib}/roma/storage/dummy_storage.rb +0 -0
  67. data/lib/roma/storage/groonga_storage.rb +101 -0
  68. data/{ruby/server/lib → lib}/roma/storage/rh_storage.rb +0 -0
  69. data/{ruby/server/lib → lib}/roma/storage/sqlite3_storage.rb +0 -0
  70. data/{ruby/server/lib → lib}/roma/storage/tc_storage.rb +0 -0
  71. data/{ruby/server/lib → lib}/roma/tools/chg_redundancy.rb +0 -0
  72. data/{ruby/server/lib → lib}/roma/tools/cpdb.rb +13 -2
  73. data/{ruby/server/lib → lib}/roma/tools/key_access.rb +1 -1
  74. data/{ruby/server/lib → lib}/roma/tools/key_list.rb +1 -1
  75. data/{ruby/server/lib → lib}/roma/tools/log_merger.rb +0 -0
  76. data/{ruby/server/lib → lib}/roma/tools/mkconfig.rb +1 -1
  77. data/{ruby/server/lib → lib}/roma/tools/mkrecent.rb +1 -1
  78. data/{ruby/server/lib → lib}/roma/tools/mkroute.rb +5 -1
  79. data/{ruby/server/lib → lib}/roma/tools/multi_commander.rb +0 -0
  80. data/{ruby/server/lib → lib}/roma/tools/recoverlost.rb +0 -0
  81. data/{ruby/server/lib → lib}/roma/tools/recoverlost_alist.rb +0 -0
  82. data/{ruby/server/lib → lib}/roma/tools/recoverlost_alist_all.rb +0 -0
  83. data/{ruby/server/lib → lib}/roma/tools/recoverlost_alist_keys.rb +0 -0
  84. data/{ruby/server/lib → lib}/roma/tools/recoverlost_lib.rb +1 -1
  85. data/{ruby/server/lib → lib}/roma/tools/roma_watcher.rb +0 -0
  86. data/{ruby/server/lib → lib}/roma/tools/roma_watcher_config.yml.example +0 -0
  87. data/{ruby/server/lib → lib}/roma/tools/safecopy_integration_test.rb +0 -0
  88. data/{ruby/server/lib → lib}/roma/tools/safecopy_test.rb +0 -0
  89. data/{ruby/server/lib → lib}/roma/tools/sample_watcher.rb +0 -0
  90. data/{ruby/server/lib → lib}/roma/tools/sample_watcher2.rb +0 -0
  91. data/{ruby/server/lib → lib}/roma/tools/sample_watcher3.rb +0 -0
  92. data/{ruby/server/lib → lib}/roma/tools/simple_bench.rb +0 -0
  93. data/{ruby/server/lib → lib}/roma/tools/simple_bench2.rb +0 -0
  94. data/{ruby/server/lib → lib}/roma/tools/ssroute.rb +1 -1
  95. data/{ruby/server/lib → lib}/roma/tools/test-scenario.rb +3 -3
  96. data/{ruby/server/lib → lib}/roma/tools/tribunus.rb +1 -1
  97. data/lib/roma/version.rb +4 -0
  98. data/{ruby/server/lib → lib}/roma/write_behind.rb +0 -0
  99. data/{ruby/server/test → test}/config4mhash.rb +0 -0
  100. data/{ruby/server/test → test}/config4storage_error.rb +0 -0
  101. data/{ruby/server/test → test}/config4test.rb +0 -0
  102. data/{ruby/server/test → test}/rcirb.rb +0 -0
  103. data/{ruby/server/test → test}/roma-test-utils.rb +10 -14
  104. data/test/run-test.rb +20 -0
  105. data/{ruby/server/test → test}/storage_error_storage.rb +0 -0
  106. data/{ruby/server/test → test}/t_command_definition.rb +10 -10
  107. data/{ruby/server/test → test}/t_cpdata.rb +0 -0
  108. data/{ruby/server/test → test}/t_eventmachine.rb +0 -0
  109. data/{ruby/server/test → test}/t_listplugin.rb +9 -3
  110. data/{ruby/server/test → test}/t_mapcountplugin.rb +0 -0
  111. data/{ruby/server/test → test}/t_mapplugin.rb +9 -3
  112. data/{ruby/server/test → test}/t_mhash.rb +7 -7
  113. data/{ruby/server/test → test}/t_protocol.rb +0 -0
  114. data/{ruby/server/test → test}/t_rclient.rb +8 -2
  115. data/{ruby/server/test → test}/t_routing_data.rb +0 -0
  116. data/{ruby/server/test → test}/t_storage.rb +58 -26
  117. data/{ruby/server/test → test}/t_storage_error.rb +5 -3
  118. data/{ruby/server/test → test}/t_writebehind.rb +17 -17
  119. metadata +225 -122
  120. data/README +0 -17
  121. data/ruby/server/bin/chg_redundancy +0 -10
  122. data/ruby/server/bin/cpdb +0 -6
  123. data/ruby/server/bin/key_access +0 -7
  124. data/ruby/server/bin/key_list +0 -7
  125. data/ruby/server/bin/log_merger +0 -6
  126. data/ruby/server/bin/mkrecent +0 -6
  127. data/ruby/server/bin/mkroute +0 -6
  128. data/ruby/server/bin/recoverlost +0 -10
  129. data/ruby/server/bin/recoverlost_alist +0 -10
  130. data/ruby/server/bin/recoverlost_alist_all +0 -10
  131. data/ruby/server/bin/recoverlost_alist_keys +0 -10
  132. data/ruby/server/bin/roma_watcher +0 -7
  133. data/ruby/server/bin/safecopy_integration_test +0 -10
  134. data/ruby/server/bin/safecopy_test +0 -10
  135. data/ruby/server/bin/sample_watcher +0 -7
  136. data/ruby/server/bin/sample_watcher2 +0 -7
  137. data/ruby/server/bin/sample_watcher3 +0 -7
  138. data/ruby/server/bin/simple_bench +0 -11
  139. data/ruby/server/bin/ssroute +0 -6
  140. data/ruby/server/bin/test-scenario +0 -11
  141. data/ruby/server/bin/tribunus +0 -6
  142. data/ruby/server/lib/roma/version.rb +0 -4
  143. data/ruby/server/test/run-test.rb +0 -17
@@ -41,7 +41,7 @@ module Roma
41
41
  end
42
42
 
43
43
  unless @storages.key?(hname)
44
- send_data("SERVER_ERROR #{hname} dose not exists.\r\n")
44
+ send_data("SERVER_ERROR #{hname} does not exists.\r\n")
45
45
  return
46
46
  end
47
47
  data = @storages[hname].get(vn, key, 0)
@@ -64,7 +64,7 @@ module Roma
64
64
  end
65
65
 
66
66
  unless @storages.key?(hname)
67
- send_data("SERVER_ERROR #{hname} dose not exists.\r\n")
67
+ send_data("SERVER_ERROR #{hname} does not exists.\r\n")
68
68
  return
69
69
  end
70
70
  data = @storages[hname].get(vn, key, 0)
@@ -138,7 +138,7 @@ module Roma
138
138
  return send_data("#{res}\r\n")
139
139
  end
140
140
  unless @storages.key?(hname)
141
- send_data("SERVER_ERROR #{hname} dose not exists.\r\n")
141
+ send_data("SERVER_ERROR #{hname} does not exists.\r\n")
142
142
  return
143
143
  end
144
144
 
@@ -180,7 +180,7 @@ module Roma
180
180
  return send_data("SERVER_ERROR Routing table is inconsistent.\r\n")
181
181
  end
182
182
  unless @storages.key?(hname)
183
- send_data("SERVER_ERROR #{hname} dose not exists.\r\n")
183
+ send_data("SERVER_ERROR #{hname} does not exists.\r\n")
184
184
  return
185
185
  end
186
186
 
@@ -218,7 +218,7 @@ module Roma
218
218
  d = Digest::SHA1.hexdigest(key).hex % @rttable.hbits
219
219
  vn = @rttable.get_vnode_id(d)
220
220
  unless @storages.key?(hname)
221
- send_data("SERVER_ERROR #{hname} dose not exists.\r\n")
221
+ send_data("SERVER_ERROR #{hname} does not exists.\r\n")
222
222
  return
223
223
  end
224
224
  if @storages[hname].rdelete(vn, key, d, s[2].to_i)
@@ -319,7 +319,7 @@ module Roma
319
319
  end
320
320
 
321
321
  unless @storages.key?(hname)
322
- send_data("SERVER_ERROR #{hname} dose not exists.\r\n")
322
+ send_data("SERVER_ERROR #{hname} does not exists.\r\n")
323
323
  return
324
324
  end
325
325
 
@@ -358,7 +358,7 @@ module Roma
358
358
  end
359
359
 
360
360
  unless @storages.key?(hname)
361
- send_data("SERVER_ERROR #{hname} dose not exists.\r\n")
361
+ send_data("SERVER_ERROR #{hname} does not exists.\r\n")
362
362
  return
363
363
  end
364
364
 
@@ -413,7 +413,7 @@ module Roma
413
413
  @log.error("forward get failed:nid=#{nid} key=#{k}")
414
414
  return nil
415
415
  elsif res == "END\r\n"
416
- # value dose not found
416
+ # value does not found
417
417
  elsif res.start_with?("ERROR")
418
418
  @rttable.proc_succeed(nid)
419
419
  con.close_connection
@@ -454,7 +454,7 @@ module Roma
454
454
  def store(fnc, hname, vn, k, d, expt, v, nodes)
455
455
  expt = chg_time_expt(expt)
456
456
  unless @storages.key?(hname)
457
- send_data("SERVER_ERROR #{hname} dose not exists.\r\n")
457
+ send_data("SERVER_ERROR #{hname} does not exists.\r\n")
458
458
  return
459
459
  end
460
460
 
@@ -481,7 +481,7 @@ module Roma
481
481
  def store_cas(hname, vn, k, d, clk, expt, v, nodes)
482
482
  expt = chg_time_expt(expt)
483
483
  unless @storages.key?(hname)
484
- send_data("SERVER_ERROR #{hname} dose not exists.\r\n")
484
+ send_data("SERVER_ERROR #{hname} does not exists.\r\n")
485
485
  return
486
486
  end
487
487
 
@@ -587,7 +587,7 @@ module Roma
587
587
 
588
588
  def store_incr_decr(fnc, hname, vn, k, d, v, nodes)
589
589
  unless @storages.key?(hname)
590
- send_data("SERVER_ERROR #{hname} dose not exists.\r\n")
590
+ send_data("SERVER_ERROR #{hname} does not exists.\r\n")
591
591
  return
592
592
  end
593
593
 
File without changes
@@ -156,12 +156,21 @@ module Roma
156
156
  if Config.const_defined?(:DATACOPY_STREAM_COPY_WAIT_PARAM)
157
157
  @stats.stream_copy_wait_param = Config::DATACOPY_STREAM_COPY_WAIT_PARAM
158
158
  end
159
+ if Config.const_defined?(:LOG_STREAM_SHOW_WAIT_PARAM)
160
+ @stats.stream_show_wait_param = Config::LOG_STREAM_SHOW_WAIT_PARAM
161
+ end
159
162
  if Config.const_defined?(:WB_COMMAND_MAP)
160
163
  @stats.wb_command_map = Config::WB_COMMAND_MAP
161
164
  end
162
165
  if Config.const_defined?(:STORAGE_CLEAN_UP_INTERVAL)
163
166
  @stats.clean_up_interval = Config::STORAGE_CLEAN_UP_INTERVAL
164
167
  end
168
+ if Config.const_defined?(:LOG_SHIFT_SIZE)
169
+ @stats.log_shift_size = Config::LOG_SHIFT_SIZE
170
+ end
171
+ if Config.const_defined?(:LOG_SHIFT_AGE)
172
+ @stats.log_shift_age = Config::LOG_SHIFT_AGE
173
+ end
165
174
  end
166
175
 
167
176
  def initialize_connection
@@ -283,9 +292,16 @@ module Roma
283
292
 
284
293
  opts.on("-n", "--name [name]") { |v| @stats.name = v }
285
294
 
295
+ ##
296
+ # "--enabled_repeathost" is deplicated. We will rename it to "--replication_in_host"
297
+ ##
286
298
  @stats.enabled_repetition_host_in_routing = false
287
299
  opts.on(nil,"--enabled_repeathost", "Allow redundancy to same host"){
288
300
  @stats.enabled_repetition_host_in_routing = true
301
+ puts "Warning: \"--enabled_repeathost\" is deplicated. Please use \"--replication_in_host\""
302
+ }
303
+ opts.on(nil,"--replication_in_host", "Allow redundancy to same host"){
304
+ @stats.enabled_repetition_host_in_routing = true
289
305
  }
290
306
 
291
307
  @stats.disabled_cmd_protect = false
@@ -349,6 +365,7 @@ module Roma
349
365
  st = st_class.new
350
366
  st.storage_path = "#{path}/#{hname}"
351
367
  st.vn_list = @rttable.vnodes
368
+ st.st_class = st_class
352
369
  st.divnum = st_divnum
353
370
  st.option = st_option
354
371
  @storages[hname] = st
@@ -359,6 +376,7 @@ module Roma
359
376
  st = st_class.new
360
377
  st.storage_path = "#{path}/#{hname}"
361
378
  st.vn_list = @rttable.vnodes
379
+ st.st_class = st_class
362
380
  st.divnum = st_divnum
363
381
  st.option = st_option
364
382
  @storages[hname] = st
@@ -574,6 +592,12 @@ module Roma
574
592
  end
575
593
 
576
594
  def node_check(nid)
595
+ if @startup && @rttable.enabled_failover == false
596
+ unless Roma::Messaging::ConPool.instance.check_connection(nid)
597
+ @log.info("I'm wating for booting the #{nid} instance.")
598
+ return false
599
+ end
600
+ end
577
601
  name = async_send_cmd(nid,"whoami\r\n",2)
578
602
  return false unless name
579
603
  if name != @stats.name
@@ -606,7 +630,7 @@ module Roma
606
630
 
607
631
  idx=nodes.index(@stats.ap_str)
608
632
  unless idx
609
- @log.error("My node-id(=#{@stats.ap_str}) dose not found in the routingtable.")
633
+ @log.error("My node-id(=#{@stats.ap_str}) does not found in the routingtable.")
610
634
  EventMachine::stop_event_loop
611
635
  return
612
636
  end
File without changes
File without changes
@@ -37,6 +37,7 @@ module Roma
37
37
 
38
38
  # proc param
39
39
  attr_accessor :stream_copy_wait_param
40
+ attr_accessor :stream_show_wait_param
40
41
  attr_accessor :dcnice
41
42
  attr_accessor :clean_up_interval
42
43
 
@@ -76,6 +77,10 @@ module Roma
76
77
  attr_accessor :gui_run_gather_logs
77
78
  attr_accessor :gui_last_snapshot
78
79
 
80
+ # for log rotate
81
+ attr_accessor :log_shift_size
82
+ attr_accessor :log_shift_age
83
+
79
84
  def initialize
80
85
  @config_path = nil
81
86
  @run_recover = false
@@ -92,6 +97,7 @@ module Roma
92
97
  @gui_last_snapshot = []
93
98
  @spushv_protection = false
94
99
  @stream_copy_wait_param = 0.0001
100
+ @stream_show_wait_param = 0.001
95
101
  @dcnice = 3
96
102
  @clean_up_interval = 300
97
103
  @enabled_vnodes_balance = nil
@@ -113,6 +119,8 @@ module Roma
113
119
  @spushv_read_timeout = 100
114
120
  @reqpushv_timeout_count = 300 # 0.1 * 300 sec
115
121
  @routing_trans_timeout = 3600 * 3 # 3hr
122
+ @log_shift_size = 1048576
123
+ @log_shift_age = 0
116
124
  end
117
125
 
118
126
  def ap_str
@@ -141,6 +149,7 @@ module Roma
141
149
  ret['stats.gui_last_snapshot'] = @gui_last_snapshot
142
150
  ret['stats.spushv_protection'] = @spushv_protection
143
151
  ret['stats.stream_copy_wait_param'] = @stream_copy_wait_param
152
+ ret['stats.stream_show_wait_param'] = @stream_show_wait_param
144
153
  ret['stats.dcnice'] = @dcnice
145
154
  ret['stats.clean_up_interval'] = @clean_up_interval
146
155
  ret['stats.size_of_zredundant'] = @size_of_zredundant
@@ -160,6 +169,8 @@ module Roma
160
169
  ret['stats.spushv_read_timeout'] = @spushv_read_timeout
161
170
  ret['stats.reqpushv_timeout_count'] = @reqpushv_timeout_count
162
171
  ret['stats.routing_trans_timeout'] = @routing_trans_timeout
172
+ ret['stats.log_shift_size'] = @log_shift_size
173
+ ret['stats.log_shift_age'] = @log_shift_age
163
174
  ret
164
175
  end
165
176
 
@@ -18,6 +18,7 @@ module Roma
18
18
  attr_writer :storage_path
19
19
  attr_writer :option
20
20
 
21
+ attr_accessor :st_class
21
22
  attr_accessor :divnum
22
23
  attr_accessor :each_vn_dump_sleep
23
24
  attr_accessor :each_vn_dump_sleep_count
@@ -42,6 +43,7 @@ module Roma
42
43
 
43
44
  @ext_name = 'db'
44
45
 
46
+ @st_class = nil
45
47
  @divnum = 10
46
48
 
47
49
  @each_vn_dump_sleep = 0.001
@@ -58,6 +60,7 @@ module Roma
58
60
  def get_stat
59
61
  ret = {}
60
62
  ret['storage.storage_path'] = File.expand_path(@storage_path)
63
+ ret['storage.st_class'] = @st_class.to_s.match(/Roma::Storage::(.*)/)[1]
61
64
  ret['storage.divnum'] = @divnum
62
65
  ret['storage.option'] = @option
63
66
  ret['storage.each_vn_dump_sleep'] = @each_vn_dump_sleep
@@ -0,0 +1,101 @@
1
+ require 'groonga'
2
+ require 'roma/storage/basic_storage'
3
+
4
+ module Roma
5
+ module Storage
6
+
7
+ class GroongaStorage < BasicStorage
8
+ def initialize
9
+ super
10
+ @ext_name = 'grn'
11
+ end
12
+
13
+ def get_stat
14
+ ret = super
15
+ @hdb.each_with_index do |hdb, i|
16
+ ret["storage[#{i}].path"] = File.expand_path(hdb.path)
17
+ ret["storage[#{i}].rnum"] = hdb.rnum
18
+ end
19
+ ret
20
+ end
21
+
22
+ private
23
+ def open_db(fname)
24
+ hdb = GroongaHash.new(fname)
25
+ hdb.open
26
+ hdb
27
+ end
28
+
29
+ def close_db(hdb)
30
+ hdb.close
31
+ end
32
+
33
+ class GroongaHash
34
+ def initialize(fname)
35
+ @fname = fname
36
+ end
37
+
38
+ def path
39
+ @hash.path
40
+ end
41
+
42
+ def put(key, value)
43
+ record = @hash.add(key)
44
+ @value[record.id] = value
45
+ end
46
+
47
+ def get(key)
48
+ record = @hash[key]
49
+ return nil if record.nil?
50
+ @value[record.id]
51
+ end
52
+
53
+ def out(key)
54
+ record = @hash[key]
55
+ if record
56
+ record.delete
57
+ true
58
+ else
59
+ false
60
+ end
61
+ end
62
+
63
+ def rnum
64
+ @hash.count
65
+ end
66
+
67
+ def each
68
+ @hash.each do |record|
69
+ yield(record.key, @value[record.id])
70
+ end
71
+ end
72
+
73
+ def open
74
+ @context = Groonga::Context.new(:encoding => :none)
75
+ if File.exist?(@fname)
76
+ @database = Groonga::Database.new(@fname, :context => @context)
77
+ else
78
+ @database = Groonga::Database.create(:context => @context,
79
+ :path => @fname)
80
+ Groonga::Schema.define(:context => @context) do |schema|
81
+ schema.create_table("hash",
82
+ :type => :hash,
83
+ :key_type => "ShortText") do |table|
84
+ table.text("value")
85
+ end
86
+ end
87
+ end
88
+
89
+ @hash = @context["hash"]
90
+ @value = @hash.column("value")
91
+ end
92
+
93
+ def close
94
+ @database.close
95
+ @context.close
96
+ @hash = @value = @database = @context = nil
97
+ end
98
+ end
99
+ end # class GroongaStorage
100
+ end # module Storage
101
+ end # module Roma
File without changes
File without changes
@@ -19,6 +19,16 @@ module Roma
19
19
  end
20
20
  end
21
21
 
22
+ def check_storage_type
23
+ stats('st_class') do |line|
24
+ storage_type = line.match(/storages\[.+\]\.storage\.st_class\s(.+)/)[1].chomp
25
+ unless storage_type =~ /^(TCStorage|RubyHashStorage)$/
26
+ puts "ERROR:cpdb supports just TCStorage or RubyHashStorage system, your storage type is #{storage_type}"
27
+ exit
28
+ end
29
+ end
30
+ end
31
+
22
32
  def backup(hname)
23
33
  stat = get_safecopy_stats(hname)
24
34
  if stat.uniq != [:normal]
@@ -93,8 +103,8 @@ module Roma
93
103
  @con.gets
94
104
  end
95
105
 
96
- def stats
97
- @con.puts "stat storage\r\n"
106
+ def stats(regexp = "storage")
107
+ @con.puts "stat #{regexp}\r\n"
98
108
  yield $_ while @con.gets != "END\r\n"
99
109
  end
100
110
 
@@ -114,6 +124,7 @@ end
114
124
  sc = Roma::SafeCopy.new("localhost", ARGV[0].to_i)
115
125
 
116
126
  begin
127
+ sc.check_storage_type
117
128
  sc.backup_all
118
129
  sc.set_gui_last_snapshot
119
130
  ensure
@@ -68,7 +68,7 @@ module Roma
68
68
 
69
69
  def open_storage(path)
70
70
  unless File::directory?(path)
71
- STDERR.puts "#{path} dose not found."
71
+ STDERR.puts "#{path} does not found."
72
72
  return nil
73
73
  end
74
74
 
@@ -46,7 +46,7 @@ module Roma
46
46
 
47
47
  def open_storage(path)
48
48
  unless File::directory?(path)
49
- STDERR.puts "#{path} dose not found."
49
+ STDERR.puts "#{path} does not found."
50
50
  return nil
51
51
  end
52
52
 
File without changes
@@ -359,7 +359,7 @@ module Roma
359
359
 
360
360
  skip.call if @next_hash == "menu" || @next_hash == "server" || @next_hash == "fd_server" || @next_hash == "check_plugin"
361
361
  break if end?(@base[@next_hash])
362
- puts "if you dosen't input anything, default value is set."
362
+ puts "if you doesn't input anything, default value is set."
363
363
  Box.print_with_box(@defaults)
364
364
  print_status(@results)
365
365
  @base.print_question(@next_hash)
@@ -103,7 +103,7 @@ module Roma
103
103
 
104
104
  def ropen(path)
105
105
  unless File::directory?(path)
106
- STDERR.puts "#{path} dose not found."
106
+ STDERR.puts "#{path} does not found."
107
107
  return nil
108
108
  end
109
109
 
@@ -16,7 +16,11 @@ opts.banner = "usage:#{File.basename($0)} [options] node-id..."
16
16
  opts.on("-h","--hash [bits]","(default=32)"){|v| dgst_bits = v.to_i }
17
17
  opts.on("-d","--divide [bits]","(default=9)"){|v| div_bits = v.to_i }
18
18
  opts.on("-r","--redundant [num]","(default=2)"){|v| rn = v.to_i }
19
- opts.on(nil,"--enabled_repeathost"){|v| repeathost=true }
19
+ opts.on(nil,"--enabled_repeathost"){|v|
20
+ repeathost=true
21
+ puts "Warning: \"--enabled_repeathost\" is deplicated. Please use \"--replication_in_host\""
22
+ }
23
+ opts.on(nil,"--replication_in_host"){|v| repeathost=true }
20
24
  opts.parse!(ARGV)
21
25
 
22
26
  nodes = ARGV
File without changes
@@ -112,7 +112,7 @@ module Roma
112
112
 
113
113
  def open_storage(path,vn_list)
114
114
  unless File::directory?(path)
115
- STDERR.puts "#{path} dose not found."
115
+ STDERR.puts "#{path} does not found."
116
116
  return nil
117
117
  end
118
118
 
File without changes
File without changes
@@ -15,7 +15,7 @@ begin
15
15
  if Roma::Routing::RoutingData::snapshot("#{ap}.route")
16
16
  puts "succeed"
17
17
  else
18
- puts "Routing-log file dose not found."
18
+ puts "Routing-log file does not found."
19
19
  end
20
20
  rescue =>e
21
21
  puts "error:#{e}"
@@ -110,7 +110,7 @@ module Roma
110
110
  def init_roma
111
111
  @log.debug "begin init_roma"
112
112
  exec "rm -f localhost_1121?.*"
113
- exec "bin/mkroute -d 7 #{RomaProc.to_str(@roma_procs)} --enabled_repeathost"
113
+ exec "bin/mkroute -d 7 #{RomaProc.to_str(@roma_procs)} --replication_in_host"
114
114
  @log.debug "end init_roma"
115
115
  end
116
116
 
@@ -124,7 +124,7 @@ module Roma
124
124
 
125
125
  def start_roma_proc i
126
126
  @log.debug "begin start_roma_proc"
127
- str = "bin/romad #{@roma_procs[i].addr} -p #{@roma_procs[i].port.to_s} -d --enabled_repeathost"
127
+ str = "bin/romad #{@roma_procs[i].addr} -p #{@roma_procs[i].port.to_s} -d --replication_in_host"
128
128
  exec str
129
129
  @roma_procs[i].pid = get_pid(str)
130
130
  @log.debug "end start_roma_proc"
@@ -313,7 +313,7 @@ cnf = Roma::Test::Config.new(ARGV)
313
313
  # check for a working path
314
314
  unless File::exist?("#{cnf.working_path}/bin/romad")
315
315
  # in invalid path
316
- $stderr.puts "#{cnf.working_path}/bin/romad dose't found"
316
+ $stderr.puts "#{cnf.working_path}/bin/romad does't found"
317
317
  $stderr.puts "You should set to a working path option(-p)."
318
318
  exit 1
319
319
  end
@@ -6,7 +6,7 @@ UDP_PORT=14329
6
6
  MULTICAST_ADDR="225.0.0.123"
7
7
  ROMA_LOAD_PATH=File.expand_path(File.join(File.dirname(__FILE__),"../.."))
8
8
  RUBY_COMMAND_OPTIONS=["-I",ROMA_LOAD_PATH]
9
- ROMAD_OPTIONS=["--enabled_repeathost"]
9
+ ROMAD_OPTIONS=["--replication_in_host"]
10
10
  bin_dir=File.expand_path(File.join(File.dirname(__FILE__),"../../../bin"))
11
11
  ROMAD_PATH= File.expand_path(File.join(bin_dir,"romad"))
12
12
  MKROUTE_PATH= File.expand_path(File.join(bin_dir,"mkroute"))
@@ -0,0 +1,4 @@
1
+
2
+ module Roma
3
+ VERSION = "1.1.0"
4
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -8,27 +8,23 @@ require 'roma/messaging/con_pool'
8
8
  module RomaTestUtils
9
9
  module_function
10
10
  def base_dir
11
- Pathname(__FILE__).dirname.parent.parent.expand_path
11
+ Pathname(__FILE__).dirname.parent.expand_path
12
12
  end
13
13
 
14
- def server_base_dir
15
- base_dir + "server"
14
+ def bin_dir
15
+ base_dir + "bin"
16
16
  end
17
17
 
18
- def server_bin_dir
19
- server_base_dir + "bin"
20
- end
21
-
22
- def server_test_dir
23
- server_base_dir + "test"
18
+ def test_dir
19
+ base_dir + "test"
24
20
  end
25
21
 
26
22
  def mkroute_path
27
- (server_bin_dir + "mkroute").to_s
23
+ (bin_dir + "mkroute").to_s
28
24
  end
29
25
 
30
26
  def romad_path
31
- (server_bin_dir + "romad").to_s
27
+ (bin_dir + "romad").to_s
32
28
  end
33
29
 
34
30
  def ruby_path
@@ -48,7 +44,7 @@ module RomaTestUtils
48
44
  sh.system(ruby_path, mkroute_path,
49
45
  "localhost_11211","localhost_11212",
50
46
  "-d","3",
51
- "--enabled_repeathost")
47
+ "--replication_in_host")
52
48
  sleep 0.2
53
49
  do_command_romad conf
54
50
  sleep 1
@@ -57,9 +53,9 @@ module RomaTestUtils
57
53
  def do_command_romad conf
58
54
  sh = Shell.new
59
55
  sh.system(ruby_path,romad_path,"localhost","-p","11211","-d","--verbose",
60
- "--disabled_cmd_protect","--config","#{server_test_dir}/#{conf}")
56
+ "--disabled_cmd_protect","--config","#{test_dir}/#{conf}")
61
57
  sh.system(ruby_path,romad_path,"localhost","-p","11212","-d","--verbose",
62
- "--disabled_cmd_protect","--config","#{server_test_dir}/#{conf}")
58
+ "--disabled_cmd_protect","--config","#{test_dir}/#{conf}")
63
59
  end
64
60
 
65
61
  def stop_roma
data/test/run-test.rb ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'pathname'
5
+
6
+ base_path = Pathname(__FILE__).dirname.parent.expand_path
7
+
8
+ $LOAD_PATH.unshift("#{base_path}/lib")
9
+ $LOAD_PATH.unshift("#{base_path}/test")
10
+
11
+ client_base_path = Pathname(__FILE__).dirname.parent.parent.expand_path
12
+ $LOAD_PATH.unshift("#{client_base_path}/roma-ruby-client/lib")
13
+
14
+ require 'roma-test-utils'
15
+
16
+ Dir["#{base_path}/test/t_*.rb"].each do |test_file|
17
+ require File.basename(test_file, '*.rb')
18
+ end
19
+
20
+ exit(Test::Unit::AutoRunner.run)
File without changes