Beispiel #1
0
        public DocumentsWriterPerThread(string segmentName, Directory directory, LiveIndexWriterConfig indexWriterConfig, InfoStream infoStream, DocumentsWriterDeleteQueue deleteQueue, FieldInfos.Builder fieldInfos)
        {
            this.directoryOrig       = directory;
            this.directory           = new TrackingDirectoryWrapper(directory);
            this.fieldInfos          = fieldInfos;
            this.indexWriterConfig   = indexWriterConfig;
            this.infoStream          = infoStream;
            this.codec               = indexWriterConfig.Codec;
            this.docState            = new DocState(this, infoStream);
            this.docState.similarity = indexWriterConfig.Similarity;
            bytesUsed          = Counter.NewCounter();
            byteBlockAllocator = new DirectTrackingAllocator(bytesUsed);
            pendingUpdates     = new BufferedUpdates();
            intBlockAllocator  = new Int32BlockAllocator(bytesUsed);
            this.deleteQueue   = deleteQueue;
            Debug.Assert(numDocsInRAM == 0, "num docs " + numDocsInRAM);
            pendingUpdates.Clear();
            deleteSlice = deleteQueue.NewSlice();

            segmentInfo = new SegmentInfo(directoryOrig, Constants.LUCENE_MAIN_VERSION, segmentName, -1, false, codec, null);
            Debug.Assert(numDocsInRAM == 0);
            if (INFO_VERBOSE && infoStream.IsEnabled("DWPT"))
            {
                infoStream.Message("DWPT", Thread.CurrentThread.Name + " init seg=" + segmentName + " delQueue=" + deleteQueue);
            }
            // this should be the last call in the ctor
            // it really sucks that we need to pull this within the ctor and pass this ref to the chain!
            consumer = indexWriterConfig.IndexingChain.GetChain(this);
        }
Beispiel #2
0
 /// <summary>
 /// Called by <see cref="DocumentsWriter"/> to initialize the <see cref="FlushPolicy"/>
 /// </summary>
 protected internal virtual void Init(LiveIndexWriterConfig indexWriterConfig)
 {
     lock (this)
     {
         this.m_indexWriterConfig = indexWriterConfig;
         m_infoStream             = indexWriterConfig.InfoStream;
     }
 }
Beispiel #3
0
 internal DocumentsWriter(IndexWriter writer, LiveIndexWriterConfig config, Directory directory)
 {
     this.directory     = directory;
     this.config        = config;
     this.infoStream    = config.InfoStream;
     this.perThreadPool = config.IndexerThreadPool;
     flushPolicy        = config.FlushPolicy;
     this.writer        = writer;
     this.events        = new ConcurrentQueue <IEvent>();
     flushControl       = new DocumentsWriterFlushControl(this, config, writer.bufferedUpdatesStream);
 }
Beispiel #4
0
 internal DocumentsWriterFlushControl(DocumentsWriter documentsWriter, LiveIndexWriterConfig config, BufferedUpdatesStream bufferedUpdatesStream)
 {
     this.infoStream            = config.InfoStream;
     this.stallControl          = new DocumentsWriterStallControl();
     this.perThreadPool         = documentsWriter.perThreadPool;
     this.flushPolicy           = documentsWriter.flushPolicy;
     this.config                = config;
     this.hardMaxBytesPerDWPT   = config.RAMPerThreadHardLimitMB * 1024 * 1024;
     this.documentsWriter       = documentsWriter;
     this.bufferedUpdatesStream = bufferedUpdatesStream;
 }
Beispiel #5
0
 /// <summary>
 /// Called by <see cref="DocumentsWriter"/> to initialize the <see cref="FlushPolicy"/>
 /// </summary>
 protected internal virtual void Init(LiveIndexWriterConfig indexWriterConfig)
 {
     UninterruptableMonitor.Enter(this);
     try
     {
         this.m_indexWriterConfig = indexWriterConfig;
         m_infoStream             = indexWriterConfig.InfoStream;
     }
     finally
     {
         UninterruptableMonitor.Exit(this);
     }
 }