예제 #1
0
        protected override void HandleCommitPoints(IndexedItemsInfo itemsInfo, IndexSegmentsInfo segmentsInfo)
        {
            if (ShouldStoreCommitPoint(itemsInfo) && itemsInfo.HighestETag != null)
            {
                context.IndexStorage.StoreCommitPoint(indexId.ToString(), new IndexCommitPoint
                {
                    HighestCommitedETag = itemsInfo.HighestETag,
                    TimeStamp           = LastIndexTime,
                    SegmentsInfo        = segmentsInfo ?? IndexStorage.GetCurrentSegmentsInfo(indexDefinition.Name, directory)
                });

                LastCommitPointStoreTime = SystemTime.UtcNow;
            }
            else if (itemsInfo.DeletedKeys != null && directory is RAMDirectory == false)
            {
                context.IndexStorage.AddDeletedKeysToCommitPoints(indexDefinition, itemsInfo.DeletedKeys);
            }
        }
예제 #2
0
		protected bool Equals(IndexSegmentsInfo other)
		{
			var theSameNumberOfItems = ReferencedFiles.Count == other.ReferencedFiles.Count;
			var theSameReferencedFiles = true;

			if (theSameNumberOfItems)
			{
				if (ReferencedFiles.Any(file => other.ReferencedFiles.Contains(file) == false))
					theSameReferencedFiles = false;
			}
			else
				theSameReferencedFiles = false;

			return theSameReferencedFiles &&
				Generation == other.Generation &&
				string.Equals(SegmentsFileName, other.SegmentsFileName) &&
				IsIndexCorrupted.Equals(other.IsIndexCorrupted);
		}
예제 #3
0
        protected bool Equals(IndexSegmentsInfo other)
        {
            var theSameNumberOfItems   = ReferencedFiles.Count == other.ReferencedFiles.Count;
            var theSameReferencedFiles = true;

            if (theSameNumberOfItems)
            {
                if (ReferencedFiles.Any(file => other.ReferencedFiles.Contains(file) == false))
                {
                    theSameReferencedFiles = false;
                }
            }
            else
            {
                theSameReferencedFiles = false;
            }

            return(theSameReferencedFiles &&
                   Generation == other.Generation &&
                   string.Equals(SegmentsFileName, other.SegmentsFileName) &&
                   IsIndexCorrupted.Equals(other.IsIndexCorrupted));
        }
예제 #4
0
        private IndexSegmentsInfo GetCurrentSegmentsInfo()
        {
            var segmentInfos = new SegmentInfos();
            var result       = new IndexSegmentsInfo();

            try
            {
                segmentInfos.Read(directory);

                result.Generation       = segmentInfos.Generation;
                result.SegmentsFileName = segmentInfos.GetCurrentSegmentFileName();
                result.ReferencedFiles  = segmentInfos.Files(directory, false);
            }
            catch (CorruptIndexException ex)
            {
                logIndexing.WarnException(string.Format("Could not read segment information for an index '{0}'", indexId), ex);

                result.IsIndexCorrupted = true;
            }

            return(result);
        }
예제 #5
0
		protected override void HandleCommitPoints(IndexedItemsInfo itemsInfo, IndexSegmentsInfo segmentsInfo)
		{
			if (ShouldStoreCommitPoint(itemsInfo) && itemsInfo.HighestETag != null)
			{
				context.IndexStorage.StoreCommitPoint(indexId.ToString(), new IndexCommitPoint
				{
					HighestCommitedETag = itemsInfo.HighestETag,
					TimeStamp = LastIndexTime,
					SegmentsInfo = segmentsInfo ?? IndexStorage.GetCurrentSegmentsInfo(indexDefinition.Name, directory)
				});

				LastCommitPointStoreTime = SystemTime.UtcNow;
			}
			else if (itemsInfo.DeletedKeys != null && directory is RAMDirectory == false)
			{
				context.IndexStorage.AddDeletedKeysToCommitPoints(indexDefinition, itemsInfo.DeletedKeys);
			}
		}
예제 #6
0
        public static IndexSegmentsInfo GetCurrentSegmentsInfo(string indexName, Lucene.Net.Store.Directory directory)
        {
            var segmentInfos = new SegmentInfos();
            var result = new IndexSegmentsInfo();

            try
            {
                segmentInfos.Read(directory);

                result.Generation = segmentInfos.Generation;
                result.SegmentsFileName = segmentInfos.GetCurrentSegmentFileName();
                result.ReferencedFiles = segmentInfos.Files(directory, false);
            }
            catch (CorruptIndexException ex)
            {
                log.WarnException(string.Format("Could not read segment information for an index '{0}'", indexName), ex);

                result.IsIndexCorrupted = true;
            }

            return result;
        }
예제 #7
0
파일: Index.cs 프로젝트: jon-adams/ravendb
		protected abstract void HandleCommitPoints(IndexedItemsInfo itemsInfo, IndexSegmentsInfo segmentsInfo);
예제 #8
0
		protected override void HandleCommitPoints(IndexedItemsInfo itemsInfo, IndexSegmentsInfo segmentsInfo)
		{
			// MapReduce index does not store and use any commit points
		}
예제 #9
0
 protected override void HandleCommitPoints(IndexedItemsInfo itemsInfo, IndexSegmentsInfo segmentsInfo)
 {
     // MapReduce index does not store and use any commit points
 }