Package com.atlassian.jira.index.request
Class DefaultReindexRequestManager
java.lang.Object
com.atlassian.jira.index.request.DefaultReindexRequestManager
- All Implemented Interfaces:
ReindexRequestManager
- Since:
- 6.4
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultReindexRequestManager(ReindexRequestDao reindexRequestDao, Clock clock, ReindexRequestCoalescer requestCoalescer, ClusterManager clusterManager, com.atlassian.beehive.ClusterLockService clusterLockService, TaskManager taskManager, IndexLifecycleManager indexLifecycleManager, I18nHelper.BeanFactory i18nFactory, I18nHelper i18nHelper, JohnsonProvider johnsonProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidclearAll()Clear any pending requests.Finds any active or running requests from inactive nodes in the cluster and transitions them to failed.failRunningRequestsFromNode(String nodeId) Finds any active or running requests from the specified node in the cluster and transitions them to failed.getPendingReindexRequests(Set<ReindexRequestType> reindexRequestTypes) Retrieves all pending reindex requests, in order from oldest to newest.getReindexProgress(Long requestId) getReindexProgress(Set<Long> requestIds) Retrieves the progress of some requests.booleanbooleanChecks if any ReindexRequests of any type are waiting to be processed.booleanisReindexRequested(Set<ReindexRequestType> reindexRequestTypes) Checks if any ReindexRequests are waiting to be processed.protected ReindexRequestperformReindex(ReindexRequest request, boolean waitForCompletion, boolean runInBackground) processPendingRequests(boolean waitForCompletion, Set<ReindexRequestType> reindexRequestTypes, boolean runInBackground) Process any outstanding reindex requests.readPendingReindexRequests(Set<ReindexRequestType> reindexRequestTypes, boolean updateCoalescedRequests) requestReindex(ReindexRequestType type, Set<AffectedIndex> affectedIndexes, Set<SharedEntityType> entityTypes) Requests a reindex.transitionStatus(ReindexRequest request, ReindexStatus newStatus) Transitions the status of a reindex request.transitionStatus(Iterable<ReindexRequest> requests, ReindexStatus newStatus) Transitions the status of reindex requests.
-
Constructor Details
-
DefaultReindexRequestManager
public DefaultReindexRequestManager(ReindexRequestDao reindexRequestDao, Clock clock, ReindexRequestCoalescer requestCoalescer, ClusterManager clusterManager, com.atlassian.beehive.ClusterLockService clusterLockService, TaskManager taskManager, IndexLifecycleManager indexLifecycleManager, I18nHelper.BeanFactory i18nFactory, I18nHelper i18nHelper, JohnsonProvider johnsonProvider)
-
-
Method Details
-
isReindexRequested
public boolean isReindexRequested()Description copied from interface:ReindexRequestManagerChecks if any ReindexRequests of any type are waiting to be processed.- Specified by:
isReindexRequestedin interfaceReindexRequestManager- Returns:
- true if unprocessed requests exist
-
isReindexRequested
Description copied from interface:ReindexRequestManagerChecks if any ReindexRequests are waiting to be processed.- Specified by:
isReindexRequestedin interfaceReindexRequestManager- Parameters:
reindexRequestTypes- Types of requests to check for.- Returns:
- true if unprocessed requests exist
-
getPendingReindexRequests
@Nonnull public Iterable<ReindexRequest> getPendingReindexRequests(@Nonnull Set<ReindexRequestType> reindexRequestTypes) Description copied from interface:ReindexRequestManagerRetrieves all pending reindex requests, in order from oldest to newest.- Specified by:
getPendingReindexRequestsin interfaceReindexRequestManager- Parameters:
reindexRequestTypes- Types of requests to check for.- Returns:
- a list of reindex requests.
-
readPendingReindexRequests
@Nonnull public Iterable<ReindexRequest> readPendingReindexRequests(@Nonnull Set<ReindexRequestType> reindexRequestTypes, boolean updateCoalescedRequests) -
processPendingRequests
public Set<ReindexRequest> processPendingRequests(boolean waitForCompletion, Set<ReindexRequestType> reindexRequestTypes, boolean runInBackground) Description copied from interface:ReindexRequestManagerProcess any outstanding reindex requests.- Specified by:
processPendingRequestsin interfaceReindexRequestManager- Parameters:
waitForCompletion- If true this method will not return until the reindexing is complete, otherwise it will return when the reindex task is submitted,reindexRequestTypes- Types of requests to process eitherReindexRequestTyperunInBackground- If true the reindex should be a background reindex otherwise a foreground stop the world reindex- Returns:
- The updated processed requests.
-
performReindex
@Nonnull protected ReindexRequest performReindex(@Nonnull ReindexRequest request, boolean waitForCompletion, boolean runInBackground) throws InterruptedException - Throws:
InterruptedException
-
failRunningRequestsFromDeadNodes
Description copied from interface:ReindexRequestManagerFinds any active or running requests from inactive nodes in the cluster and transitions them to failed. Use this to clean up any tasks from nodes that were running on nodes that were killed.- Specified by:
failRunningRequestsFromDeadNodesin interfaceReindexRequestManager- Returns:
- the list of requests that were transitioned.
-
failRunningRequestsFromNode
Description copied from interface:ReindexRequestManagerFinds any active or running requests from the specified node in the cluster and transitions them to failed.- Specified by:
failRunningRequestsFromNodein interfaceReindexRequestManager- Parameters:
nodeId- the ID of the cluster node, or null if not clustered.- Returns:
- the list of requests that were transitioned.
-
isReindexInProgress
public boolean isReindexInProgress()- Specified by:
isReindexInProgressin interfaceReindexRequestManager- Returns:
- true if a reindex is in progress, false if not.
-
requestReindex
@Nonnull public ReindexRequest requestReindex(@Nonnull ReindexRequestType type, @Nonnull Set<AffectedIndex> affectedIndexes, @Nonnull Set<SharedEntityType> entityTypes) Description copied from interface:ReindexRequestManagerRequests a reindex.- Specified by:
requestReindexin interfaceReindexRequestManager- Parameters:
type- whether reindex is immediate or delayed.affectedIndexes- the indexes to regenerate.entityTypes- the entity types whose indexes are to be regenerated.- Returns:
- the request that was created.
-
transitionStatus
@Nonnull public List<ReindexRequest> transitionStatus(@Nonnull Iterable<ReindexRequest> requests, @Nonnull ReindexStatus newStatus) Description copied from interface:ReindexRequestManagerTransitions the status of reindex requests.- Specified by:
transitionStatusin interfaceReindexRequestManager- Parameters:
requests- the requests.newStatus- the new status to transition to.- Returns:
- the updated requests.
-
transitionStatus
@Nonnull public ReindexRequest transitionStatus(@Nonnull ReindexRequest request, @Nonnull ReindexStatus newStatus) Description copied from interface:ReindexRequestManagerTransitions the status of a reindex request.- Specified by:
transitionStatusin interfaceReindexRequestManager- Parameters:
request- the request.newStatus- the new status to transition to.- Returns:
- the updated request.
-
getReindexProgress
Description copied from interface:ReindexRequestManagerRetrieves the progress of some requests.- Specified by:
getReindexProgressin interfaceReindexRequestManager- Parameters:
requestIds- the set of reindex request IDs to look up.- Returns:
- set of requests indicating progress. Any request IDs that were not found will not have a corresponding entry in this result set.
-
clearAll
public void clearAll()Description copied from interface:ReindexRequestManagerClear any pending requests.- Specified by:
clearAllin interfaceReindexRequestManager
-
getReindexProgress
-