Esempio n. 1
0
		private void HandleActiveIndex(UnusedIndexState thisItem, double age, double lastQuery, IStorageActionsAccessor accessor, double timeToWaitForIdle)
		{
			if (age < (timeToWaitForIdle * 2.5) && lastQuery < (1.5 * timeToWaitForIdle))
				return;

			if (age < (timeToWaitForIdle * 6) && lastQuery < (2.5 * timeToWaitForIdle))
				return;

			accessor.Indexing.SetIndexPriority(thisItem.Index.indexId, IndexingPriority.Idle);

			thisItem.Index.Priority = IndexingPriority.Idle;

			documentDatabase.Notifications.RaiseNotifications(new IndexChangeNotification()
			{
				Name = thisItem.Name,
				Type = IndexChangeTypes.IndexDemotedToIdle
			});
		}
Esempio n. 2
0
		private void HandleIdleIndex(double age, double lastQuery, UnusedIndexState thisItem,
											IStorageActionsAccessor accessor)
		{
			// relatively young index, haven't been queried for a while already
			// can be safely removed, probably
			if (age < 90 && lastQuery > 30)
			{
				accessor.Indexing.DeleteIndex(thisItem.Index.indexId, documentDatabase.WorkContext.CancellationToken);
				return;
			}

			if (lastQuery < configuration.TimeToWaitBeforeMarkingIdleIndexAsAbandoned.TotalMinutes)
				return;

			// old enough, and haven't been queried for a while, mark it as abandoned

			accessor.Indexing.SetIndexPriority(thisItem.Index.indexId, IndexingPriority.Abandoned);

			thisItem.Index.Priority = IndexingPriority.Abandoned;

			documentDatabase.Notifications.RaiseNotifications(new IndexChangeNotification()
			{
				Name = thisItem.Name,
				Type = IndexChangeTypes.IndexDemotedToAbandoned
			});
		}