public class IndexUtils extends Object
Modifier and Type | Field and Description |
---|---|
static com.google.common.io.PatternFilenameFilter |
INDEX_SNAPSHOT_FILTER |
static String |
INDEX_SNAPSHOT_PREFIX |
Constructor and Description |
---|
IndexUtils(com.atlassian.event.api.EventPublisher eventPublisher,
ApplicationProperties applicationProperties,
IndexBackupContributorsManager indexBackupContributorsManager,
ClusterNodes clusterNodes,
IndexLifecycleManager indexLifecycleManager) |
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,
ArchiveUtils.Type archiveType) |
String |
performBackupOperations(String destinationPath,
String snapshotId,
TemporaryFilesProvider metadataProvider,
String requestingNodeId)
Creates a backup file at
destinationPath . |
public static final String INDEX_SNAPSHOT_PREFIX
public static final com.google.common.io.PatternFilenameFilter INDEX_SNAPSHOT_FILTER
public IndexUtils(com.atlassian.event.api.EventPublisher eventPublisher, ApplicationProperties applicationProperties, IndexBackupContributorsManager indexBackupContributorsManager, ClusterNodes clusterNodes, IndexLifecycleManager indexLifecycleManager)
public String performBackupOperations(@Nonnull String destinationPath, @Nonnull String snapshotId, @Nullable TemporaryFilesProvider metadataProvider, @Nullable String requestingNodeId) throws IndexException
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 necessarysnapshotId
- identifier suffix added to 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 consistentpublic String deriveFilename(String snapshotId, ArchiveUtils.Type archiveType)
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-2022 Atlassian. All Rights Reserved.