Exemplo n.º 1
0
        private static Exception DumpsterResubmitRpc(string hubServer, ReplayConfiguration config, SafetyNetRequestKey snKey, SafetyNetInfo snInfo, IMonitoringADConfig adConfig, bool inPrimaryPhase)
        {
            bool      flag = false;
            Exception ex   = null;

            SafetyNetRedelivery.Tracer.TraceDebug <string, string, string>((long)config.GetHashCode(), "DumpsterResubmitRpc() called for {0}({1}) to HUB server {2}.", config.Name, config.Identity, hubServer);
            if (SafetyNetRedelivery.IsSafetyNetRedeliveryRpcSupportedOnHubServer(hubServer, adConfig, out ex))
            {
                AddResubmitRequestStatus addResubmitRequestStatus;
                ex = SafetyNetRedelivery.DumpsterResubmitRpcInternal(true, hubServer, config, snKey, snInfo, inPrimaryPhase, out addResubmitRequestStatus);
                if (addResubmitRequestStatus == AddResubmitRequestStatus.Disabled)
                {
                    flag = true;
                    SafetyNetRedelivery.Tracer.TraceDebug <string, string, string>((long)config.GetHashCode(), "DumpsterResubmitRpc() requested from SafetyNet for {0}({1}) to HUB server {2}, but it is Disabled. Falling back to classic Dumpster...", config.Name, config.Identity, hubServer);
                }
                else if (addResubmitRequestStatus == AddResubmitRequestStatus.DuplicateRequest)
                {
                    SafetyNetRedelivery.Tracer.TraceDebug <string, string, string>((long)config.GetHashCode(), "DumpsterResubmitRpc() requested from SafetyNet for {0}({1}) to HUB server {2}, but it is DuplicateRequest. Treating this duplicate RPC as successful.", config.Name, config.Identity, hubServer);
                }
            }
            else if (ex != null)
            {
                SafetyNetRedelivery.LogResubmitToServerException(true, hubServer, config, snKey, snInfo, inPrimaryPhase, ex, string.Empty);
            }
            else
            {
                flag = true;
            }
            if (flag)
            {
                AddResubmitRequestStatus addResubmitRequestStatus;
                ex = SafetyNetRedelivery.DumpsterResubmitRpcInternal(false, hubServer, config, snKey, snInfo, inPrimaryPhase, out addResubmitRequestStatus);
            }
            return(ex);
        }
