Ejemplo n.º 1
0
        // Token: 0x060001C2 RID: 450 RVA: 0x0000B6B8 File Offset: 0x000098B8
        internal void LogQueueInfo(AmDbOperation operation)
        {
            string name     = operation.GetType().Name;
            string uniqueId = operation.UniqueId;
            string text     = operation.ToString();
            int    count    = this.m_queue.Count;
            string text2    = "<none>";
            string text3    = "<none>";
            string text4    = "<none>";

            if (this.m_operationServiced != null)
            {
                text2 = this.m_operationServiced.GetType().Name;
                text3 = this.m_operationServiced.UniqueId;
                text4 = this.m_operationServiced.ToString();
            }
            string        text5         = "<none>";
            string        text6         = "<none>";
            string        text7         = "<none>";
            AmDbOperation amDbOperation = this.m_queue.FirstOrDefault <AmDbOperation>();

            if (amDbOperation != null)
            {
                text5 = amDbOperation.GetType().Name;
                text6 = amDbOperation.UniqueId;
                text7 = amDbOperation.ToString();
            }
            ReplayCrimsonEvents.DatabaseOperationSkippedSinceAlreadyActionsQueued.Log <Guid, int, string, string, string, string, string, string, string, string, string>(this.databaseGuid, count, name, uniqueId, text, text2, text3, text4, text5, text6, text7);
        }
 // Token: 0x0600004C RID: 76 RVA: 0x00002BA0 File Offset: 0x00000DA0
 protected void DecrementCounters(AmDbOperation opr)
 {
     if (opr is AmDbMountOperation)
     {
         this.m_mountRequests--;
         return;
     }
     if (opr is AmDbDismountMismountedOperation)
     {
         this.m_dismountRequests--;
         return;
     }
     if (opr is AmDbClusterDatabaseSyncOperation)
     {
         this.m_clusDbSyncRequests--;
         return;
     }
     if (opr is AmDbAdPropertySyncOperation)
     {
         this.m_adSyncRequests--;
         return;
     }
     if (opr is AmDbMoveOperation)
     {
         this.m_moveRequests--;
     }
 }
Ejemplo n.º 3
0
 internal AmDbOperation(IADDatabase db)
 {
     this.Database     = db;
     this.CreationTime = ExDateTime.Now;
     this.Counter      = (long)Interlocked.Increment(ref AmDbOperation.sm_operationCounter);
     this.UniqueId     = AmDbOperation.GenerateUniqueId(this.Database.Guid, this.CreationTime, this.Counter);
 }
Ejemplo n.º 4
0
        internal AmDatabaseMoveResult ConvertDetailedStatusToRpcMoveResult(AmDbOperationDetailedStatus detailedStatus)
        {
            Guid            guid                  = detailedStatus.Database.Guid;
            string          name                  = detailedStatus.Database.Name;
            string          fromServerFqdn        = string.Empty;
            string          finalActiveServerFqdn = string.Empty;
            AmDbMountStatus dbMountStatusAtStart  = AmDbMountStatus.Unknown;
            AmDbMountStatus dbMountStatusAtEnd    = AmDbMountStatus.Unknown;

            if (detailedStatus.InitialDbState != null)
            {
                fromServerFqdn       = detailedStatus.InitialDbState.ActiveServer.Fqdn;
                dbMountStatusAtStart = AmDbOperation.ConvertMountStatusToRpcMountStatus(detailedStatus.InitialDbState.MountStatus);
            }
            if (detailedStatus.FinalDbState != null)
            {
                finalActiveServerFqdn = detailedStatus.FinalDbState.ActiveServer.Fqdn;
                dbMountStatusAtEnd    = AmDbOperation.ConvertMountStatusToRpcMountStatus(detailedStatus.FinalDbState.MountStatus);
            }
            Exception                        lastException = this.LastException;
            RpcErrorExceptionInfo            errorInfo     = AmRpcExceptionWrapper.Instance.ConvertExceptionToErrorExceptionInfo(lastException);
            AmDbMoveStatus                   dbMoveStatus  = AmDbOperation.TranslateExceptionIntoMoveStatusEnum(lastException);
            List <AmDbRpcOperationSubStatus> attemptedServerSubStatuses = (from opSubStatus in detailedStatus.GetAllSubStatuses()
                                                                           select opSubStatus.ConvertToRpcSubStatus()).ToList <AmDbRpcOperationSubStatus>();

            return(new AmDatabaseMoveResult(guid, name, fromServerFqdn, finalActiveServerFqdn, dbMoveStatus, dbMountStatusAtStart, dbMountStatusAtEnd, errorInfo, attemptedServerSubStatuses));
        }
Ejemplo n.º 5
0
 internal void ReportStatus(IADDatabase db, AmDbActionStatus status)
 {
     lock (this.m_statusInfo)
     {
         this.m_statusInfo[status] = ExDateTime.Now;
     }
     if (AmDbOperation.IsCompletionStatus(status) || status == this.CustomStatus)
     {
         this.IsComplete = true;
     }
     if (this.CompletionCallback != null && this.IsComplete && !this.m_isCompletionCalled)
     {
         this.m_isCompletionCalled = true;
         this.CompletionCallback(db);
     }
     if (status == AmDbActionStatus.UpdateMasterServerInitiated)
     {
         ExTraceGlobals.FaultInjectionTracer.TraceTest(2309369149U);
         return;
     }
     if (status == AmDbActionStatus.StoreMountInitiated)
     {
         ExTraceGlobals.FaultInjectionTracer.TraceTest(3383110973U);
     }
 }
