// Token: 0x06001B3A RID: 6970 RVA: 0x00075602 File Offset: 0x00073802
 public AcllAutoLockRelease(ReplicaInstance instance) : base(TimeSpan.FromMilliseconds((double)RegistryParameters.AcllLockAutoReleaseAfterDurationMs), TimeSpan.FromMilliseconds((double)RegistryParameters.AcllLockAutoReleaseAfterDurationMs), "AcllAutoLockRelease")
 {
     this.ReplicaInstance = instance;
 }
 // Token: 0x06001B3D RID: 6973 RVA: 0x0007563D File Offset: 0x0007383D
 protected override void StopInternal()
 {
     base.StopInternal();
     this.ReplicaInstance = null;
 }
Exemple #3
0
        // Token: 0x060001B1 RID: 433 RVA: 0x0000AD64 File Offset: 0x00008F64
        internal void MountDatabaseDirect(Guid mdbGuid, MountFlags storeFlags, AmMountFlags amMountFlags, AmDbActionCode actionCode)
        {
            AmTrace.Debug("MountDatabaseDirect called. (Guid={0}, StoreFlags={1}, AmMountFlags={2} ActionCode={3})", new object[]
            {
                mdbGuid,
                storeFlags,
                amMountFlags,
                actionCode
            });
            AmConfig config = AmSystemManager.Instance.Config;

            if (!config.IsUnknown)
            {
                bool flag = false;
                LogStreamResetOnMount         logReset  = null;
                MountDirectPerformanceTracker mountPerf = new MountDirectPerformanceTracker(mdbGuid);
                ReplicaInstanceContext        replicaInstanceContext = null;
                try
                {
                    int         actualMountFlags = (int)storeFlags;
                    IADDatabase db = this.AdLookup.DatabaseLookup.FindAdObjectByGuidEx(mdbGuid, AdObjectLookupFlags.None);
                    if (db == null)
                    {
                        throw new AmDatabaseNotFoundException(mdbGuid);
                    }
                    if (AmSystemManager.Instance.IsSystemShutdownInProgress)
                    {
                        ReplayCrimsonEvents.MountRejectedSinceSystemShutdownInProgress.Log <string, Guid, ExDateTime?>(db.Name, mdbGuid, AmSystemManager.Instance.SystemShutdownStartTime);
                        throw new AmInvalidConfiguration(string.Empty);
                    }
                    ExTraceGlobals.FaultInjectionTracer.TraceTest(2198220093U);
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.AmPreMountCallback, delegate
                    {
                        this.m_replicaInstanceManager.AmPreMountCallback(mdbGuid, ref actualMountFlags, amMountFlags, mountPerf, out logReset, out replicaInstanceContext);
                    });
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.RegistryReplicatorCopy, delegate
                    {
                        this.m_registryMonitor.PreMountCopy(mdbGuid, db.IsPublicFolderDatabase);
                    });
                    if (replicaInstanceContext != null)
                    {
                        replicaInstanceContext.IsReplayDatabaseDismountPending = false;
                    }
                    ExTraceGlobals.FaultInjectionTracer.TraceTest(2166762813U);
                    try
                    {
                        mountPerf.RunTimedOperation(MountDatabaseDirectOperation.StoreMount, delegate
                        {
                            AmStoreHelper.Mount(mdbGuid, (MountFlags)actualMountFlags);
                        });
                    }
                    catch (MapiExceptionDismountInProgress mapiExceptionDismountInProgress)
                    {
                        AmTrace.Error("AmStoreHelper.Mount encountered exception {0}", new object[]
                        {
                            mapiExceptionDismountInProgress
                        });
                        mountPerf.IsDismountInProgress = true;
                        throw;
                    }
                    ((ReplicaInstanceManager)this.m_replicaInstanceManager).ClearLossyMountRecord(mdbGuid);
                    ((ReplicaInstanceManager)this.m_replicaInstanceManager).ClearLastAcllRunWithSkipHealthChecksRecord(mdbGuid);
                    AmTrace.Debug("MountDatabaseDirect initiating UpdateReplicationContentIndexing() asynchronously for DB '{0}'.", new object[]
                    {
                        mdbGuid
                    });
                    ThreadPool.QueueUserWorkItem(delegate(object obj)
                    {
                        Exception ex = ReplicaInstance.UpdateReplicationContentIndexing();
                        if (ex != null)
                        {
                            AmTrace.Error("MountDatabaseDirect background call of UpdateReplicationContentIndexing() failed for DB '{0}'. Exception: {1}", new object[]
                            {
                                (Guid)obj,
                                ex
                            });
                        }
                    }, mdbGuid);
                    this.DetermineWorkerProcessId(mdbGuid);
                    this.m_registryMonitor.PostMountCopy();
                    flag = true;
                    return;
                }
                finally
                {
                    if (replicaInstanceContext != null)
                    {
                        replicaInstanceContext.BestEffortDismountReplayDatabase();
                    }
                    if (logReset != null && logReset.ResetPending)
                    {
                        if (flag)
                        {
                            mountPerf.RunTimedOperation(MountDatabaseDirectOperation.ConfirmLogReset, delegate
                            {
                                logReset.ConfirmLogReset();
                            });
                            Dependencies.ConfigurationUpdater.NotifyChangedReplayConfiguration(mdbGuid, false, true, true, true, ReplayConfigChangeHints.AmPreMountCallbackLogStreamReset, -1);
                        }
                        else
                        {
                            logReset.CancelLogReset();
                        }
                    }
                    mountPerf.LogEvent();
                }
            }
            AmTrace.Error("MountDatabaseDirect: AmConfig is invalid!", new object[0]);
            throw new AmInvalidConfiguration(config.LastError);
        }
 public TargetReplicaInstance(ReplayConfiguration replayConfiguration, ReplicaInstance previousReplicaInstance, IPerfmonCounters perfCounters) : base(replayConfiguration, true, previousReplicaInstance, perfCounters)
 {
     TargetReplicaInstance < > 4__this = this;
     ReplicaInstance.DisposeIfActionUnsuccessful(delegate
     {
Exemple #5
0
        protected override void TimerCallbackInternal()
        {
            List <Guid> list = null;

            lock (this.m_cacheLock)
            {
                if (this.m_allDatabasesCached == null || this.m_allDatabasesCached.Count == 0)
                {
                    ExTraceGlobals.AmConfigManagerTracer.TraceDebug(0L, "AmPerfCounterUpdater: No configurations have been discovered, so nothing to do! Exiting.");
                    return;
                }
                list = new List <Guid>(this.m_allDatabasesCached);
            }
            Exception ex = null;

            MdbStatus[] array = null;
            if (AmStoreHelper.GetAllDatabaseStatuses(null, false, out array, out ex))
            {
                Dictionary <Guid, string> dictionary = new Dictionary <Guid, string>(array.Length);
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i] != null && (array[i].Status & MdbStatusFlags.Online) == MdbStatusFlags.Online)
                    {
                        try
                        {
                            dictionary.Add(array[i].MdbGuid, array[i].MdbName);
                        }
                        catch (ArgumentException)
                        {
                            ExTraceGlobals.AmConfigManagerTracer.TraceDebug <Guid, string>(0L, "AmPerfCounterUpdater: Database {0} ({1}) was returned more than once from GetAllDatabasesStatuses.", array[i].MdbGuid, array[i].MdbName);
                        }
                    }
                }
                AmStoreHelper.UpdateNumberOfDatabasesCounter(list.Count);
                foreach (Guid guid in list)
                {
                    string empty = string.Empty;
                    if (dictionary.TryGetValue(guid, out empty))
                    {
                        AmStoreHelper.UpdateIsMountedCounter(guid, empty, true, false);
                    }
                    else
                    {
                        AmStoreHelper.UpdateIsMountedCounter(guid, null, false, false);
                    }
                    IADDatabase database = Dependencies.ADConfig.GetDatabase(guid);
                    if (database != null)
                    {
                        MountStatus? mountStatus;
                        string       activeServerForDatabase = ReplicaInstance.GetActiveServerForDatabase(guid, database.Name, new AmServerName(database.Server.Name).Fqdn, out mountStatus);
                        AmServerName amServerName            = new AmServerName(activeServerForDatabase);
                        AmStoreHelper.UpdateCopyRoleIsActivePerfCounter(guid, empty, amServerName.IsLocalComputerName);
                    }
                    else
                    {
                        ExTraceGlobals.AmConfigManagerTracer.TraceError <Guid>(0L, "AmPerfCounterUpdater: Failed to get the database for guid {0}", guid);
                    }
                }
                return;
            }
            AmTrace.Error("AmPerfCounterUpdater: Failed to get mounted database information from store. Exception: {0}", new object[]
            {
                ex
            });
        }
 public ReplicaInstanceRequestSuspend(ReplicaInstance instance) : base(instance)
 {
 }
