Skip to content

Commit

Permalink
Update test-run
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerold103 committed Aug 15, 2018
1 parent 9f82b42 commit 9b92846
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 10 deletions.
12 changes: 12 additions & 0 deletions test/misc/check_uuid_on_connect.result
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ test_run:cmd('start server bad_uuid_2_a_repaired')
---
- true
...
test_run:cmd('create server bad_uuid_2_b with script="misc/bad_uuid_2_b.lua", wait=False, wait_load=False')
---
- true
...
test_run:cmd('start server bad_uuid_2_b')
---
- true
Expand Down Expand Up @@ -140,10 +144,18 @@ test_run:drop_cluster(REPLICASET_2)
REPLICASET_2 = { 'bad_uuid_2_a', 'bad_uuid_2_b' }
---
...
test_run:cmd('create server bad_uuid_2_a with script="misc/bad_uuid_2_a.lua", wait=False, wait_load=False')
---
- true
...
test_run:cmd('start server bad_uuid_2_a with wait=False, wait_load=False')
---
- true
...
test_run:cmd('create server bad_uuid_2_b with script="misc/bad_uuid_2_b.lua", wait=False, wait_load=False')
---
- true
...
test_run:cmd('start server bad_uuid_2_b with wait=False, wait_load=False')
---
- true
Expand Down
3 changes: 3 additions & 0 deletions test/misc/check_uuid_on_connect.test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ test_run:drop_cluster(REPLICASET_2)
REPLICASET_2 = { 'bad_uuid_2_a_repaired', 'bad_uuid_2_b' }
test_run:cmd('create server bad_uuid_2_a_repaired with script="misc/bad_uuid_2_a_repaired.lua", wait=False, wait_load=False')
test_run:cmd('start server bad_uuid_2_a_repaired')
test_run:cmd('create server bad_uuid_2_b with script="misc/bad_uuid_2_b.lua", wait=False, wait_load=False')
test_run:cmd('start server bad_uuid_2_b')
util.wait_master(test_run, REPLICASET_2, 'bad_uuid_2_a_repaired')

Expand All @@ -55,7 +56,9 @@ require('log').info(string.rep('a', 1000))
test_run:cmd("switch default")
test_run:drop_cluster(REPLICASET_2)
REPLICASET_2 = { 'bad_uuid_2_a', 'bad_uuid_2_b' }
test_run:cmd('create server bad_uuid_2_a with script="misc/bad_uuid_2_a.lua", wait=False, wait_load=False')
test_run:cmd('start server bad_uuid_2_a with wait=False, wait_load=False')
test_run:cmd('create server bad_uuid_2_b with script="misc/bad_uuid_2_b.lua", wait=False, wait_load=False')
test_run:cmd('start server bad_uuid_2_b with wait=False, wait_load=False')
util.wait_master(test_run, REPLICASET_2, 'bad_uuid_2_a')

Expand Down
5 changes: 4 additions & 1 deletion test/rebalancer/rebalancer_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ local function do_read_load()
vshard.router.call(bucket, 'read', 'do_select',
{{read_iterations}},
{timeout = 100})
assert(tuples)
if not tuples then
log.info('Error during read loading: %s', err)
tuples = {}
end
end
assert(tuples[1][1] == read_iterations)
assert(tuples[1][2] == bucket)
Expand Down
4 changes: 2 additions & 2 deletions test/rebalancer/receiving_bucket.result
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ box.space.test3:count()
---
- 10000
...
vshard.storage.bucket_send(1, util.replicasets[2])
vshard.storage.bucket_send(1, util.replicasets[2], {timeout = 10})
---
- true
...
Expand Down Expand Up @@ -138,7 +138,7 @@ vshard.storage.internal.errinj.ERRINJ_RECEIVE_PARTIALLY = true
_ = test_run:switch('box_2_a')
---
...
vshard.storage.bucket_send(1, util.replicasets[1])
vshard.storage.bucket_send(1, util.replicasets[1], {timeout = 10})
---
- null
- type: ClientError
Expand Down
4 changes: 2 additions & 2 deletions test/rebalancer/receiving_bucket.test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ box.space.test:count()
box.space.test2:count()
box.space.test3:count()

vshard.storage.bucket_send(1, util.replicasets[2])
vshard.storage.bucket_send(1, util.replicasets[2], {timeout = 10})
box.space._bucket:get{1}

_ = test_run:switch('box_2_a')
Expand All @@ -56,7 +56,7 @@ _ = test_run:switch('box_1_a')
while box.space._bucket:get{1} do fiber.sleep(0.01) end
vshard.storage.internal.errinj.ERRINJ_RECEIVE_PARTIALLY = true
_ = test_run:switch('box_2_a')
vshard.storage.bucket_send(1, util.replicasets[1])
vshard.storage.bucket_send(1, util.replicasets[1], {timeout = 10})
box.space._bucket:get{1}
_ = test_run:switch('box_1_a')
box.space._bucket:get{1}
Expand Down
10 changes: 6 additions & 4 deletions vshard/storage/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ end
--
-- Send a bucket to other replicaset.
--
local function bucket_send_xc(bucket_id, destination)
local function bucket_send_xc(bucket_id, destination, opts)
local status, err = bucket_check_state(bucket_id, 'write')
if err then
return nil, err
Expand All @@ -809,7 +809,8 @@ local function bucket_send_xc(bucket_id, destination)
local data = bucket_collect_internal(bucket_id)
box.space._bucket:replace({bucket_id, consts.BUCKET.SENDING, destination})
status, err = replicaset:callrw('vshard.storage.bucket_recv',
{bucket_id, box.info.cluster.uuid, data})
{bucket_id, box.info.cluster.uuid, data},
opts)
if not status then
err = lerror.make(err)
if err.type == 'ShardingError' then
Expand All @@ -825,13 +826,14 @@ end
--
-- Exception and recovery safe version of bucket_send_xc.
--
local function bucket_send(bucket_id, destination)
local function bucket_send(bucket_id, destination, opts)
if type(bucket_id) ~= 'number' or type(destination) ~= 'string' then
error('Usage: bucket_send(bucket_id, destination)')
end
M.buckets_to_recovery[bucket_id] = true
M.rebalancer_transfering_buckets[bucket_id] = true
local status, ret, err = pcall(bucket_send_xc, bucket_id, destination)
local status, ret, err = pcall(bucket_send_xc, bucket_id, destination,
opts)
M.rebalancer_transfering_buckets[bucket_id] = nil
if status then
if ret then
Expand Down

0 comments on commit 9b92846

Please sign in to comment.