예제 #1
0
        // Token: 0x06000EDF RID: 3807 RVA: 0x0003F870 File Offset: 0x0003DA70
        internal static Dictionary <int, List <DatabaseGroupLayoutEntry> > GenerateCopyLayoutTable(DatabaseCopyLayoutEntry copyLayoutEntry, int serversPerDag, int databasesPerDag, int databaseDrivesPerServer, int databasesPerDrive, int copiesPerDatabase, int numberOfExtraCopiesOnSpares = 0)
        {
            CopyLayoutGenerator.Tracer.TraceDebug(0L, "CopyLayoutGenerator: GenerateCopyLayoutTable() ServersPerDag = {0}, DatabasesPerDag = {1}, databaseDrivesPerServer = {2}, DatabasesPerDrive = {3}, CopiesPerDatabase = {4}, numberOfExtraCopiesOnSpares = {5}", new object[]
            {
                serversPerDag,
                databasesPerDag,
                databaseDrivesPerServer,
                databasesPerDrive,
                copiesPerDatabase,
                numberOfExtraCopiesOnSpares
            });
            Dictionary <int, List <DatabaseGroupLayoutEntry> > dictionary = CopyLayoutGenerator.GenerateCopyLayoutWithEmptySpares(copyLayoutEntry, serversPerDag, databasesPerDag, databaseDrivesPerServer, databasesPerDrive, copiesPerDatabase);

            if (numberOfExtraCopiesOnSpares > 0)
            {
                CopyLayoutGenerator.Tracer.TraceDebug <int>(0L, "CopyLayoutGenerator: GenerateCopyLayoutTable() Generating {0} extra copy on the spare disks.", numberOfExtraCopiesOnSpares);
                try
                {
                    CopyLayoutGenerator.GenerateAdditionalCopyOnSpares(numberOfExtraCopiesOnSpares, databaseDrivesPerServer, dictionary);
                }
                catch (DatabaseCopyLayoutException ex)
                {
                    CopyLayoutGenerator.Tracer.TraceDebug <string>(0L, "CopyLayoutGenerator: Call to GenerateAdditionalCopyOnSpares() failed. Error '{0}'.", ex.Message);
                    throw new CallWithoutnumberOfExtraCopiesOnSparesException(ex.Message);
                }
            }
            return(dictionary);
        }
예제 #2
0
 public Dictionary <int, List <DatabaseGroupLayoutEntry> > GenerateDatabaseCopyLayoutForDag()
 {
     return(CopyLayoutGenerator.GenerateCopyLayoutTable(this.m_copyLayoutEntry, this.m_serversPerDag, this.m_databasesPerDag, this.m_databaseDrivesPerServer, this.m_databasesPerDrive, this.m_copiesPerDatabase, this.m_numberOfExtraCopiesOnSpares));
 }
예제 #3
0
        // Token: 0x06000EE0 RID: 3808 RVA: 0x0003F938 File Offset: 0x0003DB38
        internal static Dictionary <int, List <DatabaseGroupLayoutEntry> > GenerateCopyLayoutWithEmptySpares(DatabaseCopyLayoutEntry copyLayoutEntry, int serversPerDag, int databasesPerDag, int databaseDrivesPerServer, int databasesPerDrive, int copiesPerDatabase)
        {
            CopyLayoutGenerator.Tracer.TraceDebug(0L, "CopyLayoutGenerator: GenerateCopyLayoutWithEmptySpares() ServersPerDag = {0}, DatabasesPerDag = {1}, databaseDrivesPerServer = {2}, DatabasesPerDrive = {3}, CopiesPerDatabase = {4}", new object[]
            {
                serversPerDag,
                databasesPerDag,
                databaseDrivesPerServer,
                databasesPerDrive,
                copiesPerDatabase
            });
            Dictionary <int, List <DatabaseGroupLayoutEntry> > dictionary = new Dictionary <int, List <DatabaseGroupLayoutEntry> >();
            Dictionary <string, int> databaseGroups = new Dictionary <string, int>();
            int num  = serversPerDag / copiesPerDatabase;
            int num2 = databasesPerDag / databasesPerDrive;

            Math.Floor((double)num2 / (double)num);
            int num3 = (int)Math.Ceiling((double)num2 / (double)num);
            int num4 = num2 % num;
            int num5 = 0;
            int num6 = 0;
            int i    = 0;
            int num7 = 0;

            for (int j = 0; j < num3; j++)
            {
                num7++;
                CopyLayoutGenerator.SeedStandardRand(num6 + i + j + 371293);
                for (i = 0; i <= copiesPerDatabase - 1; i++)
                {
                    int num8 = i * num;
                    int num9 = CopyLayoutGenerator.StandardRand();
                    num6 = (num7 - 1) * num;
                    int num10 = 371293 * (i + 1) + 1;
                    if (num10 % num == 0 || CopyLayoutGenerator.GreatestCommonDivisor(num10, num) != 1)
                    {
                        num10 = 371293;
                    }
                    for (int k = 0; k < num; k++)
                    {
                        if (j != num3 - 1 || num4 <= 0 || k < num4)
                        {
                            int num11 = num8 + (k * num10 + num9) % num;
                            num5++;
                            DatabaseGroupLayoutEntry        databaseGroupInstance = CopyLayoutGenerator.GetDatabaseGroupInstance(num6, databasesPerDrive, num5, copyLayoutEntry, databaseGroups);
                            List <DatabaseGroupLayoutEntry> list;
                            if (dictionary.TryGetValue(num11 + 1, out list))
                            {
                                list.Add(databaseGroupInstance);
                            }
                            else
                            {
                                List <DatabaseGroupLayoutEntry> list2 = new List <DatabaseGroupLayoutEntry>();
                                list2.Add(databaseGroupInstance);
                                dictionary.Add(num11 + 1, list2);
                            }
                            num6++;
                        }
                    }
                }
                i = copiesPerDatabase - 1;
            }
            return(dictionary);
        }