public class

DefaultReindexRequestManager

extends Object
implements ReindexRequestManager
java.lang.Object
   ↳ com.atlassian.jira.index.request.DefaultReindexRequestManager

Summary

Public Constructors
DefaultReindexRequestManager(ReindexRequestDao reindexRequestDao, Clock clock, ReindexRequestCoalescer requestCoalescer, ClusterManager clusterManager, ClusterLockService clusterLockService, TaskManager taskManager, IndexLifecycleManager indexLifecycleManager, I18nHelper.BeanFactory i18nFactory, I18nHelper i18nHelper, JohnsonProvider johnsonProvider)
Public Methods
void clearAll()
Clear any pending requests.
@Nonnull List<ReindexRequest> failRunningRequestsFromDeadNodes()
Finds any active or running requests from inactive nodes in the cluster and transitions them to failed.
@Nonnull List<ReindexRequest> failRunningRequestsFromNode(String nodeId)
Finds any active or running requests from the specified node in the cluster and transitions them to failed.
@Nonnull Iterable<ReindexRequest> getPendingReindexRequests(Set<ReindexRequestType> reindexRequestTypes)
Retrieves all pending reindex requests, in order from oldest to newest.
@Nonnull Set<ReindexRequest> getReindexProgress(Set<Long> requestIds)
Retrieves the progress of some requests.
ReindexRequest getReindexProgress(Long requestId)
boolean isReindexInProgress()
boolean isReindexRequested(Set<ReindexRequestType> reindexRequestTypes)
Checks if any ReindexRequests are waiting to be processed.
boolean isReindexRequested()
Checks if any ReindexRequests of any type are waiting to be processed.
Set<ReindexRequest> processPendingRequests(boolean waitForCompletion, Set<ReindexRequestType> reindexRequestTypes, boolean runInBackground)
Process any outstanding reindex requests.
@Nonnull Iterable<ReindexRequest> readPendingReindexRequests(Set<ReindexRequestType> reindexRequestTypes, boolean updateCoalescedRequests)
@Nonnull ReindexRequest requestReindex(ReindexRequestType type, Set<AffectedIndex> affectedIndexes, Set<SharedEntityType> entityTypes)
Requests a reindex.
@Nonnull List<ReindexRequest> transitionStatus(Iterable<ReindexRequest> requests, ReindexStatus newStatus)
Transitions the status of reindex requests.
@Nonnull ReindexRequest transitionStatus(ReindexRequest request, ReindexStatus newStatus)
Transitions the status of a reindex request.
Protected Methods
@Nonnull ReindexRequest performReindex(ReindexRequest request, boolean waitForCompletion, boolean runInBackground)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.index.request.ReindexRequestManager

Public Constructors

public DefaultReindexRequestManager (ReindexRequestDao reindexRequestDao, Clock clock, ReindexRequestCoalescer requestCoalescer, ClusterManager clusterManager, ClusterLockService clusterLockService, TaskManager taskManager, IndexLifecycleManager indexLifecycleManager, I18nHelper.BeanFactory i18nFactory, I18nHelper i18nHelper, JohnsonProvider johnsonProvider)

Public Methods

public void clearAll ()

Clear any pending requests.

@Nonnull public List<ReindexRequest> failRunningRequestsFromDeadNodes ()

Finds 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.

Returns
  • the list of requests that were transitioned.

@Nonnull public List<ReindexRequest> failRunningRequestsFromNode (String nodeId)

Finds any active or running requests from the specified node in the cluster and transitions them to failed.

Parameters
nodeId the ID of the cluster node, or null if not clustered.
Returns
  • the list of requests that were transitioned.

@Nonnull public Iterable<ReindexRequest> getPendingReindexRequests (Set<ReindexRequestType> reindexRequestTypes)

Retrieves all pending reindex requests, in order from oldest to newest.

Parameters
reindexRequestTypes Types of requests to check for.
Returns
  • a list of reindex requests.

@Nonnull public Set<ReindexRequest> getReindexProgress (Set<Long> requestIds)

Retrieves the progress of some requests.

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.

public ReindexRequest getReindexProgress (Long requestId)

public boolean isReindexInProgress ()

public boolean isReindexRequested (Set<ReindexRequestType> reindexRequestTypes)

Checks if any ReindexRequests are waiting to be processed.

Parameters
reindexRequestTypes Types of requests to check for.
Returns
  • true if unprocessed requests exist

public boolean isReindexRequested ()

Checks if any ReindexRequests of any type are waiting to be processed.

Returns
  • true if unprocessed requests exist

public Set<ReindexRequest> processPendingRequests (boolean waitForCompletion, Set<ReindexRequestType> reindexRequestTypes, boolean runInBackground)

Process any outstanding reindex requests.

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 either ReindexRequestType
runInBackground If true the reindex should be a background reindex otherwise a foreground stop the world reindex
Returns
  • The updated processed requests.

@Nonnull public Iterable<ReindexRequest> readPendingReindexRequests (Set<ReindexRequestType> reindexRequestTypes, boolean updateCoalescedRequests)

@Nonnull public ReindexRequest requestReindex (ReindexRequestType type, Set<AffectedIndex> affectedIndexes, Set<SharedEntityType> entityTypes)

Requests a reindex.

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.

@Nonnull public List<ReindexRequest> transitionStatus (Iterable<ReindexRequest> requests, ReindexStatus newStatus)

Transitions the status of reindex requests.

Parameters
requests the requests.
newStatus the new status to transition to.
Returns
  • the updated requests.

@Nonnull public ReindexRequest transitionStatus (ReindexRequest request, ReindexStatus newStatus)

Transitions the status of a reindex request.

Parameters
request the request.
newStatus the new status to transition to.
Returns
  • the updated request.

Protected Methods

@Nonnull protected ReindexRequest performReindex (ReindexRequest request, boolean waitForCompletion, boolean runInBackground)