Exemplo n.º 2
0
 private static void DoRedeliveryIfRequiredLocked(ReplayConfiguration config, SafetyNetInfoCache snCache, SafetyNetInfoHashTable safetyNetInfos)
 {
     foreach (KeyValuePair <SafetyNetRequestKey, SafetyNetInfo> request in safetyNetInfos)
     {
         SafetyNetRedelivery.ProcessSingleRequest(config, snCache, request);
     }
 }
        protected void PerformSeedIfNecessary()
        {
            TDataObject                  dataObject    = this.DataObject;
            IIdentityParameter           id            = new DatabaseIdParameter(dataObject.Id);
            IConfigDataProvider          dataSession   = base.DataSession;
            ObjectId                     rootId        = this.RootId;
            TDataObject                  dataObject2   = this.DataObject;
            LocalizedString?             notFoundError = new LocalizedString?(Strings.ErrorDatabaseNotFound(dataObject2.Name));
            TDataObject                  dataObject3   = this.DataObject;
            Database                     database      = (Database)base.GetDataObject <Database>(id, dataSession, rootId, notFoundError, new LocalizedString?(Strings.ErrorDatabaseNotUnique(dataObject3.Name)));
            IADDatabaseAvailabilityGroup dag           = null;

            if (this.m_server.DatabaseAvailabilityGroup != null)
            {
                DatabaseAvailabilityGroup dag2 = this.ConfigurationSession.Read <DatabaseAvailabilityGroup>(this.m_server.DatabaseAvailabilityGroup);
                dag = ADObjectWrapperFactory.CreateWrapper(dag2);
            }
            ReplayConfiguration config = RemoteReplayConfiguration.TaskGetReplayConfig(dag, ADObjectWrapperFactory.CreateWrapper(database), ADObjectWrapperFactory.CreateWrapper(this.m_server));

            if (this.m_fSeeding)
            {
                this.SeedDatabase(config);
            }
            this.SuspendDatabaseCopyIfNecessary(config);
        }
 protected sealed override void InternalProcessRecord()
 {
     TaskLogger.LogEnter(new object[]
     {
         this.DataObject
     });
     try
     {
         base.Validate(this.DataObject);
         if (!base.HasErrors)
         {
             ExTraceGlobals.CmdletsTracer.TraceDebug <ObjectId>((long)this.GetHashCode(), "DatabaseCopyStateAction: enter InternalProcessRecord: {0}", this.DataObject.Identity);
             Database database = this.DataObject.GetDatabase <Database>();
             if (!this.m_UseRpc)
             {
                 ReplayConfiguration replayConfiguration = base.ConstructReplayConfiguration(database);
                 this.ProcessRecordWorker(replayConfiguration);
             }
             else
             {
                 this.ProcessRecordWorker(null);
             }
             ExTraceGlobals.CmdletsTracer.TraceDebug <ObjectId>((long)this.GetHashCode(), "DatabaseCopyStateAction: leave InternalProcessRecord: {0}", this.DataObject.Identity);
         }
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
Exemplo n.º 5
0
 private static void ExitLock(ReplayConfiguration config)
 {
     lock (SafetyNetRedelivery.s_inProgressRequests)
     {
         SafetyNetRedelivery.s_inProgressRequests.Remove(config.IdentityGuid);
     }
 }
Exemplo n.º 6
0
        protected override bool RunIndividualCheck(ReplayConfiguration configToCheck, RpcDatabaseCopyStatus2 copyStatus)
        {
            bool       flag        = false;
            string     text        = null;
            CopyStatus copyStatus2 = CopyStatus.Unknown;

            if (copyStatus.CopyStatus == CopyStatusEnum.Suspended)
            {
                copyStatus2 = CopyStatus.Suspended;
                text        = copyStatus.SuspendComment;
                flag        = true;
            }
            else if (copyStatus.CopyStatus == CopyStatusEnum.FailedAndSuspended)
            {
                copyStatus2 = CopyStatus.FailedAndSuspended;
                text        = copyStatus.ErrorMessage;
                flag        = true;
            }
            if (flag)
            {
                text = ((!string.IsNullOrEmpty(text)) ? text : Strings.ReplicationCheckBlankMessage);
                base.FailContinue(Strings.DatabaseCopySuspendedCheck(new LocalizedReplayConfigType(configToCheck.Type).ToString(), configToCheck.DisplayName, copyStatus2.ToString(), base.ServerName, text));
                return(false);
            }
            return(true);
        }
Exemplo n.º 7
0
        private void ResumeUsingState(ReplayConfiguration replayConfiguration)
        {
            ReplayState replayState = replayConfiguration.ReplayState;

            replayState.SuspendLockRemote.TryLeaveSuspend();
            replayState.SuspendMessage = null;
            this.m_fSuccess            = true;
        }
Exemplo n.º 8
0
        private Thread BeginSuspendUsingState(ReplayConfiguration replayConfiguration)
        {
            ReplayState replayState = replayConfiguration.ReplayState;
            Thread      thread      = new Thread(new ParameterizedThreadStart(this.SuspendStateThreadProc));

            thread.IsBackground = true;
            thread.Start(replayState);
            return(thread);
        }
Exemplo n.º 9
0
        public void TriggerDumpster(Guid dbGuid, DateTime inspectorTime)
        {
            IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true);
            IADDatabase db     = iadtoplogyConfigurationSession.FindDatabaseByGuid(dbGuid);
            IADServer   server = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName);
            IADDatabaseAvailabilityGroup dag           = iadtoplogyConfigurationSession.FindDagByServer(server);
            ReplayConfiguration          configuration = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server);

            DumpsterRedeliveryWrapper.MarkRedeliveryRequired(configuration, inspectorTime, 0L, 0L);
        }