Exemple #7
0
        // Token: 0x06001D53 RID: 7507 RVA: 0x000846D0 File Offset: 0x000828D0
        private bool InspectLogInternal(long logfileNumber, bool fRecopyOnFailure)
        {
            ExTraceGlobals.LogInspectorTracer.TraceDebug <long>((long)this.GetHashCode(), "LogInspector called, logfileNumber = {0}", logfileNumber);
            ExTraceGlobals.PFDTracer.TracePfd <int, long>((long)this.GetHashCode(), "PFD CRS {0} LogInspector called, logfileNumber = {1}", 26269, logfileNumber);
            string filenameFromGenerationNumber = base.GetFilenameFromGenerationNumber(logfileNumber);
            string text          = Path.Combine(this.FromDir, filenameFromGenerationNumber);
            string logfileReplay = Path.Combine(this.m_replayDir, filenameFromGenerationNumber);
            bool   result        = false;

            try
            {
                this.VerifyLog(logfileNumber, text, fRecopyOnFailure);
                this.MoveLogfile(logfileNumber, text, logfileReplay);
                if (!this.m_fAttemptFinalCopyCalled && this.LogTruncater != null)
                {
                    this.LogTruncater.RecordInspectorGeneration(logfileNumber);
                }
                long num;
                if (logfileNumber != 0L)
                {
                    num = logfileNumber;
                }
                else
                {
                    num = this.m_fileState.HighestGenerationPresent + 1L;
                }
                this.UpdateGenerationPresent(num);
                if (!this.m_firstLogReported)
                {
                    ReplayEventLogConstants.Tuple_ReplicaInstanceLogCopied.LogEvent(null, new object[]
                    {
                        this.Config.Name,
                        this.Config.ServerName,
                        Environment.MachineName,
                        num
                    });
                    this.m_firstLogReported = true;
                }
                this.m_replicaProgress.ReportOneLogCopied();
                result = true;
            }
            catch (LogInspectorFailedException ex)
            {
                if (ex.InnerException is IOException)
                {
                    this.m_setBroken.SetBroken(ReplicaInstance.IOExceptionToFailureTag((IOException)ex.InnerException), ReplayEventLogConstants.Tuple_LogInspectorFailed, ex, new string[]
                    {
                        text,
                        ex.Message
                    });
                }
                else
                {
                    this.m_setBroken.SetBroken(FailureTag.NoOp, ReplayEventLogConstants.Tuple_LogInspectorFailed, ex, new string[]
                    {
                        text,
                        ex.Message
                    });
                }
            }
            return(result);
        }
 // Token: 0x0600205B RID: 8283 RVA: 0x00096A3D File Offset: 0x00094C3D
 public ReplicaInstanceAttemptCopyLastLogs(AmAcllArgs acllArgs, AcllPerformanceTracker acllPerf, ReplicaInstance instance) : base(instance)
 {
     this.AcllArgs        = acllArgs;
     this.AcllPerfTracker = acllPerf;
 }
