示例#1
0
        // Token: 0x060006F6 RID: 1782 RVA: 0x000216FC File Offset: 0x0001F8FC
        private Dictionary <AmServerName, RpcDatabaseCopyStatus2> GetStatusTable(out Dictionary <AmServerName, RpcHealthStateInfo[]> healthTable)
        {
            Dictionary <AmServerName, CopyStatusClientCachedEntry> cachedEntryTable = null;
            List <AmServerName> serversToContact = this.m_statusFetcher.ServersToContact;

            healthTable = null;
            Dictionary <Guid, Dictionary <AmServerName, CopyStatusClientCachedEntry> > status = this.m_statusFetcher.GetStatus(out healthTable);
            Dictionary <AmServerName, RpcDatabaseCopyStatus2> dictionary;

            if (status.TryGetValue(this.m_bcsContext.DatabaseGuid, out cachedEntryTable))
            {
                Dictionary <AmServerName, Exception> rpcErrorTable = null;
                rpcErrorTable = (from server in serversToContact
                                 let possibleEx = this.m_statusFetcher.GetPossibleExceptionForServer(server)
                                                  where possibleEx != null
                                                  select new KeyValuePair <AmServerName, Exception>(server, possibleEx)).ToDictionary((KeyValuePair <AmServerName, Exception> kvp) => kvp.Key, (KeyValuePair <AmServerName, Exception> kvp) => kvp.Value);
                IEnumerable <KeyValuePair <AmServerName, Exception> > second = from kvp in cachedEntryTable
                                                                               where !rpcErrorTable.ContainsKey(kvp.Key) && kvp.Value != null && kvp.Value.CopyStatus == null
                                                                               select new KeyValuePair <AmServerName, Exception>(kvp.Key, kvp.Value.LastException);
                IEnumerable <KeyValuePair <AmServerName, Exception> > rpcErrors = rpcErrorTable.Concat(second);
                AmBestCopySelection.ReportRpcErrors(rpcErrors, this.m_bcsContext);
                IEnumerable <CopyStatusClientCachedEntry> source = from server in serversToContact
                                                                   let possibleEx = this.m_statusFetcher.GetPossibleExceptionForServer(server)
                                                                                    where possibleEx == null && cachedEntryTable.ContainsKey(server) && cachedEntryTable[server].CopyStatus != null
                                                                                    select cachedEntryTable[server];
                dictionary = source.ToDictionary((CopyStatusClientCachedEntry entry) => entry.ServerContacted, (CopyStatusClientCachedEntry entry) => entry.CopyStatus);
            }
            else
            {
                dictionary = new Dictionary <AmServerName, RpcDatabaseCopyStatus2>();
            }
            if (dictionary.Count == 0)
            {
                ReplayCrimsonEvents.BcsDbNodeCopyStatusRpcFailed.Log <string, Guid>(this.m_bcsContext.GetDatabaseNameOrGuid(), this.m_bcsContext.DatabaseGuid);
            }
            return(dictionary);
        }
        // Token: 0x0600072B RID: 1835 RVA: 0x00023324 File Offset: 0x00021524
        private void ConstructBcsStatusTable(List <AmServerName> serversToContact)
        {
            Dictionary <AmServerName, RpcHealthStateInfo[]>        stateInfoMap     = null;
            Dictionary <AmServerName, CopyStatusClientCachedEntry> cachedEntryTable = null;

            this.m_statusFetcher = new AmMultiNodeCopyStatusFetcher(serversToContact, new Guid[]
            {
                this.m_bcsContext.DatabaseGuid
            }, null, RpcGetDatabaseCopyStatusFlags2.ReadThrough, null, true);
            Dictionary <Guid, Dictionary <AmServerName, CopyStatusClientCachedEntry> > status = this.m_statusFetcher.GetStatus(out stateInfoMap);
            Dictionary <AmServerName, RpcDatabaseCopyStatus2> statusTable;

            if (status.TryGetValue(this.m_bcsContext.DatabaseGuid, out cachedEntryTable))
            {
                Dictionary <AmServerName, Exception> rpcErrorTable = null;
                rpcErrorTable = (from server in serversToContact
                                 let possibleEx = this.m_statusFetcher.GetPossibleExceptionForServer(server)
                                                  where possibleEx != null
                                                  select new KeyValuePair <AmServerName, Exception>(server, possibleEx)).ToDictionary((KeyValuePair <AmServerName, Exception> kvp) => kvp.Key, (KeyValuePair <AmServerName, Exception> kvp) => kvp.Value);
                IEnumerable <KeyValuePair <AmServerName, Exception> > second = from kvp in cachedEntryTable
                                                                               where !rpcErrorTable.ContainsKey(kvp.Key) && kvp.Value != null && kvp.Value.CopyStatus == null
                                                                               select new KeyValuePair <AmServerName, Exception>(kvp.Key, kvp.Value.LastException);
                IEnumerable <KeyValuePair <AmServerName, Exception> > rpcErrors = rpcErrorTable.Concat(second);
                AmBestCopySelection.ReportRpcErrors(rpcErrors, this.m_bcsContext);
                IEnumerable <CopyStatusClientCachedEntry> source = from server in serversToContact
                                                                   let possibleEx = this.m_statusFetcher.GetPossibleExceptionForServer(server)
                                                                                    where possibleEx == null && cachedEntryTable.ContainsKey(server) && cachedEntryTable[server].CopyStatus != null
                                                                                    select cachedEntryTable[server];
                statusTable = source.ToDictionary((CopyStatusClientCachedEntry entry) => entry.ServerContacted, (CopyStatusClientCachedEntry entry) => entry.CopyStatus);
            }
            else
            {
                statusTable = new Dictionary <AmServerName, RpcDatabaseCopyStatus2>();
            }
            this.m_bcsContext.StatusTable           = statusTable;
            this.m_bcsContext.ComponentStateWrapper = new ComponentStateWrapper(this.m_bcsContext.Database.Name, this.m_bcsContext.InitiatingComponent, this.m_bcsContext.SourceServerName, this.m_bcsContext.ActionCode, stateInfoMap);
        }