Exemplo n.º 10
0
        public void TriggerDumpsterEx(Guid dbGuid, bool fTriggerSafetyNet, DateTime failoverTimeUtc, DateTime startTimeUtc, DateTime endTimeUtc, long lastLogGenBeforeActivation, long numLogsLost)
        {
            IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true);
            IADDatabase db     = iadtoplogyConfigurationSession.FindDatabaseByGuid(dbGuid);
            IADServer   server = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName);
            IADDatabaseAvailabilityGroup dag           = iadtoplogyConfigurationSession.FindDagByServer(server);
            ReplayConfiguration          configuration = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server);

            DumpsterRedeliveryWrapper.MarkRedeliveryRequired(configuration, failoverTimeUtc, startTimeUtc, endTimeUtc, lastLogGenBeforeActivation, numLogsLost);
        }
Exemplo n.º 11
0
        public void DoDumpsterRedeliveryIfRequired(Guid dbGuid)
        {
            IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true);
            IADDatabase db     = iadtoplogyConfigurationSession.FindDatabaseByGuid(dbGuid);
            IADServer   server = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName);
            IADDatabaseAvailabilityGroup dag          = iadtoplogyConfigurationSession.FindDagByServer(server);
            ReplayConfiguration          replayConfig = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server);

            DumpsterRedeliveryWrapper.DoRedeliveryIfRequired(replayConfig);
        }
Exemplo n.º 12
0
        protected override bool RunIndividualCheck(ReplayConfiguration configToCheck, RpcDatabaseCopyStatus2 copyStatus)
        {
            long replayQueueLength = copyStatus.GetReplayQueueLength();

            if (copyStatus.ReplayQueueNotKeepingUp)
            {
                base.FailContinue(Strings.DatabaseReplayQueueNotKeepingUp(configToCheck.DisplayName, base.ServerName, replayQueueLength));
                return(false);
            }
            return(true);
        }
Exemplo n.º 13
0
 protected override bool RunIndividualCheck(ReplayConfiguration configToCheck, RpcDatabaseCopyStatus2 copyStatus)
 {
     if ((this.UseReplayRpc() && copyStatus.CopyStatus == CopyStatusEnum.Failed) || (!this.UseReplayRpc() && configToCheck.ReplayState.ConfigBroken))
     {
         string text = this.UseReplayRpc() ? copyStatus.ErrorMessage : configToCheck.ReplayState.ConfigBrokenMessage;
         text = ((!string.IsNullOrEmpty(text)) ? text : Strings.ReplicationCheckBlankMessage);
         base.FailContinue(Strings.DatabaseCopyFailedCheck(new LocalizedReplayConfigType(configToCheck.Type).ToString(), configToCheck.DisplayName, CopyStatus.Failed.ToString(), base.ServerName, text), this.UseReplayRpc() ? copyStatus.ErrorEventId : 0U);
         return(false);
     }
     return(true);
 }
Exemplo n.º 14
0
        protected override bool ShouldCheckConfig(ReplayConfiguration replayconfig)
        {
            bool result = IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(DatabasesSuspendedCheck)));

            if (base.ShouldCheckConfig(replayconfig))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string, string>((long)this.GetHashCode(), "ShouldCheckConfig(): Config '{0}': Dependent check SuspendCheck passed: {1}.", replayconfig.DisplayName, result.ToString());
                return(result);
            }
            return(false);
        }
