mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 02:15:45 +02:00
fix(cluster) : moved error port number on migration finish (#4776)
Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
753c25e37c
commit
d75cfe8c9f
2 changed files with 9 additions and 2 deletions
|
@ -351,7 +351,6 @@ bool ClusterConfig::IsMySlot(std::string_view key) const {
|
||||||
|
|
||||||
ClusterNodeInfo ClusterConfig::GetMasterNodeForSlot(SlotId id) const {
|
ClusterNodeInfo ClusterConfig::GetMasterNodeForSlot(SlotId id) const {
|
||||||
CHECK_LE(id, kMaxSlotNum) << "Requesting a non-existing slot id " << id;
|
CHECK_LE(id, kMaxSlotNum) << "Requesting a non-existing slot id " << id;
|
||||||
|
|
||||||
for (const auto& shard : config_) {
|
for (const auto& shard : config_) {
|
||||||
if (shard.slot_ranges.Contains(id)) {
|
if (shard.slot_ranges.Contains(id)) {
|
||||||
if (shard.master.id == my_id_) {
|
if (shard.master.id == my_id_) {
|
||||||
|
@ -359,7 +358,11 @@ ClusterNodeInfo ClusterConfig::GetMasterNodeForSlot(SlotId id) const {
|
||||||
// migrated
|
// migrated
|
||||||
for (const auto& m : shard.migrations) {
|
for (const auto& m : shard.migrations) {
|
||||||
if (m.slot_ranges.Contains(id)) {
|
if (m.slot_ranges.Contains(id)) {
|
||||||
return m.node_info;
|
for (const auto& shard : config_) {
|
||||||
|
if (shard.master.id == m.node_info.id) {
|
||||||
|
return shard.master;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2753,6 +2753,10 @@ async def test_migration_timeout_on_sync(df_factory: DflyInstanceFactory, df_see
|
||||||
await wait_for_status(nodes[0].admin_client, nodes[1].id, "FINISHED", 300)
|
await wait_for_status(nodes[0].admin_client, nodes[1].id, "FINISHED", 300)
|
||||||
await wait_for_status(nodes[1].admin_client, nodes[0].id, "FINISHED")
|
await wait_for_status(nodes[1].admin_client, nodes[0].id, "FINISHED")
|
||||||
|
|
||||||
|
with pytest.raises(aioredis.ResponseError) as e_info:
|
||||||
|
await nodes[0].client.get("x")
|
||||||
|
assert f"MOVED 16287 127.0.0.1:{instances[1].port}" == str(e_info.value)
|
||||||
|
|
||||||
nodes[0].migrations = []
|
nodes[0].migrations = []
|
||||||
nodes[0].slots = []
|
nodes[0].slots = []
|
||||||
nodes[1].slots = [(0, 16383)]
|
nodes[1].slots = [(0, 16383)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue