Class IndexUtils

java.lang.Object
com.atlassian.jira.index.ha.IndexUtils

public class IndexUtils extends Object
Helper methods to work with LuceneIndexes.
Since:
v6.1
  • Field Details

    • SNAPSHOT_PARALLEL_CREATION_ALLOWED

      public static final String SNAPSHOT_PARALLEL_CREATION_ALLOWED
      See Also:
    • INDEX_SNAPSHOT_IN_PROGRESS_CLUSTER_LOCK

      public static final String INDEX_SNAPSHOT_IN_PROGRESS_CLUSTER_LOCK
      See Also:
    • INDEX_SNAPSHOT_PREFIX

      public static final String INDEX_SNAPSHOT_PREFIX
      See Also:
    • SNAPSHOT_CREATION_BARRIER

      public static final String SNAPSHOT_CREATION_BARRIER
      See Also:
    • INDEX_SNAPSHOT_FILTER

      public static final com.google.common.io.PatternFilenameFilter INDEX_SNAPSHOT_FILTER
    • MAX_SNAPSHOTS

      public static final int MAX_SNAPSHOTS
      See Also:
  • Constructor Details

  • Method Details

    • performBackupOperations

      public IndexSnapshotCreationResult performBackupOperations(@Nonnull String destinationPath, @Nonnull String snapshotFilename, @Nullable TemporaryFilesProvider metadataProvider, @Nullable String requestingNodeId) throws IndexException, InterruptedException, ExecutionException, TimeoutException
      Creates a backup file at destinationPath. Allows backup contributors registered in IndexBackupContributorsManager to contribute to that file. Creates temporary folder for the time of operation and allows and the metadataProvider to crate additional files in that folder and also adds them to the backup. Performs cleanup of existing previous snapshot in destination. The number of left snapshots is determined by value under com.atlassian.jira.config.properties.APKeys#INDEX_SNAPSHOT_COUNT and defaults to com.atlassian.jira.index.ha.IndexUtils#MAX_SNAPSHOTS
      Parameters:
      destinationPath - directory path for newly created snapshot. Will be created if necessary
      snapshotFilename - snapshot filename
      metadataProvider - provider of additional files that should be included in the archive, can be null. Files it will create in given temp directory will be removed after the backup ends
      requestingNodeId - id of node that awaits the snapshot. the node be notified on completion
      Returns:
      name of created snapshot file
      Throws:
      IndexException - when the index is not consistent
      InterruptedException
      ExecutionException
      TimeoutException
    • deriveFilename

      public String deriveFilename(String snapshotId)
    • createIndexSnapshot

      protected Long createIndexSnapshot(@Nonnull File snapshot, @Nonnull ArchiveUtils.Type archiveType, @Nullable TemporaryFilesProvider metadataProvider)
    • calculateFileSize

      protected long calculateFileSize(File snapshot)
    • deleteOldSnapshots

      protected int deleteOldSnapshots(File directory, int numToKeep)