-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: return to fullmesh topology
Fullmesh was disabled by #66 because of its too raw implementation in Tarantool. Now it is ripe enough to be granted a second chance. Fullmesh provides a benefit of a constant complete sync. If a tuple is written on a master right before its demotion, a new master still will receive the tuple from the old one. Closes #83
- Loading branch information
Showing
9 changed files
with
158 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
test_run = require('test_run').new() | ||
--- | ||
... | ||
REPLICASET_1 = { 'storage_1_a', 'storage_1_b' } | ||
--- | ||
... | ||
REPLICASET_2 = { 'storage_2_a', 'storage_2_b' } | ||
--- | ||
... | ||
test_run:create_cluster(REPLICASET_1, 'misc') | ||
--- | ||
... | ||
test_run:create_cluster(REPLICASET_2, 'misc') | ||
--- | ||
... | ||
util = require('util') | ||
--- | ||
... | ||
test_run:wait_fullmesh(REPLICASET_1) | ||
--- | ||
... | ||
test_run:wait_fullmesh(REPLICASET_2) | ||
--- | ||
... | ||
util.map_evals(test_run, {REPLICASET_1, REPLICASET_2}, 'bootstrap_storage(\'memtx\')') | ||
--- | ||
... | ||
-- | ||
-- gh-83: use fullmesh topology in vshard. Scenario of the test: | ||
-- start writing a tuple on a master. Then switch master. After | ||
-- switch the tuple still should be sent from the slave to a new | ||
-- master. | ||
-- | ||
_ = test_run:switch('storage_1_a') | ||
--- | ||
... | ||
-- Block new requests sending. | ||
box.error.injection.set("ERRINJ_WAL_DELAY", true) | ||
--- | ||
- ok | ||
... | ||
f = fiber.create(function() box.space.test:replace{1, 1} end) | ||
--- | ||
... | ||
box.space.test:select{} | ||
--- | ||
- - [1, 1] | ||
... | ||
cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_b].master = true | ||
--- | ||
... | ||
cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_a].master = false | ||
--- | ||
... | ||
vshard.storage.cfg(cfg, util.name_to_uuid.storage_1_a) | ||
--- | ||
... | ||
_ = test_run:switch('storage_1_b') | ||
--- | ||
... | ||
cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_b].master = true | ||
--- | ||
... | ||
cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_a].master = false | ||
--- | ||
... | ||
vshard.storage.cfg(cfg, util.name_to_uuid.storage_1_b) | ||
--- | ||
... | ||
box.space.test:select{} | ||
--- | ||
- [] | ||
... | ||
_ = test_run:switch('storage_1_a') | ||
--- | ||
... | ||
box.error.injection.set("ERRINJ_WAL_DELAY", false) | ||
--- | ||
- ok | ||
... | ||
_ = test_run:switch('storage_1_b') | ||
--- | ||
... | ||
while box.space.test:count() == 0 do fiber.sleep(0.1) end | ||
--- | ||
... | ||
box.space.test:select{} | ||
--- | ||
- - [1, 1] | ||
... | ||
_ = test_run:cmd("switch default") | ||
--- | ||
... | ||
test_run:drop_cluster(REPLICASET_2) | ||
--- | ||
... | ||
test_run:drop_cluster(REPLICASET_1) | ||
--- | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
test_run = require('test_run').new() | ||
REPLICASET_1 = { 'storage_1_a', 'storage_1_b' } | ||
REPLICASET_2 = { 'storage_2_a', 'storage_2_b' } | ||
test_run:create_cluster(REPLICASET_1, 'misc') | ||
test_run:create_cluster(REPLICASET_2, 'misc') | ||
util = require('util') | ||
test_run:wait_fullmesh(REPLICASET_1) | ||
test_run:wait_fullmesh(REPLICASET_2) | ||
util.map_evals(test_run, {REPLICASET_1, REPLICASET_2}, 'bootstrap_storage(\'memtx\')') | ||
|
||
-- | ||
-- gh-83: use fullmesh topology in vshard. Scenario of the test: | ||
-- start writing a tuple on a master. Then switch master. After | ||
-- switch the tuple still should be sent from the slave to a new | ||
-- master. | ||
-- | ||
|
||
_ = test_run:switch('storage_1_a') | ||
-- Block new requests sending. | ||
box.error.injection.set("ERRINJ_WAL_DELAY", true) | ||
f = fiber.create(function() box.space.test:replace{1, 1} end) | ||
box.space.test:select{} | ||
cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_b].master = true | ||
cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_a].master = false | ||
vshard.storage.cfg(cfg, util.name_to_uuid.storage_1_a) | ||
_ = test_run:switch('storage_1_b') | ||
cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_b].master = true | ||
cfg.sharding[util.replicasets[1]].replicas[util.name_to_uuid.storage_1_a].master = false | ||
vshard.storage.cfg(cfg, util.name_to_uuid.storage_1_b) | ||
box.space.test:select{} | ||
_ = test_run:switch('storage_1_a') | ||
box.error.injection.set("ERRINJ_WAL_DELAY", false) | ||
_ = test_run:switch('storage_1_b') | ||
while box.space.test:count() == 0 do fiber.sleep(0.1) end | ||
box.space.test:select{} | ||
|
||
_ = test_run:cmd("switch default") | ||
test_run:drop_cluster(REPLICASET_2) | ||
test_run:drop_cluster(REPLICASET_1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -275,7 +275,7 @@ uris | |
... | ||
box.cfg.replication | ||
--- | ||
- [] | ||
- - storage:[email protected]:3301 | ||
... | ||
_ = test_run:switch('storage_2_a') | ||
--- | ||
|
@@ -300,7 +300,8 @@ uris | |
... | ||
box.cfg.replication | ||
--- | ||
- - storage:[email protected]:3304 | ||
- - storage:[email protected]:3303 | ||
- storage:[email protected]:3304 | ||
... | ||
_ = test_run:switch('storage_2_b') | ||
--- | ||
|
@@ -325,7 +326,8 @@ uris | |
... | ||
box.cfg.replication | ||
--- | ||
- [] | ||
- - storage:[email protected]:3303 | ||
- storage:[email protected]:3304 | ||
... | ||
_ = test_run:switch('storage_3_a') | ||
--- | ||
|
@@ -350,7 +352,7 @@ uris | |
... | ||
box.cfg.replication | ||
--- | ||
- [] | ||
- - storage:[email protected]:3306 | ||
... | ||
_ = test_run:switch('router_1') | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters