示例#1
0
        // Token: 0x06000447 RID: 1095 RVA: 0x00016BD0 File Offset: 0x00014DD0
        protected override T GetDebugOptionInternal <T>(string serverName, string propertyName, T defaultValue, out bool doesValueExist)
        {
            doesValueExist = false;
            T result = defaultValue;

            try
            {
                if (serverName == null)
                {
                    result = this.m_dbgOptionHandle.GetValue(propertyName, defaultValue, null);
                }
                else
                {
                    using (IDistributedStoreKey distributedStoreKey = this.m_dbgOptionHandle.OpenKey(serverName, DxStoreKeyAccessMode.Read, true, null))
                    {
                        if (distributedStoreKey != null)
                        {
                            result = distributedStoreKey.GetValue(propertyName, defaultValue, null);
                        }
                    }
                }
            }
            catch (ClusterException ex)
            {
                AmTrace.Debug("Ignoring cluster exception while trying to get debug option (serverName={0}, propertyName={1}, exception={2})", new object[]
                {
                    serverName,
                    propertyName,
                    ex
                });
            }
            return(result);
        }
示例#2
0
        // Token: 0x06001BDD RID: 7133 RVA: 0x000787A8 File Offset: 0x000769A8
        private void PopulateBatch(IDistributedStoreKey stateHandle, IDistributedStoreBatchRequest batchHandle, Dictionary <string, string> clusdbUpdates)
        {
            string propertyValue = ExDateTime.UtcNow.ToString("s");

            foreach (string text in clusdbUpdates.Keys)
            {
                bool   flag  = false;
                long   num   = 0L;
                long   num2  = 0L;
                bool   flag2 = false;
                string text2 = clusdbUpdates[text];
                string value = stateHandle.GetValue(text, null, out flag, null);
                if (flag)
                {
                    flag2 = true;
                }
                if (text2 != null && (!flag || !long.TryParse(text2, out num) || !long.TryParse(value, out num2) || num > num2))
                {
                    ClusterBatchWriter.Tracer.TraceError <string, long, long>(0L, "ClusterBatchWriter prepping update for db {0} from {1} to {2}", text, num2, num);
                    batchHandle.SetValue(text, text2, RegistryValueKind.Unknown);
                    flag2 = true;
                }
                if (flag2)
                {
                    string propertyName = AmDbState.ConstructLastLogTimeStampProperty(text);
                    batchHandle.SetValue(propertyName, propertyValue, RegistryValueKind.Unknown);
                }
            }
            batchHandle.SetValue(AmServerName.LocalComputerName.NetbiosName, propertyValue, RegistryValueKind.Unknown);
        }
示例#3
0
        internal T GetDxStorePrivateProperty <T>(string propertyName, T defaultValue)
        {
            T value;

            using (IDistributedStoreKey baseKey = DistributedStore.Instance.DxStoreKeyFactoryInstance.GetBaseKey(DxStoreKeyAccessMode.Read, null, null, true))
            {
                value = baseKey.GetValue(propertyName, defaultValue, null);
            }
            return(value);
        }
示例#4
0
        public static T GetValue <T>(this IDistributedStoreKey key, string propertyName, T defaultValue, out bool isValueExist, ReadWriteConstraints constriants = null)
        {
            RegistryValueKind registryValueKind;
            object            value = key.GetValue(propertyName, out isValueExist, out registryValueKind, constriants);

            if (isValueExist)
            {
                return((T)((object)value));
            }
            return(defaultValue);
        }
        // Token: 0x06000756 RID: 1878 RVA: 0x00023E94 File Offset: 0x00022094
        private void DeleteTimeStampsInternal(AmClusterHandle clusterHandle)
        {
            using (IDistributedStoreKey clusterKey = DistributedStore.Instance.GetClusterKey(clusterHandle, null, null, DxStoreKeyAccessMode.Write, false))
            {
                using (IDistributedStoreKey distributedStoreKey = clusterKey.OpenKey("ExchangeActiveManager", DxStoreKeyAccessMode.Write, true, null))
                {
                    if (distributedStoreKey != null)
                    {
                        using (IDistributedStoreKey distributedStoreKey2 = distributedStoreKey.OpenKey("LastLog", DxStoreKeyAccessMode.Write, true, null))
                        {
                            if (distributedStoreKey2 != null)
                            {
                                using (IDistributedStoreBatchRequest distributedStoreBatchRequest = distributedStoreKey2.CreateBatchUpdateRequest())
                                {
                                    foreach (Database database in this.m_databases)
                                    {
                                        string name         = database.Name;
                                        string text         = database.Guid.ToString();
                                        string propertyName = AmDbState.ConstructLastLogTimeStampProperty(text);
                                        string value        = distributedStoreKey2.GetValue(propertyName, null, null);
                                        if (value != null)
                                        {
                                            ClusterBatchLastLogGenDeleter.Tracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "LastLogGeneration time stamp for database [{0} ({1})] found with value '{2}'.", name, text, value);
                                            this.m_logger.AppendLogMessage("Deleting LastLogGeneration time stamp from cluster registry for database [{0} ({1})] with existing value: '{2}'.", new object[]
                                            {
                                                name,
                                                text,
                                                value
                                            });
                                            distributedStoreBatchRequest.DeleteValue(propertyName);
                                        }
                                        else
                                        {
                                            ClusterBatchLastLogGenDeleter.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "LastLogGeneration time stamp for database [{0} ({1})] does not exist.", name, text);
                                        }
                                    }
                                    distributedStoreBatchRequest.Execute(null);
                                    goto IL_151;
                                }
                            }
                            ClusterBatchLastLogGenDeleter.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "ActiveManager LastLog key '{0}\\{1}' does not exist in the cluster registry. Skipping deletion.", "ExchangeActiveManager", "LastLog");
IL_151:
                            goto IL_178;
                        }
                    }
                    ClusterBatchLastLogGenDeleter.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ActiveManager root key '{0}' does not exist in the cluster registry. Skipping deletion.", "ExchangeActiveManager");
                    IL_178 :;
                }
            }
        }
