Exemple #1
0
        protected override bool IsIndexStale(IndexStats indexesStat, IStorageActionsAccessor actions, bool isIdle, Reference<bool> onlyFoundIdleWork)
        {
            var isStale = actions.Staleness.IsMapStale(indexesStat.Id);
            var indexingPriority = indexesStat.Priority;
            if (isStale == false)
                return false;

            if (indexingPriority == IndexingPriority.None)
                return true;

            if ((indexingPriority & IndexingPriority.Normal) == IndexingPriority.Normal)
            {
                onlyFoundIdleWork.Value = false;
                return true;
            }

            if ((indexingPriority & (IndexingPriority.Disabled | IndexingPriority.Error)) != IndexingPriority.None)
                return false;

            if (isIdle == false)
                return false; // everything else is only valid on idle runs

            if ((indexingPriority & IndexingPriority.Idle) == IndexingPriority.Idle)
                return true;

            if ((indexingPriority & IndexingPriority.Abandoned) == IndexingPriority.Abandoned)
            {
                var timeSinceLastIndexing = (SystemTime.UtcNow - indexesStat.LastIndexingTime);

                return (timeSinceLastIndexing > context.Configuration.TimeToWaitBeforeRunningAbandonedIndexes);
            }

            throw new InvalidOperationException("Unknown indexing priority for index " + indexesStat.Id + ": " + indexesStat.Priority);
        }
Exemple #2
0
		protected override IndexToWorkOn GetIndexToWorkOn(IndexStats indexesStat)
		{
			return new IndexToWorkOn
			{
				IndexName = indexesStat.Name,
				LastIndexedEtag = indexesStat.LastReducedEtag ?? Guid.Empty
			};
		}
Exemple #3
0
 private string GetIndexGroup(IndexStats index)
 {
     if (index.ForEntityName.Count == 1)
     {
         return(index.ForEntityName.First());
     }
     return("Others");
 }
		protected override IndexToWorkOn GetIndexToWorkOn(IndexStats indexesStat)
		{
			return new IndexToWorkOn
			{
				IndexName = indexesStat.Name,
				LastIndexedEtag = indexesStat.LastIndexedEtag
			};
		}
Exemple #5
0
		protected override IndexToWorkOn GetIndexToWorkOn(IndexStats indexesStat)
		{
			return new IndexToWorkOn
			{
				IndexId = indexesStat.Id,
				LastIndexedEtag = indexesStat.LastIndexedEtag,
				LastIndexedTimestamp = indexesStat.LastIndexedTimestamp
			};
		}
 public void CopyFrom(IndexStats indexStats)
 {
     // TODO: Use automapper.
     this.IndexingAttempts = indexStats.IndexingAttempts;
     this.IndexingErrors = indexStats.IndexingErrors;
     this.IndexingSuccesses = indexStats.IndexingSuccesses;
     this.LastIndexedEtag = indexStats.LastIndexedEtag;
     this.LastIndexedTimestamp = indexStats.LastIndexedTimestamp;
     this.LastQueryTimestamp = indexStats.LastQueryTimestamp;
     this.LastReducedEtag = indexStats.LastReducedEtag;
     this.LastReducedTimestamp = indexStats.LastReducedTimestamp;
     this.Name = indexStats.Name;
     //this.Performance = indexStats.Performance;
     this.ReduceIndexingAttempts = indexStats.ReduceIndexingAttempts;
     this.ReduceIndexingErrors = indexStats.ReduceIndexingErrors;
     this.ReduceIndexingSuccesses = indexStats.ReduceIndexingSuccesses;
     this.TouchCount = indexStats.TouchCount;
 }
Exemple #7
0
        private string GetIndexGroup(IndexStats index)
        {
            if (UseGrouping.Value == false)
            {
                return("Indexes");
            }
            if (index.ForEntityName == null)
            {
                return("Others");
            }
            if (index.ForEntityName.Count == 1)
            {
                var first = index.ForEntityName.First();
                if (first != null)
                {
                    return(first);
                }
            }

            return("Others");
        }
		protected override bool IsIndexStale(IndexStats indexesStat, IStorageActionsAccessor actions)
		{
			return actions.Staleness.IsReduceStale(indexesStat.Name);
		}
 protected abstract bool IsValidIndex(IndexStats indexesStat);
 protected abstract bool IsIndexStale(IndexStats indexesStat, IStorageActionsAccessor actions, bool isIdle, Reference<bool> onlyFoundIdleWork);
 protected abstract IndexToWorkOn GetIndexToWorkOn(IndexStats indexesStat);
Exemple #12
0
		protected override bool IsValidIndex(IndexStats indexesStat)
		{
			return true;
		}
Exemple #13
0
		private string GetIndexGroup(IndexStats index)
		{
			if (UseGrouping.Value == false)
				return "Indexes";
			if (index.ForEntityName == null)
				return "Others";
			if (index.ForEntityName.Count == 1)
			{
				var first = index.ForEntityName.First();
				if (first != null)
					return first;
			}

			return "Others";
		}
		protected override IndexToWorkOn GetIndexToWorkOn(IndexStats indexesStat)
		{
			return new IndexToWorkOn
			{
				IndexId = indexesStat.Id,
				LastIndexedEtag = Etag.Empty
			};
		}
Exemple #15
0
		private string GetIndexGroup(IndexStats index)
		{
			if (index.ForEntityName.Count == 1)
				return index.ForEntityName.First();
			return "Others";
		}
Exemple #16
0
		protected override bool IsIndexStale(IndexStats indexesStat, IStorageActionsAccessor actions, bool isIdle, Reference<bool> onlyFoundIdleWork)
		{
			onlyFoundIdleWork.Value = false;
			return actions.Staleness.IsReduceStale(indexesStat.Name);
		}
		protected abstract bool IsIndexStale(IndexStats indexesStat, IStorageActionsAccessor actions);
Exemple #18
0
		protected override bool IsValidIndex(IndexStats indexesStat)
		{
			var indexDefinition = context.IndexDefinitionStorage.GetIndexDefinition(indexesStat.Name);
			return indexDefinition != null && indexDefinition.IsMapReduce;
		}
Exemple #19
0
		protected override bool IsIndexStale(IndexStats indexesStat, IStorageActionsAccessor actions, bool isIdle, Reference<bool> onlyFoundIdleWork)
		{
			onlyFoundIdleWork.Value = false;
			var isReduceStale = actions.Staleness.IsReduceStale(indexesStat.Id);

			if (isReduceStale == false)
				return false;

			if (indexesStat.Priority.HasFlag(IndexingPriority.Error))
				return false;

			return true;
		}