Exemplo n.º 15
0
        public static void MarkRedeliveryRequired(ReplayConfiguration configuration, DateTime failoverTimeUtc, DateTime startTimeUtc, DateTime endTimeUtc, long lastLogGenBeforeActivation, long numLogsLost)
        {
            SafetyNetRedelivery.Tracer.TraceDebug(0L, "MarkRedeliveryRequired() for {0}({1}) called: failoverTimeUtc={2}, startTimeUtc={3}, endTimeUtc={4}, lastLogGenBeforeActivation={5}, numLogsLost={6}", new object[]
            {
                configuration.Name,
                configuration.Identity,
                failoverTimeUtc,
                startTimeUtc,
                endTimeUtc,
                lastLogGenBeforeActivation,
                numLogsLost
            });
            if (endTimeUtc < startTimeUtc)
            {
                SafetyNetRedelivery.Tracer.TraceError <string, string>(0L, "MarkRedeliveryRequired() for {0}({1}) failed because endTimeUtc should not be less than startTimeUtc", configuration.Name, configuration.Identity);
                DiagCore.AssertOrWatson(false, "endTimeUtc ({0}) should not be less than startTimeUtc ({1}) !", new object[]
                {
                    endTimeUtc,
                    startTimeUtc
                });
                throw new DumpsterInvalidResubmitRequestException(configuration.DatabaseName);
            }
            TimeSpan timeSpan  = endTimeUtc.Subtract(startTimeUtc);
            TimeSpan timeSpan2 = TimeSpan.FromSeconds((double)RegistryParameters.DumpsterRedeliveryMaxTimeRangeInSecs);

            if (timeSpan > timeSpan2)
            {
                SafetyNetRedelivery.Tracer.TraceError(0L, "MarkRedeliveryRequired() for {0}({1}) failed because the request window ({2}) is larger than the maximum allowed of {3}", new object[]
                {
                    configuration.Name,
                    configuration.Identity,
                    timeSpan,
                    timeSpan2
                });
                throw new DumpsterInvalidResubmitRequestException(configuration.DatabaseName);
            }
            string text;

            ActiveManagerCore.GetDatabaseMountStatus(configuration.IdentityGuid, out text);
            SafetyNetInfo      safetyNetInfo  = new SafetyNetInfo(text, lastLogGenBeforeActivation, numLogsLost, failoverTimeUtc, startTimeUtc, endTimeUtc);
            SafetyNetInfoCache safetyNetTable = configuration.ReplayState.GetSafetyNetTable();

            safetyNetTable.Update(safetyNetInfo);
            ReplayEventLogConstants.Tuple_DatabaseDumpsterRedeliveryRequired.LogEvent(null, new object[]
            {
                configuration.DatabaseName,
                startTimeUtc,
                endTimeUtc
            });
            ReplayCrimsonEvents.DumpsterRedeliveryRequired.Log <string, Guid, string, long, long, DateTime, DateTime, DateTime, bool, bool>(configuration.DatabaseName, configuration.IdentityGuid, text, lastLogGenBeforeActivation, numLogsLost, failoverTimeUtc, startTimeUtc, endTimeUtc, false, true);
        }
Exemplo n.º 16
0
 protected override bool RunIndividualCheck(ReplayConfiguration configToCheck, RpcDatabaseCopyStatus2 copyStatus)
 {
     if (copyStatus.CopyStatus == CopyStatusEnum.DisconnectedAndHealthy)
     {
         base.FailContinue(Strings.DatabaseCopyDisconnectedCheck(new LocalizedReplayConfigType(configToCheck.Type).ToString(), configToCheck.DisplayName, CopyStatus.DisconnectedAndHealthy.ToString(), copyStatus.MailboxServer));
         return(false);
     }
     if (copyStatus.CopyStatus == CopyStatusEnum.DisconnectedAndResynchronizing)
     {
         base.FailContinue(Strings.DatabaseCopyDisconnectedCheck(new LocalizedReplayConfigType(configToCheck.Type).ToString(), configToCheck.DisplayName, CopyStatus.DisconnectedAndResynchronizing.ToString(), copyStatus.MailboxServer));
         return(false);
     }
     return(true);
 }
