public bool TryBeginDbSeed(RpcSeederArgs rpcSeederArgs) { bool result; lock (this.m_instance) { if (!this.Suspended) { ExTraceGlobals.ReplicaInstanceTracer.TraceError <string>((long)this.GetHashCode(), "TryBeginDbSeed: {0}: Could not mark RI for seed because it is not suspended.", this.m_displayName); result = false; } else { this.CheckReseedBlocked(); this.ClearViable(); this.LogCrimsonEventOnStateChange <bool>("Seeding", this.Seeding, true); this.Seeding = true; if (this.m_perfmonCounters != null) { this.m_perfmonCounters.Initializing = 0L; this.m_perfmonCounters.Resynchronizing = 0L; this.m_perfmonCounters.SuspendedAndNotSeeding = 0L; } this.m_replayState.ResetForSeed(); this.InitializeVolumeInfo(); this.ClearLogStreamStartGeneration(); this.ClearCurrentFailedState(); this.ClearPreviousFailedOrDisconnectedState(); this.SetSeedingStartedErrorMessage(rpcSeederArgs); this.ExternalStatus.Refresh(); result = true; } } return(result); }
// 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: 0x06001A47 RID: 6727 RVA: 0x0006EA10 File Offset: 0x0006CC10 public void BeginServerLevelSeed(bool fDeleteExistingLogs, bool fSafeDeleteExistingFiles, int maxSeedsInParallel, bool fAutoSuspend, bool fManualResume, bool fSeedDatabase, bool fSeedCiFiles, bool?compressOverride, bool?encryptOverride, SeederRpcFlags flags = SeederRpcFlags.None) { RpcSeederArgs args = new RpcSeederArgs(Guid.Empty, fDeleteExistingLogs, fAutoSuspend, null, null, string.Empty, false, string.Empty, null, fManualResume, fSeedDatabase, fSeedCiFiles, compressOverride, encryptOverride, maxSeedsInParallel, fSafeDeleteExistingFiles, flags); this.ValidateArgs(args); ExTraceGlobals.SeederClientTracer.TraceDebug <RpcSeederArgs>((long)this.GetHashCode(), "BeginServerLevelSeed(): Constructed RpcSeederArgs: {0}", args); RpcErrorExceptionInfo errorInfo = null; RpcSeederStatus seedStatus = null; ServerVersion version = this.GetTestHookServerVersion(); SeederRpcExceptionWrapper.Instance.ClientRetryableOperation(this.m_serverName, delegate { if (ReplayRpcVersionControl.IsSeedRpcV5Supported(version)) { errorInfo = this.m_client.RpccPrepareDatabaseSeedAndBegin5(args, ref seedStatus); return; } if (ReplayRpcVersionControl.IsSeedRpcSafeDeleteSupported(version)) { errorInfo = this.m_client.RpccPrepareDatabaseSeedAndBegin4(args, ref seedStatus); return; } ExTraceGlobals.SeederClientTracer.TraceError <string, ServerVersion, ServerVersion>((long)this.GetHashCode(), "BeginServerLevelSeed(): Server '{0}' does not support server-level reseed RPC. Server version: {1}. Minimum supported version: {2}", this.m_serverName, version, ReplayRpcVersionControl.SeedRpcSafeDeleteSupportVersion); throw new SeederRpcServerLevelUnsupportedException(this.m_serverName, version.ToString(), ReplayRpcVersionControl.SeedRpcSafeDeleteSupportVersion.ToString()); }); SeederRpcExceptionWrapper.Instance.ClientRethrowIfFailed(this.m_databaseName, this.m_serverName, errorInfo); }
// Token: 0x06001B1A RID: 6938 RVA: 0x00074B9C File Offset: 0x00072D9C private void HandleDbCopyNotTarget(RpcSeederArgs seederArgs, ReplayConfiguration replayConfig) { ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' ({1}) is NOT a replication target on the local machine. It is a source!", replayConfig.Name, seederArgs.InstanceGuid); DbCopyNotTargetException ex = new DbCopyNotTargetException(replayConfig.DatabaseName, Environment.MachineName); throw ex; }
// Token: 0x06001A4B RID: 6731 RVA: 0x0006ED36 File Offset: 0x0006CF36 private void ValidateArgs(RpcSeederArgs args) { if (!args.SeedDatabase && !args.SeedCiFiles) { throw new ArgumentException("One of SeedDatabase and SeedCiFiles must be specified."); } if (args.SafeDeleteExistingFiles && args.DeleteExistingFiles) { throw new ArgumentException("Only one of SafeDeleteExistingFiles and DeleteExistingFiles can be specified at once."); } }
private void SetSeedingStartedErrorMessage(RpcSeederArgs rpcSeederArgs) { string[] argumentsWithDb = ReplicaInstanceContext.GetArgumentsWithDb(new string[] { rpcSeederArgs.ToString() }, this.m_displayName); ExEventLog.EventTuple tuple_SeedInstanceStartedSetBroken = ReplayEventLogConstants.Tuple_SeedInstanceStartedSetBroken; int num; string value = tuple_SeedInstanceStartedSetBroken.EventLogToString(out num, argumentsWithDb); this.FailureInfo.SetBroken(tuple_SeedInstanceStartedSetBroken, new LocalizedString(value), null); this.FailureInfo.PersistFailure(this.m_replayState); }
// Token: 0x06001986 RID: 6534 RVA: 0x0006AA54 File Offset: 0x00068C54 protected SeederInstanceBase(RpcSeederArgs rpcArgs, ConfigurationArgs configArgs) { this.SeederArgs = rpcArgs; this.ConfigArgs = configArgs; this.m_seederStatus = new RpcSeederStatus(); ExTraceGlobals.SeederServerTracer.TraceDebug <string, string>((long)this.GetHashCode(), "SeederInstanceBase constructed with the following arguments: {0}; {1}", this.SeederArgs.ToString(), this.ConfigArgs.ToString()); this.InitializePerfCounters(); this.m_completedTimeUtc = DateTime.MaxValue; if (!string.IsNullOrEmpty(rpcArgs.SourceMachineName) && !SharedHelper.StringIEquals(rpcArgs.SourceMachineName, configArgs.SourceMachine)) { this.m_fPassiveSeeding = true; } }
// Token: 0x06001A9D RID: 6813 RVA: 0x00071EC8 File Offset: 0x000700C8 public SeederInstanceContainer(RpcSeederArgs rpcArgs, ConfigurationArgs configArgs) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 66, ".ctor", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Replay\\seeder\\seederinstancecontainer.cs"); Database database = null; Exception ex = null; try { database = topologyConfigurationSession.FindDatabaseByGuid <Database>(configArgs.IdentityGuid); } catch (ADTransientException ex2) { ex = ex2; } catch (ADExternalException ex3) { ex = ex3; } catch (ADOperationException ex4) { ex = ex4; } if (ex != null) { throw new SeedPrepareException(ReplayStrings.CouldNotFindDatabase(configArgs.IdentityGuid.ToString(), ex.ToString()), ex); } this.m_seederArgs = rpcArgs; this.m_configArgs = configArgs; this.m_seedDatabase = rpcArgs.SeedDatabase; this.m_seedCiFiles = (rpcArgs.SeedCiFiles && !database.IsPublicFolderDatabase); if (this.m_seedDatabase) { if (this.m_seedCiFiles) { this.m_databaseSeeder = new DatabaseSeederInstance(rpcArgs, configArgs, new SeedCompletionCallback(this.LaunchCiFileSeeder), null); } else { this.m_databaseSeeder = new DatabaseSeederInstance(rpcArgs, configArgs, null, null); } } if (this.m_seedCiFiles) { this.m_ciFilesSeeder = new CiFilesSeederInstance(rpcArgs, configArgs); } }
// Token: 0x06001B14 RID: 6932 RVA: 0x0007440C File Offset: 0x0007260C public void BeginServerLevelSeed(RpcSeederArgs seederArgs) { lock (this) { if (!this.m_fStarted) { ExTraceGlobals.SeederServerTracer.TraceError((long)this.GetHashCode(), "SeedManager.BeginServerLevelSeed(): Skipping seeds because SeedManager is being stopped."); ReplayCrimsonEvents.FullServerSeedSkippedShutdown.Log(); throw new FullServerSeedSkippedShutdownException(); } if (this.m_serverSeeder != null && !this.m_serverSeeder.StopCalled) { ExTraceGlobals.SeederServerTracer.TraceError((long)this.GetHashCode(), "SeedManager.BeginServerLevelSeed(): Another server-seed is in progress."); ReplayCrimsonEvents.FullServerSeedAlreadyInProgress.Log(); throw new FullServerSeedInProgressException(); } this.m_serverSeeder = new FullServerReseeder(seederArgs); this.m_serverSeeder.Start(); } }
public CiFilesSeederInstance(RpcSeederArgs rpcArgs, ConfigurationArgs configArgs) : base(rpcArgs, configArgs) { ITopologyConfigurationSession adSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 73, ".ctor", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Replay\\seeder\\cifileseederinstance.cs"); this.targetServer = CiFilesSeederInstance.GetLocalServer(adSession); if (!string.IsNullOrEmpty(rpcArgs.SourceMachineName) && !SharedHelper.StringIEquals(rpcArgs.SourceMachineName, configArgs.SourceMachine)) { this.m_fPassiveSeeding = true; } Server server = this.m_fPassiveSeeding ? CiFilesSeederInstance.GetServerByName(adSession, rpcArgs.SourceMachineName) : CiFilesSeederInstance.GetServerByName(adSession, configArgs.SourceMachine); string indexSystemName = FastIndexVersion.GetIndexSystemName(this.ConfigArgs.IdentityGuid); this.targetIndexSeeder = new IndexSeeder(indexSystemName); this.sourceSeederProvider = new CiFileSeederProvider(server.Fqdn, this.targetServer.Fqdn, this.ConfigArgs.IdentityGuid); this.sourceSeederProvider.NetworkName = this.SeederArgs.NetworkId; this.sourceSeederProvider.CompressOverride = this.SeederArgs.CompressOverride; this.sourceSeederProvider.EncryptOverride = this.SeederArgs.EncryptOverride; base.ReadSeedTestHook(); ExTraceGlobals.SeederServerTracer.TraceDebug <string, string>((long)this.GetHashCode(), "CiFilesSeederInstance constructed with the following arguments: {0}; {1}", this.SeederArgs.ToString(), this.ConfigArgs.ToString()); }
// Token: 0x06001A46 RID: 6726 RVA: 0x0006E83C File Offset: 0x0006CA3C public void PrepareDbSeedAndBegin(Guid dbGuid, bool fDeleteExistingLogs, bool fSafeDeleteExistingFiles, bool fAutoSuspend, bool fManualResume, bool fSeedDatabase, bool fSeedCiFiles, string networkId, string seedingPath, string sourceName, bool?compressOverride, bool?encryptOverride, SeederRpcFlags flags = SeederRpcFlags.None) { if (dbGuid == Guid.Empty) { throw new ArgumentException("An invalid Database Guid was specified.", "dbGuid"); } RpcSeederArgs args = new RpcSeederArgs(dbGuid, fDeleteExistingLogs, fAutoSuspend, seedingPath, null, networkId, false, sourceName, null, fManualResume, fSeedDatabase, fSeedCiFiles, compressOverride, encryptOverride, 0, fSafeDeleteExistingFiles, flags); this.ValidateArgs(args); ExTraceGlobals.SeederClientTracer.TraceDebug <RpcSeederArgs>((long)this.GetHashCode(), "PrepareDbSeedAndBegin(): Constructed RpcSeederArgs: {0}", args); RpcErrorExceptionInfo errorInfo = null; RpcSeederStatus seedStatus = null; ServerVersion version = this.GetTestHookServerVersion(); bool isSafeDeleteSupported = ReplayRpcVersionControl.IsSeedRpcSafeDeleteSupported(version); bool isSeedV5Supported = ReplayRpcVersionControl.IsSeedRpcV5Supported(version); SeederRpcExceptionWrapper.Instance.ClientRetryableOperation(this.m_serverName, delegate { if (isSeedV5Supported) { errorInfo = this.m_client.RpccPrepareDatabaseSeedAndBegin5(args, ref seedStatus); return; } if (isSafeDeleteSupported) { errorInfo = this.m_client.RpccPrepareDatabaseSeedAndBegin4(args, ref seedStatus); return; } if (!fSafeDeleteExistingFiles) { errorInfo = this.m_client.RpccPrepareDatabaseSeedAndBegin(args, ref seedStatus); return; } ExTraceGlobals.SeederClientTracer.TraceError <string, ServerVersion, ServerVersion>((long)this.GetHashCode(), "PrepareDbSeedAndBegin(): Server '{0}' does not support SafeDeleteExistingFiles RPC. Server version: {1}. Minimum supported version: {2}", this.m_serverName, version, ReplayRpcVersionControl.SeedRpcSafeDeleteSupportVersion); throw new SeederRpcSafeDeleteUnsupportedException(this.m_serverName, version.ToString(), ReplayRpcVersionControl.SeedRpcSafeDeleteSupportVersion.ToString()); }); SeederRpcExceptionWrapper.Instance.ClientRethrowIfFailed(this.m_databaseName, this.m_serverName, errorInfo); }
// Token: 0x06001B19 RID: 6937 RVA: 0x00074918 File Offset: 0x00072B18 private void CheckDbValidReplicationTarget(RpcSeederArgs seederArgs, out ReplayConfiguration replayConfig) { replayConfig = null; ADReplicationRetryTimer adreplicationRetryTimer = new ADReplicationRetryTimer(); bool flag = !seederArgs.SeedDatabase && seederArgs.SeedCiFiles; try { bool flag2; while (!this.IsDBCurrentReplicaInstance(seederArgs.InstanceGuid, out replayConfig, out flag2)) { if (SeedHelper.IsDbPendingLcrRcrTarget(seederArgs.InstanceGuid, out replayConfig, out flag2)) { if (flag2) { if (flag) { ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' ({1}) is not a valid RCR replica target but the requested seeding is CI only.", replayConfig.Name, seederArgs.InstanceGuid); return; } this.HandleDbCopyNotTarget(seederArgs, replayConfig); } ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' ({1}) is a valid RCR replica target.", replayConfig.Name, seederArgs.InstanceGuid); return; } ExTraceGlobals.SeederServerTracer.TraceDebug <Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' is NOT a valid RCR replica target!", seederArgs.InstanceGuid); if (adreplicationRetryTimer.IsExpired) { throw new InvalidDbForSeedSpecifiedException(); } adreplicationRetryTimer.Sleep(); } if (flag2) { if (flag) { ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' ({1}) is not running as a valid RCR replica target but the requested seeding is CI only.", replayConfig.Name, seederArgs.InstanceGuid); return; } this.HandleDbCopyNotTarget(seederArgs, replayConfig); } ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' ({1}) is currently running as a valid RCR replica target.", replayConfig.Name, seederArgs.InstanceGuid); } catch (DataSourceOperationException ex) { ExTraceGlobals.SeederServerTracer.TraceError <DataSourceOperationException>((long)this.GetHashCode(), "SeedManager: CheckDBValidReplicationTarget: Exception encountered: {0}", ex); throw new SeedPrepareException(ex.ToString(), ex); } catch (DataValidationException ex2) { ExTraceGlobals.SeederServerTracer.TraceError <DataValidationException>((long)this.GetHashCode(), "SeedManager: CheckDBValidReplicationTarget: Exception encountered: {0}", ex2); throw new SeedPrepareException(ex2.ToString(), ex2); } catch (ObjectNotFoundException ex3) { ExTraceGlobals.SeederServerTracer.TraceError <ObjectNotFoundException>((long)this.GetHashCode(), "SeedManager: CheckDBValidReplicationTarget: Exception encountered: {0}", ex3); throw new SeedPrepareException(ex3.ToString(), ex3); } catch (StoragePermanentException ex4) { ExTraceGlobals.SeederServerTracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "SeedManager: CheckDBValidReplicationTarget: Exception encountered: {0}", ex4); throw new SeedPrepareException(ex4.ToString(), ex4); } catch (TransientException ex5) { ExTraceGlobals.SeederServerTracer.TraceError <TransientException>((long)this.GetHashCode(), "SeedManager: CheckDBValidReplicationTarget: Exception encountered: {0}", ex5); throw new SeedPrepareException(ex5.ToString(), ex5); } }
// 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 }); } } }
// Token: 0x06001A33 RID: 6707 RVA: 0x0006DE49 File Offset: 0x0006C049 public FullServerReseeder(RpcSeederArgs seederArgs) : base(true) { this.m_args = seederArgs; this.m_resumesAttempted = new Dictionary <Guid, CopyStatusClientCachedEntry>(20); this.m_reseedsAttempted = new Dictionary <Guid, CopyStatusClientCachedEntry>(20); }