Ejemplo n.º 1
0
        // Token: 0x06000496 RID: 1174 RVA: 0x00018950 File Offset: 0x00016B50
        internal static Exception Dismount(Guid mdbGuid, UnmountFlags flags)
        {
            Exception result = null;

            if ((flags & UnmountFlags.SkipCacheFlush) == UnmountFlags.SkipCacheFlush)
            {
                result = AmStoreHelper.DismountWithKillOnTimeout(mdbGuid, flags, true);
            }
            else
            {
                try
                {
                    AmStoreHelper.RemoteDismount(null, mdbGuid, flags, true);
                }
                catch (MapiRetryableException ex)
                {
                    result = ex;
                }
                catch (MapiPermanentException ex2)
                {
                    result = ex2;
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        // Token: 0x060004A9 RID: 1193 RVA: 0x00019340 File Offset: 0x00017540
        private static Exception DismountWithKillOnTimeout(Guid mdbGuid, UnmountFlags flags, bool retryOnConflict)
        {
            AmTrace.Debug("DismountWithKillOnTimeout {0}", new object[]
            {
                mdbGuid
            });
            Exception result   = null;
            bool      flag     = false;
            DateTime  utcNow   = DateTime.UtcNow;
            TimeSpan  timeSpan = TimeSpan.FromSeconds((double)RegistryParameters.AmDismountOrKillTimeoutInSec);

            try
            {
                InvokeWithTimeout.Invoke(delegate()
                {
                    AmStoreHelper.RemoteDismount(null, mdbGuid, flags, retryOnConflict);
                }, timeSpan);
            }
            catch (TimeoutException)
            {
                flag = true;
            }
            catch (MapiPermanentException ex)
            {
                result = ex;
            }
            catch (MapiRetryableException ex2)
            {
                result = ex2;
            }
            if (flag)
            {
                AmTrace.Debug("Dismount {0} timedOut after {1}ms", new object[]
                {
                    mdbGuid,
                    timeSpan.TotalMilliseconds
                });
                ReplayCrimsonEvents.DismountFailedOnTimeout.Log <Guid, TimeSpan>(mdbGuid, timeSpan);
                result = AmStoreServiceMonitor.KillStoreIfRunningBefore(utcNow, "DismountWithKillOnTimeout");
            }
            return(result);
        }
Ejemplo n.º 3
0
        internal static void DismountIfMismounted(IADDatabase db, AmDbActionCode actionCode, List <AmServerName> mismountedNodes)
        {
            AmConfig config = AmSystemManager.Instance.Config;

            if (config.Role == AmRole.Unknown)
            {
                throw new AmInvalidConfiguration(config.LastError);
            }
            AmDbStateInfo amDbStateInfo = config.DbState.Read(db.Guid);

            if (amDbStateInfo.IsEntryExist)
            {
                using (List <AmServerName> .Enumerator enumerator = mismountedNodes.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AmServerName amServerName = enumerator.Current;
                        if (!AmServerName.IsEqual(amServerName, amDbStateInfo.ActiveServer))
                        {
                            ReplayCrimsonEvents.DismountingMismountedDatabase.Log <string, Guid, AmServerName>(db.Name, db.Guid, amServerName);
                            AmStoreHelper.RemoteDismount(amServerName, db.Guid, UnmountFlags.SkipCacheFlush, false);
                        }
                        else
                        {
                            AmTrace.Warning("Ignoring force dismount for {0} since it is the current active {1}", new object[]
                            {
                                db.Name,
                                amServerName
                            });
                        }
                    }
                    return;
                }
            }
            AmTrace.Warning("DismountIfMismounted skipped since the database {0} was never mounted", new object[]
            {
                db.Name
            });
        }
Ejemplo n.º 4
0
        internal bool AttemptDismount(AmServerName serverName, UnmountFlags flags, bool isIgnoreKnownExceptions, out Exception exception)
        {
            bool result = false;

            exception = null;
            bool isNodeup = true;

            if (this.Config.IsPamOrSam && !this.Config.DagConfig.IsNodePubliclyUp(serverName))
            {
                isNodeup = false;
            }
            TimeSpan bestEffortDismountTimeout = this.DetermineDismountTimeout(this.ActionCode, isNodeup);

            this.DbTrace.Debug("Attempting dismount (server={0}, flags={1}, actionCode={2}, dismountTimeout={3}ms, ignoreException={4})", new object[]
            {
                serverName,
                flags,
                this.ActionCode,
                bestEffortDismountTimeout.TotalMilliseconds,
                isIgnoreKnownExceptions
            });
            AmDbAction.DismountMode modeOfDismount = AmDbAction.DismountMode.None;
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            bool        flag        = true;
            MountStatus mountStatus = this.State.MountStatus;

            try
            {
                ReplayCrimsonEvents.StoreDismountInitiated.LogGeneric(this.PrepareSubactionArgs(new object[]
                {
                    serverName,
                    flags,
                    bestEffortDismountTimeout
                }));
                if (AmServerName.IsEqual(this.State.ActiveServer, serverName))
                {
                    this.WriteStateDismounting(false);
                }
                ExTraceGlobals.FaultInjectionTracer.TraceTest(3152424253U);
                exception = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                {
                    InvokeWithTimeout.Invoke(delegate()
                    {
                        if (isNodeup && AmHelper.IsReplayRunning(serverName))
                        {
                            this.DbTrace.Debug("Attempting Dismount through active manager", new object[0]);
                            modeOfDismount = AmDbAction.DismountMode.ThroughReplayService;
                            AmDbAction.DismountDatabaseDirect(serverName, this.DatabaseGuid, flags, this.ActionCode);
                            return;
                        }
                        this.DbTrace.Debug("Attempting dismount by directly RPCing to store", new object[0]);
                        modeOfDismount = AmDbAction.DismountMode.DirectlyToStore;
                        AmStoreHelper.RemoteDismount(serverName, this.DatabaseGuid, flags, true);
                    }, bestEffortDismountTimeout);
                    this.DbTrace.Debug("Database is possibly dismounted at server {0}", new object[]
                    {
                        serverName
                    });
                });
                if (exception != null)
                {
                    this.DbTrace.Debug("Dismount failed with error: {0}", new object[]
                    {
                        exception
                    });
                }
                flag = false;
            }
            finally
            {
                stopwatch.Stop();
                string text = null;
                if (flag)
                {
                    text = ReplayStrings.UnknownError;
                }
                else if (exception != null)
                {
                    text = exception.Message;
                }
                if (string.IsNullOrEmpty(text))
                {
                    result = true;
                    ReplayCrimsonEvents.StoreDismountSuccess.LogGeneric(this.PrepareSubactionArgs(new object[]
                    {
                        serverName,
                        modeOfDismount,
                        stopwatch.Elapsed
                    }));
                    if (AmServerName.IsEqual(this.State.ActiveServer, serverName))
                    {
                        this.WriteStateDismountFinished(true, MountStatus.Dismounted, false);
                    }
                }
                else
                {
                    ReplayCrimsonEvents.StoreDismountFailed.LogGeneric(this.PrepareSubactionArgs(new object[]
                    {
                        serverName,
                        modeOfDismount,
                        stopwatch.Elapsed,
                        text
                    }));
                    if (AmServerName.IsEqual(this.State.ActiveServer, serverName))
                    {
                        this.WriteStateDismountFinished(true, mountStatus, false);
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 5
0
 // Token: 0x06000497 RID: 1175 RVA: 0x000189A4 File Offset: 0x00016BA4
 internal static void RemoteDismount(AmServerName serverName, Guid mdbGuid)
 {
     AmStoreHelper.RemoteDismount(serverName, mdbGuid, UnmountFlags.SkipCacheFlush, true);
 }