Ejemplo n.º 6
0
 // Token: 0x060001C4 RID: 452 RVA: 0x0000B864 File Offset: 0x00009A64
 private void AddNoLock(AmDbOperation op)
 {
     this.m_queue.Enqueue(op);
     if (!this.m_isInUse)
     {
         this.m_isInUse = true;
         ThreadPool.QueueUserWorkItem(new WaitCallback(this.PerformAction));
     }
 }
Ejemplo n.º 7
0
 // Token: 0x06000647 RID: 1607 RVA: 0x0001F148 File Offset: 0x0001D348
 internal void AddOperation(AmDbOperation operation)
 {
     lock (this.locker)
     {
         if (this.Phase != BatchDatabaseOperation.BatchPhase.Initializing)
         {
             throw new InvalidOperationException("Operations cannot be added after Dispatch");
         }
         operation.CompletionCallback = (AmReportCompletionDelegate)Delegate.Combine(operation.CompletionCallback, new AmReportCompletionDelegate(this.OnOperationComplete));
         this.opList.Add(operation);
     }
 }
Ejemplo n.º 8
0
        // Token: 0x060001CB RID: 459 RVA: 0x0000BAF0 File Offset: 0x00009CF0
        internal bool Enqueue(AmDbOperation opr)
        {
            bool result = false;

            lock (this.m_locker)
            {
                if (this.IsEnabled)
                {
                    AmDatabaseOperationQueue operationQueueByGuid = this.GetOperationQueueByGuid(opr.Database.Guid, true);
                    result = operationQueueByGuid.Add(opr, false);
                }
                else
                {
                    opr.Cancel();
                }
            }
            return(result);
        }
Ejemplo n.º 9
0
 // Token: 0x060001C5 RID: 453 RVA: 0x0000B894 File Offset: 0x00009A94
 private void RunOperation(AmDbOperation opr)
 {
     AmTrace.Debug("Running database operation: {0}", new object[]
     {
         opr
     });
     AmFaultInject.SleepIfRequired(opr.Database.Guid, AmSleepTag.GenericDbOperationProcessingDelay);
     opr.Run();
     if (opr.LastException != null)
     {
         AmTrace.Error("Error from database operation {0}\n{1}", new object[]
         {
             opr,
             opr.LastException
         });
         return;
     }
     AmTrace.Debug("Database operation finished: {0}", new object[]
     {
         opr
     });
 }
Ejemplo n.º 10
0
        // Token: 0x060001C3 RID: 451 RVA: 0x0000B79C File Offset: 0x0000999C
        internal void PerformAction(object context)
        {
            AmDbOperation amDbOperation = null;

            for (;;)
            {
                lock (this.m_locker)
                {
                    if (this.m_queue.Count <= 0)
                    {
                        this.m_operationServiced = null;
                        this.m_isInUse           = false;
                        break;
                    }
                    amDbOperation            = this.m_queue.Dequeue();
                    this.m_operationServiced = amDbOperation;
                }
                if (this.IsEnabled)
                {
                    bool flag2 = true;
                    try
                    {
                        amDbOperation.ReportStatus(amDbOperation.Database, AmDbActionStatus.Started);
                        this.RunOperation(amDbOperation);
                        amDbOperation.ReportStatus(amDbOperation.Database, AmDbActionStatus.Completed);
                        flag2 = false;
                        continue;
                    }
                    finally
                    {
                        if (flag2)
                        {
                            amDbOperation.ReportStatus(amDbOperation.Database, AmDbActionStatus.Failed);
                        }
                    }
                }
                amDbOperation.Cancel();
            }
        }
Ejemplo n.º 11
0
        // Token: 0x060001C1 RID: 449 RVA: 0x0000B5DC File Offset: 0x000097DC
        internal bool Add(AmDbOperation op, bool checkIfQueueIdle)
        {
            bool flag = false;

            if (!this.IsEnabled)
            {
                op.Cancel();
                return(false);
            }
            lock (this.m_locker)
            {
                if (!checkIfQueueIdle || this.IsIdle)
                {
                    AmTrace.Debug("AmDatabaseOperationQueue: Add operation {0} into the queue. checkIfQueueIdle:{1}, IsIdle:{2}", new object[]
                    {
                        op.ToString(),
                        checkIfQueueIdle,
                        this.IsIdle
                    });
                    this.AddNoLock(op);
                    flag = true;
                }
                else
                {
                    AmTrace.Debug("AmDatabaseOperationQueue: Skip operation {0}. checkIfQueueIdle:{1}, IsIdle:{2}", new object[]
                    {
                        op.ToString(),
                        checkIfQueueIdle,
                        this.IsIdle
                    });
                    this.LogQueueInfo(op);
                }
                if (!flag)
                {
                    op.Cancel();
                }
            }
            return(flag);
        }
 // Token: 0x06000053 RID: 83 RVA: 0x00002CB3 File Offset: 0x00000EB3
 private void FixDatabaseOperation(AmDbOperation operation)
 {
     operation.CustomStatus       = this.CustomStatus;
     operation.CompletionCallback = (AmReportCompletionDelegate)Delegate.Combine(operation.CompletionCallback, new AmReportCompletionDelegate(this.OnOperationComplete));
 }
 // Token: 0x0600004A RID: 74 RVA: 0x00002B14 File Offset: 0x00000D14
 protected void EnqueueDatabaseOperation(AmDbOperation operation)
 {
     this.m_totalSingleOperationsQueued++;
     this.FixDatabaseOperation(operation);
     this.m_opList.Add(operation);
 }