Class 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 of IndexRecoveryService.
    Since:
    5.8
    • Method Detail

      • isIndexRecoveryRequired

        public boolean isIndexRecoveryRequired​(JournalIdentifier journalId,
                                               String indexDirName)
        Description copied from interface: IndexRecoveryService
        Checks 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:
        isIndexRecoveryRequired in interface IndexRecoveryService
        Parameters:
        journalId - the index to check whether it needs to be recovered
        indexDirName - the name of the subdirectory containing the Lucene index
      • recoverIndex

        public boolean recoverIndex​(JournalIdentifier journalId,
                                    String indexDirName)
        Description copied from interface: IndexRecoveryService
        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.

        This will overwrite the local index files if it already exists.

        Specified by:
        recoverIndex in interface IndexRecoveryService
        Parameters:
        journalId - the index to recover
        indexDirName - 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: IndexRecoveryService
        Recovers the index snapshot stored in the shared home.

        This will overwrite the local index files if it already exists.

        Specified by:
        recoverIndexFromSharedHome in interface IndexRecoveryService
        Parameters:
        journalId - the index to recover
        indexDirName - 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: IndexRecoveryService
        Creates an index snapshot in the cluster shared home.

        This will overwrite existing snapshots of the same index in the shared home.

        Specified by:
        createIndexBackup in interface IndexRecoveryService
        Parameters:
        journalId - the index to backup
        indexDirName - the name of the subdirectory containing the Lucene index
        indexRecoverer - 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)
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        Exception
      • destroy

        public void destroy()
                     throws Exception
        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean
        Throws:
        Exception