Exemplo n.º 17
0
 private static void LogSpecificRequestFailedEvent(ReplayConfiguration config, SafetyNetRequestKey snKey, SafetyNetInfo snInfo, string errorMessageFormatStr, params object[] messageParams)
 {
     if (SafetyNetRedelivery.Tracer.IsTraceEnabled(TraceType.ErrorTrace))
     {
         SafetyNetRedelivery.Tracer.TraceError((long)config.GetHashCode(), "ProcessSingleRequest: Redelivery request ({2}) for {0}({1}) failed. Error: {3}", new object[]
         {
             config.Name,
             config.Identity,
             snKey,
             string.Format(errorMessageFormatStr, messageParams)
         });
     }
     ReplayCrimsonEvents.DumpsterRedeliverySpecificRequestFailed.LogPeriodic <string, Guid, bool, DateTime, SafetyNetRequestKey, string, string>(config.Identity + snKey.ToString(), DiagCore.DefaultEventSuppressionInterval, config.DatabaseName, config.IdentityGuid, false, snKey.RequestCreationTimeUtc, snKey, snInfo.GetSerializedForm(), string.Format(errorMessageFormatStr, messageParams));
 }
Exemplo n.º 18
0
        private static bool TryEnterLock(ReplayConfiguration config)
        {
            bool result;

            lock (SafetyNetRedelivery.s_inProgressRequests)
            {
                if (SafetyNetRedelivery.s_inProgressRequests.Contains(config.IdentityGuid))
                {
                    result = false;
                }
                else
                {
                    SafetyNetRedelivery.s_inProgressRequests.Add(config.IdentityGuid);
                    result = true;
                }
            }
            return(result);
        }
