Exemple #1
0
        internal static unsafe PartitionQuorumLossProgress FromNative(IntPtr pointer)
        {
            NativeTypes.FABRIC_PARTITION_QUORUM_LOSS_PROGRESS nativeProgress = *(NativeTypes.FABRIC_PARTITION_QUORUM_LOSS_PROGRESS *)pointer;
            var state = TestCommandStateHelper.FromNative(nativeProgress.State);

            PartitionQuorumLossResult result = null;

            if (nativeProgress.Result != IntPtr.Zero)
            {
                result = new PartitionQuorumLossResult();
                result.CreateFromNative(nativeProgress.Result);
            }

            return(new PartitionQuorumLossProgress(state, result));
        }
        public async Task <PartitionQuorumLossProgress> GetInvokeQuorumLossProgressAsync(
            Guid operationId,
            TimeSpan timeout,
            CancellationToken cancellationToken)
        {
            this.ThrowIfNotReady();
            PartitionQuorumLossProgress progress = null;

            try
            {
                ActionStateBase actionState = await this.MessageProcessor.ProcessGetProgressAsync(operationId, timeout, cancellationToken);

                StepStateNames stateName = actionState.StateProgress.Peek();

                TestCommandProgressState state = FaultAnalysisServiceUtility.ConvertState(actionState, TraceType);
                InvokeQuorumLossState    invokeQuorumLossState = actionState as InvokeQuorumLossState;

                var selectedPartition = new SelectedPartition
                {
                    ServiceName = invokeQuorumLossState.Info.PartitionSelector.ServiceName,
                    PartitionId = invokeQuorumLossState.Info.PartitionId
                };

                PartitionQuorumLossResult result = new PartitionQuorumLossResult(selectedPartition, actionState.ErrorCausingRollback);

                progress = new PartitionQuorumLossProgress(state, result);

                TestabilityTrace.TraceSource.WriteInfo(
                    TraceType,
                    "{0} - {1} progress - {2}, Exception - {3}",
                    operationId,
                    ActionType.InvokeQuorumLoss,
                    progress.Result != null ? progress.Result.SelectedPartition.ToString() : FASConstants.UnavailableMessage,
                    (progress.Result != null && progress.Result.Exception != null) ? progress.Result.Exception.ToString() : FASConstants.UnavailableMessage);
            }
            catch (Exception e)
            {
                TestabilityTrace.TraceSource.WriteWarning(TraceType, "{0} - Exception: {1}", operationId, e.ToString());
                FaultAnalysisServiceUtility.ThrowTransientExceptionIfRetryable(e);

                throw;
            }

            return(progress);
        }
Exemple #3
0
 internal PartitionQuorumLossProgress(TestCommandProgressState state, PartitionQuorumLossResult result)
 {
     this.State  = state;
     this.Result = result;
 }