Interface ReindexRequestManager

All Known Implementing Classes:
DefaultReindexRequestManager

@PublicApi public interface ReindexRequestManager
Used for persistence and control of reindex requests.
Since:
6.4
  • Method Details

    • isReindexRequested

      boolean isReindexRequested()
      Checks if any ReindexRequests of any type are waiting to be processed.
      Returns:
      true if unprocessed requests exist
    • isReindexRequested

      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
    • getPendingReindexRequests

      @Nonnull 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.
    • isReindexInProgress

      boolean isReindexInProgress()
      Returns:
      true if a reindex is in progress, false if not.
    • requestReindex

      @Nonnull ReindexRequest requestReindex(@Nonnull ReindexRequestType type, @Nonnull Set<AffectedIndex> affectedIndexes, @Nonnull 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.
    • transitionStatus

      @Nonnull List<ReindexRequest> transitionStatus(@Nonnull Iterable<ReindexRequest> requests, @Nonnull ReindexStatus newStatus)
      Transitions the status of reindex requests.
      Parameters:
      requests - the requests.
      newStatus - the new status to transition to.
      Returns:
      the updated requests.
    • transitionStatus

      @Nonnull ReindexRequest transitionStatus(@Nonnull ReindexRequest request, @Nonnull ReindexStatus newStatus)
      Transitions the status of a reindex request.
      Parameters:
      request - the request.
      newStatus - the new status to transition to.
      Returns:
      the updated request.
    • getReindexProgress

      @Nonnull Set<ReindexRequest> getReindexProgress(@Nonnull 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.
    • processPendingRequests

      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.
    • failRunningRequestsFromDeadNodes

      @Nonnull 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.
    • failRunningRequestsFromNode

      @Nonnull List<ReindexRequest> failRunningRequestsFromNode(@Nullable 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.
    • clearAll

      void clearAll()
      Clear any pending requests.