Class PrimaryNode

java.lang.Object
org.apache.lucene.replicator.nrt.Node
org.apache.lucene.replicator.nrt.PrimaryNode
All Implemented Interfaces:
Closeable, AutoCloseable

public abstract class PrimaryNode extends Node
Node that holds an IndexWriter, indexing documents into its local index.
WARNING: This API is experimental and might change in incompatible ways in the next release.
  • Field Details

    • writer

      protected final IndexWriter writer
    • primaryGen

      protected final long primaryGen
  • Constructor Details

  • Method Details

    • getPrimaryGen

      public long getPrimaryGen()
      Returns the current primary generation, which is incremented each time a new primary is started for this index
    • flushAndRefresh

      public boolean flushAndRefresh() throws IOException
      Flush all index operations to disk and opens a new near-real-time reader. new NRT point, to make the changes visible to searching. Returns true if there were changes.
      Throws:
      IOException
    • getCopyStateVersion

      public long getCopyStateVersion()
    • getLastCommitVersion

      public long getLastCommitVersion()
    • commit

      public void commit() throws IOException
      Specified by:
      commit in class Node
      Throws:
      IOException
    • getCopyState

      public CopyState getCopyState() throws IOException
      IncRef the current CopyState and return it
      Throws:
      IOException
    • releaseCopyState

      public void releaseCopyState(CopyState copyState) throws IOException
      Called once replica is done (or failed) copying an NRT point
      Throws:
      IOException
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in class Node
    • close

      public void close() throws IOException
      Throws:
      IOException
    • preCopyMergedSegmentFiles

      protected abstract void preCopyMergedSegmentFiles(SegmentCommitInfo info, Map<String,FileMetaData> files) throws IOException
      Called when a merge has finished, but before IW switches to the merged segment
      Throws:
      IOException