public class IndexUtils extends Object
Modifier and Type | Field and Description |
---|---|
static com.google.common.io.PatternFilenameFilter |
INDEX_SNAPSHOT_FILTER |
static String |
INDEX_SNAPSHOT_IN_PROGRESS_CLUSTER_LOCK |
static String |
INDEX_SNAPSHOT_PREFIX |
static int |
MAX_SNAPSHOTS |
static String |
SNAPSHOT_CREATION_BARRIER |
static String |
SNAPSHOT_PARALLEL_CREATION_ALLOWED |
Constructor and Description |
---|
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) |
Modifier and Type | Method and Description |
---|---|
protected long |
calculateFileSize(File snapshot) |
protected Long |
createIndexSnapshot(File snapshot,
ArchiveUtils.Type archiveType,
TemporaryFilesProvider metadataProvider) |
protected int |
deleteOldSnapshots(File directory,
int numToKeep) |
String |
deriveFilename(String snapshotId) |
IndexSnapshotCreationResult |
performBackupOperations(String destinationPath,
String snapshotFilename,
TemporaryFilesProvider metadataProvider,
String requestingNodeId)
Creates a backup file at
destinationPath . |
public static final String SNAPSHOT_PARALLEL_CREATION_ALLOWED
public static final String INDEX_SNAPSHOT_IN_PROGRESS_CLUSTER_LOCK
public static final String INDEX_SNAPSHOT_PREFIX
public static final String SNAPSHOT_CREATION_BARRIER
public static final com.google.common.io.PatternFilenameFilter INDEX_SNAPSHOT_FILTER
public static final int MAX_SNAPSHOTS
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)
public IndexSnapshotCreationResult performBackupOperations(@Nonnull String destinationPath, @Nonnull String snapshotFilename, @Nullable TemporaryFilesProvider metadataProvider, @Nullable String requestingNodeId) throws IndexException, InterruptedException, ExecutionException, TimeoutException
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_SNAPSHOTSdestinationPath
- 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 completionIndexException
- when the index is not consistentInterruptedException
ExecutionException
TimeoutException
protected Long createIndexSnapshot(@Nonnull File snapshot, @Nonnull ArchiveUtils.Type archiveType, @Nullable TemporaryFilesProvider metadataProvider)
protected long calculateFileSize(File snapshot)
protected int deleteOldSnapshots(File directory, int numToKeep)
Copyright © 2002-2024 Atlassian. All Rights Reserved.