125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# File 'lib/roma/tools/safecopy_test.rb', line 125
def test_change_status
puts "write (0...10000) = 0"
set_counts(ARGV, 0...10000, 0)
Thread.new { random_rquest_sender(ARGV, 10000) }
nid = ARGV[0]
sleep(5)
10.times do |n|
t = Thread.new { set_counts(ARGV, (n * 1000)...(n * 1000 + 2000), n * 10 + 1) }
p set_storage_status(nid, n, 'safecopy')
p wait_status(nid, n, :safecopy_flushed)
t.join
p safecopy_stats(nid)
t = Thread.new { set_counts(ARGV, (n * 1000 + 500)...(n * 1000 + 2000), n * 10 + 2) }
p set_storage_status(nid, n, 'normal')
p wait_status(nid, n, :normal)
t.join
p safecopy_stats(nid)
check_count(ARGV, (n * 1000)...(n * 1000 + 500), n * 10 + 1)
check_count(ARGV, (n * 1000 + 500)...(n * 1000 + 2000), n * 10 + 2)
if (n * 1000 + 2000) < 10000
check_count(ARGV, (n * 1000 + 2000)...10000, 0)
end
end
end
|