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

    • createExternalSearchPlatformIndexOperation

      @Nullable public Long createExternalSearchPlatformIndexOperation(ReplicatedIndexOperation.Operation operation, Map<String,Long> affectedIdToVersion, String documentType)
      Creates and stores the index operation in the underlying database, associating it with the provided external search platform.
      Parameters:
      operation - the ReplicatedIndexOperation.Operation that was performed on the underlying index
      affectedIdToVersion - Map of affectedId to version that participated in the index operation
      documentType - the type of document being indexed (e.g., "issue", "comment") from DocumentTypes
      Returns:
      the operation id that was inserted into the underlying db.
      Since:
      11.1
    • createIndexOperation

      @Nullable public Long createIndexOperation(AffectedIndex affectedIndex, SharedEntityType entityType, ReplicatedIndexOperation.Operation operation, Map<String,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)
      Purges old replicated index operations for a specific node that are older than the specified date.

      This method removes outdated entries from the replicatedindexoperation table while preserving the most recent operation for the node to maintain history.

      Parameters:
      sourceNodeId - the ID of the node whose operations should be purged.
      before - the cutoff date. Operations with an index time older than this date will be purged.
      Returns:
      the number of operations that were successfully purged from the database.
    • 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
    • getExternalIndexOperationsAfter

      public Set<ReplicatedIndexOperation> getExternalIndexOperationsAfter(String nodeId, Long operationId)
      Returns a set of IndexOperations that have happened after the given operationId and are associated with an external search platform node ID.
      Parameters:
      operationId - identifier for the Operation to get the operations after (exclusively)
      Returns:
      a set of ReplicatedIndexOperation that have taken place on the external search platform after a specified id
    • getLocalIndexOperationsAfter

      public Set<ReplicatedIndexOperation> getLocalIndexOperationsAfter(String nodeId, Long operationId)
      Returns a set of IndexOperations that have happened after the given operationId and are associated with a lucene search platform node ID.
      Parameters:
      operationId - identifier for the Operation to get the operations after (exclusively)
      Returns:
      a set of ReplicatedIndexOperation that have taken place on the lucene search platform 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.
    • getLatestOperations

      public Map<String,Long> getLatestOperations()
      Returns The latest operation for all nodes
      Returns:
      map of Source Node ID > id of the latest operation for that node
    • contains

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