Exemplo n.º 19
0
        protected override bool ShouldCheckConfig(ReplayConfiguration replayconfig)
        {
            bool flag  = IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(DatabasesSuspendedCheck)));
            bool flag2 = IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(DatabasesFailedCheck)));
            bool flag3 = flag && flag2;

            if (this.UseReplayRpc())
            {
                bool flag4 = IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(DatabasesInitializingCheck)));
                flag3 = (flag3 && flag4);
            }
            if (base.ShouldCheckConfig(replayconfig))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "ShouldCheckConfig(): Config '{0}': Dependent checks SuspendCheck  and FailedCheck {2} passed: {1}.", replayconfig.DisplayName, flag3.ToString(), this.UseReplayRpc() ? "and InitializingCheck" : string.Empty);
                return(flag3);
            }
            return(false);
        }
        internal void SuspendDatabaseCopyIfNecessary(ReplayConfiguration config)
        {
            string text = string.Empty;

            text = config.TargetMachine;
            if (!this.m_fConfigOnly && !WmiWrapper.IsFileExisting(text, config.DestinationEdbPath))
            {
                string fileName = string.Empty;
                fileName = Path.Combine(config.DestinationLogPath, EseHelper.MakeLogfileName(config.LogFilePrefix, "." + config.LogExtension, 1L));
                if (!WmiWrapper.IsFileExisting(SharedHelper.GetFqdnNameFromNode(config.SourceMachine), fileName))
                {
                    try
                    {
                        this.WriteWarning(Strings.EnableDBCSuspendReplayNoDbComment(config.Name));
                        ReplayRpcClientWrapper.RequestSuspend(text, config.IdentityGuid, Strings.EnableDBCSuspendReplayNoDbComment(config.Name));
                        ReplayEventLogConstants.Tuple_DbSeedingRequired.LogEvent(null, new object[]
                        {
                            config.Name,
                            text
                        });
                    }
                    catch (TaskServerTransientException ex)
                    {
                        ExTraceGlobals.CmdletsTracer.TraceDebug <TaskServerTransientException>((long)this.GetHashCode(), "SeedDatabase: Caught exception in RPC: {0}", ex);
                        base.WriteError(new InvalidOperationException(Strings.SgcFailedToSuspendRpc(config.Name, ex.Message)), ErrorCategory.InvalidOperation, this.Identity);
                    }
                    catch (TaskServerException ex2)
                    {
                        ExTraceGlobals.CmdletsTracer.TraceDebug <TaskServerException>((long)this.GetHashCode(), "SeedDatabase: Caught exception in RPC: {0}", ex2);
                        if (!(ex2 is ReplayServiceSuspendWantedSetException))
                        {
                            if (ex2 is ReplayServiceSuspendRpcPartialSuccessCatalogFailedException)
                            {
                                base.WriteWarning(ex2.Message);
                            }
                            else
                            {
                                base.WriteError(new InvalidOperationException(Strings.SgcFailedToSuspendRpc(config.Name, ex2.Message)), ErrorCategory.InvalidOperation, this.Identity);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 21
0
        private void QueryDumpsterStats(Server mailboxServer, string databaseDn, ref MailboxDatabase entry)
        {
            List <string> serversWithServerRoleInSiteByServer = ReplayConfiguration.GetServersWithServerRoleInSiteByServer(ADObjectWrapperFactory.CreateWrapper(mailboxServer), ServerRole.HubTransport);
            List <string> list = new List <string>();
            List <DumpsterStatisticsEntry> list2 = new List <DumpsterStatisticsEntry>();

            foreach (string text in serversWithServerRoleInSiteByServer)
            {
                MailSubmissionServiceRpcClient mailSubmissionServiceRpcClient2;
                MailSubmissionServiceRpcClient mailSubmissionServiceRpcClient = mailSubmissionServiceRpcClient2 = new MailSubmissionServiceRpcClient(text);
                try
                {
                    long ticksOldestItem = 0L;
                    long queueSize       = 0L;
                    int  numberOfItems   = 0;
                    long num             = mailSubmissionServiceRpcClient.QueryDumpsterStats(databaseDn, ref ticksOldestItem, ref queueSize, ref numberOfItems);
                    if (num != 0L)
                    {
                        ExTraceGlobals.CmdletsTracer.TraceError <string, long>((long)this.GetHashCode(), "GetDatabase.QueryDumpsterStats: RPC to server '{0}' returned {1}", text, num);
                        list.Add(text);
                    }
                    else
                    {
                        list2.Add(new DumpsterStatisticsEntry(text, ticksOldestItem, queueSize, numberOfItems));
                    }
                }
                catch (RpcException)
                {
                    list.Add(text);
                }
                finally
                {
                    if (mailSubmissionServiceRpcClient2 != null)
                    {
                        ((IDisposable)mailSubmissionServiceRpcClient2).Dispose();
                    }
                }
            }
            entry.m_DumpsterStatistics = new DumpsterStatisticsEntry[list2.Count];
            list2.CopyTo(entry.m_DumpsterStatistics);
            entry.m_DumpsterServersNotAvailable = new string[list.Count];
            list.CopyTo(entry.m_DumpsterServersNotAvailable);
        }
        protected override bool RunIndividualCheck(ReplayConfiguration configToCheck, RpcDatabaseCopyStatus2 copyStatus)
        {
            long queueLength;

            if (this.UseReplayRpc())
            {
                queueLength = copyStatus.GetCopyQueueLength();
            }
            else
            {
                queueLength = Math.Max(0L, configToCheck.ReplayState.CopyNotificationGenerationNumber - configToCheck.ReplayState.InspectorGenerationNumber);
            }
            if (copyStatus.CopyQueueNotKeepingUp)
            {
                base.FailContinue(Strings.DatabaseCopyQueueNotKeepingUp(configToCheck.DisplayName, base.ServerName, queueLength));
                return(false);
            }
            return(true);
        }
Exemplo n.º 23
0
        public static void MarkRedeliveryRequired(ReplayConfiguration configuration, DateTime inspectorTime, long lastLogGenBeforeActivation, long numLogsLost)
        {
            DateTime utcNow = DateTime.UtcNow;

            SafetyNetRedelivery.Tracer.TraceDebug(0L, "Setting Dumpster re-delivery required for instance {0}. CreationTime {1}, StartTime {2}, LastLogGenBeforeActivation={3}, NumLogsLost={4}.", new object[]
            {
                configuration.Name,
                utcNow,
                inspectorTime,
                lastLogGenBeforeActivation,
                numLogsLost
            });
            DiagCore.AssertOrWatson(inspectorTime > ReplayState.ZeroFileTime, "inspectorTime is '{0}' which is unexpected!", new object[]
            {
                inspectorTime
            });
            DateTime utcNow2 = DateTime.UtcNow;
            DateTime startTimeUtc;
            DateTime endTimeUtc;

            SafetyNetRedelivery.GetConservativeLossTimes(inspectorTime, out startTimeUtc, out endTimeUtc);
            SafetyNetRedelivery.MarkRedeliveryRequired(configuration, utcNow2, startTimeUtc, endTimeUtc, lastLogGenBeforeActivation, numLogsLost);
        }
        internal void SeedDatabase(ReplayConfiguration config)
        {
            ReplayState replayState = config.ReplayState;

            if (config is RemoteReplayConfiguration)
            {
                string targetMachine = config.TargetMachine;
                try
                {
                    string      machineFqdn        = targetMachine;
                    string      destinationLogPath = config.DestinationLogPath;
                    string      destinationEdbPath = config.DestinationEdbPath;
                    TDataObject dataObject         = this.DataObject;
                    AddDatabaseCopyTaskBase <TDataObject> .CheckSeedingPath(machineFqdn, destinationLogPath, destinationEdbPath, dataObject.LogFilePrefix);
                }
                catch (SeedingPathWarningException ex)
                {
                    if (this.m_SeedingPostponedSpecified)
                    {
                        base.WriteWarning(ex.Message);
                    }
                    return;
                }
                catch (SeedingPathErrorException exception)
                {
                    base.WriteError(exception, ErrorCategory.InvalidOperation, this.Identity);
                }
                SystemConfigurationTasksHelper.TryCreateDirectory(this.m_server.Fqdn, config.DestinationLogPath, Database_Directory.GetDomainWidePermissions(), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
                using (TaskSeeder taskSeeder = this.ConstructSeeder())
                {
                    taskSeeder.SeedDatabase();
                }
                return;
            }
            throw new NotSupportedException(config.GetType() + " is not supported");
        }
 internal abstract void ProcessRecordWorker(ReplayConfiguration replayConfiguration);
        public static bool IsRedeliveryRequired(ReplayConfiguration replayConfig)
        {
            SafetyNetInfoCache safetyNetTable = replayConfig.ReplayState.GetSafetyNetTable();

            return(safetyNetTable.IsRedeliveryRequired(true, true));
        }
Exemplo n.º 27
0
 protected virtual bool ShouldCheckConfig(ReplayConfiguration replayconfig)
 {
     return(replayconfig.Type == ReplayConfigType.RemoteCopyTarget);
 }
Exemplo n.º 28
0
 protected abstract bool RunIndividualCheck(ReplayConfiguration configToCheck, RpcDatabaseCopyStatus2 copyStatus);
 public static void MarkRedeliveryRequired(ReplayConfiguration configuration, DateTime inspectorTime, long lastLogGenBeforeActivation, long numLogsLost)
 {
     SafetyNetRedelivery.MarkRedeliveryRequired(configuration, inspectorTime, lastLogGenBeforeActivation, numLogsLost);
 }
Exemplo n.º 30
0
 internal override void ProcessRecordWorker(ReplayConfiguration replayConfiguration)
 {
     ExTraceGlobals.CmdletsTracer.TraceDebug <ObjectId, string>((long)this.GetHashCode(), "Suspend-DBC: ProcessRecordWorker: {0}, {1}", this.DataObject.Identity, this.SuspendComment);
     ExTraceGlobals.PFDTracer.TracePfd <int, ObjectId, string>((long)this.GetHashCode(), "PFD CRS {0} Suspend-DBC Initiated for : ProcessRecordWorker: {1}, {2}", 25051, this.DataObject.Identity, this.SuspendComment);
     if (this.EnableReplayLag)
     {
         Database database = this.DataObject.GetDatabase <Database>();
         ReplayRpcClientHelper.RpccEnableReplayLag(base.Server.Name, database.Guid, ActionInitiatorType.Administrator);
         return;
     }
     if (this.SuspendComment != null && this.SuspendComment.Length > 512)
     {
         ExTraceGlobals.CmdletsTracer.TraceDebug((long)this.GetHashCode(), "Suspend-DBC {0}: ProcessRecordWorker: SuspendComment length (length={1}, max length={2}) is too long: {3}", new object[]
         {
             this.DataObject.Identity,
             this.SuspendComment.Length,
             512,
             this.SuspendComment
         });
         base.WriteError(new SuspendCommentTooLongException(this.SuspendComment.Length, 512), ErrorCategory.InvalidOperation, this.Identity);
     }
     if (!base.Stopping)
     {
         if (!base.UseRpc)
         {
             this.m_suspendThread = this.BeginSuspendUsingState(replayConfiguration);
         }
         else
         {
             this.m_suspendThread = base.BeginRpcOperation();
         }
         try
         {
             TimeSpan timeSpan = base.UseRpc ? DatabaseCopyStateAction.TimeoutRpc : SuspendDatabaseCopy.Timeout;
             if (!this.m_suspendThread.Join(timeSpan))
             {
                 ExTraceGlobals.CmdletsTracer.TraceDebug <TimeSpan>((long)this.GetHashCode(), "Suspend-DBC: suspend is being slow: timeout={0}", timeSpan);
                 this.WriteWarning(Strings.SuspendSgcTimeout);
                 if (!base.UseRpc)
                 {
                     this.m_suspendThread.Join();
                 }
                 else
                 {
                     this.m_event.WaitOne();
                 }
             }
         }
         finally
         {
             if (this.m_Exception != null)
             {
                 if (this.m_Terminating)
                 {
                     base.ThrowTerminatingError(this.m_Exception, ErrorCategory.NotSpecified, null);
                 }
                 else
                 {
                     ErrorCategory category;
                     this.TranslateException(ref this.m_Exception, out category);
                     if (this.m_Exception is ReplayServiceSuspendWantedSetException)
                     {
                         base.WriteWarning(this.m_Exception.Message);
                         this.m_fSuccess = true;
                     }
                     else if (this.m_Exception is ReplayServiceSuspendRpcPartialSuccessCatalogFailedException)
                     {
                         base.WriteWarning(this.m_Exception.Message);
                         this.m_fSuccess = true;
                     }
                     else if (!this.m_fFallbackToState)
                     {
                         this.WriteError(this.m_Exception, category, null, false);
                     }
                     else if (!base.Stopping)
                     {
                         ExTraceGlobals.CmdletsTracer.TraceDebug <ObjectId>((long)this.GetHashCode(), "ProcessRecordWorker: There was an RPC connection error, so now falling back to Suspend through the State, for {0}.", this.DataObject.Identity);
                         this.WriteWarning(Strings.SuspendSgcFallbackToState(this.DataObject.Identity.ToString(), this.m_Exception.Message));
                     }
                 }
             }
         }
     }
     if (!this.m_fSuccess && base.Stopping)
     {
         ExTraceGlobals.CmdletsTracer.TraceDebug <ObjectId>((long)this.GetHashCode(), "Suspend was cancelled for {0}", this.DataObject.Identity);
         return;
     }
     if (!base.UseRpc && this.m_Exception == null && this.m_fSuccess)
     {
         replayConfiguration.ReplayState.SuspendMessage = this.SuspendComment;
     }
     else if (base.UseRpc && this.m_fFallbackToState)
     {
         ReplayConfiguration replayConfiguration2 = base.ConstructReplayConfiguration(this.DataObject.GetDatabase <Database>());
         replayConfiguration2.ReplayState.SuspendLockRemote.EnterSuspend();
         replayConfiguration2.ReplayState.SuspendMessage = this.SuspendComment;
         this.m_fSuccess = true;
     }
     if (this.m_fSuccess)
     {
         ExTraceGlobals.CmdletsTracer.TraceDebug <string, ObjectId>((long)this.GetHashCode(), "Suspended ({0}) for {1}", this.SuspendComment, this.DataObject.Identity);
         ExTraceGlobals.PFDTracer.TracePfd <int, string, ObjectId>((long)this.GetHashCode(), "PFD CRS {0} Sucessfully Suspended ({1}) for {2}", 20955, this.SuspendComment, this.DataObject.Identity);
         if (this.m_fFallbackToState)
         {
             ReplayEventLogConstants.Tuple_SuspendMarkedForDatabaseCopy.LogEvent(null, new object[]
             {
                 this.DataObject.Identity
             });
         }
     }
     TaskLogger.LogExit();
 }