コード例 #1
0
 public override void OnDelete(DocumentsWriterFlushControl control, ThreadState state)
 {
     if (FlushOnDeleteTerms)
     {
         // Flush this state by num del terms
         int maxBufferedDeleteTerms = m_indexWriterConfig.MaxBufferedDeleteTerms;
         if (control.NumGlobalTermDeletes >= maxBufferedDeleteTerms)
         {
             control.SetApplyAllDeletes();
         }
     }
     if ((FlushOnRAM && control.DeleteBytesUsed > (1024 * 1024 * m_indexWriterConfig.RAMBufferSizeMB)))
     {
         control.SetApplyAllDeletes();
         if (m_infoStream.IsEnabled("FP"))
         {
             m_infoStream.Message("FP", "force apply deletes bytesUsed=" + control.DeleteBytesUsed + " vs ramBuffer=" + (1024 * 1024 * m_indexWriterConfig.RAMBufferSizeMB));
         }
     }
 }
コード例 #2
0
 public override void OnInsert(DocumentsWriterFlushControl control, ThreadState state)
 {
     if (FlushOnDocCount && state.dwpt.NumDocsInRAM >= m_indexWriterConfig.MaxBufferedDocs)
     {
         // Flush this state by num docs
         control.SetFlushPending(state);
     } // flush by RAM
     else if (FlushOnRAM)
     {
         long limit    = (long)(m_indexWriterConfig.RAMBufferSizeMB * 1024d * 1024d);
         long totalRam = control.ActiveBytes + control.DeleteBytesUsed;
         if (totalRam >= limit)
         {
             if (m_infoStream.IsEnabled("FP"))
             {
                 m_infoStream.Message("FP", "flush: activeBytes=" + control.ActiveBytes + " deleteBytes=" + control.DeleteBytesUsed + " vs limit=" + limit);
             }
             MarkLargestWriterPending(control, state, totalRam);
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Marks the most ram consuming active <see cref="DocumentsWriterPerThread"/> flush
 /// pending
 /// </summary>
 protected virtual void MarkLargestWriterPending(DocumentsWriterFlushControl control, ThreadState perThreadState, long currentBytesPerThread)
 {
     control.SetFlushPending(FindLargestNonPendingWriter(control, perThreadState));
 }