Exemple #1
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);
        }
        // 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 :;
                }
            }
        }