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); }
protected override IndexToWorkOn GetIndexToWorkOn(IndexStats indexesStat) { return new IndexToWorkOn { IndexName = indexesStat.Name, LastIndexedEtag = indexesStat.LastReducedEtag ?? Guid.Empty }; }
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 }; }
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; }
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);
protected override bool IsValidIndex(IndexStats indexesStat) { return true; }
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 }; }
private string GetIndexGroup(IndexStats index) { if (index.ForEntityName.Count == 1) return index.ForEntityName.First(); return "Others"; }
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);
protected override bool IsValidIndex(IndexStats indexesStat) { var indexDefinition = context.IndexDefinitionStorage.GetIndexDefinition(indexesStat.Name); return indexDefinition != null && indexDefinition.IsMapReduce; }
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; }