Package org.apache.solr.update
Class DefaultSolrCoreState
- java.lang.Object
-
- org.apache.solr.update.SolrCoreState
-
- org.apache.solr.update.DefaultSolrCoreState
-
- All Implemented Interfaces:
RecoveryStrategy.RecoveryListener
public final class DefaultSolrCoreState extends SolrCoreState implements RecoveryStrategy.RecoveryListener
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.update.SolrCoreState
SolrCoreState.CoreIsClosedException, SolrCoreState.IndexWriterCloser
-
-
Field Summary
Fields Modifier and Type Field Description protected ReentrantLock
commitLock
-
Fields inherited from class org.apache.solr.update.SolrCoreState
closed
-
-
Constructor Summary
Constructors Constructor Description DefaultSolrCoreState(DirectoryFactory directoryFactory)
Deprecated.DefaultSolrCoreState(DirectoryFactory directoryFactory, RecoveryStrategy.Builder recoveryStrategyBuilder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancelRecovery()
void
close(SolrCoreState.IndexWriterCloser closer)
void
closeIndexWriter(SolrCore core, boolean rollback)
Expert method that closes the IndexWriter - you must callSolrCoreState.openIndexWriter(SolrCore)
in a finally block after calling this method.protected SolrIndexWriter
createMainIndexWriter(SolrCore core, String name)
void
doRecovery(CoreContainer cc, CoreDescriptor cd)
void
failed()
called from recoveryStrat on a failed recoveryCallable
getCdcrBootstrapCallable()
Future<Boolean>
getCdcrBootstrapFuture()
boolean
getCdcrBootstrapRunning()
Lock
getCommitLock()
DirectoryFactory
getDirectoryFactory()
RefCounted<org.apache.lucene.index.IndexWriter>
getIndexWriter(SolrCore core)
Get the current IndexWriter.boolean
getLastReplicateIndexSuccess()
ActionThrottle
getLeaderThrottle()
org.apache.lucene.search.Sort
getMergePolicySort()
Get the current Sort of the current IndexWriter's MergePolicy..Lock
getRecoveryLock()
RecoveryStrategy.Builder
getRecoveryStrategyBuilder()
void
newIndexWriter(SolrCore core, boolean rollback)
Force the creation of a new IndexWriter using the settings from the given SolrCore.void
openIndexWriter(SolrCore core)
Expert method that opens the IndexWriter - you must callSolrCoreState.closeIndexWriter(SolrCore, boolean)
first, and then call this method in a finally block.void
recovered()
called from recoveryStrat on a successful recoveryvoid
rollbackIndexWriter(SolrCore core)
Rollback the current IndexWriter.void
setCdcrBootstrapCallable(Callable cdcrBootstrapCallable)
void
setCdcrBootstrapFuture(Future<Boolean> cdcrBootstrapFuture)
void
setCdcrBootstrapRunning(boolean cdcrRunning)
void
setLastReplicateIndexSuccess(boolean success)
-
Methods inherited from class org.apache.solr.update.SolrCoreState
decrefSolrCoreState, getReloadLock, getTragicException, getUpdateLock, increfSolrCoreState
-
-
-
-
Field Detail
-
commitLock
protected final ReentrantLock commitLock
-
-
Constructor Detail
-
DefaultSolrCoreState
@Deprecated public DefaultSolrCoreState(DirectoryFactory directoryFactory)
Deprecated.
-
DefaultSolrCoreState
public DefaultSolrCoreState(DirectoryFactory directoryFactory, RecoveryStrategy.Builder recoveryStrategyBuilder)
-
-
Method Detail
-
getIndexWriter
public RefCounted<org.apache.lucene.index.IndexWriter> getIndexWriter(SolrCore core) throws IOException
Description copied from class:SolrCoreState
Get the current IndexWriter. If a new IndexWriter must be created, use the settings from the givenSolrCore
.- Specified by:
getIndexWriter
in classSolrCoreState
- Throws:
IOException
- If there is a low-level I/O error.
-
newIndexWriter
public void newIndexWriter(SolrCore core, boolean rollback) throws IOException
Description copied from class:SolrCoreState
Force the creation of a new IndexWriter using the settings from the given SolrCore.- Specified by:
newIndexWriter
in classSolrCoreState
rollback
- close IndexWriter if false, else rollback- Throws:
IOException
- If there is a low-level I/O error.
-
closeIndexWriter
public void closeIndexWriter(SolrCore core, boolean rollback) throws IOException
Description copied from class:SolrCoreState
Expert method that closes the IndexWriter - you must callSolrCoreState.openIndexWriter(SolrCore)
in a finally block after calling this method.- Specified by:
closeIndexWriter
in classSolrCoreState
- 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 void openIndexWriter(SolrCore core) throws IOException
Description copied from class:SolrCoreState
Expert method that opens the IndexWriter - you must callSolrCoreState.closeIndexWriter(SolrCore, boolean)
first, and then call this method in a finally block.- Specified by:
openIndexWriter
in classSolrCoreState
- Parameters:
core
- that the IW belongs to- Throws:
IOException
- If there is a low-level I/O error.
-
rollbackIndexWriter
public void rollbackIndexWriter(SolrCore core) throws IOException
Description copied from class:SolrCoreState
Rollback the current IndexWriter. When creating the new IndexWriter use the settings from the givenSolrCore
.- Specified by:
rollbackIndexWriter
in classSolrCoreState
- Throws:
IOException
- If there is a low-level I/O error.
-
createMainIndexWriter
protected SolrIndexWriter createMainIndexWriter(SolrCore core, String name) throws IOException
- Throws:
IOException
-
getMergePolicySort
public org.apache.lucene.search.Sort getMergePolicySort() throws IOException
Description copied from class:SolrCoreState
Get the current Sort of the current IndexWriter's MergePolicy..- Specified by:
getMergePolicySort
in classSolrCoreState
- Throws:
IOException
- If there is a low-level I/O error.
-
getDirectoryFactory
public DirectoryFactory getDirectoryFactory()
- Specified by:
getDirectoryFactory
in classSolrCoreState
- Returns:
- the
DirectoryFactory
that should be used.
-
getRecoveryStrategyBuilder
public RecoveryStrategy.Builder getRecoveryStrategyBuilder()
- Specified by:
getRecoveryStrategyBuilder
in classSolrCoreState
- Returns:
- the
RecoveryStrategy.Builder
that should be used.
-
doRecovery
public void doRecovery(CoreContainer cc, CoreDescriptor cd)
- Specified by:
doRecovery
in classSolrCoreState
-
cancelRecovery
public void cancelRecovery()
- Specified by:
cancelRecovery
in classSolrCoreState
-
recovered
public void recovered()
called from recoveryStrat on a successful recovery- Specified by:
recovered
in interfaceRecoveryStrategy.RecoveryListener
-
failed
public void failed()
called from recoveryStrat on a failed recovery- Specified by:
failed
in interfaceRecoveryStrategy.RecoveryListener
-
close
public void close(SolrCoreState.IndexWriterCloser closer)
- Specified by:
close
in classSolrCoreState
-
getCommitLock
public Lock getCommitLock()
- Specified by:
getCommitLock
in classSolrCoreState
-
getLeaderThrottle
public ActionThrottle getLeaderThrottle()
- Specified by:
getLeaderThrottle
in classSolrCoreState
- Returns:
- throttle to limit how fast a core attempts to become leader
-
getLastReplicateIndexSuccess
public boolean getLastReplicateIndexSuccess()
- Specified by:
getLastReplicateIndexSuccess
in classSolrCoreState
-
setLastReplicateIndexSuccess
public void setLastReplicateIndexSuccess(boolean success)
- Specified by:
setLastReplicateIndexSuccess
in classSolrCoreState
-
getRecoveryLock
public Lock getRecoveryLock()
- Specified by:
getRecoveryLock
in classSolrCoreState
-
getCdcrBootstrapRunning
public boolean getCdcrBootstrapRunning()
- Specified by:
getCdcrBootstrapRunning
in classSolrCoreState
-
setCdcrBootstrapRunning
public void setCdcrBootstrapRunning(boolean cdcrRunning)
- Specified by:
setCdcrBootstrapRunning
in classSolrCoreState
-
getCdcrBootstrapFuture
public Future<Boolean> getCdcrBootstrapFuture()
- Specified by:
getCdcrBootstrapFuture
in classSolrCoreState
-
setCdcrBootstrapFuture
public void setCdcrBootstrapFuture(Future<Boolean> cdcrBootstrapFuture)
- Specified by:
setCdcrBootstrapFuture
in classSolrCoreState
-
getCdcrBootstrapCallable
public Callable getCdcrBootstrapCallable()
- Specified by:
getCdcrBootstrapCallable
in classSolrCoreState
-
setCdcrBootstrapCallable
public void setCdcrBootstrapCallable(Callable cdcrBootstrapCallable)
- Specified by:
setCdcrBootstrapCallable
in classSolrCoreState
-
-