コード例 #1
0
        /// <summary>
        /// Verify DatabaseStateTransferManager if no task is running/waiting/failed then state transfer is compelted for this database.
        /// </summary>
        /// <returns></returns>
        ///
        private void VerifyDST()
        {
            //bool isComplete = true;
            //StateTxfrStatus dbTaskStatus = StateTxfrStatus.CompletedSuccessfully;
            //foreach (KeyValuePair<String, IStateTransferTask> pair in collectionTasksMap)
            //{
            //    if (pair.Value.Status.Equals(StateTxfrStatus.Failed)) dbTaskStatus = StateTxfrStatus.Failed;

            //    if (pair.Value.Status.Equals(StateTxfrStatus.Waiting) || pair.Value.Status.Equals(StateTxfrStatus.Running))
            //    {
            //        isComplete = false;
            //        break;
            //    }
            //}

            //if (isComplete)
            //{
            //    this.Status = dbTaskStatus;
            if (IsCompleted())
            {
                //this.Status = operation.OpCode == StateTransferOpCode.StateTxferCompeleted ? StateTxfrStatus.CompletedSuccessfully : StateTxfrStatus.Failed;
                if (LoggerManager.Instance.StateXferLogger != null && LoggerManager.Instance.StateXferLogger.IsInfoEnabled)
                {
                    LoggerManager.Instance.StateXferLogger.Info("DBStateTxfrMgr.VerifyDST()", "State transfer of the database " + this.dbName + " completed with status " + this.Status.ToString());
                }

                if (this.dispatcher != null)
                {
                    // in case database tasks  been entertained, notify NodeStateTransferManager about status
                    StateTransferOpCode     opCode      = this.Status == StateTxfrStatus.CompletedSuccessfully ? StateTransferOpCode.StateTxferCompeleted : StateTransferOpCode.StateTxferFailed;
                    IStateTransferOperation dbOperation = CreateStateTransferOperation(opCode);
                    this.dispatcher.DispatchOperation <Object>(dbOperation);
                }
            }
        }
コード例 #2
0
        private IStateTransferOperation CreateStateTransferOperation(StateTransferOpCode stateTransferOpCode)
        {
            StateTransferIdentity   transferIdentity       = new StateTransferIdentity(this.dbName, null, null, this.TransferType, DistributionMethod.None);
            IStateTransferOperation stateTransferOperation = new StateTransferOperation(transferIdentity,
                                                                                        stateTransferOpCode, new OperationParam());

            return(stateTransferOperation);
        }
コード例 #3
0
 public StateTransferOperation(StateTransferIdentity identity, StateTransferOpCode opCode, OperationParam param)
 {
     this.identity = identity;
     this.opCode   = opCode;
     this.param    = param;
 }
コード例 #4
0
 public void Deserialize(Common.Serialization.IO.CompactReader reader)
 {
     identity = (StateTransferIdentity)reader.ReadObject();
     opCode   = (StateTransferOpCode)reader.ReadByte();
     param    = (OperationParam)reader.ReadObject();
 }
コード例 #5
0
        /// <summary>
        /// Get Log Table to be transfered from oplog for bucket being provided
        /// </summary>
        /// <param name="bucketIds"></param>
        /// <param name="isLoggingStopped"></param>
        /// <returns></returns>
        //private ICollection GetLogTable(ArrayList bucketIds, ref bool isLoggingStopped)
        //{
        //    IStateTransferOperation operation = this.CreateStateTransferOperation(StateTransferOpCode.GetLogTable);
        //    operation.Params.SetParamValue(ParamName.BucketList, bucketIds);
        //    operation.Params.SetParamValue(ParamName.IsLoggingStopped, isLoggingStopped);

        //    ICollection vector = _dispatcher.DispatchOperation<ICollection>(operation);
        //    isLoggingStopped = (bool)operation.Params.GetParamValue(ParamName.IsLoggingStopped);

        //    return vector;
        //}

        /// <summary>
        /// Remove Log Table from oplog for provided bucket id
        /// </summary>
        /// <param name="bucketID"></param>
        //private void RemoveLoggedOperations(int bucketID)
        //{
        //    IStateTransferOperation operation = this.CreateStateTransferOperation(StateTransferOpCode.RemoveLoggedOperations);
        //    operation.Params.SetParamValue(ParamName.BucketID, bucketID);

        //    _dispatcher.DispatchOperation<HashVector>(operation);
        //}

        private IStateTransferOperation CreateStateTransferOperation(StateTransferOpCode stateTransferOpCode)
        {
            return(new StateTransferOperation(corresponderIdentity, stateTransferOpCode, new OperationParam()));
        }