}
}
public void memberRemoved(final MemberImpl member) {
updateMemberGroupsSize();
final Address deadAddress = member.getAddress();
final Address thisAddress = node.getThisAddress();
if (deadAddress == null || deadAddress.equals(thisAddress)) {
return;
}
lock.lock();
try {
migrationQueue.clear();
if (!activeMigrations.isEmpty()) {
if (node.isMaster()) {
rollbackActiveMigrationsFromPreviousMaster(node.getLocalMember().getUuid());
}
for (MigrationInfo migrationInfo : activeMigrations.values()) {
if (deadAddress.equals(migrationInfo.getSource()) || deadAddress.equals(migrationInfo.getDestination())) {
migrationInfo.invalidate();
}
}
}
// Pause migration and let all other members notice the dead member
// and fix their own partitions.
// Otherwise new master may take action fast and send new partition state
// before other members realize the dead one.
pauseMigration();
for (InternalPartitionImpl partition : partitions) {
boolean promote = false;
if (deadAddress.equals(partition.getOwner()) && thisAddress.equals(partition.getReplicaAddress(1))) {
promote = true;
partition.setMigrating(true);
}
// shift partition table up.
partition.onDeadAddress(deadAddress);