Class DefaultIndexRecoveryService
- java.lang.Object
-
- com.atlassian.confluence.impl.index.DefaultIndexRecoveryService
-
- All Implemented Interfaces:
IndexRecoveryService,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean
public class DefaultIndexRecoveryService extends Object implements IndexRecoveryService, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
This is the default implementation ofIndexRecoveryService.- Since:
- 5.8
-
-
Constructor Summary
Constructors Constructor Description DefaultIndexRecoveryService(JournalStateStore journalStateStore, JournalDao journalDao, com.atlassian.dc.filestore.api.FileStore.Path sharedHome, ClusterManager clusterManager, com.atlassian.event.api.EventPublisher eventPublisher, ClusterEventWrapperService clusterEventWrapperService, com.atlassian.plugin.PluginAccessor pluginAccessor, ClusterConfigurationHelper clusterConfigurationHelper, ConfluenceDirectories confluenceDirectories, BootstrapManager bootstrapManager, SearchPlatformConfig searchPlatformConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()booleancreateIndexBackup(JournalIdentifier journalId, String indexDirName, IndexRecoverer indexRecoverer)Creates an index snapshot in the cluster shared home.voiddestroy()protected IndexRecovererModuleDescriptorgetIndexRecovererModuleDescriptor(Predicate<IndexRecovererModuleDescriptor> predicate)voidhandleEvent(ClusterEventWrapper eventWrapper)voidhandleModuleEnableEvent(com.atlassian.plugin.event.events.PluginModuleEnabledEvent event)voidhandleStartingEvent(com.atlassian.plugin.event.events.PluginFrameworkResumingEvent event)booleanisIndexRecoveryRequired(JournalIdentifier journalId, String indexDirName)Checks to see whether the index needs to be recovered.voidonPluginFrameworkStartedEvent(PluginFrameworkStartedEvent ignored)All plugins (including analytics) have been started successfully.voidonReIndexFinishedEvent(ReindexFinishedEvent ignored)booleanrecoverIndex(JournalIdentifier journalId, String indexDirName)Recovers the index required by asking other nodes in the cluster for a snapshot of their index and copying it to its local home directory.booleanrecoverIndexFromSharedHome(JournalIdentifier journalId, String indexDirName)Recovers the index snapshot stored in the shared home.protected voidtriggerIndexRecovererModuleDescriptors()
-
-
-
Constructor Detail
-
DefaultIndexRecoveryService
public DefaultIndexRecoveryService(JournalStateStore journalStateStore, JournalDao journalDao, com.atlassian.dc.filestore.api.FileStore.Path sharedHome, ClusterManager clusterManager, com.atlassian.event.api.EventPublisher eventPublisher, ClusterEventWrapperService clusterEventWrapperService, com.atlassian.plugin.PluginAccessor pluginAccessor, ClusterConfigurationHelper clusterConfigurationHelper, ConfluenceDirectories confluenceDirectories, BootstrapManager bootstrapManager, SearchPlatformConfig searchPlatformConfig)
- Since:
- 7.14
-
-
Method Detail
-
isIndexRecoveryRequired
public boolean isIndexRecoveryRequired(JournalIdentifier journalId, String indexDirName)
Description copied from interface:IndexRecoveryServiceChecks to see whether the index needs to be recovered.This will be true if the index folder does not exist, or, if the index is copied over from a live system and is invalid, or, if the journal has been purged past where the node is currently processing, Note, this will always return false if the instance is not clustered.
- Specified by:
isIndexRecoveryRequiredin interfaceIndexRecoveryService- Parameters:
journalId- the index to check whether it needs to be recoveredindexDirName- the name of the subdirectory containing the Lucene index
-
recoverIndex
public boolean recoverIndex(JournalIdentifier journalId, String indexDirName)
Description copied from interface:IndexRecoveryServiceRecovers the index required by asking other nodes in the cluster for a snapshot of their index and copying it to its local home directory.This will overwrite the local index files if it already exists.
- Specified by:
recoverIndexin interfaceIndexRecoveryService- Parameters:
journalId- the index to recoverindexDirName- the name of the subdirectory containing the Lucene index- Returns:
- true if index recovery was successful, false otherwise.
-
recoverIndexFromSharedHome
public boolean recoverIndexFromSharedHome(JournalIdentifier journalId, String indexDirName)
Description copied from interface:IndexRecoveryServiceRecovers the index snapshot stored in the shared home.This will overwrite the local index files if it already exists.
- Specified by:
recoverIndexFromSharedHomein interfaceIndexRecoveryService- Parameters:
journalId- the index to recoverindexDirName- the name of the subdirectory where the Lucene index will be moved to- Returns:
- true if index recovery was successful, false otherwise.
-
createIndexBackup
public boolean createIndexBackup(JournalIdentifier journalId, String indexDirName, IndexRecoverer indexRecoverer)
Description copied from interface:IndexRecoveryServiceCreates an index snapshot in the cluster shared home.This will overwrite existing snapshots of the same index in the shared home.
- Specified by:
createIndexBackupin interfaceIndexRecoveryService- Parameters:
journalId- the index to backupindexDirName- the name of the subdirectory containing the Lucene indexindexRecoverer- the index recover module that will take the lucene index snapshot- Returns:
- true if successful
-
handleStartingEvent
@EventListener public void handleStartingEvent(com.atlassian.plugin.event.events.PluginFrameworkResumingEvent event)
-
onPluginFrameworkStartedEvent
@EventListener public void onPluginFrameworkStartedEvent(PluginFrameworkStartedEvent ignored)
All plugins (including analytics) have been started successfully.
-
handleModuleEnableEvent
@EventListener public void handleModuleEnableEvent(com.atlassian.plugin.event.events.PluginModuleEnabledEvent event)
-
triggerIndexRecovererModuleDescriptors
protected void triggerIndexRecovererModuleDescriptors()
-
onReIndexFinishedEvent
@EventListener public void onReIndexFinishedEvent(ReindexFinishedEvent ignored)
-
handleEvent
@EventListener public void handleEvent(ClusterEventWrapper eventWrapper) throws Exception
- Throws:
Exception
-
getIndexRecovererModuleDescriptor
protected IndexRecovererModuleDescriptor getIndexRecovererModuleDescriptor(Predicate<IndexRecovererModuleDescriptor> predicate)
- Returns:
- the IndexRecoverModuleDescriptor that satisfies the predicate
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
-