Beispiel #1
0
        // Token: 0x06001B1C RID: 6940 RVA: 0x00074C1C File Offset: 0x00072E1C
        private void ThrowExceptionForExistingInstance(RpcSeederArgs seederArgs, SeederInstanceContainer seederInstance)
        {
            SeederState seedState = seederInstance.SeedState;

            ExTraceGlobals.SeederServerTracer.TraceError <string, Guid, SeederState>((long)this.GetHashCode(), "SeedManager: A SeederInstanceContainer already exists for DB '{0}' ({1}) and is in SeederState '{2}'.", seederArgs.DatabaseName, seederArgs.InstanceGuid, seedState);
            if (seedState == SeederState.Unknown)
            {
                throw new SeederInstanceAlreadyAddedException(seederInstance.SeedingSource);
            }
            if (seedState == SeederState.SeedPrepared)
            {
                throw new SeederInstanceAlreadyAddedException(seederInstance.SeedingSource);
            }
            if (seedState == SeederState.SeedInProgress)
            {
                throw new SeederInstanceAlreadyInProgressException(seederInstance.SeedingSource);
            }
            if (seedState == SeederState.SeedSuccessful)
            {
                throw new SeederInstanceAlreadyCompletedException(seederInstance.SeedingSource);
            }
            if (seedState == SeederState.SeedCancelled)
            {
                throw new SeederInstanceAlreadyCancelledException(seederInstance.SeedingSource);
            }
            if (seedState == SeederState.SeedFailed)
            {
                throw new SeederInstanceAlreadyFailedException(seederInstance.GetSeedStatus(), seederInstance.SeedingSource);
            }
        }
        // Token: 0x06001AA7 RID: 6823 RVA: 0x00072250 File Offset: 0x00070450
        public RpcSeederStatus GetSeedStatus()
        {
            ExTraceGlobals.SeederServerTracer.TraceDebug((long)this.GetHashCode(), "SeederInstanceContainer.GetSeedStatus() entered.");
            RpcSeederStatus rpcSeederStatus = null;
            bool            flag            = true;
            bool            flag2           = this.m_seedDatabase && this.m_seedCiFiles;

            if (this.m_databaseSeeder != null)
            {
                if (!flag2)
                {
                    flag = false;
                }
                RpcSeederStatus seedStatus = this.m_databaseSeeder.GetSeedStatus();
                if (seedStatus.State != SeederState.SeedSuccessful)
                {
                    flag = false;
                }
                rpcSeederStatus = SeederInstanceContainer.ScaleDatabaseSeedStatus(seedStatus, flag2);
            }
            if (flag)
            {
                rpcSeederStatus = this.m_ciFilesSeeder.GetSeedStatus();
                rpcSeederStatus = SeederInstanceContainer.ScaleCiSeedStatus(rpcSeederStatus, flag2);
            }
            return(rpcSeederStatus);
        }
Beispiel #3
0
        // Token: 0x06001B15 RID: 6933 RVA: 0x000744C4 File Offset: 0x000726C4
        public void PrepareDbSeedAndBegin(RpcSeederArgs seederArgs)
        {
            ExTraceGlobals.SeederServerTracer.TraceDebug((long)this.GetHashCode(), "SeedManager: PrepareDbSeedAndBegin() called.");
            SeederInstanceContainer seederInstanceContainer;
            bool flag = this.m_seederInstances.TryGetInstance(seederArgs.InstanceGuid, out seederInstanceContainer);

            if (flag)
            {
                this.ThrowExceptionForExistingInstance(seederArgs, seederInstanceContainer);
            }
            ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: A SeederInstanceContainer does NOT already exist for DB '{0}' ({1}).", seederArgs.DatabaseName, seederArgs.InstanceGuid);
            Dependencies.ADConfig.Refresh("SeedManager.PrepareDbSeedAndBegin");
            ReplayConfiguration replayConfiguration;

            this.CheckDbValidReplicationTarget(seederArgs, out replayConfiguration);
            ConfigurationArgs configurationArgs = new ConfigurationArgs(replayConfiguration, this.m_replicaInstanceManager);

            seederInstanceContainer = new SeederInstanceContainer(seederArgs, configurationArgs);
            try
            {
                this.m_seederInstances.AddInstance(seederInstanceContainer);
                ReplayEventLogConstants.Tuple_SeedInstancePrepareAdded.LogEvent(null, new object[]
                {
                    configurationArgs.Name,
                    seederArgs.ToString()
                });
            }
            catch (ArgumentException arg)
            {
                ExTraceGlobals.SeederServerTracer.TraceError <string, ArgumentException>((long)this.GetHashCode(), "SeedManager: SeederInstanceContainer for db '{0}' has already been added. This indicates another PrepareDbSeed() call got to add it just before this one. Ex: {1}", replayConfiguration.Name, arg);
                throw new SeederInstanceAlreadyAddedException(seederInstanceContainer.SeedingSource);
            }
            try
            {
                seederInstanceContainer.PrepareDbSeed();
                ReplayEventLogConstants.Tuple_SeedInstancePrepareSucceeded.LogEvent(null, new object[]
                {
                    configurationArgs.Name
                });
            }
            finally
            {
                SeederState seedState = seederInstanceContainer.SeedState;
                if (seedState != SeederState.SeedPrepared)
                {
                    this.m_seederInstances.RemoveInstance(seederInstanceContainer);
                    ExTraceGlobals.SeederServerTracer.TraceDebug <string, SeederState>((long)this.GetHashCode(), "SeedManager: SeederInstanceContainer for db '{0}' is being removed from table because PrepareDbSeed() did not pass (state ={1}, expected was SeedPrepared).", replayConfiguration.Name, seedState);
                    ReplayEventLogConstants.Tuple_SeedInstancePrepareUnknownError.LogEvent(null, new object[]
                    {
                        configurationArgs.Name
                    });
                }
            }
            ExTraceGlobals.SeederServerTracer.TraceDebug <string>((long)this.GetHashCode(), "SeedManager: SeederInstanceContainer for db '{0} is being queued for seeding since PrepareDbSeed() passed.", replayConfiguration.Name);
            try
            {
                seederInstanceContainer.BeginDbSeed();
                ReplayEventLogConstants.Tuple_SeedInstanceBeginSucceeded.LogEvent(null, new object[]
                {
                    configurationArgs.Name
                });
            }
            finally
            {
                SeederState seedState2 = seederInstanceContainer.SeedState;
                if (seedState2 != SeederState.SeedInProgress && seedState2 != SeederState.SeedSuccessful)
                {
                    this.m_seederInstances.RemoveInstance(seederInstanceContainer);
                    ExTraceGlobals.SeederServerTracer.TraceDebug <string, SeederState>((long)this.GetHashCode(), "SeedManager: SeederInstanceContainer for db '{0}' is being removed from table because BeginDbSeed() did not pass (state = {1}).", replayConfiguration.Name, seedState2);
                    ReplayEventLogConstants.Tuple_SeedInstanceBeginUnknownError.LogEvent(null, new object[]
                    {
                        configurationArgs.Name
                    });
                }
            }
        }