Package com.atlassian.jira.index.ha
Class IndexUtils
java.lang.Object
com.atlassian.jira.index.ha.IndexUtils
Helper methods to work with LuceneIndexes.
- Since:
- v6.1
-
Field Summary
-
Constructor Summary
ConstructorDescriptionIndexUtils
(com.atlassian.event.api.EventPublisher eventPublisher, ApplicationProperties applicationProperties, IndexBackupContributorsManager indexBackupContributorsManager, ClusterNodes clusterNodes, IndexLifecycleManager indexLifecycleManager, PeriodicIndexWriterCommitScheduler periodicIndexWriterCommitScheduler, com.atlassian.beehive.ClusterLockService clusterLockService, JiraProperties jiraProperties, BarrierFactory barrierFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected long
calculateFileSize
(File snapshot) protected Long
createIndexSnapshot
(File snapshot, ArchiveUtils.Type archiveType, TemporaryFilesProvider metadataProvider) protected int
deleteOldSnapshots
(File directory, int numToKeep) deriveFilename
(String snapshotId) performBackupOperations
(String destinationPath, String snapshotFilename, TemporaryFilesProvider metadataProvider, String requestingNodeId) Creates a backup file atdestinationPath
.
-
Field Details
-
SNAPSHOT_PARALLEL_CREATION_ALLOWED
- See Also:
-
INDEX_SNAPSHOT_IN_PROGRESS_CLUSTER_LOCK
- See Also:
-
INDEX_SNAPSHOT_PREFIX
- See Also:
-
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
-
IndexUtils
public IndexUtils(com.atlassian.event.api.EventPublisher eventPublisher, ApplicationProperties applicationProperties, IndexBackupContributorsManager indexBackupContributorsManager, ClusterNodes clusterNodes, IndexLifecycleManager indexLifecycleManager, PeriodicIndexWriterCommitScheduler periodicIndexWriterCommitScheduler, com.atlassian.beehive.ClusterLockService clusterLockService, JiraProperties jiraProperties, BarrierFactory barrierFactory)
-
-
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 atdestinationPath
. Allows backup contributors registered inIndexBackupContributorsManager
to contribute to that file. Creates temporary folder for the time of operation and allows and themetadataProvider
to crate additional files in that folder and also adds them to the backup. Performs cleanup of existing previous snapshot indestination
. 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 necessarysnapshotFilename
- snapshot filenamemetadataProvider
- 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 endsrequestingNodeId
- 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 consistentInterruptedException
ExecutionException
TimeoutException
-
deriveFilename
-
createIndexSnapshot
protected Long createIndexSnapshot(@Nonnull File snapshot, @Nonnull ArchiveUtils.Type archiveType, @Nullable TemporaryFilesProvider metadataProvider) -
calculateFileSize
-
deleteOldSnapshots
-