Exemple #9
0
 public ReplicaInstanceSyncSuspendResumeState(ReplicaInstance instance) : base(instance)
 {
 }
        // Token: 0x06000A21 RID: 2593 RVA: 0x0002F2C0 File Offset: 0x0002D4C0
        public static void MoveLogFiles(ReplayConfiguration config, FileState fileState, ISetBroken setBroken, long corruptLogGen)
        {
            string    text = Path.Combine(config.E00LogBackupPath, "SkippedLogs");
            Exception ex   = DirectoryOperations.TryCreateDirectory(text);

            if (ex != null)
            {
                setBroken.SetBroken(FailureTag.Configuration, ReplayEventLogConstants.Tuple_FailedToCreateDirectory, ex, new string[]
                {
                    text,
                    ex.ToString()
                });
                return;
            }
            string currentDateString = FileOperations.GetCurrentDateString();
            string text2             = Path.Combine(text, currentDateString);

            ex = DirectoryOperations.TryCreateDirectory(text2);
            if (ex != null)
            {
                setBroken.SetBroken(FailureTag.Configuration, ReplayEventLogConstants.Tuple_FailedToCreateDirectory, ex, new string[]
                {
                    text2,
                    ex.ToString()
                });
                return;
            }
            string destinationLogPath = config.DestinationLogPath;
            string text3 = string.Empty;
            string path  = string.Empty;

            try
            {
                ReplayEventLogConstants.Tuple_MovingFilesToRestartLogStream.LogEvent(null, new object[]
                {
                    config.DatabaseName,
                    EseHelper.MakeLogfileName(config.LogFilePrefix, config.LogFileSuffix, corruptLogGen),
                    text2
                });
                foreach (string text4 in Directory.GetFiles(destinationLogPath, "*." + config.LogExtension))
                {
                    text3 = text4;
                    path  = Path.GetFileName(text4);
                    long logfileGenerationFromFilePath = EseHelper.GetLogfileGenerationFromFilePath(text4, config.LogFilePrefix);
                    if (logfileGenerationFromFilePath >= fileState.LowestGenerationRequired)
                    {
                        ExTraceGlobals.ReplicaInstanceTracer.TraceError <string>(0L, "MoveLogFiles(): Cannot move logfile '{0}' because it is required by the database.", text4);
                    }
                    else
                    {
                        File.Move(text4, Path.Combine(text2, path));
                    }
                }
                foreach (string text5 in Directory.GetFiles(destinationLogPath, "*.jsl"))
                {
                    text3 = text5;
                    path  = Path.GetFileName(text5);
                    File.Move(text5, Path.Combine(text2, path));
                }
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string>(0L, "Moved log files successfully from '{0}'", config.DestinationLogPath);
            }
            catch (IOException ex2)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string, string, IOException>(0L, "Moving file '{0}' to '{1}' failed with exception: {2}", text3, text2, ex2);
                setBroken.SetBroken(ReplicaInstance.IOExceptionToFailureTag(ex2), ReplayEventLogConstants.Tuple_CouldNotDeleteLogFile, ex2, new string[]
                {
                    text3,
                    ex2.ToString()
                });
            }
            catch (UnauthorizedAccessException ex3)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string, string, UnauthorizedAccessException>(0L, "Moving file '{0}' to '{1}' failed with exception: {2}", text3, text2, ex3);
                setBroken.SetBroken(FailureTag.AlertOnly, ReplayEventLogConstants.Tuple_CouldNotDeleteLogFile, ex3, new string[]
                {
                    text3,
                    ex3.ToString()
                });
            }
        }
