private static InternalReplication GetNode(string databaseName, ClusterTopology clusterTopology, string rehab, string mentor, out PromotableTask promotableTask) { var url = clusterTopology.GetUrlFromTag(rehab); var node = new InternalReplication { Database = databaseName, NodeTag = rehab, Url = url }; promotableTask = new PromotableTask(rehab, url, databaseName, mentor); return(node); }
private bool TryGetMentorNode(string dbName, DatabaseTopology topology, ClusterTopology clusterTopology, string promotable, out string mentorNode) { var url = clusterTopology.GetUrlFromTag(promotable); var task = new PromotableTask(promotable, url, dbName); mentorNode = topology.WhoseTaskIsIt(task, _server.IsPassive()); if (mentorNode == null) { // We are in passive mode and were kicked out of the cluster. return(false); } return(true); }
private bool TryGetMentorNode(string dbName, DatabaseTopology topology, ClusterTopology clusterTopology, string promotable, out string mentorNode) { var url = clusterTopology.GetUrlFromTag(promotable); topology.PredefinedMentors.TryGetValue(promotable, out var mentor); var task = new PromotableTask(promotable, url, dbName, mentor); mentorNode = topology.WhoseTaskIsIt(_server.Engine.CurrentState, task, null); if (mentorNode == null) { // We are in passive mode and were kicked out of the cluster. return(false); } return(true); }