示例#6
0
        public T GetValue <T>(string keyName, string valueName, T defaultValue)
        {
            T result;

            try
            {
                using (IDistributedStoreKey distributedStoreKey = this.OpenRegKey(keyName, false, false))
                {
                    result = distributedStoreKey.GetValue(valueName, defaultValue, null);
                }
            }
            catch (ClusterApiException)
            {
                result = defaultValue;
            }
            return(result);
        }
示例#7
0
        public static T GetValue <T>(this IDistributedStoreKey key, string propertyName, T defaultValue = default(T), ReadWriteConstraints constraints = null)
        {
            bool flag;

            return(key.GetValue(propertyName, defaultValue, out flag, constraints));
        }
        // Token: 0x06000543 RID: 1347 RVA: 0x00013D3C File Offset: 0x00011F3C
        private XElement GetXElementSnapshotInternal(string keyName)
        {
            bool   flag  = false;
            bool   flag2 = true;
            string keyName2;
            string value;

            if (!string.IsNullOrEmpty(keyName))
            {
                keyName2 = Utils.CombinePathNullSafe(this.rootKeyName, keyName);
                value    = keyName.Substring(keyName.LastIndexOf('\\') + 1);
            }
            else
            {
                keyName2 = this.rootKeyName;
                value    = "\\";
                flag     = true;
                if (this.filterRootKeys.Length > 1)
                {
                    flag2 = false;
                }
            }
            XElement xelement  = new XElement("Key", new XAttribute("Name", value));
            XElement xelement2 = xelement;

            if (this.IsProduceDxStoreFormat && flag)
            {
                xelement.Add(new XElement("Key", new XAttribute("Name", "Private")));
                XElement xelement3 = new XElement("Key", new XAttribute("Name", "Public"));
                xelement.Add(xelement3);
                xelement2 = xelement3;
            }
            IDistributedStoreKey distributedStoreKey = flag ? this.baseKey : this.baseKey.OpenKey(keyName2, DxStoreKeyAccessMode.Read, false, null);

            try
            {
                if (flag2 || this.isForceIncludeRootProperties)
                {
                    foreach (string propertyName in distributedStoreKey.GetValueNames(null))
                    {
                        bool flag3;
                        RegistryValueKind kind;
                        object            value2 = distributedStoreKey.GetValue(propertyName, out flag3, out kind, null);
                        if (value2 != null && flag3)
                        {
                            PropertyValue propertyValue = new PropertyValue(value2, kind);
                            xelement2.Add(propertyValue.ToXElement(propertyName));
                        }
                    }
                }
                IEnumerable <string> subkeyNames = distributedStoreKey.GetSubkeyNames(null);
                if (subkeyNames != null)
                {
                    foreach (string path in subkeyNames)
                    {
                        string keyName3 = Utils.CombinePathNullSafe(keyName ?? string.Empty, path);
                        if (!flag || this.IsIncludeKey(keyName3))
                        {
                            XElement xelementSnapshotInternal = this.GetXElementSnapshotInternal(keyName3);
                            xelement2.Add(xelementSnapshotInternal);
                        }
                    }
                }
            }
            finally
            {
                if (distributedStoreKey != null && !flag)
                {
                    distributedStoreKey.Dispose();
                }
            }
            return(xelement);
        }