roma 0.8.2 → 0.8.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANG +326 -0
- data/CHANGELOG +132 -0
- data/{README.rdoc → FETCH_HEAD} +0 -0
- data/{LICENSE.rdoc → LICENSE} +0 -1
- data/README +17 -0
- data/Rakefile +33 -18
- data/ruby/server/bin/chg_redundancy +10 -0
- data/ruby/server/bin/key_access +7 -0
- data/ruby/server/bin/key_list +7 -0
- data/ruby/server/bin/mkconfig +19 -0
- data/{bin → ruby/server/bin}/mkrecent +0 -1
- data/{bin → ruby/server/bin}/mkroute +0 -1
- data/ruby/server/bin/multi_commander +19 -0
- data/ruby/server/bin/recoverlost +10 -0
- data/ruby/server/bin/recoverlost_alist +10 -0
- data/ruby/server/bin/recoverlost_alist_all +10 -0
- data/ruby/server/bin/recoverlost_alist_keys +10 -0
- data/{bin/recoverlost → ruby/server/bin/roma_watcher} +1 -2
- data/ruby/server/bin/romad +36 -0
- data/{bin → ruby/server/bin}/sample_watcher +0 -1
- data/{bin → ruby/server/bin}/sample_watcher2 +0 -1
- data/{bin/simple_bench → ruby/server/bin/sample_watcher3} +1 -2
- data/ruby/server/bin/simple_bench +26 -0
- data/{bin → ruby/server/bin}/ssroute +0 -1
- data/ruby/server/bin/test-scenario +11 -0
- data/{bin → ruby/server/bin}/tribunus +0 -1
- data/{lib → ruby/server/lib}/roma/async_process.rb +67 -15
- data/{lib → ruby/server/lib}/roma/command/bg_command_receiver.rb +1 -1
- data/ruby/server/lib/roma/command/command_definition.rb +422 -0
- data/ruby/server/lib/roma/command/mh_command_receiver.rb +127 -0
- data/ruby/server/lib/roma/command/receiver.rb +64 -0
- data/{lib → ruby/server/lib}/roma/command/rt_command_receiver.rb +6 -1
- data/ruby/server/lib/roma/command/sys_command_receiver.rb +609 -0
- data/{lib → ruby/server/lib}/roma/command/util_command_receiver.rb +15 -5
- data/{lib → ruby/server/lib}/roma/command/vn_command_receiver.rb +12 -4
- data/{lib → ruby/server/lib}/roma/command_plugin.rb +0 -0
- data/ruby/server/lib/roma/config.rb +84 -0
- data/{lib → ruby/server/lib}/roma/event/con_pool.rb +12 -1
- data/ruby/server/lib/roma/event/handler.rb +256 -0
- data/ruby/server/lib/roma/live_patch-20120302-001.rb +107 -0
- data/ruby/server/lib/roma/logging/rlogger.rb +163 -0
- data/ruby/server/lib/roma/messaging/con_pool.rb +92 -0
- data/{lib → ruby/server/lib}/roma/plugin/plugin_alist.rb +118 -240
- data/ruby/server/lib/roma/plugin/plugin_debug.rb +31 -0
- data/ruby/server/lib/roma/plugin/plugin_map.rb +177 -0
- data/ruby/server/lib/roma/plugin/plugin_mapcount.rb +185 -0
- data/{lib/roma/command/st_command_receiver.rb → ruby/server/lib/roma/plugin/plugin_storage.rb} +170 -146
- data/ruby/server/lib/roma/plugin/plugin_stub.rb +283 -0
- data/{lib → ruby/server/lib}/roma/plugin/plugin_test.rb +0 -0
- data/{lib → ruby/server/lib}/roma/romad.rb +221 -94
- data/{lib → ruby/server/lib}/roma/routing/cb_rttable.rb +4 -6
- data/{lib → ruby/server/lib}/roma/routing/merkle_tree.rb +0 -0
- data/ruby/server/lib/roma/routing/routing_data.rb +307 -0
- data/{lib → ruby/server/lib}/roma/routing/rttable.rb +4 -0
- data/{lib → ruby/server/lib}/roma/stats.rb +19 -3
- data/{lib → ruby/server/lib}/roma/storage/basic_storage.rb +25 -26
- data/{lib → ruby/server/lib}/roma/storage/dbm_storage.rb +1 -23
- data/{lib → ruby/server/lib}/roma/storage/dummy_storage.rb +0 -0
- data/{lib → ruby/server/lib}/roma/storage/rh_storage.rb +0 -0
- data/{lib → ruby/server/lib}/roma/storage/sqlite3_storage.rb +0 -0
- data/{lib → ruby/server/lib}/roma/storage/tc_storage.rb +62 -2
- data/ruby/server/lib/roma/tools/chg_redundancy.rb +36 -0
- data/ruby/server/lib/roma/tools/key_access.rb +105 -0
- data/ruby/server/lib/roma/tools/key_list.rb +94 -0
- data/ruby/server/lib/roma/tools/mkconfig.rb +535 -0
- data/{lib → ruby/server/lib}/roma/tools/mkrecent.rb +0 -0
- data/{lib → ruby/server/lib}/roma/tools/mkroute.rb +0 -0
- data/ruby/server/lib/roma/tools/multi_commander.rb +45 -0
- data/{lib → ruby/server/lib}/roma/tools/recoverlost.rb +0 -0
- data/{lib → ruby/server/lib}/roma/tools/recoverlost_alist.rb +0 -0
- data/ruby/server/lib/roma/tools/recoverlost_alist_all.rb +8 -0
- data/ruby/server/lib/roma/tools/recoverlost_alist_keys.rb +16 -0
- data/ruby/server/lib/roma/tools/recoverlost_lib.rb +349 -0
- data/ruby/server/lib/roma/tools/roma_watcher.rb +150 -0
- data/ruby/server/lib/roma/tools/roma_watcher_config.yml.example +20 -0
- data/{lib → ruby/server/lib}/roma/tools/sample_watcher.rb +3 -1
- data/{lib → ruby/server/lib}/roma/tools/sample_watcher2.rb +3 -1
- data/ruby/server/lib/roma/tools/sample_watcher3.rb +49 -0
- data/{lib → ruby/server/lib}/roma/tools/simple_bench.rb +2 -0
- data/ruby/server/lib/roma/tools/simple_bench2.rb +78 -0
- data/{lib → ruby/server/lib}/roma/tools/ssroute.rb +0 -0
- data/ruby/server/lib/roma/tools/test-scenario.rb +327 -0
- data/{lib → ruby/server/lib}/roma/tools/tribunus.rb +0 -0
- data/ruby/server/lib/roma/version.rb +4 -0
- data/{lib → ruby/server/lib}/roma/write_behind.rb +1 -0
- data/ruby/server/test/config4mhash.rb +68 -0
- data/ruby/server/test/config4storage_error.rb +69 -0
- data/{lib/roma/config.rb → ruby/server/test/config4test.rb} +6 -3
- data/{test → ruby/server/test}/rcirb.rb +0 -1
- data/{test → ruby/server/test}/roma-test-utils.rb +21 -8
- data/{test → ruby/server/test}/run-test.rb +3 -2
- data/ruby/server/test/storage_error_storage.rb +37 -0
- data/ruby/server/test/t_command_definition.rb +326 -0
- data/{test → ruby/server/test}/t_cpdata.rb +9 -3
- data/{test → ruby/server/test}/t_listplugin.rb +48 -12
- data/ruby/server/test/t_mapcountplugin.rb +231 -0
- data/ruby/server/test/t_mapplugin.rb +131 -0
- data/ruby/server/test/t_mhash.rb +222 -0
- data/ruby/server/test/t_rclient.rb +199 -0
- data/{test → ruby/server/test}/t_routing_data.rb +56 -0
- data/{test → ruby/server/test}/t_storage.rb +107 -111
- data/ruby/server/test/t_storage_error.rb +61 -0
- data/ruby/server/test/t_writebehind.rb +374 -0
- metadata +150 -82
- data/bin/recoverlost_alist +0 -8
- data/bin/romad +0 -7
- data/lib/roma/command/mh_command_receiver.rb +0 -117
- data/lib/roma/command/receiver.rb +0 -287
- data/lib/roma/event/handler.rb +0 -159
- data/lib/roma/plugin/plugin_debug.rb +0 -19
- data/lib/roma/tools/recoverlost_lib.rb +0 -217
- data/lib/roma/version.rb +0 -4
- data/test/t_rclient.rb +0 -318
- data/test/t_writebehind.rb +0 -200
data/{README.rdoc → FETCH_HEAD}
RENAMED
File without changes
|
data/{LICENSE.rdoc → LICENSE}
RENAMED
data/README
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
================================================================
|
2
|
+
ROMA: A Distributed Key-Value Store in Ruby
|
3
|
+
Copyright (C) 2009 Rakuten, Inc.
|
4
|
+
================================================================
|
5
|
+
|
6
|
+
ROMA is one of the data storing systems for distributed key-value
|
7
|
+
stores. It is a completely decentralized distributed system that
|
8
|
+
consists of multiple processes, called nodes, on several machines. It
|
9
|
+
is based on pure P2P architecture like a distributed hash table, thus
|
10
|
+
it provides high availability and scalability.
|
11
|
+
|
12
|
+
ROMA is written in Ruby. However, following choices are available to
|
13
|
+
access to ROMA.
|
14
|
+
|
15
|
+
* Client libraries of Ruby and Java are available.
|
16
|
+
* ROMA protocol is compatible with memcached text-based one so that
|
17
|
+
any memcached client libraries allows users to interact with ROMA.
|
data/Rakefile
CHANGED
@@ -1,31 +1,44 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require 'rubygems'
|
3
3
|
require 'rake'
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'rubygems/package_task'
|
7
|
+
PackageTask = Gem::PackageTask
|
8
|
+
rescue LoadError
|
9
|
+
require 'rake/gempackagetask'
|
10
|
+
PackageTask = Rake::GemPackageTask
|
11
|
+
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'rdoc/task'
|
15
|
+
rescue LoadError
|
16
|
+
require 'rake/rdoctask'
|
17
|
+
end
|
6
18
|
|
7
19
|
RDOC_OPTIONS = [
|
8
20
|
'--line-numbers',
|
9
21
|
'--inline-source',
|
10
|
-
"--main", "README
|
22
|
+
"--main", "README",
|
11
23
|
"-c UTF-8",
|
12
24
|
]
|
13
25
|
|
14
26
|
# gem tasks
|
27
|
+
base = 'ruby/server/'
|
15
28
|
PKG_FILES = FileList[
|
16
29
|
'[A-Z]*',
|
17
|
-
'bin/**/*',
|
18
|
-
'lib
|
19
|
-
'test/**/*.rb',
|
20
|
-
'spec/**/*.rb',
|
21
|
-
'doc/**/*',
|
22
|
-
'examples/**/*',
|
30
|
+
base + 'bin/**/*',
|
31
|
+
base + 'lib/**/*',
|
32
|
+
base + 'test/**/*.rb',
|
33
|
+
base + 'spec/**/*.rb',
|
34
|
+
base + 'doc/**/*',
|
35
|
+
base + 'examples/**/*',
|
23
36
|
]
|
24
37
|
|
25
|
-
EXEC_TABLE = Dir.entries('bin').reject{ |d| d =~ /^\.+$/ || d =~ /^sample_/ }
|
26
|
-
|
38
|
+
EXEC_TABLE = Dir.entries(base + 'bin').reject{ |d| d =~ /^\.+$/ || d =~ /^sample_/ }
|
27
39
|
|
28
|
-
|
40
|
+
require File.expand_path(File.join('ruby', 'server', 'lib', 'roma', 'version'), File.dirname(__FILE__))
|
41
|
+
VER_NUM = Roma::VERSION
|
29
42
|
|
30
43
|
if VER_NUM =~ /([0-9.]+)$/
|
31
44
|
CURRENT_VERSION = $1
|
@@ -34,6 +47,8 @@ else
|
|
34
47
|
end
|
35
48
|
|
36
49
|
SPEC = Gem::Specification.new do |s|
|
50
|
+
s.authors = ["Junji Torii", "Hiroki Matsue"]
|
51
|
+
s.homepage = 'http://code.google.com/p/roma-prj/'
|
37
52
|
s.name = "roma"
|
38
53
|
s.version = CURRENT_VERSION
|
39
54
|
s.summary = "ROMA server"
|
@@ -43,21 +58,21 @@ SPEC = Gem::Specification.new do |s|
|
|
43
58
|
s.files = PKG_FILES.to_a
|
44
59
|
|
45
60
|
# Use these for libraries.
|
46
|
-
s.require_path = 'lib'
|
61
|
+
s.require_path = base + 'lib'
|
47
62
|
|
48
63
|
# Use these for applications.
|
49
|
-
s.bindir = "bin"
|
64
|
+
s.bindir = base + "bin"
|
50
65
|
s.executables = EXEC_TABLE
|
51
66
|
s.default_executable = "romad"
|
52
67
|
|
53
68
|
s.has_rdoc = true
|
54
69
|
s.rdoc_options.concat RDOC_OPTIONS
|
55
|
-
s.extra_rdoc_files = ["README
|
70
|
+
s.extra_rdoc_files = ["README", "CHANGELOG"]
|
56
71
|
|
57
|
-
s.add_dependency('
|
72
|
+
s.add_dependency('eventmachine')
|
58
73
|
end
|
59
74
|
|
60
|
-
package_task =
|
75
|
+
package_task = PackageTask.new(SPEC) do |pkg|
|
61
76
|
end
|
62
77
|
|
63
78
|
|
@@ -66,5 +81,5 @@ Rake::RDocTask.new("doc") { |rdoc|
|
|
66
81
|
rdoc.title = "ROMA documents"
|
67
82
|
rdoc.options.concat RDOC_OPTIONS
|
68
83
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
69
|
-
rdoc.rdoc_files.include("README
|
84
|
+
rdoc.rdoc_files.include("README")
|
70
85
|
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
base_path = Pathname(__FILE__).dirname.parent.parent.expand_path
|
5
|
+
$LOAD_PATH.unshift("#{base_path}/server/lib")
|
6
|
+
|
7
|
+
client_base_path = Pathname(__FILE__).dirname.parent.parent.parent.parent.expand_path
|
8
|
+
$LOAD_PATH.unshift("#{client_base_path}/roma-ruby-client/lib")
|
9
|
+
|
10
|
+
require 'roma/tools/chg_redundancy'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift(File.expand_path(File.join('..', 'lib'), File.dirname(__FILE__)))
|
4
|
+
|
5
|
+
require 'optparse'
|
6
|
+
require 'roma/tools/mkconfig'
|
7
|
+
|
8
|
+
opt = OptionParser.new
|
9
|
+
opt.on("-m","--with_menu", "Show menu to setup configurations individually.") { |v| Roma::Mkconfig.new(:with_menu)}
|
10
|
+
|
11
|
+
if ARGV.count == 0
|
12
|
+
Roma::Mkconfig.new
|
13
|
+
elsif
|
14
|
+
begin
|
15
|
+
opt.parse!(ARGV)
|
16
|
+
rescue OptionParser::InvalidOption
|
17
|
+
puts opt.help
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
base_path = Pathname(__FILE__).dirname.parent.parent.expand_path
|
5
|
+
$LOAD_PATH.unshift("#{base_path}/server/lib")
|
6
|
+
|
7
|
+
client_base_path = Pathname(__FILE__).dirname.parent.parent.parent.parent.expand_path
|
8
|
+
$LOAD_PATH.unshift("#{client_base_path}/roma-ruby-client/lib")
|
9
|
+
|
10
|
+
require 'roma/tools/multi_commander'
|
11
|
+
|
12
|
+
if ARGV.length < 2
|
13
|
+
STDERR.puts "usage:#{File.basename($0)} addr_port command args..."
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
|
17
|
+
w = Roma::MultiCommander.new(ARGV[0])
|
18
|
+
STDOUT.puts w.send_cmd_all(ARGV[1..-1].join(' '))
|
19
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
base_path = Pathname(__FILE__).dirname.parent.parent.expand_path
|
5
|
+
$LOAD_PATH.unshift("#{base_path}/server/lib")
|
6
|
+
|
7
|
+
client_base_path = Pathname(__FILE__).dirname.parent.parent.parent.parent.expand_path
|
8
|
+
$LOAD_PATH.unshift("#{client_base_path}/roma-ruby-client/lib")
|
9
|
+
|
10
|
+
require 'roma/tools/recoverlost'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
base_path = Pathname(__FILE__).dirname.parent.parent.expand_path
|
5
|
+
$LOAD_PATH.unshift("#{base_path}/server/lib")
|
6
|
+
|
7
|
+
client_base_path = Pathname(__FILE__).dirname.parent.parent.parent.parent.expand_path
|
8
|
+
$LOAD_PATH.unshift("#{client_base_path}/roma-ruby-client/lib")
|
9
|
+
|
10
|
+
require 'roma/tools/recoverlost_alist'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
base_path = Pathname(__FILE__).dirname.parent.parent.expand_path
|
5
|
+
$LOAD_PATH.unshift("#{base_path}/server/lib")
|
6
|
+
|
7
|
+
client_base_path = Pathname(__FILE__).dirname.parent.parent.parent.parent.expand_path
|
8
|
+
$LOAD_PATH.unshift("#{client_base_path}/roma-ruby-client/lib")
|
9
|
+
|
10
|
+
require 'roma/tools/recoverlost_alist_all'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
base_path = Pathname(__FILE__).dirname.parent.parent.expand_path
|
5
|
+
$LOAD_PATH.unshift("#{base_path}/server/lib")
|
6
|
+
|
7
|
+
client_base_path = Pathname(__FILE__).dirname.parent.parent.parent.parent.expand_path
|
8
|
+
$LOAD_PATH.unshift("#{client_base_path}/roma-ruby-client/lib")
|
9
|
+
|
10
|
+
require 'roma/tools/recoverlost_alist_keys'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
path = File.dirname(File.expand_path($PROGRAM_NAME))
|
4
|
+
$LOAD_PATH << path + "/../lib"
|
5
|
+
|
6
|
+
require 'roma/romad'
|
7
|
+
|
8
|
+
def daemonize
|
9
|
+
p = Process.fork {
|
10
|
+
pid=Process.setsid
|
11
|
+
Signal.trap(:INT){
|
12
|
+
exit! 0
|
13
|
+
}
|
14
|
+
Signal.trap(:TERM){
|
15
|
+
exit! 0
|
16
|
+
}
|
17
|
+
Signal.trap(:HUP){
|
18
|
+
exit! 0
|
19
|
+
}
|
20
|
+
File.open("/dev/null","r+"){|f|
|
21
|
+
STDIN.reopen f
|
22
|
+
STDOUT.reopen f
|
23
|
+
STDERR.reopen f
|
24
|
+
}
|
25
|
+
yield
|
26
|
+
}
|
27
|
+
$stderr.puts p
|
28
|
+
exit! 0
|
29
|
+
end
|
30
|
+
|
31
|
+
$roma = Roma::Romad.new(ARGV)
|
32
|
+
if $roma.daemon?
|
33
|
+
daemonize{ $roma.start }
|
34
|
+
else
|
35
|
+
$roma.start
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
base_path = Pathname(__FILE__).dirname.parent.parent.expand_path
|
5
|
+
$LOAD_PATH.unshift("#{base_path}/server/lib")
|
6
|
+
|
7
|
+
client_base_path = Pathname(__FILE__).dirname.parent.parent.parent.parent.expand_path
|
8
|
+
$LOAD_PATH.unshift("#{client_base_path}/roma-ruby-client/lib")
|
9
|
+
|
10
|
+
require 'roma/tools/simple_bench'
|
11
|
+
|
12
|
+
if ARGV.length == 0
|
13
|
+
STDERR.puts "usage:simple_bench addr:port"
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
|
17
|
+
tn=10
|
18
|
+
t=[]
|
19
|
+
tn.times{
|
20
|
+
t << Thread.new{
|
21
|
+
random_rquest_sender(ARGV)
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
t[0].join
|
26
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
base_path = Pathname(__FILE__).dirname.parent.parent.expand_path
|
5
|
+
$LOAD_PATH.unshift("#{base_path}/server/lib")
|
6
|
+
|
7
|
+
client_base_path = Pathname(__FILE__).dirname.parent.parent.parent.parent.expand_path
|
8
|
+
$LOAD_PATH.unshift("#{client_base_path}/roma-ruby-client/lib")
|
9
|
+
|
10
|
+
require 'roma/tools/test-scenario'
|
11
|
+
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
# -*- coding: utf-8 -*-
|
2
3
|
require 'thread'
|
3
4
|
require 'digest/sha1'
|
@@ -43,6 +44,7 @@ module Roma
|
|
43
44
|
@async_thread = Thread.new{
|
44
45
|
async_process_loop
|
45
46
|
}
|
47
|
+
@async_thread[:name] = __method__
|
46
48
|
rescue =>e
|
47
49
|
@log.error("#{e}\n#{$@}")
|
48
50
|
end
|
@@ -65,11 +67,12 @@ module Roma
|
|
65
67
|
msg.callback.call(msg,true) if msg.callback
|
66
68
|
else
|
67
69
|
if msg.retry?
|
68
|
-
Thread.new{
|
70
|
+
t = Thread.new{
|
69
71
|
msg.wait
|
70
72
|
msg.incr_count
|
71
73
|
@@async_queue.push(msg)
|
72
74
|
}
|
75
|
+
t[:name] = __method__
|
73
76
|
else
|
74
77
|
@log.error("async process retry out:#{msg.inspect}")
|
75
78
|
msg.callback.call(msg,false) if msg.callback
|
@@ -85,9 +88,10 @@ module Roma
|
|
85
88
|
def asyncev_broadcast_cmd(args)
|
86
89
|
@log.debug("asyncev_broadcast_cmd #{args.inspect}")
|
87
90
|
cmd, nids, tout = args
|
88
|
-
Thread::new{
|
91
|
+
t = Thread::new{
|
89
92
|
async_broadcast_cmd("#{cmd}\r\n", nids, tout)
|
90
93
|
}
|
94
|
+
t[:name] = __method__
|
91
95
|
true
|
92
96
|
end
|
93
97
|
|
@@ -98,7 +102,7 @@ module Roma
|
|
98
102
|
return true
|
99
103
|
end
|
100
104
|
@stats.run_acquire_vnodes = true
|
101
|
-
Thread::new{
|
105
|
+
t = Thread::new{
|
102
106
|
begin
|
103
107
|
acquire_vnodes_process
|
104
108
|
rescue =>e
|
@@ -108,6 +112,7 @@ module Roma
|
|
108
112
|
@stats.join_ap = nil
|
109
113
|
end
|
110
114
|
}
|
115
|
+
t[:name] = __method__
|
111
116
|
true
|
112
117
|
end
|
113
118
|
|
@@ -115,7 +120,7 @@ module Roma
|
|
115
120
|
@log.debug("asyncev_start_dumpfile_process #{args.inspect}")
|
116
121
|
key, path, cmd = args
|
117
122
|
path = Roma::Config::STORAGE_DUMP_PATH + '/' + path
|
118
|
-
Thread.new{
|
123
|
+
t = Thread.new{
|
119
124
|
begin
|
120
125
|
except_vnh = {}
|
121
126
|
@rttable.each_vnode{|vn,nids|
|
@@ -138,6 +143,7 @@ module Roma
|
|
138
143
|
@log.error("#{e}\n#{$@}")
|
139
144
|
end
|
140
145
|
}
|
146
|
+
t[:name] = __method__
|
141
147
|
true
|
142
148
|
end
|
143
149
|
|
@@ -176,7 +182,7 @@ module Roma
|
|
176
182
|
return true # no retry
|
177
183
|
end
|
178
184
|
res = async_send_cmd(nid,"rset #{k}\e#{hname} #{d} #{clk} #{expt} #{v.length}\r\n#{v}\r\n",10)
|
179
|
-
|
185
|
+
if res == nil || res.start_with?("ERROR")
|
180
186
|
@log.warn("async redundant failed:#{k}\e#{hname} #{d} #{clk} #{expt} #{v.length} -> #{nid}")
|
181
187
|
return false # retry
|
182
188
|
end
|
@@ -191,27 +197,43 @@ module Roma
|
|
191
197
|
return true # no retry
|
192
198
|
end
|
193
199
|
res = async_send_cmd(nid,"rzset #{k}\e#{hname} #{d} #{clk} #{expt} #{zv.length}\r\n#{zv}\r\n",10)
|
194
|
-
|
200
|
+
if res == nil || res.start_with?("ERROR")
|
195
201
|
@log.warn("async zredundant failed:#{k}\e#{hname} #{d} #{clk} #{expt} #{v.length} -> #{nid}")
|
196
202
|
return false # retry
|
197
203
|
end
|
198
204
|
true
|
199
205
|
end
|
200
206
|
|
207
|
+
def asyncev_rdelete(args)
|
208
|
+
nid,hname,k,clk = args
|
209
|
+
@log.debug("asyncev_rdelete #{args.inspect}")
|
210
|
+
unless @rttable.nodes.include?(nid)
|
211
|
+
@log.warn("async rdelete failed:#{nid} dose not found in routing table.#{k}\e#{hname} #{clk}")
|
212
|
+
return true # no retry
|
213
|
+
end
|
214
|
+
res = async_send_cmd(nid,"rdelete #{k}\e#{hname} #{clk}\r\n",10)
|
215
|
+
unless res
|
216
|
+
@log.warn("async redundant failed:#{k}\e#{hname} #{clk} -> #{nid}")
|
217
|
+
return false # retry
|
218
|
+
end
|
219
|
+
true
|
220
|
+
end
|
221
|
+
|
201
222
|
def asyncev_reqpushv(args)
|
202
223
|
vn, nid, p = args
|
203
224
|
@log.debug("asyncev_reqpushv #{args.inspect}")
|
204
|
-
Thread::new{
|
225
|
+
t = Thread::new{
|
205
226
|
sync_a_vnode(vn.to_i, nid, p == 'true')
|
206
227
|
}
|
228
|
+
t[:name] = __method__
|
207
229
|
end
|
208
230
|
|
209
231
|
def asyncev_start_recover_process(args)
|
210
232
|
@log.debug("asyncev_start_recover_process #{args.inspect}")
|
211
233
|
@stats.run_recover = true
|
212
|
-
Thread::new{
|
234
|
+
t = Thread::new{
|
213
235
|
begin
|
214
|
-
if args
|
236
|
+
if args == nil || args.length == 0
|
215
237
|
acquired_recover_process
|
216
238
|
elsif args[0] == '-s'
|
217
239
|
recover_process
|
@@ -225,12 +247,13 @@ module Roma
|
|
225
247
|
end
|
226
248
|
@stats.run_recover = false
|
227
249
|
}
|
250
|
+
t[:name] = __method__
|
228
251
|
end
|
229
252
|
|
230
253
|
def asyncev_start_release_process(args)
|
231
254
|
@log.debug("asyncev_start_release_process #{args}")
|
232
255
|
@stats.run_release = true
|
233
|
-
Thread::new{
|
256
|
+
t = Thread::new{
|
234
257
|
begin
|
235
258
|
release_process
|
236
259
|
rescue => e
|
@@ -238,15 +261,17 @@ module Roma
|
|
238
261
|
end
|
239
262
|
@stats.run_relase = false
|
240
263
|
}
|
264
|
+
t[:name] = __method__
|
241
265
|
end
|
242
266
|
|
243
267
|
def asyncev_start_sync_process(args)
|
244
268
|
@log.debug("asyncev_start_sync_process")
|
245
269
|
@stats.run_recover = true
|
246
|
-
Thread::new{
|
270
|
+
t = Thread::new{
|
247
271
|
sync_process(args)
|
248
272
|
@stats.run_recover = false
|
249
273
|
}
|
274
|
+
t[:name] = __method__
|
250
275
|
end
|
251
276
|
|
252
277
|
def sync_process(st)
|
@@ -354,9 +379,13 @@ module Roma
|
|
354
379
|
def req_push_a_vnode(vn, src_nid, is_primary)
|
355
380
|
con = Roma::Messaging::ConPool.instance.get_connection(src_nid)
|
356
381
|
con.write("reqpushv #{vn} #{@stats.ap_str} #{is_primary}\r\n")
|
357
|
-
res = con.gets # receive 'PUSHED\r\n' | 'REJECTED\r\n'
|
382
|
+
res = con.gets # receive 'PUSHED\r\n' | 'REJECTED\r\n' | 'ERROR\r\n'
|
358
383
|
if res == "REJECTED\r\n"
|
359
384
|
@log.warn("req_push_a_vnode:request was rejected from #{src_nid}.")
|
385
|
+
Roma::Messaging::ConPool.instance.return_connection(src_nid,con)
|
386
|
+
return :rejected
|
387
|
+
elsif res.start_with?("ERROR")
|
388
|
+
@log.warn("req_push_a_vnode:#{src_nid} busy.")
|
360
389
|
return :rejected
|
361
390
|
end
|
362
391
|
Roma::Messaging::ConPool.instance.return_connection(src_nid,con)
|
@@ -606,9 +635,24 @@ module Roma
|
|
606
635
|
|
607
636
|
def push_a_vnode_stream(hname, vn, nid)
|
608
637
|
@stats.run_iterate_storage = true
|
609
|
-
@log.info("
|
638
|
+
@log.info("#{__method__}:hname=#{hname} vn=#{vn} nid=#{nid}")
|
639
|
+
|
640
|
+
while(@stats.run_storage_clean_up)
|
641
|
+
@log.info("#{__method__}:stop clean up storage process")
|
642
|
+
@storages.each_value{|st| st.stop_clean_up}
|
643
|
+
sleep 0.1
|
644
|
+
end
|
645
|
+
|
610
646
|
con = Roma::Messaging::ConPool.instance.get_connection(nid)
|
611
647
|
|
648
|
+
@do_push_a_vnode_stream = true
|
649
|
+
|
650
|
+
while(@stats.run_storage_clean_up)
|
651
|
+
@log.info("#{__method__}:stop_clean_up")
|
652
|
+
@storages.each_value{|st| st.stop_clean_up}
|
653
|
+
sleep 0.5
|
654
|
+
end
|
655
|
+
|
612
656
|
con.write("spushv #{hname} #{vn}\r\n")
|
613
657
|
|
614
658
|
res = con.gets # READY\r\n or error string
|
@@ -618,6 +662,13 @@ module Roma
|
|
618
662
|
end
|
619
663
|
|
620
664
|
@storages[hname].each_vn_dump(vn){|data|
|
665
|
+
|
666
|
+
unless @do_push_a_vnode_stream
|
667
|
+
con.close
|
668
|
+
@log.error("#{__method__}:canceled in hname=#{hname} vn=#{vn} nid=#{nid}")
|
669
|
+
return "CANCELED"
|
670
|
+
end
|
671
|
+
|
621
672
|
@stats.run_iterate_storage = true
|
622
673
|
con.write(data)
|
623
674
|
sleep @stats.stream_copy_wait_param
|
@@ -643,7 +694,7 @@ module Roma
|
|
643
694
|
return
|
644
695
|
end
|
645
696
|
@stats.run_storage_clean_up = true
|
646
|
-
Thread::new{
|
697
|
+
t = Thread::new{
|
647
698
|
begin
|
648
699
|
storage_clean_up_process
|
649
700
|
rescue =>e
|
@@ -652,6 +703,7 @@ module Roma
|
|
652
703
|
@stats.run_storage_clean_up = false
|
653
704
|
end
|
654
705
|
}
|
706
|
+
t[:name] = __method__
|
655
707
|
end
|
656
708
|
|
657
709
|
def storage_clean_up_process
|
@@ -675,7 +727,7 @@ module Roma
|
|
675
727
|
@stats.out_count += 1
|
676
728
|
# @log.debug("#{__method__}:key=#{key} vn=#{vn}")
|
677
729
|
nodes = @rttable.search_nodes_for_write(vn)
|
678
|
-
next if(nodes.length <= 1)
|
730
|
+
next if(nodes == nil || nodes.length <= 1)
|
679
731
|
nodes[1..-1].each{|nid|
|
680
732
|
res = async_send_cmd(nid,"out #{key}\e#{hname} #{vn}\r\n")
|
681
733
|
unless res
|