roma 0.8.14 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +19 -0
- data/ruby/server/lib/roma/async_process.rb +130 -16
- data/ruby/server/lib/roma/command/command_definition.rb +19 -3
- data/ruby/server/lib/roma/command/rt_command_receiver.rb +28 -0
- data/ruby/server/lib/roma/command/sys_command_receiver.rb +64 -2
- data/ruby/server/lib/roma/config.rb +1 -0
- data/ruby/server/lib/roma/plugin/plugin_gui.rb +66 -0
- data/ruby/server/lib/roma/plugin/plugin_storage.rb +49 -6
- data/ruby/server/lib/roma/romad.rb +23 -18
- data/ruby/server/lib/roma/routing/cb_rttable.rb +28 -10
- data/ruby/server/lib/roma/routing/random_partitioner.rb +34 -7
- data/ruby/server/lib/roma/routing/rttable.rb +24 -7
- data/ruby/server/lib/roma/stats.rb +11 -1
- data/ruby/server/lib/roma/storage/basic_storage.rb +36 -31
- data/ruby/server/lib/roma/tools/cpdb.rb +20 -2
- data/ruby/server/lib/roma/tools/safecopy_integration_test.rb +37 -16
- data/ruby/server/lib/roma/version.rb +1 -1
- data/ruby/server/test/t_protocol.rb +1 -1
- data/ruby/server/test/t_storage.rb +28 -21
- data/ruby/server/test/t_writebehind.rb +120 -5
- metadata +19 -18
@@ -444,7 +444,7 @@ class TCStorageTest < Test::Unit::TestCase
|
|
444
444
|
@st.delete(0, "key#{i}", 0)
|
445
445
|
}
|
446
446
|
count = 0
|
447
|
-
@st.each_vn_dump(0){|data|
|
447
|
+
res = @st.each_vn_dump(0){|data|
|
448
448
|
vn, last, clk, expt, klen = data.slice!(0..19).unpack('NNNNN')
|
449
449
|
k = data.slice!(0..(klen-1))
|
450
450
|
vlen, = data.slice!(0..3).unpack('N')
|
@@ -457,6 +457,7 @@ class TCStorageTest < Test::Unit::TestCase
|
|
457
457
|
assert_nil( @st.load_stream_dump(vn, last, clk, expt, k, v) )
|
458
458
|
@st.load_stream_dump(2, last, clk, expt, k, v)
|
459
459
|
}
|
460
|
+
assert(res)
|
460
461
|
assert_equal(100,count)
|
461
462
|
|
462
463
|
count = 0
|
@@ -493,34 +494,40 @@ class TCStorageTest < Test::Unit::TestCase
|
|
493
494
|
}
|
494
495
|
|
495
496
|
count = 0
|
496
|
-
@st.each_vn_dump(0){|data|
|
497
|
+
res = @st.each_vn_dump(0){|data|
|
497
498
|
vn, last, clk, expt, klen = data.slice!(0..19).unpack('NNNNN')
|
498
499
|
k = data.slice!(0..(klen-1))
|
499
500
|
vlen, = data.slice!(0..3).unpack('N')
|
500
501
|
v = data
|
501
502
|
count += 1
|
502
503
|
# puts "#{vn} #{last} #{clk} #{expt} #{klen} #{k} #{vlen} #{v}"
|
503
|
-
assert_match(/key\d/, k)
|
504
|
-
if k[3..-1].to_i < 80
|
505
|
-
assert_match("val#{k[3..-1]}", v)
|
506
|
-
elsif k[3..-1].to_i < 90
|
507
|
-
assert_match("val#{k[3..-1].to_i + 1}", v)
|
508
|
-
else
|
509
|
-
assert(vlen == 0)
|
510
|
-
end
|
511
|
-
|
512
|
-
assert_nil( @st.load_stream_dump(vn, last, clk, expt, k, v) )
|
513
|
-
@st.load_stream_dump(2, last, clk, expt, k, v)
|
514
504
|
}
|
515
|
-
assert_equal(
|
516
|
-
|
517
|
-
|
518
|
-
@st.each_vn_dump(1){|data| count += 1 }
|
519
|
-
assert_equal(0,count )
|
505
|
+
assert_equal(false, res)
|
506
|
+
assert_equal(0, count)
|
507
|
+
end
|
520
508
|
|
521
|
-
|
522
|
-
|
523
|
-
|
509
|
+
def test_db_stat_with_each_vn_dump
|
510
|
+
n = 100 # number of data
|
511
|
+
m = 10 # number of vnode
|
512
|
+
# set data
|
513
|
+
n.times do |i|
|
514
|
+
m.times do|vn|
|
515
|
+
@st.set(vn,"key#{vn}_#{i}",0,0x7fffffff,"val#{i}")
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
m.times do |vn|
|
520
|
+
dn = @st.instance_eval{ @hdiv[vn] }
|
521
|
+
count = 0
|
522
|
+
res = @st.each_vn_dump(vn) do
|
523
|
+
assert_equal(false, @st.each_vn_dump(vn){})
|
524
|
+
assert_equal(:normal, @st.dbs[dn])
|
525
|
+
assert_equal(false, @st.set_db_stat(dn, :safecopy_flushing))
|
526
|
+
count += 1
|
527
|
+
end
|
528
|
+
assert_equal(n, count)
|
529
|
+
assert(res)
|
530
|
+
end
|
524
531
|
end
|
525
532
|
|
526
533
|
def test_db_stat
|
@@ -235,12 +235,33 @@ class WriteBehindTest < FileWriterTest
|
|
235
235
|
wb0 = read_wb("#{wb_path}/0.wb")
|
236
236
|
assert_equal(1, wb0.length)
|
237
237
|
wb0.each do |last, cmd, key, val|
|
238
|
+
puts "#{cmd} #{key} #{val.inspect}"
|
238
239
|
assert_equal(1, cmd)
|
239
240
|
assert_equal("abc", key)
|
240
241
|
assert_equal("value abc", val)
|
241
242
|
end
|
242
243
|
end
|
243
244
|
|
245
|
+
def test_wb2_set2
|
246
|
+
send_cmd("localhost_11211", "wb_command_map {:set=>1, :set__prev=>2}")
|
247
|
+
assert_equal("STORED", @rc.set("abc","val1",0,true))
|
248
|
+
assert_equal("STORED", @rc.set("abc","val2",0,true))
|
249
|
+
send_cmd("localhost_11211", "writebehind_rotate roma")
|
250
|
+
|
251
|
+
res = [[1,"abc","val1"], [2,"abc","val1"], [1,"abc","val2"]]
|
252
|
+
wb0 = read_wb("#{wb_path}/0.wb")
|
253
|
+
assert_equal(3, wb0.length)
|
254
|
+
i = 0
|
255
|
+
wb0.each do |last, cmd, key, val|
|
256
|
+
# puts "#{cmd} #{key} #{val.inspect} #{i}"
|
257
|
+
assert_equal(res[i][0], cmd)
|
258
|
+
assert_equal(res[i][1], key)
|
259
|
+
assert_equal(res[i][2], val)
|
260
|
+
i+=1
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
|
244
265
|
def test_wb2_storage_commands
|
245
266
|
h = {:set=>1,:delete=>2,:add=>3,:replace=>4,:append=>5,:prepend=>6,:cas=>7,:incr=>8,:decr=>9,:set_expt=>10}
|
246
267
|
send_cmd("localhost_11211", "wb_command_map #{h}")
|
@@ -256,16 +277,73 @@ class WriteBehindTest < FileWriterTest
|
|
256
277
|
assert_equal("STORED", res)
|
257
278
|
assert_equal(129, @rc.incr("abc"))
|
258
279
|
assert_equal(128, @rc.decr("abc"))
|
259
|
-
|
280
|
+
res = send_cmd("localhost_11211", "set_expt abc 100")
|
281
|
+
assert_equal("STORED", res.chomp)
|
260
282
|
send_cmd("localhost_11211", "writebehind_rotate roma")
|
261
283
|
|
262
284
|
|
263
|
-
res = {1=>'1',2=>'1',3=>'1',4=>'2',5=>'23',6=>'123',7=>'128',8=>'129',9=>'128'}
|
285
|
+
res = {1=>'1',2=>'1',3=>'1',4=>'2',5=>'23',6=>'123',7=>'128',8=>'129',9=>'128', 10=>nil}
|
264
286
|
wb0 = read_wb("#{wb_path}/0.wb")
|
265
|
-
assert_equal(
|
287
|
+
assert_equal(10, wb0.length)
|
266
288
|
wb0.each do |last, cmd, key, val|
|
267
289
|
# puts "#{cmd} #{key} #{val.inspect}"
|
268
|
-
assert_equal(res[cmd], val)
|
290
|
+
assert_equal(res[cmd], val) if res[cmd]
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
def test_wb2_storage_commands2
|
295
|
+
h = {
|
296
|
+
:set=>1, :set__prev=>11,
|
297
|
+
:delete=>2, :delete__prev=>12,
|
298
|
+
:add=>3, :add__prev=>13,
|
299
|
+
:replace=>4, :replace__prev=>14,
|
300
|
+
:append=>5,:append__prev=>15,
|
301
|
+
:prepend=>6,:prepend__prev=>16,
|
302
|
+
:cas=>7,:cas__prev=>17,
|
303
|
+
:incr=>8,:incr__prev=>18,
|
304
|
+
:decr=>9,:decr__prev=>19,
|
305
|
+
:set_expt=>10,:set_expt__prev=>20
|
306
|
+
}
|
307
|
+
send_cmd("localhost_11211", "wb_command_map #{h}")
|
308
|
+
assert_equal("STORED", @rc.set("abc","1",0,true))
|
309
|
+
assert_equal("DELETED", @rc.delete("abc"))
|
310
|
+
assert_equal("STORED", @rc.add("abc","1",0,true))
|
311
|
+
assert_equal("STORED", @rc.replace("abc","2",0,true))
|
312
|
+
assert_equal("STORED", @rc.append("abc","3"))
|
313
|
+
assert_equal("STORED", @rc.prepend("abc","1"))
|
314
|
+
res = @rc.cas("abc", 0, true) do |v|
|
315
|
+
v = "128"
|
316
|
+
end
|
317
|
+
assert_equal("STORED", res)
|
318
|
+
assert_equal(129, @rc.incr("abc"))
|
319
|
+
assert_equal(128, @rc.decr("abc"))
|
320
|
+
res = send_cmd("localhost_11211", "set_expt abc 100")
|
321
|
+
assert_equal("STORED", res.chomp)
|
322
|
+
|
323
|
+
send_cmd("localhost_11211", "writebehind_rotate roma")
|
324
|
+
|
325
|
+
res = [
|
326
|
+
[1, "abc", "1"], [12, "abc", "1"],
|
327
|
+
[2, "abc", "1"],
|
328
|
+
[3, "abc", "1"], [14, "abc", "1"],
|
329
|
+
[4, "abc", "2"], [15, "abc", "2"],
|
330
|
+
[5, "abc", "23"],[16, "abc", "23"],
|
331
|
+
[6, "abc", "123"], [17, "abc", "123"],
|
332
|
+
[7, "abc", "128"], [18, "abc", "128"],
|
333
|
+
[8, "abc", "129"], [19, "abc", "129"],
|
334
|
+
[9, "abc", "128"],
|
335
|
+
[20, "abc"], [10, "abc"]
|
336
|
+
]
|
337
|
+
|
338
|
+
wb0 = read_wb("#{wb_path}/0.wb")
|
339
|
+
assert_equal(18, wb0.length)
|
340
|
+
i = 0
|
341
|
+
wb0.each do |last, cmd, key, val|
|
342
|
+
# puts "#{cmd} #{key} #{val.inspect}"
|
343
|
+
assert_equal(res[i][0], cmd)
|
344
|
+
assert_equal(res[i][1], key)
|
345
|
+
assert_equal(res[i][2], val) if res.length < 3
|
346
|
+
i += 1
|
269
347
|
end
|
270
348
|
end
|
271
349
|
|
@@ -336,7 +414,7 @@ class WriteBehindTest < FileWriterTest
|
|
336
414
|
assert_equal('CLEARED', @rc.map_clear("abc"))
|
337
415
|
send_cmd("localhost_11211", "writebehind_rotate roma")
|
338
416
|
|
339
|
-
res = {1=>
|
417
|
+
res = {1=>{"mapkey1"=>"value1"},2=>{},3=>{}}
|
340
418
|
wb0 = read_wb("#{wb_path}/0.wb")
|
341
419
|
assert_equal(4, wb0.length)
|
342
420
|
wb0.each do |last, cmd, key, val|
|
@@ -349,6 +427,43 @@ class WriteBehindTest < FileWriterTest
|
|
349
427
|
end
|
350
428
|
end
|
351
429
|
|
430
|
+
def test_wb2_map_commands2
|
431
|
+
h = {
|
432
|
+
:map_set=>1, :map_set__prev=>11,
|
433
|
+
:map_delete=>2, :map_delete__prev=>12,
|
434
|
+
:map_clear=>3, :map_clear__prev=>13
|
435
|
+
}
|
436
|
+
send_cmd("localhost_11211", "wb_command_map #{h}")
|
437
|
+
assert_equal('STORED', @rc.map_set('abc','mapkey1','value1'))
|
438
|
+
assert_equal('STORED', @rc.map_set('abc','mapkey2','value2'))
|
439
|
+
assert_equal('DELETED', @rc.map_delete('abc', 'mapkey1'))
|
440
|
+
assert_equal('STORED', @rc.map_set('abc','mapkey1','value1'))
|
441
|
+
assert_equal('CLEARED', @rc.map_clear("abc"))
|
442
|
+
send_cmd("localhost_11211", "writebehind_rotate roma")
|
443
|
+
|
444
|
+
res = [
|
445
|
+
[1, {"mapkey1"=>"value1"}],
|
446
|
+
[11, {"mapkey1"=>"value1"}], [1, {"mapkey1"=>"value1", "mapkey2"=>"value2"}],
|
447
|
+
[12, {"mapkey1"=>"value1", "mapkey2"=>"value2"}], [2, {"mapkey2"=>"value2"}],
|
448
|
+
[11, {"mapkey2"=>"value2"}], [1, {"mapkey2"=>"value2", "mapkey1"=>"value1"}],
|
449
|
+
[13, {"mapkey2"=>"value2", "mapkey1"=>"value1"}], [3, {}]
|
450
|
+
|
451
|
+
]
|
452
|
+
wb0 = read_wb("#{wb_path}/0.wb")
|
453
|
+
assert_equal(res.length, wb0.length)
|
454
|
+
cnt = 0
|
455
|
+
wb0.each do |last, cmd, key, val|
|
456
|
+
begin
|
457
|
+
val = Marshal.load(val)
|
458
|
+
rescue
|
459
|
+
end
|
460
|
+
#puts "#{cmd} #{key} #{val.inspect}"
|
461
|
+
assert_equal(res[cnt][0], cmd)
|
462
|
+
assert_equal(res[cnt][1], val)
|
463
|
+
cnt += 1
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
352
467
|
def send_cmd(host, cmd)
|
353
468
|
con = Roma::Messaging::ConPool.instance.get_connection(host)
|
354
469
|
con.write("#{cmd}\r\n")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Junji Torii
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: ruby/server/bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
@@ -29,27 +29,27 @@ description: |2
|
|
29
29
|
ROMA server
|
30
30
|
email:
|
31
31
|
executables:
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
- romad
|
37
|
-
- recoverlost_alist
|
32
|
+
- tribunus
|
33
|
+
- cpdb
|
34
|
+
- recoverlost_alist_all
|
35
|
+
- log_merger
|
38
36
|
- ssroute
|
37
|
+
- safecopy_test
|
39
38
|
- mkconfig
|
40
|
-
-
|
39
|
+
- safecopy_integration_test
|
40
|
+
- simple_bench
|
41
41
|
- mkrecent
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
45
|
-
- safecopy_test
|
46
|
-
- test-scenario
|
47
|
-
- recoverlost_alist_keys
|
42
|
+
- recoverlost
|
43
|
+
- mkroute
|
44
|
+
- recoverlost_alist
|
48
45
|
- key_access
|
49
|
-
-
|
50
|
-
- cpdb
|
46
|
+
- key_list
|
51
47
|
- multi_commander
|
52
|
-
-
|
48
|
+
- roma_watcher
|
49
|
+
- recoverlost_alist_keys
|
50
|
+
- chg_redundancy
|
51
|
+
- test-scenario
|
52
|
+
- romad
|
53
53
|
extensions: []
|
54
54
|
extra_rdoc_files:
|
55
55
|
- README
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- ruby/server/lib/roma/plugin/plugin_alist.rb
|
104
104
|
- ruby/server/lib/roma/plugin/plugin_cmd_aliases.rb
|
105
105
|
- ruby/server/lib/roma/plugin/plugin_debug.rb
|
106
|
+
- ruby/server/lib/roma/plugin/plugin_gui.rb
|
106
107
|
- ruby/server/lib/roma/plugin/plugin_map.rb
|
107
108
|
- ruby/server/lib/roma/plugin/plugin_mapcount.rb
|
108
109
|
- ruby/server/lib/roma/plugin/plugin_storage.rb
|