mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +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
0e56a09f70
commit
429ac6219b
2 changed files with 9 additions and 2 deletions
|
@ -327,7 +327,6 @@ bool ClusterConfig::IsMySlot(std::string_view key) const {
|
|||
|
||||
ClusterNodeInfo ClusterConfig::GetMasterNodeForSlot(SlotId id) const {
|
||||
CHECK_LE(id, kMaxSlotNum) << "Requesting a non-existing slot id " << id;
|
||||
|
||||
for (const auto& shard : config_) {
|
||||
if (shard.slot_ranges.Contains(id)) {
|
||||
if (shard.master.id == my_id_) {
|
||||
|
@ -335,7 +334,11 @@ ClusterNodeInfo ClusterConfig::GetMasterNodeForSlot(SlotId id) const {
|
|||
// migrated
|
||||
for (const auto& m : shard.migrations) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2702,6 +2702,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[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].slots = []
|
||||
nodes[1].slots = [(0, 16383)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue