public static BlockedReason CombineWith(this BlockedReason reason, BlockedReason other)
        {
            switch (reason)
            {
            case BlockedReason.WRITER_SCALING:
                throw new ArgumentException("Cannot be combined");

            case BlockedReason.NO_ACTIVE_DRIVER_GROUP:
                return(other);

            case BlockedReason.SPLIT_QUEUES_FULL:
                return
                    (other == BlockedReason.SPLIT_QUEUES_FULL || other == BlockedReason.NO_ACTIVE_DRIVER_GROUP ?
                     BlockedReason.SPLIT_QUEUES_FULL :
                     BlockedReason.MIXED_SPLIT_QUEUES_FULL_AND_WAITING_FOR_SOURCE);

            case BlockedReason.WAITING_FOR_SOURCE:
                return
                    (other == BlockedReason.WAITING_FOR_SOURCE || other == BlockedReason.NO_ACTIVE_DRIVER_GROUP ?
                     BlockedReason.WAITING_FOR_SOURCE :
                     BlockedReason.MIXED_SPLIT_QUEUES_FULL_AND_WAITING_FOR_SOURCE);

            case BlockedReason.MIXED_SPLIT_QUEUES_FULL_AND_WAITING_FOR_SOURCE:
                return(BlockedReason.MIXED_SPLIT_QUEUES_FULL_AND_WAITING_FOR_SOURCE);

            default:
                throw new ArgumentException($"Unknown blocked reason: {other}.");
            }
        }
Exemplo n.º 2
0
		private static string GetResponseErrorMessage(BlockedReason blockedReason)
		{
			string failedReason;
			switch (blockedReason)
			{
			case BlockedReason.BySelf:
				failedReason = Strings.FailBecauseOfSelf;
				break;
			case BlockedReason.ByTenant:
				failedReason = Strings.FailBecauseOfTenant;
				break;
			case BlockedReason.ByServer:
				failedReason = Strings.FailBecauseOfServer;
				break;
			default:
				throw new InvalidOperationException(string.Format("DEV Code Bug. Unexpected blocked reason {0}", blockedReason));
			}
			return Strings.RequestBeingBlockedInFailFast(failedReason);
		}
 // Token: 0x06000044 RID: 68 RVA: 0x0000310B File Offset: 0x0000130B
 internal override bool IsUserInCache(string userToken, string userTenant, out string cacheKey, out FailFastUserCacheValue cacheValue, out BlockedReason blockedReason)
 {
     throw new NotSupportedException("The IsUserBlocked should not be invoked from PassiveFailFastUserCache.");
 }
 internal override bool IsUserInCache(string userToken, string userTenant, out string cacheKey, out FailFastUserCacheValue cacheValue, out BlockedReason blockedReason)
 {
     cacheKey      = null;
     cacheValue    = null;
     blockedReason = BlockedReason.None;
     if (!FailFastUserCache.FailFastEnabled)
     {
         return(false);
     }
     Logger.EnterFunction(ExTraceGlobals.FailFastCacheTracer, "PrimaryFailFastUserCache.IsUserBlocked.");
     if (base.TryGetValue(userToken, out cacheValue) && cacheValue.IsValid)
     {
         blockedReason = BlockedReason.BySelf;
         cacheKey      = userToken;
         Logger.TraceDebug(ExTraceGlobals.FailFastCacheTracer, "User key {0} exist. CachedValue: {1}", new object[]
         {
             userToken,
             cacheValue.ToString()
         });
         return(true);
     }
     if (!string.IsNullOrEmpty(userTenant))
     {
         string text = "Tenant:C8E2A9F6-0E7A-4bcc-95A0-9CE1BCA7EE68:" + userTenant;
         if (base.TryGetValue(text, out cacheValue) && cacheValue.IsValid)
         {
             cacheKey      = text;
             blockedReason = BlockedReason.ByTenant;
             Logger.TraceDebug(ExTraceGlobals.FailFastCacheTracer, "Tenant Key {0} exist. CachedValue: {1}", new object[]
             {
                 text,
                 cacheValue.ToString()
             });
             return(true);
         }
     }
     if (base.TryGetValue("AllUsers:D3511BCA-379C-4a38-97E5-0FDA0C231C33", out cacheValue) && cacheValue.IsValid)
     {
         blockedReason = BlockedReason.ByServer;
         cacheKey      = "AllUsers:D3511BCA-379C-4a38-97E5-0FDA0C231C33";
         Logger.TraceDebug(ExTraceGlobals.FailFastCacheTracer, "All User Key {0} exist. CacheValue: {1}", new object[]
         {
             "AllUsers:D3511BCA-379C-4a38-97E5-0FDA0C231C33",
             cacheValue.ToString()
         });
         return(true);
     }
     Logger.ExitFunction(ExTraceGlobals.FailFastCacheTracer, "PrimaryFailFastUserCache.IsUserBlocked.");
     return(false);
 }
 // Token: 0x06000024 RID: 36
 internal abstract bool IsUserInCache(string userToken, string userTenant, out string cacheKey, out FailFastUserCacheValue cacheValue, out BlockedReason blockedReason);
 // Token: 0x06000006 RID: 6 RVA: 0x000021D0 File Offset: 0x000003D0
 internal static bool ShouldFailFastUserInCache(string userToken, string cacheKey, FailFastUserCacheValue cacheValue, BlockedReason blockedReason)
 {
     Logger.EnterFunction(ExTraceGlobals.FailFastModuleTracer, "ConnectedUserManager.ShouldFailFastUserInCache");
     if (blockedReason == BlockedReason.BySelf)
     {
         if (cacheValue.HitCount >= 3)
         {
             Logger.TraceDebug(ExTraceGlobals.FailFastModuleTracer, "User {0} is considered fail-fast because blocked reason is Self. cacheValue: {1}", new object[]
             {
                 userToken,
                 cacheValue
             });
             return(true);
         }
         return(false);
     }
     else
     {
         bool flag;
         if (!ConnectedUserManager.connectedUserCache.TryGetValue(userToken, out flag))
         {
             Logger.TraceDebug(ExTraceGlobals.FailFastModuleTracer, "User {0} is considered fail-fast because he is not in connected user cache.", new object[]
             {
                 userToken
             });
             return(true);
         }
         Logger.ExitFunction(ExTraceGlobals.FailFastModuleTracer, "ConnectedUserManager.ShouldFailFastUserInCache");
         return(false);
     }
 }
Exemplo n.º 7
0
        public OperatorStats(
            int pipelineId,
            int operatorId,
            PlanNodeId planNodeId,
            string operatorType,

            long totalDrivers,

            long addInputCalls,
            TimeSpan addInputWall,
            TimeSpan addInputCpu,
            TimeSpan addInputUser,
            DataSize inputDataSize,
            long inputPositions,
            double sumSquaredInputPositions,

            long getOuputCalls,
            TimeSpan getOutputWall,
            TimeSpan getOutputCpu,
            TimeSpan getOutputUser,
            DataSize outputDataSize,
            long outputPositions,

            DataSize physicalWrittenDataSize,

            TimeSpan blockedWall,

            long finishCalls,
            TimeSpan finishWall,
            TimeSpan finishCpu,
            TimeSpan finishUser,

            DataSize userMemoryReservation,
            DataSize revocableMemoryReservation,
            DataSize systemMemoryReservation,
            BlockedReason blockedReason,

            dynamic info
            )
        {
            ParameterCheck.OutOfRange(operatorId >= 0, "Operator id cannot be negative.");
            ParameterCheck.NotNullOrEmpty(operatorType, "operatorType");
            ParameterCheck.OutOfRange(inputPositions >= 0, "inputPositions", "Input positions cannot be negative.");
            ParameterCheck.OutOfRange(outputPositions >= 0, "outputPositions", "Output positions cannot be negative.");

            this.OperatorId   = operatorId;
            this.PlanNodeId   = planNodeId ?? throw new ArgumentNullException("planNodeId");
            this.OperatorType = operatorType;

            this.TotalDrivers = totalDrivers;

            this.AddInputCalls            = addInputCalls;
            this.AddInputWall             = addInputWall;
            this.AddInputCpu              = addInputCpu;
            this.AddInputUser             = addInputUser;
            this.InputDataSize            = inputDataSize ?? throw new ArgumentNullException("inputDataSize");
            this.InputPositions           = inputPositions;
            this.SumSquaredInputPositions = sumSquaredInputPositions;

            this.GetOutputCalls  = getOuputCalls;
            this.GetOutputWall   = getOutputWall;
            this.GetOutputCpu    = getOutputCpu;
            this.GetOutputUser   = getOutputUser;
            this.OutputDataSize  = outputDataSize ?? throw new ArgumentNullException("outputDataSize");
            this.OutputPositions = outputPositions;

            this.PhysicalWrittenDataSize = physicalWrittenDataSize ?? throw new ArgumentNullException("physicalWrittenDataSize");

            this.BlockedWall = blockedWall;

            this.FinishCalls = finishCalls;
            this.FinishWall  = finishWall;
            this.FinishCpu   = finishCpu;
            this.FinishUser  = finishUser;

            this.UserMemoryReservation      = userMemoryReservation ?? throw new ArgumentNullException("userMemoryReservation");
            this.RevocableMemoryReservation = revocableMemoryReservation ?? throw new ArgumentNullException("revocableMemoryReservation");
            this.SystemMemoryReservation    = systemMemoryReservation ?? throw new ArgumentNullException("systemMemoryReservation");
            this.BlockedReason = blockedReason;

            this.Info = info;
        }
 public MovementBlockedEventArgs(UnitEventType eventType, Unit subjectUnit, BlockedReason reason) : base(eventType, new [] { subjectUnit.CurrentLocation })
 {
     Reason = reason;
 }