Skip to content

Commit

Permalink
[merge-conflict]repair error caused by prev merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
忘禅 committed Nov 27, 2020
1 parent 28bdba2 commit 64e76ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package com.alipay.sofa.registry.common.model.slot;

import com.google.common.collect.Maps;

import java.io.Serializable;
import java.util.*;

Expand All @@ -36,6 +38,10 @@ public List<Slot> getSlots() {
return new ArrayList<>(slots.values());
}

public Map<Integer, Slot> getSlotMap() {
return Maps.newHashMap(slots);
}

public static Map<Integer, Slot> getSlotsAdded(SlotTable from, SlotTable to) {
Map<Integer, Slot> m = new TreeMap<>(to.slots);
from.slots.keySet().forEach(slotId -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void run() {

private SlotTable promoteFollowers(SlotTable slotTable, List<Integer> slotNums) {
long newSlotTableEpoch = slotTable.getEpoch();
Map<Integer, Slot> slotMap = Maps.newHashMap(slotTable.getSlots());
Map<Integer, Slot> slotMap = slotTable.getSlotMap();
for(Integer slotNum : slotNums) {
Slot slot = slotMap.get(slotNum);
// select one candidate from followers as new leader
Expand All @@ -83,7 +83,7 @@ private SlotTable promoteFollowers(SlotTable slotTable, List<Integer> slotNums)

private SlotTable reassignFollowers(SlotTable slotTable, List<Integer> slotNums) {
long newSlotTableEpoch = slotTable.getEpoch();
Map<Integer, Slot> slotMap = Maps.newHashMap(slotTable.getSlots());
Map<Integer, Slot> slotMap = slotTable.getSlotMap();
for(Integer slotNum : slotNums) {
Slot slot = slotMap.get(slotNum);
// select new follower from alive data servers
Expand Down

0 comments on commit 64e76ff

Please sign in to comment.