Package org.apache.solr.update
Class SolrCoreState
- java.lang.Object
-
- org.apache.solr.update.SolrCoreState
-
- Direct Known Subclasses:
DefaultSolrCoreState
public abstract class SolrCoreState extends Object
The state in this class can be easily shared between SolrCores across SolrCore reloads.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SolrCoreState.CoreIsClosedException
static interface
SolrCoreState.IndexWriterCloser
-
Field Summary
Fields Modifier and Type Field Description protected boolean
closed
-
Constructor Summary
Constructors Constructor Description SolrCoreState()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
cancelRecovery()
abstract void
close(SolrCoreState.IndexWriterCloser closer)
abstract void
closeIndexWriter(SolrCore core, boolean rollback)
Expert method that closes the IndexWriter - you must callopenIndexWriter(SolrCore)
in a finally block after calling this method.boolean
decrefSolrCoreState(SolrCoreState.IndexWriterCloser closer)
void
deregisterInFlightUpdate()
De-registers in-flight update requests to this core (marks them as completed)abstract void
doRecovery(CoreContainer cc, CoreDescriptor cd)
abstract Lock
getCommitLock()
abstract DirectoryFactory
getDirectoryFactory()
abstract RefCounted<org.apache.lucene.index.IndexWriter>
getIndexWriter(SolrCore core)
Get the current IndexWriter.abstract boolean
getLastReplicateIndexSuccess()
abstract ActionThrottle
getLeaderThrottle()
abstract org.apache.lucene.search.Sort
getMergePolicySort()
Get the current Sort of the current IndexWriter's MergePolicy..abstract Lock
getRecoveryLock()
abstract RecoveryStrategy.Builder
getRecoveryStrategyBuilder()
Object
getReloadLock()
Throwable
getTragicException()
Object
getUpdateLock()
void
increfSolrCoreState()
abstract void
newIndexWriter(SolrCore core, boolean rollback)
Force the creation of a new IndexWriter using the settings from the given SolrCore.abstract void
openIndexWriter(SolrCore core)
Expert method that opens the IndexWriter - you must callcloseIndexWriter(SolrCore, boolean)
first, and then call this method in a finally block.void
pauseUpdatesAndAwaitInflightRequests()
Pauses all update requests to this core and waits (indefinitely) for all in-flight update requests to finishboolean
registerInFlightUpdate()
Registers in-flight update requests to this core.abstract void
rollbackIndexWriter(SolrCore core)
Rollback the current IndexWriter.abstract void
setLastReplicateIndexSuccess(boolean success)
-
-
-
Method Detail
-
getUpdateLock
public Object getUpdateLock()
-
getReloadLock
public Object getReloadLock()
-
increfSolrCoreState
public void increfSolrCoreState()
-
decrefSolrCoreState
public boolean decrefSolrCoreState(SolrCoreState.IndexWriterCloser closer)
-
pauseUpdatesAndAwaitInflightRequests
public void pauseUpdatesAndAwaitInflightRequests() throws TimeoutException, InterruptedException
Pauses all update requests to this core and waits (indefinitely) for all in-flight update requests to finish- Throws:
TimeoutException
InterruptedException
-
registerInFlightUpdate
public boolean registerInFlightUpdate()
Registers in-flight update requests to this core.- Returns:
- true if request was registered, false if update requests are paused
-
deregisterInFlightUpdate
public void deregisterInFlightUpdate()
De-registers in-flight update requests to this core (marks them as completed)
-
getCommitLock
public abstract Lock getCommitLock()
-
newIndexWriter
public abstract void newIndexWriter(SolrCore core, boolean rollback) throws IOException
Force the creation of a new IndexWriter using the settings from the given SolrCore.- Parameters:
rollback
- close IndexWriter if false, else rollback- Throws:
IOException
- If there is a low-level I/O error.
-
closeIndexWriter
public abstract void closeIndexWriter(SolrCore core, boolean rollback) throws IOException
Expert method that closes the IndexWriter - you must callopenIndexWriter(SolrCore)
in a finally block after calling this method.- Parameters:
core
- that the IW belongs torollback
- true if IW should rollback rather than close- Throws:
IOException
- If there is a low-level I/O error.
-
openIndexWriter
public abstract void openIndexWriter(SolrCore core) throws IOException
Expert method that opens the IndexWriter - you must callcloseIndexWriter(SolrCore, boolean)
first, and then call this method in a finally block.- Parameters:
core
- that the IW belongs to- Throws:
IOException
- If there is a low-level I/O error.
-
getIndexWriter
public abstract RefCounted<org.apache.lucene.index.IndexWriter> getIndexWriter(SolrCore core) throws IOException
Get the current IndexWriter. If a new IndexWriter must be created, use the settings from the givenSolrCore
.- Throws:
IOException
- If there is a low-level I/O error.
-
rollbackIndexWriter
public abstract void rollbackIndexWriter(SolrCore core) throws IOException
Rollback the current IndexWriter. When creating the new IndexWriter use the settings from the givenSolrCore
.- Throws:
IOException
- If there is a low-level I/O error.
-
getMergePolicySort
public abstract org.apache.lucene.search.Sort getMergePolicySort() throws IOException
Get the current Sort of the current IndexWriter's MergePolicy..- Throws:
IOException
- If there is a low-level I/O error.
-
getDirectoryFactory
public abstract DirectoryFactory getDirectoryFactory()
- Returns:
- the
DirectoryFactory
that should be used.
-
getRecoveryStrategyBuilder
public abstract RecoveryStrategy.Builder getRecoveryStrategyBuilder()
- Returns:
- the
RecoveryStrategy.Builder
that should be used.
-
doRecovery
public abstract void doRecovery(CoreContainer cc, CoreDescriptor cd)
-
cancelRecovery
public abstract void cancelRecovery()
-
close
public abstract void close(SolrCoreState.IndexWriterCloser closer)
-
getLeaderThrottle
public abstract ActionThrottle getLeaderThrottle()
- Returns:
- throttle to limit how fast a core attempts to become leader
-
getLastReplicateIndexSuccess
public abstract boolean getLastReplicateIndexSuccess()
-
setLastReplicateIndexSuccess
public abstract void setLastReplicateIndexSuccess(boolean success)
-
getRecoveryLock
public abstract Lock getRecoveryLock()
-
getTragicException
public Throwable getTragicException() throws IOException
- Throws:
IOException
-
-