private bool TryNotifyServerAboutCrashedServer(string partitionName, string serverId, string crashedServerId) { Console.WriteLine(">>> Notifying Server=" + serverId + " about CrashedServer=" + crashedServerId); try { reattachServer(serverId); NotifyCrashReply notifyCrashReply = client.NotifyCrash(new NotifyCrashRequest { PartitionId = partitionName, CrashedMasterServerId = crashedServerId }); Console.WriteLine(">>> Got Reply from ServerId=" + serverId); Console.WriteLine(">>> New Partition Master: PartitionName=" + partitionName + "PartitionMasterId=" + notifyCrashReply.MasterId); string masterId = notifyCrashReply.MasterId; PartitionMapping.SetPartitionMaster(partitionName, masterId); if (serverId != masterId) { Console.WriteLine(">>> Reataching to new master. MasterId=" + masterId); reattachServer(masterId); } else { Console.WriteLine(">>> Already Attached to new master. MasterId=" + masterId); } return(true); } catch { Console.WriteLine(">>> No Reply..."); return(false); } }
public void setNewPartitionMaster(string partition_id, string new_master_id) { // removeing partition master means deleting the old one and assigning the new one as a master PartitionMapping.RemovePartitionMaster(partition_id); PartitionMapping.SetPartitionMaster(partition_id, new_master_id); }