Ejemplo n.º 1
0
 public static void RemoveDatabaseRequestedSchemaVersion(IClusterDB iClusterDB, Guid databaseGuid)
 {
     using (IClusterDBWriteBatch clusterDBWriteBatch = iClusterDB.CreateWriteBatch("Exchange\\Databases"))
     {
         clusterDBWriteBatch.DeleteKey(databaseGuid.ToString());
         clusterDBWriteBatch.Execute();
     }
 }
Ejemplo n.º 2
0
 public static void RemoveServerSchemaVersionRange(IClusterDB iClusterDB, Guid serverGuid)
 {
     using (IClusterDBWriteBatch clusterDBWriteBatch = iClusterDB.CreateWriteBatch("Exchange\\Servers"))
     {
         clusterDBWriteBatch.DeleteKey(serverGuid.ToString());
         clusterDBWriteBatch.Execute();
     }
 }
Ejemplo n.º 3
0
        public static void WriteRequestedDatabaseSchemaVersion(IClusterDB iClusterDB, Guid databaseGuid, int requestedVersion)
        {
            string registryKey = string.Format("Exchange\\Databases\\{0}\\Schema", databaseGuid);

            using (IClusterDBWriteBatch clusterDBWriteBatch = iClusterDB.CreateWriteBatch(registryKey))
            {
                clusterDBWriteBatch.SetValue("Requested Version", requestedVersion);
                clusterDBWriteBatch.Execute();
            }
        }
Ejemplo n.º 4
0
        public static void WriteServerDatabaseSchemaVersionRange(IClusterDB iClusterDB, Guid serverGuid, int minVersion, int maxVersion)
        {
            string registryKey = string.Format("Exchange\\Servers\\{0}\\Schema", serverGuid);

            using (IClusterDBWriteBatch clusterDBWriteBatch = iClusterDB.CreateWriteBatch(registryKey))
            {
                clusterDBWriteBatch.SetValue("Minimum Version", minVersion);
                clusterDBWriteBatch.SetValue("Maximum Version", maxVersion);
                clusterDBWriteBatch.Execute();
            }
        }
        private int RemoveItemsFromClusdb(string objectName, IClusterDB clusdb, string keyName, bool isDeleteKey, IEnumerable <Guid> collection, Func <string, string> nameGenerator = null, int batchSize = 200)
        {
            if (!DistributedStore.Instance.IsKeyExist(keyName, null))
            {
                return(0);
            }
            int num  = 0;
            int num2 = 0;
            HashSet <string> hashSet = new HashSet <string>(collection.Select(delegate(Guid id)
            {
                string text2 = id.ToString();
                if (nameGenerator != null)
                {
                    return(nameGenerator(text2));
                }
                return(text2);
            }));

            num2 = hashSet.Count;
            try
            {
                if (isDeleteKey)
                {
                    IEnumerable <string> subKeyNames = clusdb.GetSubKeyNames(keyName);
                    hashSet.IntersectWith(subKeyNames);
                }
                else
                {
                    IEnumerable <string> other = from vi in clusdb.GetValueInfos(keyName)
                                                 select vi.Item1;
                    hashSet.IntersectWith(other);
                }
            }
            catch (Exception ex)
            {
                ReplayCrimsonEvents.ClusdbPeriodicCleanupFailed.Log <string, string>(objectName, ex.ToString());
                return(0);
            }
            if (hashSet.Count == 0)
            {
                return(0);
            }
            int       num3      = 0;
            int       num4      = 0;
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            foreach (IEnumerable <string> enumerable in hashSet.Batch(batchSize))
            {
                num++;
                int num5 = 0;
                try
                {
                    using (IClusterDBWriteBatch clusterDBWriteBatch = clusdb.CreateWriteBatch(keyName))
                    {
                        foreach (string text in enumerable)
                        {
                            num5++;
                            if (isDeleteKey)
                            {
                                clusterDBWriteBatch.DeleteKey(text);
                            }
                            else
                            {
                                clusterDBWriteBatch.DeleteValue(text);
                            }
                        }
                        clusterDBWriteBatch.Execute();
                        num3 += num5;
                    }
                }
                catch (Exception ex2)
                {
                    num4++;
                    ReplayCrimsonEvents.ClusdbCleanupBatchOperationFailed.Log <string, string, string, bool, int, int, int, int>(objectName, ex2.Message, keyName, isDeleteKey, num, num5, num2, hashSet.Count);
                }
            }
            long elapsedMilliseconds = stopwatch.ElapsedMilliseconds;

            ReplayCrimsonEvents.ClusdbPeriodicCleanupCompleted.Log <string, string, int, string, int, int, long>(objectName, keyName, num3, isDeleteKey ? "Key" : "Property", num, num4, elapsedMilliseconds);
            return(num3);
        }
Ejemplo n.º 6
0
 // Token: 0x060000B2 RID: 178 RVA: 0x00005148 File Offset: 0x00003348
 internal void Flush()
 {
     if (AmSystemManager.Instance.Config.IsPAM)
     {
         Dictionary <AmServerName, AmCachedLastLogUpdater.ServerRequestInfo> dictionary = this.Cleanup();
         if (dictionary.Count > 0)
         {
             Exception ex = null;
             try
             {
                 using (IClusterDB clusterDB = ClusterDB.Open())
                 {
                     if (clusterDB.IsInitialized)
                     {
                         using (IClusterDBWriteBatch clusterDBWriteBatch = clusterDB.CreateWriteBatch("ExchangeActiveManager\\LastLog"))
                         {
                             this.PopulateBatch(clusterDBWriteBatch, dictionary);
                             clusterDBWriteBatch.Execute();
                             ExDateTime now = ExDateTime.Now;
                             foreach (AmServerName key in dictionary.Keys)
                             {
                                 this.serverUpdateTimeMap[key] = now;
                             }
                             goto IL_BA;
                         }
                     }
                     ExTraceGlobals.ClusterTracer.TraceError((long)this.GetHashCode(), "Flush(): clusdb is not initialized");
                     IL_BA :;
                 }
             }
             catch (ADExternalException ex2)
             {
                 ex = ex2;
             }
             catch (ADOperationException ex3)
             {
                 ex = ex3;
             }
             catch (ADTransientException ex4)
             {
                 ex = ex4;
             }
             catch (ClusterException ex5)
             {
                 ex = ex5;
             }
             catch (AmServerException ex6)
             {
                 ex = ex6;
             }
             catch (AmServerTransientException ex7)
             {
                 ex = ex7;
             }
             if (ex != null)
             {
                 ReplayCrimsonEvents.CachedLastLogUpdateFailed.LogPeriodic <int, string>(AmServerName.LocalComputerName.NetbiosName, TimeSpan.FromMinutes(5.0), dictionary.Count, ex.Message);
             }
         }
     }
 }