Package com.atlassian.jira.index.ha
Class OfBizReplicatedIndexOperationStore
java.lang.Object
com.atlassian.jira.index.ha.OfBizReplicatedIndexOperationStore
Stores index operation events
- Since:
- v6.1
-
Constructor Summary
ConstructorsConstructorDescriptionOfBizReplicatedIndexOperationStore(OfBizDelegator ofBizDelegator, QueryDslAccessor queryDslAccessor) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(long id) 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.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.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.getExternalIndexOperationsAfter(String nodeId, Long operationId) Returns a set of IndexOperations that have happened after the givenoperationIdand are associated with an external search platform node ID.getIndexOperationsAfter(String sourceNodeId, Long operationId) Returns a set of IndexOperations that have happened after the givenoperationId.getIndexOperationsAfterIdAndOlderThan(String sourceNodeId, Long operationId, int ageThresholdInSec) Returns a set of IndexOperations that have happened after the givenoperationIdand are older then givenageThresholdInSec(i.e.getLatestOperation(String sourceNodeId) Returns The latest operation for this nodegetOperation(long id) get an operation by idgetUnprocessedReindexOperationsAfterId(String sourceNodeId, Long operationId) intpurgeOldOperations(String sourceNodeId, Date before) Purges old replicated index operations for a specific node that are older than the specified date.
-
Constructor Details
-
OfBizReplicatedIndexOperationStore
public OfBizReplicatedIndexOperationStore(OfBizDelegator ofBizDelegator, QueryDslAccessor queryDslAccessor)
-
-
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- theReplicatedIndexOperation.Operationthat was performed on the underlying indexaffectedIdToVersion- Map of affectedId to version that participated in the index operationdocumentType- the type of document being indexed (e.g., "issue", "comment") fromDocumentTypes- Returns:
- the operation id that was inserted into the underlying db.
- Since:
- 11.1
-
purgeOldOperations
Purges old replicated index operations for a specific node that are older than the specified date.This method removes outdated entries from the
replicatedindexoperationtable 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
Returns a set of IndexOperations that have happened after the givenoperationId. We do this by node as the ids are not monotonically increasing across nodes.- Parameters:
sourceNodeId- Node to get operations sent fromoperationId- identifier for the Operation to get the operations after (exclusively)- Returns:
- a set of
ReplicatedIndexOperationthat 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 givenoperationIdand 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
ReplicatedIndexOperationthat have taken place on the external 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 givenoperationIdand are older then givenageThresholdInSec(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 fromoperationId- identifier for the Operation to get the operations after (exclusively)ageThresholdInSec- threshold to get the operations which is older than- Returns:
- a set of
ReplicatedIndexOperationthat have taken place on other nodes after a specified id
-
getUnprocessedReindexOperationsAfterId
public Set<ReplicatedIndexOperation> getUnprocessedReindexOperationsAfterId(String sourceNodeId, Long operationId) -
getOperation
get an operation by id- Returns:
- the operation.
-
getLatestOperation
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
-