Class OfBizReplicatedIndexOperationStore

java.lang.Object
com.atlassian.jira.index.ha.OfBizReplicatedIndexOperationStore

public class OfBizReplicatedIndexOperationStore extends Object
Stores index operation events
Since:
v6.1
  • Constructor Details

  • Method Details

    • createIndexOperation

      @Nullable public Long createIndexOperation(AffectedIndex affectedIndex, SharedEntityType entityType, ReplicatedIndexOperation.Operation operation, Map<Long,Long> affectedIdToVersion, String backupFilename)
      Creates and stores the index operation in the underlying database, only if the node is in a cluster.
      Parameters:
      operation - the ReplicatedIndexOperation.Operation that was performed on the underlying index
      affectedIdToVersion - Map of affectedId to local version that participated in the index operation
      Returns:
      the operation id that was inserted into the underlying db - may be null if the node is not clustered
    • createIndexOperationForNonVersionEntities

      @Nullable public Long createIndexOperationForNonVersionEntities(AffectedIndex affectedIndex, SharedEntityType entityType, ReplicatedIndexOperation.Operation operation, Collection<Long> affectedIds, String backupFilename)
      Creates and stores the index operation in the underlying database, only if the node is in a cluster.
      Parameters:
      operation - the ReplicatedIndexOperation.Operation that was performed on the underlying index
      affectedIds - list of affectedIds that participated in the index operation
      Returns:
      the operation id that was inserted into the underlying db - may be null if the node is not clustered
    • purgeOldOperations

      public int purgeOldOperations(String sourceNodeId, Date before)
    • getIndexOperationsAfter

      public Set<ReplicatedIndexOperation> getIndexOperationsAfter(String sourceNodeId, Long operationId)
      Returns a set of IndexOperations that have happened after the given operationId. We do this by node as the ids are not monotonically increasing across nodes.
      Parameters:
      sourceNodeId - Node to get operations sent from
      operationId - identifier for the Operation to get the operations after (exclusively)
      Returns:
      a set of ReplicatedIndexOperation that have taken place on other nodes after a specified id
    • getIndexOperationsAfterIdAndOlderThan

      public Set<ReplicatedIndexOperation> getIndexOperationsAfterIdAndOlderThan(String sourceNodeId, Long operationId, int ageThresholdInSec)
      Returns a set of IndexOperations that have happened after the given operationId and are older then given ageThresholdInSec (i.e. ReplicatedIndexOperation.indexTime is invalid input: '<' DB.now() - ageThresholdInSec). We do this by node as the ids are not monotonically increasing across nodes.
      Parameters:
      sourceNodeId - Node to get operations sent from
      operationId - identifier for the Operation to get the operations after (exclusively)
      ageThresholdInSec - threshold to get the operations which is older than
      Returns:
      a set of ReplicatedIndexOperation that have taken place on other nodes after a specified id
    • getUnprocessedReindexOperationsAfterId

      public Set<ReplicatedIndexOperation> getUnprocessedReindexOperationsAfterId(String sourceNodeId, Long operationId)
    • getOperation

      public ReplicatedIndexOperation getOperation(long id)
      get an operation by id
      Returns:
      the operation.
    • getLatestOperation

      public Long getLatestOperation(String sourceNodeId)
      Returns The latest operation for this node
      Parameters:
      sourceNodeId - source node of the operation
      Returns:
      id of the latest operation.
    • contains

      public boolean contains(long id)
      Parameters:
      id - the NodeIndexOperation id to check
      Returns:
      true if the database contains this index operation