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); } }
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); }
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)); }
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); }
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; }
protected abstract void HandleCommitPoints(IndexedItemsInfo itemsInfo, IndexSegmentsInfo segmentsInfo);
protected override void HandleCommitPoints(IndexedItemsInfo itemsInfo, IndexSegmentsInfo segmentsInfo) { // MapReduce index does not store and use any commit points }