Exemple #11
0
 // Token: 0x0600209F RID: 8351 RVA: 0x00096DBD File Offset: 0x00094FBD
 public ReplicaInstanceRequestResume(ReplicaInstance instance) : base(instance)
 {
 }
        // Token: 0x06001BB7 RID: 7095 RVA: 0x00076698 File Offset: 0x00074898
        private LocalizedString CopyLogs()
        {
            ExTraceGlobals.ReplicaInstanceTracer.TraceFunction((long)this.GetHashCode(), "ACLL.CopyLogs invoked");
            LocalizedString errorString  = LocalizedString.Empty;
            bool            e00Exists    = false;
            bool            fSkipLogCopy = false;

            if (this.m_logCopier == null)
            {
                return(errorString);
            }
            this.m_acllPerf.RunTimedOperation(AcllTimedOperation.IsIncrementalReseedNecessary, delegate
            {
                fSkipLogCopy = this.IsIncrementalReseedNecessary(out e00Exists, out errorString);
            });
            if (!fSkipLogCopy)
            {
                if (!e00Exists)
                {
                    if (this.m_fCreatedInspector)
                    {
                        ExTraceGlobals.ReplicaInstanceTracer.TraceDebug <string>((long)this.GetHashCode(), "ACLL: {0}: Starting the log inspector to run in parallel with AttemptFinalCopy().", this.m_configuration.Name);
                        this.m_logInspector.Start();
                    }
                    Result attemptFinalCopyResult = Result.GiveUp;
                    this.m_acllPerf.RunTimedOperation(AcllTimedOperation.AttemptFinalCopy, delegate
                    {
                        attemptFinalCopyResult = this.m_logCopier.AttemptFinalCopy(this.m_acllPerf, out errorString);
                    });
                    if (this.m_logReplayer != null)
                    {
                        this.m_logReplayer.UseSuspendLock = false;
                        this.m_logReplayer.WakeupReplayer();
                    }
                    LocalizedString inspectionError     = LocalizedString.Empty;
                    bool            fLogInspectorPassed = false;
                    this.m_acllPerf.RunTimedOperation(AcllTimedOperation.InspectFinalLogs, delegate
                    {
                        fLogInspectorPassed = this.m_logInspector.InspectFinalLogsDuringAcll(out inspectionError);
                    });
                    if (attemptFinalCopyResult == Result.Success && !fLogInspectorPassed)
                    {
                        errorString = inspectionError;
                    }
                    if (fLogInspectorPassed && (attemptFinalCopyResult == Result.Success || this.m_logCopier.GranuleUsedAsE00))
                    {
                        bool e00InspectionPassed = false;
                        this.m_acllPerf.RunTimedOperation(AcllTimedOperation.InspectE00Log, delegate
                        {
                            e00InspectionPassed = this.m_logInspector.InspectLog(0L, false, out inspectionError);
                        });
                        if (!e00InspectionPassed)
                        {
                            errorString = inspectionError;
                            string text = Path.Combine(this.m_configuration.LogInspectorPath, this.m_configuration.LogFilePrefix + "." + this.m_configuration.LogExtension);
                            ExTraceGlobals.ReplicaInstanceTracer.TraceError((long)this.GetHashCode(), "InspectLog failed, removing new e00");
                            string destinationDirectory = Path.Combine(this.m_logInspector.Config.E00LogBackupPath, "InspectionFailed");
                            if (File.Exists(text))
                            {
                                ReplicaInstance.MoveE00Log(text, ReplayStrings.RemoveLogReasonFailedInspection, destinationDirectory, this.m_configuration);
                            }
                        }
                        else
                        {
                            e00Exists = true;
                            if (attemptFinalCopyResult == Result.Success)
                            {
                                this.NoLoss = true;
                            }
                            this.m_acllPerf.IsGranuleUsedAsE00 = this.m_logCopier.GranuleUsedAsE00;
                        }
                    }
                }
                else
                {
                    this.NoLoss = true;
                    this.m_acllPerf.IsE00EndOfLogStreamAfterIncReseed = true;
                }
                if (this.m_logReplayer != null)
                {
                    this.m_logReplayer.SendFinalLogReplayRequest();
                }
            }
            if (this.m_fSkipHealthChecks || !this.m_setViable.Viable)
            {
                if (e00Exists)
                {
                    this.m_acllPerf.RunTimedOperation(AcllTimedOperation.SetE00LogGeneration, delegate
                    {
                        this.SetE00LogGeneration();
                    });
                }
                this.m_acllPerf.RunTimedOperation(AcllTimedOperation.CheckRequiredLogFilesAtEnd, delegate
                {
                    this.CheckRequiredLogFiles();
                });
            }
            if (!this.NoLoss && !e00Exists)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceDebug <string>((long)this.GetHashCode(), "ACLL.CopyLogs(): {0}: E00.log does not exist. If active manager allows mount, recovery callback will take care of it", this.m_configuration.Name);
            }
            return(errorString);
        }
 public ReplicaInstanceRequestSuspendAndFail(ReplicaInstance instance) : base(instance)
 {
     this.SuspendCopy = true;
 }
 protected ReplicaInstanceQueuedItem(ReplicaInstance replicaInstance)
 {
     this.DbGuid     = replicaInstance.Configuration.IdentityGuid;
     this.DbCopyName = replicaInstance.Configuration.DisplayName;
     this.DbName     = replicaInstance.Configuration.DatabaseName;
 }
 // Token: 0x06002065 RID: 8293 RVA: 0x00096AF0 File Offset: 0x00094CF0
 public ReplicaInstancePreMountCallback(int storeMountFlags, AmMountFlags amMountFlags, MountDirectPerformanceTracker mountPerf, ReplicaInstance instance) : base(instance)
 {
     this.StoreMountFlags  = storeMountFlags;
     this.AmMountFlags     = amMountFlags;
     this.MountPerfTracker = mountPerf;
 }
 public ReplicaInstanceContainer(ReplicaInstance instance, ReplicaInstanceActionQueue queue, IPerfmonCounters perfCounters)
 {
     this.ReplicaInstance     = instance;
     this.Queue               = queue;
     this.PerformanceCounters = perfCounters;
 }
Exemple #17
0
 // Token: 0x060020AA RID: 8362 RVA: 0x00096E7E File Offset: 0x0009507E
 public SingleCopyReplicaInstance(ReplayConfiguration replayConfiguration, IPerfmonCounters perfCounters) : base(replayConfiguration, false, null, perfCounters)
 {
     ReplicaInstance.DisposeIfActionUnsuccessful(delegate
     {
     }, this);
 }
 // Token: 0x06002074 RID: 8308 RVA: 0x00096BCB File Offset: 0x00094DCB
 public ReplicaInstanceDisableReplayLag(ReplicaInstance instance) : base(instance)
 {
 }
 protected ReplicaInstanceAmQueuedItem(ReplicaInstance replicaInstance) : base(replicaInstance)
 {
 }