Package com.atlassian.jira.index.ha
Class DefaultIndexRecoveryManager
java.lang.Object
com.atlassian.jira.index.ha.DefaultIndexRecoveryManager
- All Implemented Interfaces:
IndexRecoveryManager,Sized
-
Field Summary
FieldsFields inherited from interface com.atlassian.jira.index.ha.IndexRecoveryManager
INDEXSNAPSHOTS, SNAPSHOT_ARCHIVE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultIndexRecoveryManager(IndexLifecycleManager indexLifecycleManager, IndexPathManager indexPathManager, SharedEntityIndexManager sharedEntityIndexManager, IndexingCounterManager indexingCounterManager, IssueIndexManager indexManager, CommentManager commentManager, WorklogManager worklogManager, EntityVersioningManager entityVersioningManager, VersioningCleanupService versionsCleaner, com.atlassian.event.api.EventPublisher eventPublisher, ClusterNodes clusterNodes, IssueIndexer issueIndexer, InternalIndexingService internalIndexingService, I18nHelper i18nHelper) -
Method Summary
Modifier and TypeMethodDescriptiondeindexEntitiesDeletedInTheLast(Duration duration, TaskProgressSink taskProgressSink) Applies de-index based on the versioning table (delete column.* Why this method may be needed? It is possible in Jira (both server and DC) that a late "update" will override a "delete".com.atlassian.core.util.DateUtils.DateRangeGets the updated date range for issues that need to be re-indexed because the latest updates are missing from the index.booleanisEmpty()static DurationpadDurationBetween(Instant priorTime, Supplier<Instant> currentTime) Creates a Duration of length priorTime -> currentTime PLUS an extra 24 hours.static StringreadableDuration(Duration duration) recoverIndexFromBackup(File recoveryFile, TaskProgressSink taskProgressSink) Recovers an index from an index backup.reindexWithVersionCheckEntitiesUpdatedInTheLast(Duration duration, TaskProgressSink taskProgressSink) This method uses versioning to short-circuit building documents when the index version is already up-to-date with what's in the db.safeRecoverIndexFromBackup(File recoveryFile, TaskProgressSink taskProgressSink) Recovers an index from an index backup.intsize()
-
Field Details
-
INDEX_FIXER
- See Also:
-
-
Constructor Details
-
Method Details
-
safeRecoverIndexFromBackup
public IndexCommandResult safeRecoverIndexFromBackup(File recoveryFile, TaskProgressSink taskProgressSink) throws IndexException Description copied from interface:IndexRecoveryManagerRecovers an index from an index backup. This method throws and stops processing if it's not able to calculate the duration where catch up needs to be applied.- Specified by:
safeRecoverIndexFromBackupin interfaceIndexRecoveryManager- Parameters:
recoveryFile- The backup filetaskProgressSink- The sink to report progress back.- Throws:
IndexException- If we are unable to recover the index or catch up after recovery is successful
-
recoverIndexFromBackup
public IndexCommandResult recoverIndexFromBackup(File recoveryFile, TaskProgressSink taskProgressSink) throws IndexException Description copied from interface:IndexRecoveryManagerRecovers an index from an index backup. Unlike theIndexRecoveryManager.safeRecoverIndexFromBackup(java.io.File, com.atlassian.jira.task.TaskProgressSink)this method won't throw exception when not being able to to calculate the duration where catch up needs to be applied. It will skip the catch up and continue with other steps.- Specified by:
recoverIndexFromBackupin interfaceIndexRecoveryManager- Parameters:
recoveryFile- The backup file- Throws:
IndexException- If we are unable to recover the index or catch up after recovery is successful
-
reindexWithVersionCheckEntitiesUpdatedInTheLast
public IndexRecoveryResult reindexWithVersionCheckEntitiesUpdatedInTheLast(Duration duration, TaskProgressSink taskProgressSink) throws IndexException Description copied from interface:IndexRecoveryManagerThis method uses versioning to short-circuit building documents when the index version is already up-to-date with what's in the db. Ensures that issues which have been modified between now anddurationago are up-to-date in the index. They are reindexed/deindexed as needed to achieve this.- Specified by:
reindexWithVersionCheckEntitiesUpdatedInTheLastin interfaceIndexRecoveryManager- Parameters:
duration- specifies how far back (from present time) to look for updated issuestaskProgressSink- A progress sink.- Returns:
- Report how much time the operation took and how many issues were affected
- Throws:
IndexException
-
deindexEntitiesDeletedInTheLast
public IndexRecoveryResult deindexEntitiesDeletedInTheLast(Duration duration, TaskProgressSink taskProgressSink) throws IndexException Description copied from interface:IndexRecoveryManagerApplies de-index based on the versioning table (delete column.* Why this method may be needed? It is possible in Jira (both server and DC) that a late "update" will override a "delete". To handle this problem, Jira has to replay de-index operations after "some time". See:EntityVersioningManager) See:VersioningDaoSee:NodeReindexServiceSee:DefaultServerIndexRepairService- Specified by:
deindexEntitiesDeletedInTheLastin interfaceIndexRecoveryManager- Parameters:
duration- specifies how far back (from present time) to look for deleted issuestaskProgressSink- A progress sink.- Returns:
- result of de-indexing
- Throws:
IndexException
-
getDurationToCatchUpUsingVersions
public com.atlassian.core.util.DateUtils.DateRange getDurationToCatchUpUsingVersions()Description copied from interface:IndexRecoveryManagerGets the updated date range for issues that need to be re-indexed because the latest updates are missing from the index. The range is- from
- Latest date in the index
- to
- Latest date in the database
Note: the latest db date is based on the issue_version table. If no versions are present, we fall back to the issues table (although deletes will not be reflected here).- Specified by:
getDurationToCatchUpUsingVersionsin interfaceIndexRecoveryManager- Returns:
- Date range of issues that need to be re-indexed.
-
padDurationBetween
Creates a Duration of length priorTime -> currentTime PLUS an extra 24 hours. It's padded is just in case there's a TZ discrepancy with DB vs JVM time. See @DBR-159. As we skip reindexing when the index version is already up-to-date, the penalty for the extra input is minimal. -
readableDuration
-
size
public int size() -
isEmpty
public boolean isEmpty()
-